/* ============ SkinOS — warm design system ============ */

:root {
  --cream: #F6EFE6;
  --ivory: #FBF7F0;
  --terracotta: #C4674A;
  --terracotta-deep: #A94F35;
  --amber: #D99A4E;
  --copper: #A96F44;
  --bronze: #8A5A3B;
  --ink: #3B2A20;
  --ink-soft: #6B5546;
  --font-display: "Fraunces", Georgia, serif;
  --font-sans: "Inter", system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }
html.loading { overflow: hidden; }

body {
  font-family: var(--font-sans);
  color: var(--ink);
  background:
    radial-gradient(120% 90% at 50% 0%, #FAF4EA 0%, var(--cream) 55%, #EFE4D4 100%);
  overflow-x: hidden;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--terracotta); color: var(--ivory); }

/* ---------- fixed 3D layers ---------- */

#glow {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(42% 36% at 50% 48%, rgba(217, 154, 78, 0.34), rgba(196, 103, 74, 0.10) 55%, transparent 78%);
  opacity: 0;
}

#scene {
  position: fixed; inset: 0; z-index: 1;
  width: 100%; height: 100%;
  pointer-events: none;
  opacity: 0;
}

#hud-lines {
  position: fixed; inset: 0; z-index: 3; width: 100%; height: 100%;
  pointer-events: none;
}
#hud-lines line {
  stroke: var(--copper); stroke-width: 1.2;
  opacity: 0.85;
}
#hud-lines circle { fill: var(--amber); }

#hud { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
.hud-group { opacity: 0; }
.hud-label {
  position: absolute; top: 0; left: 0;
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 12px;
  background: rgba(251, 247, 240, 0.78);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid rgba(169, 111, 68, 0.35);
  border-radius: 10px;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  will-change: transform;
}
.hud-label .k {
  font-size: 10px; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-soft);
}
.hud-label .v {
  font-family: var(--font-display); font-size: 20px; font-weight: 500;
  color: var(--terracotta);
}

/* ---------- preloader ---------- */

#preloader {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: var(--cream);
}
.pl-inner { display: grid; justify-items: center; gap: 18px; width: min(320px, 70vw); }
.pl-logo {
  font-family: var(--font-display); font-weight: 600; font-size: 34px; color: var(--ink);
}
.pl-logo span { color: var(--terracotta); font-style: italic; }
.pl-pct {
  font-size: 12px; font-weight: 600; letter-spacing: 0.18em; color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.pl-bar {
  width: 100%; height: 2px; background: rgba(138, 90, 59, 0.18);
  border-radius: 2px; overflow: hidden;
}
.pl-bar i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--amber), var(--terracotta));
}
.pl-hint { font-size: 12px; color: var(--ink-soft); opacity: 0.7; font-style: italic; }

/* ---------- header ---------- */

#topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px clamp(20px, 4vw, 56px);
}
.logo {
  font-family: var(--font-display); font-size: 24px; font-weight: 600;
  color: var(--ink); text-decoration: none;
}
.logo span { color: var(--terracotta); font-style: italic; }
#topbar nav { display: flex; gap: 28px; }
#topbar nav a {
  font-size: 13px; font-weight: 500; letter-spacing: 0.06em;
  color: var(--ink-soft); text-decoration: none; transition: color 0.2s;
}
#topbar nav a:hover { color: var(--terracotta); }

/* ---------- buttons ---------- */

.btn {
  display: inline-block;
  padding: 14px 28px;
  background: var(--terracotta); color: var(--ivory);
  font-family: var(--font-sans); font-size: 14px; font-weight: 600; letter-spacing: 0.03em;
  border: none; border-radius: 999px; cursor: pointer;
  text-decoration: none;
  transition: background 0.25s, transform 0.25s, box-shadow 0.25s;
  box-shadow: 0 10px 30px -12px rgba(196, 103, 74, 0.55);
}
.btn:hover { background: var(--terracotta-deep); transform: translateY(-2px); box-shadow: 0 16px 34px -12px rgba(196, 103, 74, 0.6); }
.btn-ghost {
  background: transparent; color: var(--ink);
  box-shadow: inset 0 0 0 1.5px rgba(59, 42, 32, 0.28);
}
.btn-ghost:hover { background: rgba(59, 42, 32, 0.06); color: var(--ink); box-shadow: inset 0 0 0 1.5px rgba(59, 42, 32, 0.4); }
.btn-small { padding: 10px 20px; font-size: 13px; }

/* ---------- shared type ---------- */

.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--terracotta);
  margin-bottom: 18px;
}
h1 {
  font-family: var(--font-display); font-weight: 340; font-size: clamp(44px, 7.2vw, 104px);
  line-height: 1.02; letter-spacing: -0.015em;
}
h1 em, h2 em { font-style: italic; color: var(--terracotta); }
h2 {
  font-family: var(--font-display); font-weight: 380; font-size: clamp(32px, 3.6vw, 52px);
  line-height: 1.08; letter-spacing: -0.01em; margin-bottom: 18px;
}
.sub { font-size: clamp(15px, 1.4vw, 19px); line-height: 1.6; color: var(--ink-soft); }

/* ---------- sections ---------- */

main { position: relative; z-index: 2; }
section { position: relative; }

.hero {
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  text-align: left;
  padding: 90px clamp(20px, 7vw, 110px) 0;
}
.hero-copy { max-width: min(54vw, 900px); }
.hero h1 { font-size: clamp(42px, 5vw, 88px); }
@media (max-width: 768px) { .hero-copy { max-width: 100%; } }
.hero .sub { margin-top: 26px; }
.hero-actions { margin-top: 38px; display: flex; gap: 14px; flex-wrap: wrap; }

.scroll-hint {
  position: absolute; bottom: 30px; left: clamp(20px, 7vw, 110px);
  display: grid; justify-items: center; gap: 10px;
}
.scroll-hint span {
  font-size: 11px; font-weight: 600; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink-soft);
}
.scroll-hint i {
  width: 1.5px; height: 44px; background: rgba(107, 85, 70, 0.4);
  position: relative; overflow: hidden; display: block;
}
.scroll-hint i::after {
  content: ""; position: absolute; left: 0; top: -50%;
  width: 100%; height: 50%; background: var(--terracotta);
  animation: hint 1.8s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
@keyframes hint { to { top: 110%; } }

.beat {
  min-height: 110svh;
  display: flex; align-items: center;
  padding: 0 clamp(20px, 7vw, 110px);
}
.beat[data-side="right"] { justify-content: flex-end; }

.card {
  max-width: 460px;
  padding: clamp(28px, 3vw, 44px);
  background: rgba(251, 247, 240, 0.62);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid rgba(169, 111, 68, 0.18);
  border-radius: 22px;
  box-shadow: 0 30px 60px -30px rgba(59, 42, 32, 0.25);
}
.card p { font-size: 16px; line-height: 1.65; color: var(--ink-soft); }
.card .btn { margin-top: 22px; }
.chips { display: none; margin-top: 18px; gap: 8px; flex-wrap: wrap; }
.chip {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  color: var(--bronze);
  padding: 6px 12px; border: 1px solid rgba(169, 111, 68, 0.35); border-radius: 999px;
}

/* ---------- stats / devices panel ---------- */

.stats { min-height: 100svh; display: flex; align-items: center; padding: 8vh 0; }
.stats-panel {
  width: min(1060px, 92vw); margin: 0 auto;
  background: var(--ivory);
  border: 1px solid rgba(169, 111, 68, 0.14);
  border-radius: 28px;
  padding: clamp(40px, 6vw, 80px);
  box-shadow: 0 50px 100px -50px rgba(59, 42, 32, 0.35);
  text-align: center;
}
.stat-grid {
  margin-top: 46px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px;
}
.stat strong {
  display: block;
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(40px, 4.6vw, 68px);
  color: var(--terracotta);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.stat span {
  display: block; margin-top: 10px;
  font-size: 13px; line-height: 1.45; color: var(--ink-soft);
}
.footnote { margin-top: 40px; font-size: 12px; color: var(--ink-soft); opacity: 0.75; }

.devices-intro {
  max-width: 640px; margin: 0 auto;
  font-size: 16px; line-height: 1.6; color: var(--ink-soft);
}
.device-grid {
  margin-top: 46px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
  text-align: left;
}
.device-card {
  padding: 24px;
  background: rgba(251, 247, 240, 0.8);
  border: 1px solid rgba(169, 111, 68, 0.18);
  border-radius: 18px;
}
.device-card h3 {
  font-family: var(--font-display); font-weight: 400; font-size: 26px;
  line-height: 1.12; margin: 10px 0 6px;
}
.device-card p {
  font-size: 13px; line-height: 1.55; color: var(--ink-soft);
}
.device-card .eyebrow { margin-bottom: 10px; font-size: 11px; }
.device-visual {
  width: 74px; height: 96px; border-radius: 14px;
  background: linear-gradient(145deg, var(--ink), #241812);
  border: 4px solid var(--copper);
  position: relative; margin-bottom: 16px;
}
.device-visual::before {
  content: ""; position: absolute; inset: 10px;
  border: 1px solid rgba(217, 154, 78, 0.5);
  border-radius: 50% 50% 45% 45%;
}
.device-visual::after {
  content: ""; position: absolute; right: 6px; top: 6px;
  width: 5px; height: 5px; border-radius: 999px;
  background: var(--amber);
  box-shadow: 0 0 10px var(--amber);
}
.status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  background: rgba(217, 154, 78, 0.18); color: var(--bronze);
}
.status::before {
  content: ""; width: 6px; height: 6px; border-radius: 999px;
  background: currentColor;
}

/* ---------- CTA / footer ---------- */

.cta {
  min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 120px 24px 0;
}
.cta h2 { font-size: clamp(44px, 6vw, 88px); }
.cta .sub { margin-top: 14px; }
.cta-actions {
  margin-top: 36px;
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
}

.cta footer {
  margin-top: auto;
  width: 100%;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 28px clamp(20px, 4vw, 56px);
  font-size: 12px; color: var(--ink-soft); opacity: 0.8;
}

/* ---------- rail ---------- */

.rail {
  position: fixed; right: 22px; top: 50%; transform: translateY(-50%);
  z-index: 20;
  display: grid; gap: 12px;
}
.rail i {
  width: 6px; height: 6px; border-radius: 999px;
  background: rgba(107, 85, 70, 0.3);
  cursor: pointer;
  transition: background 0.3s, height 0.3s;
}
.rail i.active { background: var(--terracotta); height: 20px; }

/* ---------- grain ---------- */

.grain {
  position: fixed; inset: -50%; z-index: 50; pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.05;
  mix-blend-mode: multiply;
}

/* ---------- reveal helpers (JS animates; keep visible without JS) ---------- */

html.js-anim .reveal { opacity: 0; }

/* ---------- no-3D fallback ---------- */

html.no-3d #scene, html.no-3d #hud, html.no-3d #hud-lines, html.no-3d #preloader { display: none; }
html.no-3d #glow { opacity: 1; }
html.no-3d.loading { overflow: auto; }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  #topbar nav { display: none; }
}

@media (max-width: 768px) {
  .hero { align-items: center; text-align: center; padding-top: 110px; justify-content: flex-start; }
  .hero-actions { justify-content: center; }
  .scroll-hint { left: 50%; transform: translateX(-50%); }
  #hud, #hud-lines { display: none; }
  .chips { display: flex; }
  .beat { align-items: flex-end; padding-bottom: 8vh; }
  .beat, .beat[data-side="right"] { justify-content: center; }
  .card { max-width: 100%; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .device-grid { grid-template-columns: 1fr; }
  .rail { display: none; }
  .br-d { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scroll-hint i::after { animation: none; }
}
