/* ============================================================
   eternities.ai ... site layout + component classes
   ------------------------------------------------------------
   The design-system tokens (styles.css) carry the foundation.
   This file: (1) retunes the single light source from gold to
   SILVER for the public site, (2) translates the system's React
   primitives into static css, (3) composes the marketing page,
   (4) fixes contrast + scroll performance, (5) adds motion.
   ============================================================ */

/* ============================================================
   1. THE LIGHT IS SILVER
   The design system ships a single warm gold light. For the
   public front door we retune that one light to a cool silver /
   moonlight. We override the semantic aliases only, so every
   component that references --accent / --border-gold inherits it.
   ============================================================ */
:root {
  --silver-100: #eef1f6;
  --silver-200: #dde2ec;
  --silver-300: #c8d0dd;
  --silver-400: #aeb8c8;
  --silver-500: #8b97a9;
  --silver-600: #6c7686;

  --accent:            #cdd5e2;   /* the silver light            */
  --accent-hover:      #e7ecf3;   /* brighter on hover           */
  --accent-press:      #aeb8c8;   /* pressed / saturated         */
  --accent-soft:       rgba(205, 213, 226, 0.10);
  --accent-glow:       rgba(205, 213, 226, 0.30);

  --border-gold:        rgba(205, 213, 226, 0.26);  /* now silver */
  --border-gold-strong: rgba(205, 213, 226, 0.60);
  --ring:               rgba(205, 213, 226, 0.50);
  --text-link:          #e7ecf3;
  --text-on-gold:       #0a0e16;   /* dark night text on silver  */

  --glow-silver:        0 10px 38px rgba(170, 184, 206, 0.16);
  --glow-silver-strong: 0 14px 48px rgba(186, 198, 218, 0.26);

  /* slightly stronger body text than the system default, so copy
     stays readable over the live sky */
  --text-body:   rgba(247, 243, 234, 0.86);
  --text-muted:  rgba(247, 243, 234, 0.60);

  scroll-behavior: smooth;
}

[data-theme="day"] {
  --accent:            #5b6678;   /* graphite-silver on daylight */
  --accent-hover:      #454f5e;
  --accent-press:      #6c7686;
  --accent-soft:       rgba(91, 102, 120, 0.12);
  --accent-glow:       rgba(91, 102, 120, 0.26);
  --border-gold:        rgba(40, 50, 64, 0.18);
  --border-gold-strong: rgba(40, 50, 64, 0.50);
  --ring:               rgba(60, 72, 90, 0.45);
  --text-link:          #454f5e;
  --text-on-gold:       #f7f3ea;
  --text-body:          rgba(16, 19, 27, 0.80);
  --text-muted:         rgba(16, 19, 27, 0.58);
}

/* day: flip the glass surfaces to light frosted so dark slabs don't
   float on the bright sky. night stays the canonical brand. */
[data-theme="day"] .hero-panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.66), rgba(255,255,255,0.48));
  border-color: rgba(40,50,64,0.12);
  box-shadow: var(--shadow-hero-day), inset 0 1px 0 rgba(255,255,255,0.7);
}
[data-theme="day"] .hero h1 { text-shadow: 0 2px 40px rgba(120,150,180,0.30); }
[data-theme="day"] .card {
  background: linear-gradient(180deg, rgba(255,255,255,0.62), rgba(255,255,255,0.46));
  border-color: rgba(40,50,64,0.12);
}
[data-theme="day"] .field .control { background: rgba(255,255,255,0.62); }
[data-theme="day"] .site-nav.is-scrolled { background: rgba(236,244,251,0.60); }
[data-theme="day"] .badge-caution { background: rgba(60,72,90,0.10); color: var(--silver-600); border-color: rgba(60,72,90,0.22); }

/* ============================================================
   2. PAGE SHELL
   ============================================================ */
html, body { min-height: 100%; }
body { background: var(--night-1000); overflow-x: hidden; }

#sky { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
#sky canvas { display: block; width: 100%; height: 100%; }

/* edge + bottom protection gradients over the sky */
.protection {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: var(--edge-vignette), var(--bottom-fade);
}
/* film grain ... static texture, no blend mode (blend modes recomposite
   the full screen every scroll frame and were a source of lag) */
.grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: 0.05;
  background-image: radial-gradient(rgba(255,255,255,0.5) 0.5px, transparent 0.5px);
  background-size: 3px 3px;
}

.content { position: relative; z-index: 2; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--surface-3); color: var(--text-strong);
  padding: 10px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-gold);
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em;
}
.skip-link:focus { left: 16px; top: 16px; }

/* ============================================================
   3. SHARED TYPE + LAYOUT
   ============================================================ */
.kicker {
  font-family: var(--font-mono); font-weight: 500;
  font-size: 11px; line-height: 1; letter-spacing: 0.34em;
  text-transform: uppercase; color: var(--accent);
  margin: 0 0 22px; display: inline-flex; align-items: center; gap: 12px;
}
.kicker::before {
  content: ""; width: 26px; height: 1px; background: var(--border-gold-strong);
  display: inline-block;
}
.wordmark {
  font-family: var(--font-display); font-weight: 500;
  letter-spacing: 0.2em; color: var(--text-strong);
}
.section {
  position: relative; z-index: 4;
  max-width: var(--container-lg); margin: 0 auto;
  padding: clamp(64px, 9vw, 132px) var(--gutter);
}
/* serif editorial heading ... proper case, premium, not lowercase-gimmick */
.serif-head {
  font-family: var(--font-serif); font-weight: 600;
  font-size: clamp(30px, 4.2vw, 50px); line-height: 1.14;
  letter-spacing: 0.005em; color: var(--text-strong);
  text-wrap: balance;
}

/* ============================================================
   4. COMPONENTS (traced from the DS, retuned to silver)
   ============================================================ */

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 9px; height: 44px; padding: 11px 22px;
  font-family: var(--font-text); font-size: 14px; font-weight: 500;
  letter-spacing: 0.01em; line-height: 1;
  border-radius: var(--radius-full); border: 1px solid transparent;
  white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: transform var(--dur-base) var(--ease-soft),
              background var(--dur-base) var(--ease-soft),
              border-color var(--dur-base) var(--ease-soft),
              box-shadow var(--dur-base) var(--ease-soft),
              color var(--dur-base) var(--ease-soft);
}
.btn:active { transform: translateY(0) scale(0.985); }
.btn-sm { height: 36px; padding: 8px 16px; font-size: 13px; gap: 8px; }
.btn-lg { height: 54px; padding: 15px 32px; font-size: 15px; gap: 10px; }

.btn-primary { background: var(--accent); color: var(--text-on-gold); box-shadow: var(--glow-silver); }
.btn-primary:hover { background: var(--accent-hover); transform: var(--lift-hover); box-shadow: var(--glow-silver-strong); color: var(--text-on-gold); }
.btn-secondary {
  background: var(--surface-2); color: var(--text-strong);
  border-color: var(--border-gold);
}
.btn-secondary:hover { border-color: var(--border-gold-strong); transform: var(--lift-hover); background: var(--surface-3); color: var(--text-strong); }
.btn-ghost { background: transparent; color: var(--text-body); }
.btn-ghost:hover { color: var(--text-strong); background: var(--accent-soft); }
.btn .icon { display: inline-flex; transition: transform var(--dur-base) var(--ease-soft); }
.btn:hover .icon { transform: translateX(3px); }

/* ---- badge ---- */
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px; border-radius: var(--radius-full);
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase; line-height: 1;
  white-space: nowrap;
  background: var(--surface-2); color: var(--text-body);
  border: 1px solid var(--border-glass);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.badge-gold { background: var(--accent-soft); color: var(--accent); border-color: var(--border-gold); }
.badge-positive { background: rgba(143,184,154,0.14); color: var(--signal-positive); border-color: rgba(143,184,154,0.35); }
.badge-caution { background: rgba(174,184,200,0.12); color: var(--silver-300); border-color: rgba(174,184,200,0.32); }

/* ---- card (no backdrop-filter ... that was the scroll-lag cost;
   a more opaque fill reads as glass over the sky without per-frame blur) ---- */
.card {
  position: relative;
  background: linear-gradient(180deg, rgba(11,18,33,0.66), rgba(6,11,22,0.72));
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: clamp(22px, 2.4vw, 32px);
  box-shadow: var(--shadow-md);
  transition: transform var(--dur-base) var(--ease-soft),
              box-shadow var(--dur-base) var(--ease-soft),
              border-color var(--dur-base) var(--ease-soft);
}
.card-interactive:hover {
  box-shadow: var(--shadow-lg), var(--glow-silver); transform: var(--lift-hover);
  border-color: var(--border-gold-strong);
}

/* ---- avatar ---- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--border-glass);
  font-family: var(--font-display); font-size: 22px; letter-spacing: 0.04em;
}
.avatar-ring { border: 1px solid var(--border-gold-strong); box-shadow: 0 0 0 4px var(--accent-soft); }

/* ---- input field (keeps a light blur ... few of them, on contact only) ---- */
.field { display: flex; flex-direction: column; gap: 8px; }
.field label {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-muted);
}
.field .control {
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px; height: 50px;
  background: rgba(6,12,24,0.6); border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  transition: border-color var(--dur-base) var(--ease-soft), box-shadow var(--dur-base) var(--ease-soft);
}
.field .control:focus-within { border-color: var(--border-gold-strong); box-shadow: var(--glow-focus); }
.field textarea.control { height: auto; min-height: 120px; padding: 14px 16px; resize: vertical; }
.field input, .field textarea {
  flex: 1; min-width: 0; border: none; outline: none; background: transparent;
  color: var(--text-strong); font-family: var(--font-text); font-size: 15px; line-height: 1.55;
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-faint); }

/* ---- switch ---- */
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.switch .track {
  position: relative; width: 46px; height: 26px; flex-shrink: 0;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-gold); background: var(--surface-2);
  padding: 0; cursor: pointer;
  transition: background var(--dur-base) var(--ease-soft), border-color var(--dur-base) var(--ease-soft);
}
.switch .track[aria-checked="true"] { background: var(--accent); border-color: var(--border-gold-strong); }
.switch .knob {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--cream-50);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted); box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  transition: left var(--dur-base) var(--ease-soft), background var(--dur-base) var(--ease-soft), color var(--dur-base) var(--ease-soft);
}
.switch .track[aria-checked="true"] .knob { left: 24px; background: var(--night-900); color: var(--accent); }
.switch .knob svg { width: 11px; height: 11px; }
.switch-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-muted); min-width: 38px; }

/* ============================================================
   5. NAV
   ============================================================ */
.site-nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px var(--gutter);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: background var(--dur-base) var(--ease-soft), border-color var(--dur-base) var(--ease-soft);
}
.site-nav.is-scrolled {
  background: rgba(2, 5, 12, 0.55);
  border-bottom-color: var(--border-divider);
}
.site-nav .brand {
  background: none; border: none; cursor: pointer; padding: 0;
  font-family: var(--font-display); font-weight: 500; font-size: 21px;
  letter-spacing: 0.24em; color: var(--text-strong);
  text-decoration: none;
}
.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-links a {
  position: relative; padding: 8px 14px; border-radius: var(--radius-full);
  font-family: var(--font-text); font-size: 14px; font-weight: 500;
  color: var(--text-muted);
  transition: color var(--dur-base) var(--ease-soft);
}
.nav-links a::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 4px;
  height: 1px; background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform var(--dur-base) var(--ease-soft);
}
.nav-links a:hover { color: var(--text-strong); }
.nav-links a:hover::after, .nav-links a[aria-current="true"]::after { transform: scaleX(1); }
.nav-links a[aria-current="true"] { color: var(--text-strong); }
.nav-right { display: flex; align-items: center; gap: 16px; }

/* ============================================================
   6. HERO  (recomposed: air, hierarchy, readable subtext)
   ============================================================ */
.hero {
  position: relative; z-index: 4; min-height: 90vh;
  display: grid; place-items: center;
  padding: 64px var(--gutter) 96px; text-align: center;
}
.hero-panel {
  width: min(840px, 94vw); padding: clamp(40px, 5.5vw, 84px) clamp(28px, 5vw, 76px);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(245, 242, 234, 0.10);
  background:
    radial-gradient(130% 130% at 50% 26%, rgba(10, 16, 30, 0.34) 0%, rgba(2, 5, 12, 0.66) 70%);
  box-shadow: var(--shadow-hero), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  -webkit-backdrop-filter: blur(14px) saturate(1.08); backdrop-filter: blur(14px) saturate(1.08);
}
.hero-eyebrow {
  font-family: var(--font-mono); font-size: 12px; font-weight: 500;
  letter-spacing: 0.34em; text-transform: uppercase; color: var(--accent);
  margin-bottom: 24px;
}
.hero h1 {
  margin: 0; font-family: var(--font-display); font-weight: 500;
  font-size: clamp(54px, 8.5vw, 104px); letter-spacing: 0.16em;
  line-height: 0.96; color: var(--text-strong);
  text-shadow: 0 2px 50px rgba(0, 0, 0, 0.5);
}
.hero .lead {
  margin: 26px auto 0; color: var(--text-strong); font-weight: 500;
  font-size: clamp(18px, 2.2vw, 26px); line-height: 1.4; letter-spacing: 0.01em;
}
.hero-sub {
  margin: 14px auto 0; font-family: var(--font-serif); font-style: italic;
  font-size: clamp(15px, 1.6vw, 19px); line-height: 1.5; color: var(--text-body);
}
.hero-actions { display: flex; justify-content: center; gap: 14px; margin-top: 40px; flex-wrap: wrap; }

/* ============================================================
   7. STUDIO
   ============================================================ */
.studio .thesis {
  max-width: 660px; margin: 28px 0 0;
  font-family: var(--font-serif); font-size: clamp(18px, 1.7vw, 21px); line-height: 1.66;
  letter-spacing: 0.005em; color: var(--text-body); font-style: italic;
}
.studio .thesis em { font-style: normal; color: var(--text-strong); }
.principles {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(248px, 1fr));
  gap: 18px; margin-top: 52px;
}
.principles .p-num {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em;
  color: var(--accent); opacity: 0.8;
}
.principles .p-title {
  margin-top: 14px; font-family: var(--font-serif); font-weight: 600; font-size: 22px;
  letter-spacing: 0.005em; color: var(--text-strong);
}
.principles p { margin: 10px 0 0; color: var(--text-body); font-size: 14.5px; line-height: 1.68; }

/* ============================================================
   8. PRODUCTS
   ============================================================ */
.products-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(308px, 1fr)); gap: 18px; }
.product-card { display: flex; flex-direction: column; gap: 18px; }
.product-head { display: flex; align-items: center; justify-content: space-between; }
.product-name {
  font-family: var(--font-display); font-size: 28px; letter-spacing: 0.14em;
  color: var(--text-strong);
}
.product-card p { margin: 12px 0 0; color: var(--text-body); font-size: 14.5px; line-height: 1.68; }
.product-card .btn { align-self: flex-start; }

/* ============================================================
   9. DOCTRINE
   ============================================================ */
.doctrine { text-align: center; }
.doctrine-glyph { font-size: 24px; line-height: 1; color: var(--accent); opacity: 0.85; margin-bottom: 18px; }
.doctrine-statement {
  margin: 0 auto; max-width: 900px;
  font-family: var(--font-serif); font-weight: 400; font-style: italic;
  font-size: clamp(32px, 5vw, 60px); line-height: 1.18; letter-spacing: 0.01em;
  color: var(--text-strong); text-wrap: balance;
}

/* ============================================================
   10. CONTACT
   ============================================================ */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; margin-top: 48px; }
.contact-card h3 {
  margin: 0; font-family: var(--font-serif); font-weight: 600; font-size: 24px;
  letter-spacing: 0.005em; color: var(--text-strong);
}
.contact-card .blurb { margin: 12px 0 24px; color: var(--text-body); font-size: 14.5px; line-height: 1.66; }
.contact-card form { display: flex; flex-direction: column; gap: 16px; }
.contact-card .form-actions { display: flex; justify-content: flex-end; }
.coordinate-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.coordinate-row .field { flex: 1; min-width: 200px; }
.form-status {
  display: none; align-items: center; gap: 10px; margin-top: 4px;
  color: var(--text-body); font-size: 14px; line-height: 1.6;
}
.form-status.is-visible { display: flex; animation: riseIn var(--dur-slow) var(--ease-soft); }

/* ============================================================
   11. FOOTER
   ============================================================ */
.site-footer {
  position: relative; z-index: 4; border-top: 1px solid var(--border-divider);
  margin-top: 40px; padding: 40px var(--gutter);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px;
  max-width: var(--container-xl); margin-left: auto; margin-right: auto;
}
.site-footer .mark { font-size: 17px; }
.site-footer .meta { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; color: var(--text-faint); }

/* ============================================================
   12. MOTION
   load-in stagger for the hero, scroll reveals for sections.
   all gated behind prefers-reduced-motion.
   ============================================================ */
@keyframes riseIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

.hero-anim { opacity: 0; animation: riseIn 0.9s var(--ease-soft) forwards; }
.hero-eyebrow.hero-anim { animation-delay: 0.05s; }
.hero h1.hero-anim      { animation-delay: 0.18s; }
.hero .lead.hero-anim   { animation-delay: 0.34s; }
.hero-sub.hero-anim     { animation-delay: 0.44s; }
.hero-actions.hero-anim { animation-delay: 0.56s; }

.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.8s var(--ease-soft), transform 0.8s var(--ease-soft); }
.reveal.in { opacity: 1; transform: none; }
/* stagger cards as a grid scrolls into view */
.principles .card.reveal:nth-child(2) { transition-delay: 0.08s; }
.principles .card.reveal:nth-child(3) { transition-delay: 0.16s; }
.products-grid .card.reveal:nth-child(2) { transition-delay: 0.10s; }
.contact-grid .card.reveal:nth-child(2) { transition-delay: 0.10s; }

@media (prefers-reduced-motion: reduce) {
  :root { scroll-behavior: auto; }
  .hero-anim, .reveal, .reveal .stagger { opacity: 1 !important; transform: none !important; animation: none !important; transition: none !important; }
  .form-status.is-visible { animation: none; }
}

/* ============================================================
   13. RESPONSIVE
   ============================================================ */
@media (max-width: 760px) {
  .nav-links { display: none; }
  .hero { min-height: 82vh; }
  .hero h1 { letter-spacing: 0.12em; }
}
