/* Smoothen the switch */
html,
body,
.navbar,
.hero,
.button,
.card,
.dropdown-content,
.modal-card,
.input,
.textarea,
.select select {
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

/* Base (LIGHT) – applied when no data-theme or data-theme="light" */
:root {
  color-scheme: light;

  /* App tokens */
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --text: #1f2330;
  --text-soft: #4c5163;
  --primary: #4c7cff;
  /* feel free to use your brand hue */
  --primary-strong: #2c62ff;
  --border: #dde1ea;
  --shadow: 0 6px 18px rgba(12, 20, 38, 0.08);

  /* Optional: map to Bulma variables if you're on Bulma v1 */
  --bulma-body-background-color: var(--bg);
  --bulma-body-color: var(--text);
  --bulma-primary: var(--primary);
  /* Light mode blues */
  --nav-bg: #293860;
  /* deep blue for navbar */
  --nav-fg: #ffffff;
  /* navbar text/icons */
  --hero-bg: linear-gradient(180deg, #293869 0%, #081f5f 100%);
  /* rich blue gradient */
  --hero-fg: #ffffff;
  /* hero text/logo */

  --bulma-family-primary: Ubuntu, Helvetica Neue, Helvetica, Arial, sans-serif;
  --bulma-family-secondary: Ubuntu, Helvetica Neue, Helvetica, Arial, sans-serif;
  --bulma-family-code: Hack, Ubuntu Mono, monospace;
  --bulma-body-family: Ubuntu, Helvetica Neue, Helvetica, Arial, sans-serif;
}

/* DARK */
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0f1220;
  --bg-soft: #171a2a;
  --text: #e6e9ef;
  --text-soft: #b6bdd0;
  --primary: #7aa2ff;
  --primary-strong: #94b5ff;
  --border: #2a2e42;
  --shadow: 0 8px 22px rgba(0, 0, 0, 0.35);


  /* Dark mode, deeper/navy blues */
  --nav-bg: #0b1437;
  --nav-fg: #e6e9ef;
  --hero-bg: linear-gradient(180deg, #050f35 0%, #0f1e59 100%);
  --hero-fg: #e6e9ef;
  --bulma-body-background-color: var(--bg);
  --bulma-body-color: var(--text);
  --bulma-primary: var(--primary);
}

/* Apply tokens to the main areas (Bulma will inherit most) */
html,
body {
  background: var(--bg);
  color: var(--text);
  scroll-behavior: smooth;
}

/* Navbar uses themed colors */
.navbar.is-primary {
  background: var(--nav-bg);
  color: var(--nav-fg);
  box-shadow: var(--shadow);
}

/* Navbar items/links/icons inherit readable foreground */
.navbar .navbar-item,
.navbar .navbar-link,
.navbar a.navbar-item {
  color: var(--nav-fg);
}

.navbar .navbar-item:hover,
.navbar .navbar-link:hover,
.navbar a.navbar-item.is-active {
  background: transparent;
  color: color-mix(in oklab, var(--nav-fg) 85%, white);
}

/* Burger lines match the foreground on both themes */
.navbar-burger span {
  background-color: var(--nav-fg);
}

/* Make the "light" buttons look good on a colored navbar */
.navbar .button.is-light {
  background: transparent;
  color: var(--nav-fg);
  border-color: color-mix(in oklab, var(--nav-fg) 40%, transparent);
}

.navbar .button.is-light:hover {
  background: color-mix(in oklab, var(--nav-fg) 12%, transparent);
  border-color: color-mix(in oklab, var(--nav-fg) 60%, transparent);
}

/* Hero uses themed background + foreground */
.hero.is-primary {
  background: var(--hero-bg);
  color: var(--hero-fg);
}

/* Ensure hero text uses the hero foreground (overrides earlier rule that used --text) */
.hero.is-primary .title,
.hero.is-primary .subtitle,
.hero.is-primary p,
.hero.is-primary .content,
.hero.is-primary .lede {
  color: var(--hero-fg);
}

/* Optional: tweak the hero logo shadow per theme so it pops on blue */
.hero.is-primary .hero-logo {
  filter: drop-shadow(0 6px 16px rgba(62, 62, 62, 0.22));
}

:root[data-theme="dark"] .hero.is-primary .hero-logo {
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.45));
}

/* Buttons */
.button.is-light {
  background: var(--bg-soft);
  color: var(--text);
  border-color: var(--border);
}

.button.is-dark,
:root[data-theme="dark"] .button.is-dark {
  background: var(--primary);
  border-color: transparent;
  color: #0d1020;
}

.button.is-primary {
  background: var(--primary);
  border-color: transparent;
  color: #0d1020;
}

.button.is-primary:hover {
  background: var(--primary-strong);
}

/* Inputs (nice in both themes) */
.input,
.textarea,
.select select {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}

.input:focus,
.textarea:focus,
.select select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.125em color-mix(in oklab, var(--primary) 25%, transparent);
}

/* Optional: links */
a {
  color: var(--primary);
}

a:hover {
  color: var(--primary-strong);
}

/* Modal styles */
.modal-card {
  width: 90vw;
  /* 90% of viewport width */
  height: 90vh;
  /* 90% of viewport height */
  max-height: 90vh;
  /* prevent overflow */
}

.modal-card-body {
  overflow-y: auto;
  /* scroll if content is too long */
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {

  html,
  body,
  .navbar,
  .hero,
  .button,
  .card,
  .dropdown-content,
  .modal-card,
  .input,
  .textarea,
  .select select {
    transition: none;
  }

  html {
    scroll-behavior: auto;
  }

  .logo-float {
    animation: logo-enter 400ms ease-out forwards;
  }
}

/* Index page specific styles */
.comfortable-reading-width {
  max-width: 48ch;
  line-height: 1.6;
  margin-top: 0.75rem;
}

/* Keep the logo nicely sized and responsive */
.hero-logo {
  max-width: clamp(140px, 28vw, 280px);
  width: 100%;
  height: auto;
  /* subtle depth so it stands out on the gradient hero */
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.18));
  /* smooth appearance */
  opacity: 0;
  transform: translateY(8px) scale(0.985);
  animation: logo-enter 700ms ease-out forwards 200ms;
}

/* Gentle, attention-getting motion (not annoying) */
.logo-float {
  animation:
    logo-enter 700ms ease-out forwards 200ms,
    floaty 6s ease-in-out infinite 900ms;
  will-change: transform, filter;
}

/* Hover adds a tiny emphasis */
.hero-logo:hover {
  transform: translateY(-2px) scale(1.01);
  filter: drop-shadow(0 10px 22px rgba(255, 255, 255, 0.3));
  transition: transform 180ms ease, filter 180ms ease;
}

/* Start hidden (collapsed) in navbar - only on index page */
body:not(.legal-page) .navbar .navbar-logo {
  width: 0;
  opacity: 0;
  transform: scale(0.8);
  transition:
    width 220ms ease,
    opacity 220ms ease,
    transform 220ms ease;
  /* prevent layout shift while width animates */
  overflow: hidden;
}

/* Always visible on legal pages */
body.legal-page .navbar .navbar-logo {
  width: 32px;
  opacity: 1;
  transform: scale(1);
}

/* Keep the navbar logo container tight so the collapse looks clean */
.navbar .is-logo.navbar-item {
  padding-right: 0.25rem;
  padding-left: 0.75rem;
}

/* Big hero logo default state */
.hero-logo {
  display: inline-block;
  transition: transform 280ms ease, opacity 220ms ease, filter 220ms ease;
  will-change: transform, opacity;
}

/* When scrolled: show small logo in navbar, shrink/fade hero logo - only on index page */
body:not(.legal-page).is-scrolled .navbar .navbar-logo {
  width: 32px;
  /* tweak size to taste */
  opacity: 1;
  transform: scale(1);
}

/* Only apply hero logo scroll effects on index page */
body:not(.legal-page).is-scrolled .hero-logo {
  transform: scale(0.85);
  opacity: 0;
  filter: blur(1px);
}

/* Optional: subtle navbar shadow after scroll */
body.is-scrolled .navbar {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

/* Keyframes */
@keyframes floaty {
  0% {
    transform: translateY(0)
  }

  50% {
    transform: translateY(-6px)
  }

  100% {
    transform: translateY(0)
  }
}

@keyframes logo-enter {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Fine-tune spacing on very small screens */
@media (max-width: 480px) {
  .hero-logo {
    margin-top: 1rem;
  }
}

/* Imprint and Privacy page specific styles */
.page-container {
  max-width: 960px;
}

.toc a {
  text-decoration: none;
}

address {
  font-style: normal;
}

.last-updated {
  color: #6b7280;
}

.section + .section {
  padding-top: 2rem;
}

/* Print styles for legal pages */
@media print {
  .navbar,
  .hero,
  .footer,
  .box.toc {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .section {
    padding: 0;
  }
}