/* =============================================================================
   Ugh! Storage — Modern site stylesheet
   -----------------------------------------------------------------------------
   Design tokens mirror ios/UghStorage/UghStorage/DesignSystem/Theme.swift
   so the marketing site and the iOS app feel like siblings, not cousins.
   Motion-first, dark-mode-first, 8-pt grid, interactive micro-details
   (magnetic buttons, mouse-tracked gradients, scroll-driven reveals).
   ========================================================================== */

/* ---------- Design tokens (mirrors Theme.swift) ---------- */
:root {
  /* Brand — derived from the logo's green LED dots */
  --brand:             #00D26A;
  --brand-dark:        #00A855;
  --brand-glow:        rgba(0, 210, 106, 0.42);
  --brand-light:       rgba(0, 210, 106, 0.14);
  --brand-soft:        rgba(0, 210, 106, 0.06);

  /* Dark surfaces — near-black, straight from the app icon */
  --surface:           #0E0F14;
  --surface-elevated:  #16171F;
  --surface-tertiary:  #1E1F29;
  --surface-hover:     #242631;
  --surface-quad:      #2D2E38;

  /* Text hierarchy. All AA against --surface (#0E0F14). */
  --text-primary:      #F1F2F6;
  --text-secondary:    #9FA3AD;
  --text-muted:        #949AA3;    /* ≥4.5:1 on --surface */

  /* Borders — subtle + layered */
  --border:            rgba(255, 255, 255, 0.08);
  --border-strong:     rgba(255, 255, 255, 0.16);
  --border-brand:      rgba(0, 210, 106, 0.30);

  /* Semantic */
  --success:           #00D26A;
  --warning:           #FFC51E;
  --destructive:       #FF5B5B;
  --info:              #5B9BD5;
  --accent-gold:       #FFD740;
  --accent-purple:     #B08DE7;
  --accent-coral:      #FF6666;

  /* File-type tints (also in the app) */
  --tint-image:        rgba(0, 189, 110, 0.14);
  --tint-video:        rgba(242, 115, 82, 0.14);
  --tint-audio:        rgba(176, 128, 231, 0.14);
  --tint-doc:          rgba(237, 191, 81, 0.14);
  --tint-folder:       rgba(91, 155, 213, 0.14);

  /* Spacing — strict 8-pt grid */
  --s-xxs:  4px;
  --s-xs:   8px;
  --s-sm:   12px;
  --s-md:   16px;
  --s-lg:   24px;
  --s-xl:   32px;
  --s-2xl:  48px;
  --s-3xl:  72px;
  --s-4xl:  96px;
  --s-5xl:  128px;

  /* Radius */
  --r-sm:     10px;
  --r-md:     14px;
  --r-lg:     20px;
  --r-card:   22px;
  --r-btn:    14px;
  --r-pill:   999px;

  /* Motion — two canonical curves */
  --ease-snap:  cubic-bezier(0.2, 0.9, 0.3, 1);
  --ease-glide: cubic-bezier(0.4, 0.0, 0.2, 1);
  --dur-snap:   180ms;
  --dur-glide:  420ms;
  --dur-long:   720ms;

  /* Layout */
  --container:     1200px;
  --container-pad: var(--s-lg);
  --nav-h:         68px;

  /* Typography */
  --font-sans:    "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-rounded: "SF Pro Rounded", -apple-system, "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* Light mode — same brand, inverted surface. Automatic via OS preference;
   manual override via [data-theme]. Keeps the same token names so nothing
   else in the CSS ever has to branch on color-scheme. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --surface:           #FFFFFF;
    --surface-elevated:  #FFFFFF;
    --surface-tertiary:  #F5F7F9;
    --surface-hover:     #EDEFF2;
    --surface-quad:      #E3E6EB;
    --text-primary:      #111117;
    --text-secondary:    #4F545D;
    --text-muted:        #6F7480;
    --border:            rgba(0, 0, 0, 0.08);
    --border-strong:     rgba(0, 0, 0, 0.16);
    --brand-soft:        rgba(0, 210, 106, 0.04);
    --brand-light:       rgba(0, 210, 106, 0.10);
    --tint-image:        rgba(0, 189, 110, 0.10);
    --tint-video:        rgba(242, 115, 82, 0.10);
    --tint-audio:        rgba(176, 128, 231, 0.10);
    --tint-doc:          rgba(237, 191, 81, 0.10);
    --tint-folder:       rgba(91, 155, 213, 0.10);
  }
}
[data-theme="light"] {
  color-scheme: light;
  --surface:           #FFFFFF;
  --surface-elevated:  #FFFFFF;
  --surface-tertiary:  #F5F7F9;
  --surface-hover:     #EDEFF2;
  --surface-quad:      #E3E6EB;
  --text-primary:      #111117;
  --text-secondary:    #4F545D;
  --text-muted:        #6F7480;
  --border:            rgba(0, 0, 0, 0.08);
  --border-strong:     rgba(0, 0, 0, 0.16);
  --brand-soft:        rgba(0, 210, 106, 0.04);
  --brand-light:       rgba(0, 210, 106, 0.10);
  --tint-image:        rgba(0, 189, 110, 0.10);
  --tint-video:        rgba(242, 115, 82, 0.10);
  --tint-audio:        rgba(176, 128, 231, 0.10);
  --tint-doc:          rgba(237, 191, 81, 0.10);
  --tint-folder:       rgba(91, 155, 213, 0.10);
}
[data-theme="dark"] { color-scheme: dark; }

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + var(--s-md));
  -webkit-tap-highlight-color: transparent;
}
body {
  font-family: var(--font-sans);
  background: var(--surface);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11", "cv05";
  overflow-x: hidden;
  transition: background var(--dur-snap) var(--ease-snap),
              color var(--dur-snap) var(--ease-snap);
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; background: none; border: 0; color: inherit; }
img, svg { display: block; max-width: 100%; }
code, pre, kbd { font-family: var(--font-mono); }
::selection { background: var(--brand-light); color: var(--text-primary); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 6px; }

/* ---------- Ambient background (subtle grain + mouse-tracked glow) ---------- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(
      600px 400px at var(--mx, 50%) var(--my, 30%),
      var(--brand-glow) 0%,
      transparent 60%
    );
  opacity: 0.14;
  pointer-events: none;
  transition: opacity var(--dur-long) var(--ease-glide);
}
[data-theme="light"] body::before,
:root:not([data-theme="dark"]) body::before { opacity: 0.06; }

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence baseFrequency='0.9' seed='7' numOctaves='2' type='fractalNoise'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.18 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
  opacity: 0.4;
  pointer-events: none;
}
[data-theme="light"] body::after,
:root:not([data-theme="dark"]) body::after { opacity: 0.18; }

/* ---------- Layout primitives ---------- */
.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}
.section { padding-block: var(--s-4xl); position: relative; }
.section-tight { padding-block: var(--s-3xl); }
.section-header { max-width: 720px; margin: 0 auto var(--s-2xl); text-align: center; }
.section-eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand);
  padding: 4px 10px;
  background: var(--brand-light);
  border: 1px solid var(--border-brand);
  border-radius: var(--r-pill);
  margin-bottom: var(--s-sm);
}
.section-title {
  font-family: var(--font-rounded);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.028em;
  color: var(--text-primary);
}
.section-subtitle {
  margin-top: var(--s-sm);
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 600px;
  margin-inline: auto;
}

/* ---------- Navigation ---------- */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--nav-h);
  z-index: 100;
  display: flex;
  align-items: center;
  background: color-mix(in oklab, var(--surface) 70%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
          backdrop-filter: saturate(180%) blur(22px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-snap) var(--ease-snap),
              background var(--dur-snap) var(--ease-snap);
}
.nav.scrolled {
  border-bottom-color: var(--border);
  background: color-mix(in oklab, var(--surface) 85%, transparent);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--s-sm);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.nav-logo img {
  width: 36px; height: 36px;
  border-radius: 10px;
  filter: drop-shadow(0 4px 14px rgba(0, 210, 106, 0.35));
  transition: transform var(--dur-snap) var(--ease-snap);
}
.nav-logo:hover img { transform: rotate(-6deg) scale(1.04); }
.nav-links {
  display: flex;
  align-items: center;
  gap: var(--s-lg);
}
.nav-links a {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--dur-snap) var(--ease-snap);
  position: relative;
}
.nav-links a::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0; right: 0;
  height: 2px;
  background: var(--brand);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-snap) var(--ease-snap);
}
.nav-links a:hover { color: var(--text-primary); }
.nav-links a:hover::after { transform: scaleX(1); }

.nav-actions { display: flex; align-items: center; gap: var(--s-xs); }
.nav-toggle {
  display: none;
  width: 40px; height: 40px;
  border-radius: 10px;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
}
.nav-toggle:hover { background: var(--surface-tertiary); }

/* ---------- Buttons (magnetic + app-styled) ---------- */
.btn {
  --btn-x: 0;
  --btn-y: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-xs);
  padding: 12px 20px;
  border-radius: var(--r-btn);
  font-size: 0.94rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
  position: relative;
  transform: translate(var(--btn-x), var(--btn-y));
  transition: transform var(--dur-snap) var(--ease-snap),
              background var(--dur-snap) var(--ease-snap),
              box-shadow var(--dur-snap) var(--ease-snap),
              color var(--dur-snap) var(--ease-snap),
              border-color var(--dur-snap) var(--ease-snap);
  will-change: transform;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: translate(var(--btn-x), var(--btn-y)) scale(0.96); }

.btn-primary {
  background: linear-gradient(135deg, var(--brand) 0%, #2BE095 100%);
  color: #07170D;
  box-shadow:
    0 8px 22px rgba(0, 210, 106, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-primary:hover {
  box-shadow:
    0 12px 32px rgba(0, 210, 106, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.btn-secondary {
  background: var(--surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--border-strong); background: var(--surface-tertiary); }

.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  padding: 10px 14px;
}
.btn-ghost:hover { background: var(--surface-tertiary); }

.btn-sm { padding: 8px 14px; font-size: 0.85rem; border-radius: 10px; }
.btn-lg { padding: 14px 26px; font-size: 1rem; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: var(--s-lg);
  transition: transform var(--dur-snap) var(--ease-snap),
              border-color var(--dur-snap) var(--ease-snap),
              box-shadow var(--dur-snap) var(--ease-snap);
}
.card-compact { padding: var(--s-md); }
.card-interactive:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.5);
}
.card-glass {
  background: color-mix(in oklab, var(--surface-elevated) 60%, transparent);
  -webkit-backdrop-filter: blur(18px);
          backdrop-filter: blur(18px);
  border: 1px solid var(--border);
}
.card-featured {
  background: linear-gradient(135deg, var(--surface-elevated) 0%, var(--surface-quad) 100%);
  border: 1px solid var(--border-strong);
  position: relative;
  overflow: hidden;
}
.card-featured::after {
  content: "";
  position: absolute;
  inset: -60% -40% auto auto;
  width: 480px; height: 480px;
  background: radial-gradient(circle at center, rgba(0, 210, 106, 0.22), transparent 70%);
  pointer-events: none;
}

.card-tint-image  { background: var(--tint-image);  border-color: transparent; }
.card-tint-video  { background: var(--tint-video);  border-color: transparent; }
.card-tint-audio  { background: var(--tint-audio);  border-color: transparent; }
.card-tint-doc    { background: var(--tint-doc);    border-color: transparent; }
.card-tint-folder { background: var(--tint-folder); border-color: transparent; }

/* Spotlight — card background that follows the pointer */
.spotlight {
  --sx: 50%; --sy: 50%;
  position: relative;
  overflow: hidden;
}
.spotlight::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(300px 180px at var(--sx) var(--sy), rgba(0, 210, 106, 0.14), transparent 60%);
  opacity: 0;
  transition: opacity var(--dur-snap) var(--ease-snap);
  pointer-events: none;
}
.spotlight:hover::before { opacity: 1; }

/* ---------- Badges + chips ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge-brand {
  background: var(--brand-light);
  color: var(--brand);
  border: 1px solid var(--border-brand);
}
.badge-dot::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: pulseDot 2.4s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.6; transform: scale(1.15); }
}
.badge-muted {
  background: var(--surface-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.kbd {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--surface-tertiary);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  color: var(--text-primary);
}

/* ---------- Hero ---------- */
.hero {
  padding: calc(var(--nav-h) + var(--s-3xl)) 0 var(--s-3xl);
  position: relative;
  overflow: hidden;
}
.hero-inner {
  position: relative;
  display: grid;
  gap: var(--s-lg);
  max-width: 860px;
  margin-inline: auto;
  text-align: center;
  padding-block: var(--s-xl);
}
.hero-title {
  font-family: var(--font-rounded);
  font-size: clamp(2.6rem, 6.8vw, 5rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.04em;
  color: var(--text-primary);
}
.hero-title .accent {
  background: linear-gradient(120deg, var(--brand) 0%, #2BE095 55%, var(--info) 110%);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  position: relative;
}
.hero-subtitle {
  font-size: clamp(1.05rem, 1.8vw, 1.3rem);
  color: var(--text-secondary);
  max-width: 640px;
  margin-inline: auto;
}
.hero-ctas {
  display: flex;
  gap: var(--s-sm);
  justify-content: center;
  flex-wrap: wrap;
  margin-top: var(--s-sm);
}
.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-md);
  margin-top: var(--s-lg);
  max-width: 580px;
  margin-inline: auto;
}
.hero-stat { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.hero-stat-value {
  font-family: var(--font-rounded);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, var(--brand), #2BE095);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}
.hero-stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Hero device mockup — floating app + Pi side by side */
.hero-device {
  margin: var(--s-2xl) auto 0;
  max-width: 880px;
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  align-items: center;
  gap: var(--s-md);
}
.hero-phone, .hero-pi {
  background: linear-gradient(145deg, var(--surface-elevated), var(--surface-quad));
  border: 1px solid var(--border-strong);
  border-radius: var(--r-card);
  padding: var(--s-md);
  position: relative;
  overflow: hidden;
  box-shadow:
    0 30px 80px -30px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.hero-phone {
  aspect-ratio: 9 / 16;
  max-width: 260px;
  animation: gentleFloat 8s ease-in-out infinite;
}
.hero-pi {
  aspect-ratio: 1 / 1;
  max-width: 260px;
  margin-inline: auto;
  animation: gentleFloat 7s ease-in-out infinite 1s;
}
@keyframes gentleFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

/* Animated "secure tunnel" pipe between phone and Pi */
.tunnel-wire {
  position: relative;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  border-radius: 1px;
  overflow: visible;
}
.tunnel-wire::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 10px; height: 10px;
  margin-top: -5px;
  background: var(--brand);
  border-radius: 50%;
  box-shadow: 0 0 16px var(--brand);
  animation: packet 2.8s linear infinite;
}
@keyframes packet {
  to { left: calc(100% - 10px); }
}

/* LED dots on the Pi mockup */
.pi-leds {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: var(--s-sm);
}
.pi-leds span {
  width: 8px; height: 8px;
  background: var(--brand);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--brand);
  animation: blinkLed 2.4s ease-in-out infinite;
}
.pi-leds span:nth-child(2) { animation-delay: 0.3s; }
.pi-leds span:nth-child(3) { animation-delay: 0.6s; }
@keyframes blinkLed {
  0%, 60%, 100% { opacity: 1; }
  30%           { opacity: 0.25; }
}

/* ---------- Marquee ---------- */
.marquee {
  padding: var(--s-lg) 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent);
          mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent);
  background: var(--surface-elevated);
}
.marquee-track {
  display: flex;
  gap: var(--s-2xl);
  width: max-content;
  animation: marquee 45s linear infinite;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.88rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.marquee-track span { display: inline-flex; align-items: center; gap: var(--s-lg); white-space: nowrap; }
.marquee-track span::after { content: "✦"; color: var(--brand); }
@keyframes marquee {
  to { transform: translateX(-50%); }
}

/* ---------- Feature grid ---------- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--s-md);
}
.feature-card {
  padding: var(--s-lg);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  transition: transform var(--dur-snap) var(--ease-snap),
              border-color var(--dur-snap) var(--ease-snap);
  position: relative;
  overflow: hidden;
}
.feature-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
}
.feature-icon {
  width: 48px; height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: var(--brand-light);
  color: var(--brand);
  margin-bottom: var(--s-sm);
  transition: transform var(--dur-snap) var(--ease-snap);
}
.feature-card:hover .feature-icon { transform: scale(1.1) rotate(-4deg); }
.feature-icon svg { width: 24px; height: 24px; }
.feature-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-primary);
}
.feature-body { color: var(--text-secondary); font-size: 0.95rem; }

/* ---------- Comparison table ---------- */
.comparison-table {
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  overflow: hidden;
  background: var(--surface-elevated);
}
.comp-row {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  border-bottom: 1px solid var(--border);
  transition: background var(--dur-snap) var(--ease-snap);
}
.comp-row:not(.comp-row-head):hover { background: var(--surface-hover); }
.comp-row:last-child { border-bottom: 0; }
.comp-row > * {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  border-right: 1px solid var(--border);
  font-size: 0.93rem;
  color: var(--text-secondary);
}
.comp-row > *:last-child { border-right: 0; }
.comp-row-head > * {
  background: var(--surface-tertiary);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.comp-highlight {
  background: var(--brand-light) !important;
  color: var(--text-primary) !important;
  font-weight: 600;
}

/* ---------- Architecture flow ---------- */
.arch-flow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--s-md);
  position: relative;
}
.arch-node {
  padding: var(--s-md);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  text-align: center;
  position: relative;
  transition: transform var(--dur-snap) var(--ease-snap),
              border-color var(--dur-snap) var(--ease-snap);
}
.arch-node:hover {
  transform: translateY(-3px);
  border-color: var(--border-brand);
}
.arch-node-icon {
  width: 40px; height: 40px;
  margin: 0 auto var(--s-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--brand-light);
  color: var(--brand);
}
.arch-node-title {
  font-weight: 600;
  font-size: 0.96rem;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.arch-node-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ---------- Setup guide layout ---------- */
.setup-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: var(--s-2xl);
  align-items: start;
}
.setup-progress {
  position: sticky;
  top: calc(var(--nav-h) + var(--s-lg));
  padding: var(--s-md);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  max-height: calc(100vh - var(--nav-h) - var(--s-2xl));
  overflow-y: auto;
}
.setup-progress h3 {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: var(--s-sm);
}
.setup-progress ol {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  counter-reset: step;
}
.setup-progress a {
  display: flex;
  align-items: center;
  gap: var(--s-sm);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  transition: all var(--dur-snap) var(--ease-snap);
  counter-increment: step;
  line-height: 1.3;
}
.setup-progress a::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
  min-width: 22px;
  flex-shrink: 0;
  transition: color var(--dur-snap) var(--ease-snap);
}
.setup-progress a:hover { background: var(--surface-hover); color: var(--text-primary); }
.setup-progress a.active {
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 500;
}
.setup-progress a.active::before { color: var(--brand); }

.setup-hero {
  padding: calc(var(--nav-h) + var(--s-2xl)) 0 var(--s-2xl);
  text-align: center;
}

.step-card {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: var(--s-xl);
  margin-bottom: var(--s-lg);
  scroll-margin-top: calc(var(--nav-h) + var(--s-md));
  transition: border-color var(--dur-snap) var(--ease-snap);
}
.step-card.active { border-color: var(--border-brand); }
.step-head {
  display: flex;
  align-items: flex-start;
  gap: var(--s-md);
  margin-bottom: var(--s-md);
}
.step-num {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: var(--brand-light);
  color: var(--brand);
  font-family: var(--font-rounded);
  font-weight: 700;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.step-meta {
  font-size: 0.76rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
  font-weight: 600;
}
.step-title {
  font-family: var(--font-rounded);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.step-body > * + * { margin-top: var(--s-md); }
.step-body p { color: var(--text-secondary); }
.step-body ul, .step-body ol { padding-left: 1.4em; color: var(--text-secondary); }
.step-body ul li, .step-body ol li { margin: 5px 0; }
.step-body strong { color: var(--text-primary); font-weight: 600; }
.step-body a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.step-body h4 {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  margin-top: var(--s-lg);
  margin-bottom: var(--s-xs);
}

/* ---------- OS tab switcher ---------- */
.os-tabs {
  display: inline-flex;
  padding: 4px;
  background: var(--surface-tertiary);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: var(--s-md);
  gap: 2px;
}
.os-tab {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all var(--dur-snap) var(--ease-snap);
}
.os-tab:hover { color: var(--text-primary); }
.os-tab[aria-selected="true"] {
  background: var(--surface-elevated);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.os-tab svg { width: 14px; height: 14px; }
.os-pane { display: none; }
.os-pane[data-active] { display: block; animation: fadePanel var(--dur-glide) var(--ease-glide); }
@keyframes fadePanel {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Code blocks ---------- */
.code {
  position: relative;
  background: #05070B;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 36px 56px 14px 16px;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.65;
  color: #d8e4da;
  overflow-x: auto;
}
.code[data-label]::before {
  content: attr(data-label);
  position: absolute;
  top: 10px; left: 16px;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-weight: 600;
}
.code pre { white-space: pre; margin: 0; }
.code .c-comment { color: #6b7a6f; font-style: italic; }
.code .c-cmd     { color: #7ef0a8; }
.code .c-string  { color: #f0c993; }
.code .c-key     { color: #89b8e4; }
.code .c-dim     { color: #555e66; }
.copy-btn {
  position: absolute;
  top: 8px; right: 8px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all var(--dur-snap) var(--ease-snap);
}
.copy-btn:hover { background: rgba(255, 255, 255, 0.1); color: var(--text-primary); }
.copy-btn.copied {
  color: var(--brand);
  border-color: var(--brand);
  background: var(--brand-light);
}
.copy-btn svg { width: 14px; height: 14px; }

/* ---------- Callouts ---------- */
.callout {
  padding: var(--s-md);
  border-radius: var(--r-md);
  border-left: 3px solid var(--brand);
  background: var(--brand-light);
  display: flex;
  gap: var(--s-sm);
  font-size: 0.92rem;
}
.callout-title { font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.callout-body { color: var(--text-secondary); }
.callout-warning {
  background: rgba(255, 197, 30, 0.10);
  border-left-color: var(--warning);
}
.callout-warning .callout-title { color: var(--warning); }
.callout-danger {
  background: rgba(255, 91, 91, 0.10);
  border-left-color: var(--destructive);
}
.callout-danger .callout-title { color: var(--destructive); }
.callout-info { background: rgba(91, 155, 213, 0.10); border-left-color: var(--info); }
.callout-info .callout-title { color: var(--info); }
.callout svg { flex-shrink: 0; width: 20px; height: 20px; margin-top: 2px; }

/* ---------- Details / "why this matters" panel ---------- */
.details {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0;
  background: var(--surface-tertiary);
  overflow: hidden;
}
.details summary {
  padding: 12px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color var(--dur-snap) var(--ease-snap);
}
.details summary::-webkit-details-marker { display: none; }
.details summary::before {
  content: "›";
  font-family: var(--font-rounded);
  font-weight: 700;
  font-size: 1.2rem;
  transition: transform var(--dur-snap) var(--ease-snap);
  color: var(--brand);
  display: inline-block;
  width: 14px;
}
.details[open] summary::before { transform: rotate(90deg); }
.details summary:hover { color: var(--text-primary); }
.details-body {
  padding: 0 16px 14px 38px;
  color: var(--text-secondary);
  font-size: 0.92rem;
}
.details-body > * + * { margin-top: var(--s-xs); }
.details-body code {
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}

/* ---------- Parts list ---------- */
.parts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--s-sm);
}
.part-card {
  padding: var(--s-md);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  text-align: center;
  transition: transform var(--dur-snap) var(--ease-snap),
              border-color var(--dur-snap) var(--ease-snap);
}
.part-card:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.part-icon {
  width: 40px; height: 40px;
  margin: 0 auto 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--brand-light);
  color: var(--brand);
}
.part-name { font-weight: 600; font-size: 0.95rem; }
.part-price {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--brand);
  margin-top: 2px;
}

/* ---------- Checklist ---------- */
.checklist {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--s-sm);
  background: var(--surface-tertiary);
  border-radius: var(--r-md);
}
.checklist label {
  display: flex;
  gap: var(--s-sm);
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.92rem;
  color: var(--text-secondary);
  transition: all var(--dur-snap) var(--ease-snap);
}
.checklist label:hover { background: rgba(255, 255, 255, 0.04); }
.checklist input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--brand);
  flex-shrink: 0;
  margin-top: 2px;
}
.checklist input:checked + span {
  color: var(--text-muted);
  text-decoration: line-through;
}

/* ---------- FAQ ---------- */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-xs);
  max-width: 780px;
  margin-inline: auto;
}
.faq-item {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color var(--dur-snap) var(--ease-snap);
}
.faq-item.open { border-color: var(--border-brand); }
.faq-question {
  width: 100%;
  padding: var(--s-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-md);
  font-weight: 500;
  font-size: 1rem;
  text-align: left;
  color: var(--text-primary);
}
.faq-chevron {
  transition: transform var(--dur-snap) var(--ease-snap);
  color: var(--text-muted);
  flex-shrink: 0;
}
.faq-item.open .faq-chevron { transform: rotate(180deg); color: var(--brand); }
.faq-answer {
  max-height: 0;
  overflow: hidden;
  padding: 0 var(--s-md);
  color: var(--text-secondary);
  transition: max-height var(--dur-glide) var(--ease-glide),
              padding var(--dur-glide) var(--ease-glide);
}
.faq-item.open .faq-answer {
  padding: 0 var(--s-md) var(--s-md);
  max-height: 600px;
}

/* ---------- Final CTA ---------- */
.final-cta {
  padding: var(--s-2xl);
  background: linear-gradient(135deg, var(--surface-elevated) 0%, var(--surface-quad) 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-card);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.final-cta::after {
  content: "";
  position: absolute;
  inset: -40%;
  background: radial-gradient(circle at center, rgba(0, 210, 106, 0.18), transparent 60%);
  pointer-events: none;
  animation: slowSpin 40s linear infinite;
}
@keyframes slowSpin {
  to { transform: rotate(360deg); }
}

/* ---------- Options / DIY cards ---------- */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--s-md);
}
.option-card {
  padding: var(--s-xl);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  position: relative;
  transition: transform var(--dur-snap) var(--ease-snap),
              border-color var(--dur-snap) var(--ease-snap);
}
.option-card:hover { transform: translateY(-4px); border-color: var(--border-strong); }
.option-card.featured {
  border-color: var(--border-brand);
  background: linear-gradient(180deg, var(--surface-elevated), var(--surface-quad));
}
.option-badge {
  position: absolute;
  top: var(--s-md);
  right: var(--s-md);
}

/* ---------- App feature preview grid ---------- */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--s-md);
}
.app-feature {
  padding: var(--s-md);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  display: flex;
  gap: var(--s-sm);
  transition: transform var(--dur-snap) var(--ease-snap),
              border-color var(--dur-snap) var(--ease-snap);
}
.app-feature:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.app-feature-icon {
  width: 36px; height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-light);
  color: var(--brand);
}
.app-feature h4 { font-size: 0.95rem; font-weight: 600; margin-bottom: 2px; color: var(--text-primary); }
.app-feature p { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: var(--s-2xl) 0 var(--s-xl);
  color: var(--text-secondary);
  font-size: 0.9rem;
  background: var(--surface-elevated);
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: var(--s-2xl);
  margin-bottom: var(--s-xl);
}
.footer h4 {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-primary);
  margin-bottom: var(--s-sm);
}
.footer ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer a {
  color: var(--text-secondary);
  transition: color var(--dur-snap) var(--ease-snap);
}
.footer a:hover { color: var(--text-primary); }
.footer-bottom {
  padding-top: var(--s-md);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-sm);
  font-size: 0.82rem;
  color: var(--text-muted);
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: var(--s-sm);
  margin-bottom: var(--s-sm);
  font-weight: 700;
}
.footer-brand img { width: 28px; height: 28px; border-radius: 8px; }

/* ---------- Scroll reveal animations ---------- */
[data-animate] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--dur-long) var(--ease-glide),
              transform var(--dur-long) var(--ease-glide);
}
[data-animate].visible {
  opacity: 1;
  transform: translateY(0);
}
[data-animate="scale"] { transform: scale(0.96); }
[data-animate="scale"].visible { transform: scale(1); }
[data-animate="left"] { transform: translateX(-30px); }
[data-animate="left"].visible { transform: translateX(0); }
[data-animate="right"] { transform: translateX(30px); }
[data-animate="right"].visible { transform: translateX(0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  body::before { display: none; }
}

/* ---------- Theme toggle button ---------- */
.theme-toggle {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--dur-snap) var(--ease-snap);
}
.theme-toggle:hover { background: var(--surface-tertiary); color: var(--text-primary); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .sun, .theme-toggle .moon { transition: opacity var(--dur-snap) var(--ease-snap); }
[data-theme="dark"] .theme-toggle .sun { display: block; }
[data-theme="dark"] .theme-toggle .moon { display: none; }
[data-theme="light"] .theme-toggle .sun { display: none; }
[data-theme="light"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .sun { display: block; }
  :root:not([data-theme]) .theme-toggle .moon { display: none; }
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .theme-toggle .sun { display: none; }
  :root:not([data-theme]) .theme-toggle .moon { display: block; }
}

/* ---------- Utility ---------- */
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-brand { color: var(--brand); }
.mono { font-family: var(--font-mono); }
.center { text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .nav-links { display: none; }
  .nav-toggle { display: inline-flex; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: absolute;
    top: var(--nav-h);
    left: 0; right: 0;
    padding: var(--s-md);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    gap: var(--s-md);
  }
  .setup-layout { grid-template-columns: 1fr; }
  .setup-progress { position: static; max-height: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .hero-device { grid-template-columns: 1fr; gap: var(--s-sm); }
  .hero-phone, .hero-pi { max-width: 200px; }
  .tunnel-wire {
    width: 2px; height: 48px;
    background: linear-gradient(180deg, transparent, var(--brand), transparent);
    margin: 0 auto;
  }
  .tunnel-wire::before { animation: packet-v 2.8s linear infinite; left: 50%; margin-left: -5px; top: 0; }
  @keyframes packet-v { to { top: calc(100% - 10px); } }
}
@media (max-width: 640px) {
  :root { --container-pad: var(--s-md); }
  .section { padding-block: var(--s-3xl); }
  .hero { padding: calc(var(--nav-h) + var(--s-xl)) 0 var(--s-xl); }
  .comp-row { grid-template-columns: 1fr; }
  .comp-row > * { border-right: 0; border-bottom: 1px solid var(--border); }
  .comp-row > *:last-child { border-bottom: 0; }
  .footer-grid { grid-template-columns: 1fr; }
  .hero-stats { grid-template-columns: 1fr; }
  .step-card { padding: var(--s-md); }
  .option-card { padding: var(--s-lg); }
}
