/* CapiraLabs — GitHub Primer-inspired design system.
   Themed via html[data-theme="light"|"dark"] (set by the inline head script
   before first paint; main.js keeps it in sync with the toggle + OS). */

:root {
  /* Theme-independent scale tokens */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 999px;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.5rem;
  --space-6: 4rem;
  --space-7: 6rem;

  --text-small: 0.8rem;
  --text-body: 1rem;
  --text-lede: 1.2rem;
  --text-h2: clamp(1.4rem, 2.6vw, 1.9rem);
  --text-h1: clamp(1.9rem, 4vw, 2.6rem);
  --text-display: clamp(2.4rem, 6vw, 3.9rem);

  --shadow-sm: 0 1px 2px rgba(31, 35, 40, 0.06), 0 1px 3px rgba(31, 35, 40, 0.05);
  --shadow-md: 0 8px 24px rgba(31, 35, 40, 0.12);
  --max-width: 1080px;

  /* Light defaults (also the pre-script fallback) */
  --canvas: #ffffff;
  --canvas-subtle: #f6f8fa;
  --canvas-inset: #f6f8fa;
  --fg: #1f2328;
  --fg-muted: #59636e;
  --border: #d1d9e0;
  --accent: #0969da;
  --accent-emphasis: #1f6feb;
  --on-accent: #ffffff;
  --accent-soft: rgba(9, 105, 218, 0.1);
  --success: #2ea043;
  color-scheme: light;
}

html[data-theme="light"] {
  --canvas: #ffffff;
  --canvas-subtle: #f6f8fa;
  --canvas-inset: #f6f8fa;
  --fg: #1f2328;
  --fg-muted: #59636e;
  --border: #d1d9e0;
  --accent: #0969da;
  --accent-emphasis: #1f6feb;
  --on-accent: #ffffff;
  --accent-soft: rgba(9, 105, 218, 0.1);
  --success: #2ea043;
  --shadow-sm: 0 1px 2px rgba(31, 35, 40, 0.06), 0 1px 3px rgba(31, 35, 40, 0.05);
  --shadow-md: 0 8px 24px rgba(31, 35, 40, 0.12);
  color-scheme: light;
}

html[data-theme="dark"] {
  --canvas: #0d1117;
  --canvas-subtle: #161b22;
  --canvas-inset: #010409;
  --fg: #e6edf3;
  --fg-muted: #9198a1;
  --border: #30363d;
  --accent: #4493f8;
  --accent-emphasis: #1f6feb;
  --on-accent: #0d1117;
  --accent-soft: rgba(68, 147, 248, 0.15);
  --success: #3fb950;
  --shadow-sm: 0 1px 2px rgba(1, 4, 9, 0.4);
  --shadow-md: 0 8px 24px rgba(1, 4, 9, 0.6);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--fg);
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: var(--text-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

a {
  color: var(--accent);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--canvas);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  z-index: 100;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- Header ------------------------------------------------------------ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--canvas) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}

.mark {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.mark img {
  display: block;
  height: 48px;
  width: auto;
}

.mark .logo-dark {
  display: none;
}

html[data-theme="dark"] .mark .logo-light {
  display: none;
}

html[data-theme="dark"] .mark .logo-dark {
  display: block;
}

#site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.8rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 0.92rem;
  text-decoration: none;
  cursor: pointer;
}

.nav-link:hover,
.nav-link:focus-visible,
.nav-item.open > .nav-link {
  background: var(--canvas-subtle);
}

.nav-link .chevron {
  width: 10px;
  height: 10px;
  transition: transform 0.15s ease;
}

.nav-item.open .chevron {
  transform: rotate(180deg);
}

.nav-cta {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

.nav-cta:hover,
.nav-cta:focus-visible {
  background: var(--accent-emphasis);
  color: #ffffff;
}

.dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 280px;
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: var(--space-2);
  display: none;
}

.nav-item.open .dropdown {
  display: block;
}

.dropdown a {
  display: block;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--fg);
}

.dropdown a:hover,
.dropdown a:focus-visible {
  background: var(--canvas-subtle);
}

.dropdown a strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
}

.dropdown a span {
  display: block;
  font-size: var(--text-small);
  color: var(--fg-muted);
}

.dropdown a[aria-current="page"] strong::after {
  content: " ·";
  color: var(--accent);
}

/* theme FAB: fixed bottom-left circular control + popover */
.theme-fab-wrap {
  position: fixed;
  left: calc(1rem + env(safe-area-inset-left));
  bottom: calc(1rem + env(safe-area-inset-bottom));
  z-index: 15; /* above content, below the header's dropdown/mobile-nav layer (20) */
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.theme-fab-wrap.fab-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

.theme-fab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--canvas);
  color: var(--fg-muted);
  box-shadow: var(--shadow-md);
  cursor: pointer;
}

.theme-fab:hover,
.theme-fab:focus-visible {
  color: var(--fg);
  border-color: var(--fg-muted);
}

.theme-fab .icon {
  display: none;
  width: 18px;
  height: 18px;
}

.theme-fab-wrap[data-pref="light"] .icon-sun,
.theme-fab-wrap[data-pref="dark"] .icon-moon,
.theme-fab-wrap[data-pref="system"] .icon-auto {
  display: block;
}

.theme-popover {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  min-width: 150px;
  padding: 4px;
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  animation: popover-rise 0.15s ease;
}

.theme-popover[hidden] {
  display: none;
}

.theme-popover button {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.5rem 0.7rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}

.theme-popover button .icon {
  width: 15px;
  height: 15px;
  color: var(--fg-muted);
}

.theme-popover button:hover,
.theme-popover button:focus-visible {
  background: var(--canvas-subtle);
}

.theme-popover button[aria-checked="true"] {
  background: var(--accent-soft);
  font-weight: 600;
}

.theme-popover button[aria-checked="true"] .icon {
  color: var(--accent);
}

@keyframes popover-rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.nav-toggle {
  display: none;
  margin-left: auto;
  border: 1px solid var(--border);
  background: var(--canvas);
  color: var(--fg);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.6rem;
  font: inherit;
  cursor: pointer;
}

/* --- Hero -------------------------------------------------------------- */

.hero {
  padding: var(--space-7) 0 var(--space-6);
  position: relative;
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  align-items: center;
  gap: var(--space-6);
}

.hero h1 {
  font-size: var(--text-display);
  font-weight: 700;
  margin: 0 0 var(--space-4);
  max-width: 18ch;
}

.hero .lede {
  max-width: 52ch;
  color: var(--fg-muted);
  font-size: var(--text-lede);
  line-height: 1.55;
  margin: 0 0 var(--space-4);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.hero-illus {
  max-width: 460px;
  justify-self: center;
  will-change: transform;
}

.hero-illus svg,
.illus svg {
  display: block;
  width: 100%;
  height: auto;
}

/* hero entrance (suppressed under reduced motion) */
@keyframes hero-rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hero-copy > *:not(h1) {
  animation: hero-rise 0.7s ease both;
}

.hero-copy > *:nth-child(2) {
  animation-delay: 0.08s;
}

.hero-copy > *:nth-child(3) {
  animation-delay: 0.16s;
}

.hero-copy > *:nth-child(4) {
  animation-delay: 0.24s;
}

/* hero headline: per-word cascade (spans injected by main.js) */
.hero h1 .w {
  display: inline-block;
  animation: word-rise 0.55s cubic-bezier(0.2, 0.6, 0.2, 1) both;
  animation-delay: calc(var(--i) * 60ms + 0.1s);
}

@keyframes word-rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}

.hero-illus {
  animation: hero-rise 0.8s ease 0.15s both;
}

/* --- Buttons ----------------------------------------------------------- */

.btn {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover,
.btn:focus-visible {
  background: var(--accent-emphasis);
  border-color: var(--accent-emphasis);
  color: #ffffff;
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--fg);
}

.btn-outline:hover,
.btn-outline:focus-visible {
  background: var(--canvas-subtle);
  border-color: var(--fg-muted);
  color: var(--fg);
}

/* --- Content primitives ------------------------------------------------- */

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 var(--space-3);
}

.cta {
  display: inline-block;
  margin-top: var(--space-4);
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.cta:hover,
.cta:focus-visible {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.section {
  padding: var(--space-7) 0;
  border-top: 1px solid var(--border);
}

.section-alt {
  background: var(--canvas-subtle);
}

.section h2 {
  font-size: var(--text-h2);
  font-weight: 600;
  max-width: 34ch;
  margin: 0 0 var(--space-5);
}

/* thin accent underline that draws in as the headline settles (--u is
   progress-driven from main.js; defaults to fully drawn) */
.section h2::after {
  content: "";
  display: block;
  width: 44px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
  margin-top: 0.55rem;
  transform: scaleX(var(--u, 1));
  transform-origin: left center;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4);
}

.card {
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.18s ease,
    box-shadow 0.45s ease;
}

/* added by the scroll engine once a card reaches its rest zone: the card
   "lands" on the surface with a gentle shadow grow */
.card.landed,
.loop li.landed {
  box-shadow: var(--shadow-md);
}

.section-alt .card {
  background: var(--canvas);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card h3 {
  margin: 0 0 0.6rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.card p {
  margin: 0 0 0.75rem;
  color: var(--fg-muted);
  font-size: 0.95rem;
}

.card p:last-child {
  margin-bottom: 0;
}

.card .card-link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}

.card .card-link:hover,
.card .card-link:focus-visible {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.profile-role {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin: 0 0 0.5rem;
}

.loop {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: var(--space-4);
  counter-reset: step;
}

.loop li {
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  counter-increment: step;
}

.loop li::before {
  content: counter(step, decimal-leading-zero);
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

.loop h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.loop p {
  margin: 0;
  color: var(--fg-muted);
  font-size: 0.95rem;
}

.prose {
  max-width: 64ch;
}

.prose p {
  color: var(--fg-muted);
}

.illus {
  max-width: 420px;
  margin: var(--space-4) 0;
}

/* --- Illustration palette (inline SVGs) --------------------------------- */

.i-accent {
  fill: var(--accent);
}

.i-accent-soft {
  fill: var(--accent);
  fill-opacity: 0.14;
}

html[data-theme="dark"] .i-accent-soft {
  fill-opacity: 0.18;
}

.i-accent-stroke {
  stroke: var(--accent);
  fill: none;
}

.i-fg {
  fill: var(--fg);
}

.i-muted {
  fill: var(--fg-muted);
}

.i-subtle {
  fill: var(--canvas-subtle);
}

html[data-theme="dark"] .i-subtle {
  fill: #21262d;
}

.i-border {
  stroke: var(--border);
  fill: none;
}

/* --- Forms -------------------------------------------------------------- */

.form {
  max-width: 34rem;
}

.form .field {
  margin-bottom: var(--space-4);
}

.form label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
}

.form input[type="text"],
.form input[type="email"],
.form textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--canvas-subtle);
  color: var(--fg);
  font: inherit;
}

.form input[type="text"]:focus,
.form input[type="email"]:focus,
.form textarea:focus {
  background: var(--canvas);
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}

.form .consent {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.form .consent input {
  margin-top: 0.35rem;
  accent-color: var(--accent);
}

.form .consent label {
  margin-bottom: 0;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--fg-muted);
}

.form button {
  font: inherit;
  font-weight: 600;
  padding: 0.7rem 1.5rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
}

.form button:hover,
.form button:focus-visible {
  background: var(--accent-emphasis);
  color: #ffffff;
}

.form-status {
  margin-top: var(--space-3);
  font-size: 0.95rem;
  color: var(--accent);
}

/* --- Disclosure + legal -------------------------------------------------- */

.notice {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  max-width: 64ch;
}

.notice p {
  margin: 0;
  color: var(--fg);
  font-size: 0.95rem;
}

.review-note {
  border: 1px dashed var(--accent);
  border-radius: var(--radius-sm);
  background: var(--canvas-subtle);
  padding: 0.9rem 1.1rem;
  margin: 0.75rem 0;
  font-size: 0.85rem;
}

.version-tag {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  text-transform: uppercase;
  margin: 0 0 var(--space-3);
}

.legal-doc h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: var(--space-5) 0 0.75rem;
  max-width: none;
}

.legal-doc h2:first-child {
  margin-top: 0;
}

.legal-doc p,
.legal-doc li {
  color: var(--fg-muted);
  max-width: 72ch;
}

.legal-doc ul {
  padding-left: 1.25rem;
}

/* --- Footer -------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-6) 0 var(--space-5);
  background: var(--canvas-subtle);
  color: var(--fg-muted);
  font-size: 0.85rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.footer-col h2 {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
  margin: 0 0 var(--space-3);
}

.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.footer-col a {
  color: var(--fg-muted);
  text-decoration: none;
}

.footer-col a:hover,
.footer-col a:focus-visible {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: var(--space-4);
}

/* --- Hero brand mark (index): 3D subject, pointer tilt + idle float -------- */

.hero-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 900px;
  position: relative;
}

/* faint theme-aware halo behind the mark */
.hero-visual::before {
  content: "";
  position: absolute;
  inset: 4%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--accent-soft), transparent 72%);
}

.mark3d {
  width: 100%;
  max-width: 380px;
  transform-style: preserve-3d;
  will-change: transform;
  /* load entrance; inline JS transforms take over once it completes */
  animation: mark-enter 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 0.3s both;
}

@keyframes mark-enter {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.82) rotateX(14deg) rotateY(-10deg);
  }
}

/* scroll-driven spin lives on its own wrapper so it composes with (never
   fights) the tilt/exit transform on .mark3d and the float on .mark3d-float */
.mark3d-spin {
  position: relative;
  transform-style: preserve-3d;
}

.mark3d-face {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.mark3d-face svg {
  display: block;
  width: 100%;
  height: auto;
}

/* faint ghost seen when the spin passes 90deg */
.mark3d-back {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
  opacity: 0.3;
}

/* large faint watermark behind the hero, scroll-rotated via main.js;
   the drift wrapper adds a very slow perpetual spin on top */
.hero-watermark {
  position: absolute;
  top: 50%;
  right: -6%;
  width: min(72vh, 640px);
  transform: translateY(-50%);
  color: var(--fg);
  opacity: 0.05;
  pointer-events: none;
  z-index: 0;
}

html[data-theme="dark"] .hero-watermark {
  opacity: 0.07;
}

.hero-watermark svg {
  display: block;
  width: 100%;
  height: auto;
}

.hero-watermark-drift {
  animation: watermark-drift 90s linear infinite;
}

@keyframes watermark-drift {
  to {
    transform: rotate(360deg);
  }
}

.hero .wrap {
  position: relative;
  z-index: 1;
}

.mark3d-float svg {
  display: block;
  width: 100%;
  height: auto;
}

.mk-win {
  stroke: var(--fg);
  fill: none;
}

.mark3d-float {
  animation: mark-float 5.5s ease-in-out infinite;
}

.mk-cursor {
  animation: cursor-blink 1.7s steps(1) infinite;
}

@keyframes mark-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

@keyframes cursor-blink {
  0%,
  55% {
    opacity: 1;
  }
  56%,
  100% {
    opacity: 0.4;
  }
}

/* --- Sticky showcase (index products section) ------------------------------
   Structural alignment: each product is ONE row (visual + name + copy as a
   single unit) inside a viewport-height sticky stage; scroll progress across
   the track cross-fades/translates whole rows, so a product's name can never
   drift from its visual. */

.showcase-track {
  height: 280vh;
}

.showcase-stage {
  position: sticky;
  top: 96px;
  height: calc(100vh - 96px);
}

.showcase-stage .wrap {
  position: relative;
  height: 100%;
}

.show-row {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
  align-items: center;
}

.show-row-2 {
  opacity: 0;
}

.show-row .show-visual {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.show-row .show-visual svg {
  display: block;
  width: 100%;
  height: auto;
}

.show-copy h3 {
  font-size: var(--text-h2);
  font-weight: 600;
  margin: 0 0 var(--space-3);
}

.show-copy p {
  color: var(--fg-muted);
  max-width: 46ch;
}

/* --- Spot icons (cards / loop steps) ---------------------------------------- */

.spot {
  display: block;
  width: 30px;
  height: 30px;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.spot svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* --- Scroll-progress animation: driven entirely from main.js (inline
   transform/opacity), so there is no reveal CSS to honor — elements are
   fully visible by default and only animated while JS + motion allow. --- */

/* --- Responsive ---------------------------------------------------------- */

@media (max-width: 880px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
  }

  #site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4) var(--space-4);
    background: var(--canvas);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
  }

  .site-header.nav-open #site-nav {
    display: flex;
  }

  .nav-link {
    width: 100%;
    justify-content: space-between;
    padding: 0.7rem 0.8rem;
  }

  .nav-cta {
    text-align: center;
    justify-content: center;
  }

  .dropdown {
    position: static;
    box-shadow: none;
    border: 0;
    border-left: 2px solid var(--border);
    border-radius: 0;
    margin: 0.25rem 0 0.25rem 0.8rem;
    padding: 0 0 0 var(--space-2);
    min-width: 0;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }

  .hero-illus {
    max-width: 340px;
  }

  .mark3d,
  .mark3d-morph {
    max-width: 260px;
  }

  .showcase-track {
    height: auto;
  }

  .showcase-stage {
    position: static;
    height: auto;
  }

  .show-row {
    position: static;
    opacity: 1;
    transform: none;
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .show-row + .show-row {
    margin-top: var(--space-6);
  }

  .show-row .show-visual {
    max-width: 300px;
  }

  .hero {
    padding: var(--space-6) 0 var(--space-5);
  }
}

/* --- Reduced motion ------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .hero-copy > *,
  .hero-illus,
  .mark3d,
  .mark3d-float,
  .mk-cursor,
  .hero h1 .w,
  .hero-watermark-drift {
    animation: none;
  }

  /* With the JS engine off, both product rows render statically stacked. */
  .showcase-track {
    height: auto;
  }

  .showcase-stage {
    position: static;
    height: auto;
  }

  .show-row {
    position: static;
    opacity: 1;
    transform: none;
  }

  .show-row + .show-row {
    margin-top: var(--space-6);
  }

  .card {
    transition: none;
  }

  .theme-popover {
    animation: none;
  }

  .theme-fab-wrap {
    transition: none;
  }
}

/* --- Intro morph (index hero, final iteration) ------------------------------
   Frame zero: only header + huge centered mark. main.js drives the morph
   (mark demotes to its resting hero spot while copy fades in). No CSS hiding
   here — every state is written by JS, so reduced-motion / no-JS stays fully
   visible. Entrance keyframes are disabled inside the morph zone because the
   morph itself owns all motion. */

.intro-morph .hero-copy > *:not(h1),
.intro-morph .hero h1 .w,
.intro-morph .mark3d {
  animation: none;
}

.mark3d-morph {
  will-change: transform;
  width: 100%;
  max-width: 380px;
}

.scroll-hint {
  position: absolute;
  bottom: var(--space-5);
  left: 50%;
  transform: translateX(-50%);
  color: var(--fg-muted);
  z-index: 1;
  animation: hint-bob 1.8s ease-in-out infinite;
}

@keyframes hint-bob {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(6px);
  }
}

/* --- Showcase: sequential 3D move + stage dressing -------------------------- */

.show-row {
  transform-style: preserve-3d;
}

.show-row .show-visual {
  max-width: 460px;
  transform-style: preserve-3d;
}

/* faint enlarged ghost of the active product's visual, behind its own panel
   (JS writes wrapper opacity = row activity; inner keeps the faint tint) */
.show-ghost {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: -1;
}

.show-ghost-inner {
  width: 130%;
  max-width: 560px;
  opacity: 0.07;
  animation: ghost-drift 46s linear infinite;
}

html[data-theme="dark"] .show-ghost-inner {
  opacity: 0.09;
}

.show-ghost-inner svg {
  display: block;
  width: 100%;
  height: auto;
}

@keyframes ghost-drift {
  to {
    transform: rotate(360deg);
  }
}

/* stage floor glow under the active panel */
.show-floor {
  position: absolute;
  left: 50%;
  bottom: 6%;
  width: 62%;
  height: 90px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, var(--accent-soft), transparent 70%);
  pointer-events: none;
  z-index: -1;
}

/* progress affordance */
.showcase-dots {
  position: absolute;
  bottom: 4%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
}

.showcase-dots .dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--accent);
  background: transparent;
  transition: background 0.3s ease;
}

.showcase-dots .dot.active {
  background: var(--accent);
}

/* --- Experiment-loop ring (index): pinned stage + interactive nodes -------- */

.loop-track {
  height: 280vh;
}

.loop-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0;
  overflow: hidden;
}

.loop-layout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-6);
  align-items: center;
}

.loop-ring {
  position: relative;
  width: min(380px, 82vw);
}

.loop-ring svg {
  display: block;
  width: 100%;
  height: auto;
}

.ring-arc {
  fill: none;
  stroke: var(--border);
  stroke-width: 2.5;
  stroke-linecap: round;
}

.ring-arrow {
  fill: none;
  stroke: var(--fg-muted);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* node buttons at the four compass points */
.loop-node {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 88px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--fg-muted);
  font: inherit;
  cursor: pointer;
}

.loop-node-n {
  top: 13%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.loop-node-e {
  top: 50%;
  left: 87%;
  transform: translate(-50%, -50%);
}

.loop-node-s {
  top: 87%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.loop-node-w {
  top: 50%;
  left: 13%;
  transform: translate(-50%, -50%);
}

.loop-node-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border);
  background: var(--canvas-subtle);
  font-size: 1rem;
  font-weight: 700;
  color: var(--fg-muted);
  transition:
    border-color 0.25s ease,
    background 0.25s ease,
    color 0.25s ease;
}

.loop-node-label {
  font-size: 0.72rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.2;
  transition: color 0.25s ease;
}

.loop-node:hover .loop-node-num,
.loop-node:focus-visible .loop-node-num {
  border-color: var(--accent);
  color: var(--accent);
}

.loop-node.active .loop-node-num {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.loop-node.active .loop-node-label {
  color: var(--accent);
  font-weight: 700;
}

/* side detail card: instant swap, no superimposed text */
.loop-card {
  max-width: 30rem;
}

.loop-card-item {
  display: none;
}

.loop-card-item.active {
  display: block;
}

.loop-card-item h3 {
  margin: 0 0 0.5rem;
}

.loop-static {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
  max-width: 46ch;
  color: var(--fg-muted);
}

/* visually hidden but screen-reader available */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 880px) {
  .loop-track {
    height: 240vh;
  }

  .loop-layout {
    grid-template-columns: 1fr;
    gap: var(--space-4);
    justify-items: center;
  }

  .loop-ring {
    width: min(300px, 78vw);
  }

  .loop-card {
    max-width: 100%;
    width: 100%;
  }
}

/* --- Reduced motion: final-iteration elements ------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .scroll-hint {
    display: none;
    animation: none;
  }

  .show-ghost-inner {
    animation: none;
  }

  /* no pin, no trap: static ring + card, normal scroll */
  .loop-track {
    height: auto;
  }

  .loop-stage {
    position: static;
    height: auto;
    padding: var(--space-7) 0;
  }

  /* the ring becomes a static diagram; the plain list carries the content */
  .loop-static.sr-only {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }
}

/* --- mark morph: width-cap parity with .mark3d at small widths --------------
   (the base .mark3d-morph rule is appended late in the file, so the mobile
   cap must come after it to win the cascade) */
@media (max-width: 880px) {
  .mark3d-morph {
    max-width: 260px;
  }
}

/* --- Pinned intro stage (index) ----------------------------------------------
   The intro morph runs while the stage is pinned, so the hero assembles in
   view instead of scrolling away mid-build. The track's last ~20% is a hold
   beat: the hero sits fully assembled before the stage releases. */

.intro-track {
  height: 240vh;
}

.hero.intro-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0;
}

@media (prefers-reduced-motion: reduce) {
  /* no pin, no trap: plain static hero, normal scroll */
  .intro-track {
    height: auto;
  }

  .hero.intro-stage {
    position: static;
    height: auto;
    padding: var(--space-7) 0 var(--space-6);
  }
}

@media (max-width: 880px) {
  /* keep the assembled hero clear of the sticky header on the pinned stage */
  .hero.intro-stage {
    padding-top: 72px;
  }
}

@media (max-width: 880px) {
  /* fit the whole assembled hero inside the pinned 100vh stage */
  .mark3d,
  .mark3d-morph {
    max-width: 210px;
  }
}
