/* Funkeltronic site styles. Tokens first, dark is the default theme. */

@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/SpaceGrotesk-Variable.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("fonts/DMSans-Variable.woff2") format("woff2");
  font-weight: 100 1000;
  font-display: swap;
}

:root {
  --font-heading: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --font-body: "DM Sans", "Helvetica Neue", Arial, sans-serif;

  --bg: #0F172A;
  --bg-alt: #111B33;
  --surface: #172040;
  --surface-2: #1E2A4D;
  --text: #F1F5F9;
  --text-muted: #AEB9D4;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.22);
  --primary: #8B5CF6;
  --primary-strong: #7C3AED;
  --on-primary: #FFFFFF;
  --accent: #FBBF24;
  --link: #C4B5FD;
  --shadow: 0 18px 50px rgba(2, 6, 23, 0.55);

  --diagram-node: #1E2A4D;
  --diagram-pill: #172040;
  --diagram-line: #AEB9D4;
  --diagram-text: #F1F5F9;
  --diagram-muted: #AEB9D4;
  --diagram-band: rgba(139, 92, 246, 0.10);
  --diagram-band-stroke: rgba(196, 181, 253, 0.55);
  --diagram-accent: #7C3AED;
  --diagram-on-accent: #FFFFFF;

  --sparkle: 251, 191, 36;
  --radius: 16px;
  --radius-sm: 10px;
  --container: 1120px;
  --gutter: 16px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

:root[data-theme="light"] {
  --bg: #FAFAFC;
  --bg-alt: #F1F2F8;
  --surface: #FFFFFF;
  --surface-2: #F3F1FB;
  --text: #0F172A;
  --text-muted: #4B5569;
  --border: rgba(15, 23, 42, 0.10);
  --border-strong: rgba(15, 23, 42, 0.22);
  --primary: #6D28D9;
  --primary-strong: #5B21B6;
  --on-primary: #FFFFFF;
  --accent: #B45309;
  --link: #5B21B6;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.12);

  --diagram-node: #FFFFFF;
  --diagram-pill: #F3F1FB;
  --diagram-line: #4B5569;
  --diagram-text: #0F172A;
  --diagram-muted: #4B5569;
  --diagram-band: rgba(109, 40, 217, 0.06);
  --diagram-band-stroke: rgba(109, 40, 217, 0.45);
  --diagram-accent: #6D28D9;
  --diagram-on-accent: #FFFFFF;

  --sparkle: 109, 40, 217;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-x: hidden;
}

img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { color: var(--text); }
p { margin: 0 0 1rem; }
h1, h2, h3 { font-family: var(--font-heading); line-height: 1.12; letter-spacing: -0.01em; margin: 0 0 0.6em; }
h1 { font-size: clamp(2.25rem, 5.5vw, 4rem); font-weight: 700; }
h2 { font-size: clamp(1.75rem, 3.5vw, 2.5rem); font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 600; }
strong { font-weight: 600; }

:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; border-radius: 4px; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }
@media (min-width: 768px) { :root { --gutter: 32px; } }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 1000;
  background: var(--primary); color: var(--on-primary); padding: 10px 14px; border-radius: 8px;
}
.skip-link:focus { top: 16px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
@supports (background: color-mix(in srgb, red 50%, blue)) {
  .site-header { background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
}
.nav-row { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; text-decoration: none; color: var(--text); font-family: var(--font-heading); font-weight: 700; font-size: 1.15rem; }
.brand-mark { width: 48px; height: auto; }
.nav-toggle {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  background: transparent; border: 1px solid var(--border); border-radius: 10px; color: var(--text); cursor: pointer;
}
.site-nav { display: none; }
.site-nav a { text-decoration: none; color: var(--text-muted); font-weight: 500; padding: 10px 4px; white-space: nowrap; }
.nav-tools { display: flex; align-items: center; gap: 8px; }
@media (max-width: 599px) { .nav-tools .theme-toggle:not(.look-toggle) { display: none; } .brand-name { font-size: 1.05rem; } }
@media (max-width: 419px) { .brand-name { display: none; } }
.site-nav a:hover { color: var(--text); }
.nav-cta { color: var(--text) !important; border: 1px solid var(--border-strong); border-radius: 999px; padding: 8px 14px !important; }
.theme-toggle {
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--border); border-radius: 999px; color: var(--text); cursor: pointer;
  transition: background 200ms var(--ease);
}
.theme-toggle:hover { background: var(--surface-2); }
:root[data-theme="dark"] .icon-moon { display: none; }
:root[data-theme="light"] .icon-sun { display: none; }

@media (max-width: 1079px) {
  .site-nav.is-open {
    display: flex; flex-direction: column; gap: 4px;
    position: absolute; left: 0; right: 0; top: 64px;
    background: var(--bg); border-bottom: 1px solid var(--border); padding: 12px var(--gutter) 20px;
  }
  .site-nav.is-open a { padding: 12px 4px; font-size: 1.1rem; }
  .site-nav.is-open .nav-cta { align-self: flex-start; }
}
@media (min-width: 1080px) {
  .nav-toggle { display: none; }
  .site-nav { display: flex; align-items: center; gap: 22px; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 999px;
  font-family: var(--font-heading); font-weight: 600; font-size: 1rem; text-decoration: none; cursor: pointer;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong);
  transition: transform 160ms var(--ease), background 200ms var(--ease), color 200ms var(--ease);
}
.btn:hover { background: var(--surface); color: var(--text); }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary-strong); color: var(--on-primary); border-color: transparent; }
.btn-primary:hover { background: var(--primary-strong); color: var(--on-primary); filter: brightness(1.12); }
.btn-ghost { background: transparent; }
.btn-small { min-height: 44px; padding: 0 16px; font-size: 0.95rem; }
.btn-large { min-height: 56px; padding: 0 28px; font-size: 1.1rem; }

/* Hero */
.hero { position: relative; padding: 56px 0 48px; overflow: hidden; isolation: isolate; }
.sparkles { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.hero-grid { display: grid; gap: 32px; align-items: center; }
.eyebrow { font-family: var(--font-heading); font-weight: 500; color: var(--text-muted); letter-spacing: 0.02em; text-transform: uppercase; font-size: 0.8rem; margin-bottom: 1.2rem; }
.lead, .section-lead { font-size: 1.2rem; color: var(--text-muted); max-width: 60ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 1.5rem 0 1rem; }
.hero-note { color: var(--text-muted); font-size: 0.95rem; }
.hero-figure { margin: 0; justify-self: center; width: min(70vw, 440px); filter: drop-shadow(0 20px 30px rgba(2, 6, 23, 0.35)); }
:root[data-theme="light"] .hero-figure { filter: drop-shadow(0 20px 30px rgba(15, 23, 42, 0.15)); }
@media (min-width: 900px) {
  .hero { padding: 96px 0 80px; }
  .hero-grid { grid-template-columns: 1.15fr 0.85fr; }
  .hero-figure { width: 100%; max-width: 480px; }
}
@media (prefers-reduced-motion: no-preference) {
  .hero-figure img { animation: float 6s ease-in-out infinite; }
  @keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
}

/* Sections */
.section { padding: 72px 0; }
.section-alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
@media (min-width: 900px) { .section { padding: 104px 0; } }

.cards { display: grid; gap: 20px; margin-top: 2rem; }
@media (min-width: 700px) { .cards-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .cards-3 { grid-template-columns: repeat(3, 1fr); } }
.card {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px 24px; transition: transform 200ms var(--ease), border-color 200ms var(--ease);
}
.card:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.card-icon { color: var(--primary); margin-bottom: 14px; }
.card p { margin: 0; color: var(--text-muted); }
.card h3 { margin-bottom: 0.4em; }

/* Diagrams */
.diagram-wrap { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.diagram { width: 100%; height: auto; }
.diagram-wrap-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 699px) { .diagram-wide { min-width: 640px; } }
.diagram-loop .dia-label-small { font-size: 16px; }
.dia-label { font-family: var(--font-heading); font-size: 18px; font-weight: 600; }
.dia-label-small { font-family: var(--font-body); font-size: 14px; font-weight: 500; }
.dia-callout { font-family: var(--font-body); font-size: 24px; font-weight: 500; }
.diagram-wrap figcaption { color: var(--text-muted); font-size: 0.95rem; padding: 12px 4px 0; }

/* Stepper */
.stepper { display: grid; gap: 24px; margin-top: 2rem; }
.stepper-list { display: grid; gap: 8px; }
@media (min-width: 900px) { .stepper-list { grid-template-columns: repeat(3, 1fr); } }
.stepper .stage { transition: opacity 250ms var(--ease); }
.stepper[data-active] .stage { opacity: 0.32; }
.stepper[data-active] .stage.is-active { opacity: 1; }
.stepper-list { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.stepper-list li { counter-increment: step; display: flex; }
.step-btn {
  position: relative; width: 100%; text-align: left; padding: 14px 16px 14px 56px; border-radius: var(--radius-sm);
  font: inherit; line-height: 1.5; color: var(--text-muted); cursor: pointer; background: transparent;
  border: 1px solid transparent; transition: background 200ms var(--ease), color 200ms var(--ease);
}
.step-btn::before {
  content: counter(step); position: absolute; left: 14px; top: 13px; width: 30px; height: 30px; border-radius: 999px;
  display: grid; place-items: center; font-family: var(--font-heading); font-weight: 600; font-size: 0.9rem;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
}
.step-btn strong { color: var(--text); }
.step-btn[aria-current="step"] { background: var(--surface); border-color: var(--border); color: var(--text); }
.step-btn[aria-current="step"]::before { background: var(--primary-strong); color: var(--on-primary); border-color: transparent; }
.step-btn:hover { color: var(--text); }
.stepper-controls { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.stepper-count { color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 4.5em; text-align: center; }

/* Harness */
.harness-grid { display: grid; gap: 32px; }
@media (min-width: 1000px) { .harness-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.harness-terms { display: grid; gap: 10px; margin: 1.5rem 0 0; }
@media (min-width: 600px) { .harness-terms { grid-template-columns: 1fr 1fr; } }
.harness-terms div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; }
.harness-terms dt { font-family: var(--font-heading); font-weight: 600; margin-bottom: 4px; }
.harness-terms dd { margin: 0; color: var(--text-muted); font-size: 0.98rem; }

/* Cat figure */
.cat-grid { display: grid; gap: 32px; align-items: center; }
@media (min-width: 1000px) { .cat-grid { grid-template-columns: 1.1fr 0.9fr; } }
.cat-figure { margin: 0; }
.cat-legend { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; color: var(--text-muted); font-size: 0.98rem; }
.cat-legend li::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 999px; background: var(--primary); margin-right: 10px; vertical-align: middle; }
@media (min-width: 700px) { .cat-legend { display: none; } }
@media (max-width: 699px) { .cat-overlay .callout { display: none; } }
.cat-overlay .callout { transition: opacity 200ms var(--ease); cursor: default; }
.cat-overlay:hover .callout { opacity: 0.4; }
.cat-overlay .callout:hover { opacity: 1; }
.cat-overlay .callout circle { animation: pulse 2.4s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.35); } }
@media (prefers-reduced-motion: reduce) { .cat-overlay .callout circle { animation: none; } }

/* Fields */
.field-no { font-family: var(--font-heading); font-weight: 700; color: var(--link); font-size: 0.95rem; letter-spacing: 0.08em; }
.field h3 { margin-top: 6px; }
.field p { margin-bottom: 14px; }
.chip { display: inline-block; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.chip-accent { background: var(--surface-2); color: var(--text); border-color: var(--primary); }

.decide { display: grid; gap: 32px; margin-top: 56px; padding-top: 48px; border-top: 1px solid var(--border); }
@media (min-width: 900px) { .decide { grid-template-columns: 1fr 1fr; } }
.phases { list-style: none; padding: 0; margin: 1.2rem 0 0; display: grid; gap: 8px; }
.phases li { display: flex; align-items: center; gap: 12px; color: var(--text-muted); }
.phases li span { width: 32px; height: 32px; border-radius: 999px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); font-family: var(--font-heading); font-weight: 600; font-size: 0.9rem; color: var(--text); }
.phases li.done span { background: var(--surface); }
.phases li.done { text-decoration: line-through; }
.phases li.current { color: var(--text); font-weight: 600; }
.phases li.current span { background: var(--primary-strong); color: var(--on-primary); border-color: transparent; }

.weights { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; }
.weights figcaption { font-family: var(--font-heading); font-weight: 600; margin-bottom: 14px; }
.bars { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.bars li { display: grid; grid-template-columns: 7.5em 1fr 2em; align-items: center; gap: 12px; font-size: 0.98rem; }
.bar-label { color: var(--text-muted); }
.bar-track { height: 12px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar { display: block; height: 100%; background: var(--primary); border-radius: 0 4px 4px 0; }
.w-100 { width: 100%; } .w-67 { width: 66.7%; } .w-33 { width: 33.3%; }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* Team */
.founders { list-style: none; padding: 0; margin: 1.5rem 0; display: flex; flex-wrap: wrap; gap: 12px; }
.initial { width: 64px; height: 64px; border-radius: 999px; display: grid; place-items: center; font-family: var(--font-heading); font-weight: 700; font-size: 1.4rem; background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); }

/* Contact */
.contact-inner { text-align: center; display: grid; justify-items: center; }
.contact .section-lead { margin-left: auto; margin-right: auto; }
.contact .btn { margin-top: 12px; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 32px 0; color: var(--text-muted); font-size: 0.92rem; }
.footer-row { display: grid; gap: 8px; }
.footer-row p { margin: 0; }
@media (min-width: 768px) { .footer-row { grid-template-columns: 1fr 1fr; } .footer-row p:last-child { text-align: right; } }

/* First visit prompt: one compact bar at the bottom */
.theme-prompt {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 200;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow);
  padding: 8px 10px 10px;
}
.theme-prompt[hidden] { display: none; }
.theme-prompt-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.theme-prompt-head p { margin: 0; font-family: var(--font-heading); font-weight: 600; font-size: 0.95rem; }
.theme-prompt-close { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0; border-radius: 999px; color: var(--text-muted); cursor: pointer; }
.theme-prompt-close:hover { color: var(--text); background: var(--surface-2); }
.theme-prompt-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pill { min-height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: transparent; color: var(--text); font: inherit; font-weight: 600; font-size: 0.92rem; cursor: pointer; }
.pill[aria-pressed="true"] { background: var(--primary-strong); color: var(--on-primary); border-color: transparent; }
.pill-gap { width: 1px; height: 24px; background: var(--border-strong); margin: 0 4px; }
@media (max-width: 399px) { .pill { padding: 0 10px; font-size: 0.86rem; } .pill-gap { display: none; } }
@media (min-width: 600px) { .theme-prompt { left: auto; right: 24px; bottom: 24px; width: 360px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; animation-iteration-count: 1 !important; }
}

/* Language switch */
.lang-switch { font-family: var(--font-heading); font-weight: 600; letter-spacing: 0.04em; color: var(--text-muted) !important; border: 1px solid var(--border); border-radius: 999px; padding: 8px 12px !important; min-width: 44px; text-align: center; }
.lang-switch:hover { color: var(--text) !important; border-color: var(--border-strong); }
