@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@200;300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&display=swap');

/* ===== THEME TOKENS ===== */
:root {
  --cream: #e8e0d4;
  --dark: #0c0c0c;
  --muted: #555;
  --accent: #c4a882;
  --border: #1a1a1a;
  --border-subtle: #2a2a2a;
  --text-faint: #333;
  --text-dim: #666;
  --text-mid: #888;
  --nav-glass: rgba(12, 12, 12, 0.85);
  --mono-border: rgba(232, 224, 212, 0.15);
  --mono-border-hover: rgba(232, 224, 212, 0.3);
  --glow: rgba(196, 168, 130, 0.04);
  --glow-weak: rgba(196, 168, 130, 0.03);
  --ghost-border-hover: #444;
  --scroll-line: #444;
}

[data-theme="light"] {
  --cream: #1a1a1a;
  --dark: #f0ebe3;
  --muted: #6b6b6b;
  --accent: #9a7040;
  --border: #ddd;
  --border-subtle: #ccc;
  --text-faint: #bbb;
  --text-dim: #888;
  --text-mid: #666;
  --nav-glass: rgba(240, 235, 227, 0.85);
  --mono-border: rgba(26, 26, 26, 0.1);
  --mono-border-hover: rgba(26, 26, 26, 0.2);
  --glow: rgba(154, 112, 64, 0.06);
  --glow-weak: rgba(154, 112, 64, 0.04);
  --ghost-border-hover: #999;
  --scroll-line: #ccc;
}

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

html {
  scroll-snap-type: y mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--text-faint) var(--dark);
}

body {
  background: var(--dark);
  color: var(--cream);
  font-family: 'Outfit', sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== THEME TRANSITION (applied briefly via JS) ===== */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition-duration: 0.4s !important;
  transition-property: background-color, color, border-color, fill, stroke !important;
  transition-timing-function: ease !important;
}

/* ===== GRAIN ===== */
.grain {
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 999;
}
[data-theme="light"] .grain { opacity: 0.45; }

/* ===== NAV ===== */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  padding: 24px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.4s, backdrop-filter 0.4s;
}
nav.scrolled {
  background: var(--nav-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.nav-logo {
  display: flex; align-items: center; gap: 14px; text-decoration: none;
  color: var(--cream);
}
.nav-logo svg { opacity: 0.9; }
.nav-wordmark {
  font-size: 24px; font-weight: 400; color: var(--cream);
  letter-spacing: 3px;
}
.nav-links { display: flex; gap: 36px; list-style: none; }
.nav-links a {
  font-size: 18px; font-weight: 300; letter-spacing: 3px;
  text-transform: uppercase; color: var(--muted);
  text-decoration: none; transition: color 0.3s;
}
.nav-links a:hover { color: var(--cream); }
.nav-actions {
  display: flex; align-items: center; gap: 16px;
}
.nav-cta {
  font-size: 18px; font-weight: 400; letter-spacing: 2px;
  text-transform: uppercase; color: var(--dark); background: var(--cream);
  border: none; padding: 10px 24px; border-radius: 100px;
  cursor: pointer; text-decoration: none;
  transition: background 0.3s, transform 0.2s;
}
.nav-cta:hover { background: var(--accent); transform: translateY(-1px); }

/* ===== LANGUAGE TOGGLE ===== */
.lang-toggle {
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: color 0.3s, border-color 0.3s;
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.lang-toggle:hover {
  color: var(--cream);
  border-color: var(--ghost-border-hover);
}

/* ===== THEME TOGGLE ===== */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: color 0.3s, border-color 0.3s;
  padding: 0;
}
.theme-toggle:hover {
  color: var(--cream);
  border-color: var(--ghost-border-hover);
}
.theme-toggle svg {
  width: 16px; height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* Dark mode (default): show sun icon to switch to light */
.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun { stroke: var(--accent); }
.theme-toggle:hover .icon-sun { stroke: var(--cream); }
/* Light mode: show moon icon to switch to dark */
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* ===== HERO ===== */
.hero-spacer {
  height: 100vh;
  scroll-snap-align: start;
}
.hero {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 10;
  background: var(--dark);
  will-change: opacity;
}
.hero::before {
  content: '';
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -55%);
  width: 800px; height: 600px;
  background: radial-gradient(ellipse, var(--glow) 0%, transparent 70%);
  pointer-events: none;
}
.hero-content {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  align-items: center; gap: 48px;
}
.hero-monogram { opacity: 0; animation: fadeUp 1s ease-out 0.2s forwards; }
.hero-monogram .mono-g {
  display: flex; flex-direction: column; align-items: center;
  border: 1.5px solid var(--mono-border);
  border-radius: 20px; padding: 32px 36px 28px;
  transition: border-color 0.5s;
}
.hero-monogram .mono-g:hover { border-color: var(--mono-border-hover); }
.hero-monogram .letter-w {
  font-family: 'Outfit', sans-serif; font-size: 114px; font-weight: 500;
  color: var(--cream); line-height: 0.75; margin-top: -6px;
}
.hero-text { text-align: center; opacity: 0; animation: fadeUp 1s ease-out 0.5s forwards; }
.hero-headline {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(54px, 7.5vw, 96px); font-weight: 400;
  line-height: 1.15; color: var(--cream);
  max-width: 700px; margin-bottom: 24px;
}
.hero-headline em { font-style: italic; color: var(--accent); }
.hero-sub {
  font-size: 24px; font-weight: 300; line-height: 1.7;
  color: var(--muted); max-width: 520px; margin: 0 auto;
}
.hero-actions {
  display: flex; gap: 16px; align-items: center;
  opacity: 0; animation: fadeUp 1s ease-out 0.8s forwards;
}
.btn-primary {
  font-family: 'Outfit', sans-serif; font-size: 20px; font-weight: 400;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--dark); background: var(--cream);
  border: none; padding: 14px 32px; border-radius: 100px;
  cursor: pointer; text-decoration: none;
  transition: background 0.3s, transform 0.2s;
}
.btn-primary:hover { background: var(--accent); transform: translateY(-2px); }
.btn-ghost {
  font-family: 'Outfit', sans-serif; font-size: 20px; font-weight: 300;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--muted); background: none;
  border: 1px solid var(--border-subtle); padding: 14px 32px; border-radius: 100px;
  cursor: pointer; text-decoration: none;
  transition: color 0.3s, border-color 0.3s;
}
.btn-ghost:hover { color: var(--cream); border-color: var(--ghost-border-hover); }
.scroll-hint {
  position: absolute; bottom: 40px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  opacity: 0; animation: fadeIn 1s ease-out 1.4s forwards;
}
.scroll-hint span {
  font-size: 14px; letter-spacing: 4px; text-transform: uppercase;
  color: var(--text-faint); font-weight: 300;
}
.scroll-line {
  width: 1px; height: 40px;
  background: linear-gradient(to bottom, var(--scroll-line), transparent);
  animation: pulse 2s ease-in-out infinite;
}

/* ===== GOLDEN CIRCLE STACK ===== */
.gc-stack {
  position: relative;
  z-index: 5;
  /* 3 spacers of 100vh = 300vh total scroll area */
}
.gc-spacer {
  height: 100vh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

/* Fixed panels behind the scroll flow */
.gc-panel {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 120px 48px;
  background: var(--dark);
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  will-change: opacity;
}

.gc-inner {
  max-width: 960px; width: 100%;
  display: grid; grid-template-columns: 1fr 1.4fr;
  gap: 80px; align-items: center;
}
.gc-label-side {
  display: flex; flex-direction: column;
  align-items: flex-start; gap: 20px;
}
.gc-index {
  font-size: 17px; font-weight: 300; letter-spacing: 5px;
  text-transform: uppercase; color: var(--text-faint);
}
.gc-word {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(72px, 10.5vw, 144px); font-weight: 400;
  line-height: 1; color: var(--cream);
}
.gc-accent-line {
  width: 48px; height: 2px; background: var(--accent);
  transform-origin: left;
  transform: scaleX(0); opacity: 0;
  transition: transform 0.6s ease 0.15s, opacity 0.6s ease 0.15s;
}
.gc-content {
  opacity: 0; transform: translateY(16px);
  transition: opacity 0.6s ease 0.1s, transform 0.6s ease 0.1s;
}
.gc-headline {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(33px, 3.75vw, 45px); font-weight: 400;
  line-height: 1.35; color: var(--cream); margin-bottom: 24px;
}
.gc-body {
  font-size: 23px; font-weight: 300; line-height: 1.85; color: var(--text-mid);
}
.gc-body p + p { margin-top: 16px; }

/* Panel scroll hints */
.gc-scroll-hint {
  position: absolute; bottom: 40px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  opacity: 0;
  transition: opacity 0.6s ease 0.3s;
}
.gc-scroll-hint span {
  font-size: 14px; letter-spacing: 4px; text-transform: uppercase;
  color: var(--text-faint); font-weight: 300;
}

/* Revealed state */
.gc-panel.revealed .gc-accent-line { transform: scaleX(1); opacity: 1; }
.gc-panel.revealed .gc-content { opacity: 1; transform: translateY(0); }
.gc-panel.revealed .gc-scroll-hint { opacity: 1; }

/* Color accent per section */
.gc-panel--why .gc-word,
.gc-panel--how .gc-word,
.gc-panel--what .gc-word { color: var(--accent); }
.gc-panel--why::before {
  content: ''; position: absolute;
  left: calc(50% - 480px); top: 50%;
  transform: translateY(-50%);
  width: 400px; height: 400px;
  background: radial-gradient(ellipse, var(--glow) 0%, transparent 70%);
  pointer-events: none;
}

/* ===== PRINCIPLES ===== */
.principles {
  padding: 80px 48px;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  position: relative; z-index: 10; background: var(--dark);
  scroll-snap-align: start;
}
.principles-inner {
  max-width: 1100px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 48px;
}
.principle {
  opacity: 0; transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.principle.visible { opacity: 1; transform: translateY(0); }
.principle:nth-child(2) { transition-delay: 0.15s; }
.principle:nth-child(3) { transition-delay: 0.3s; }
.principle-icon {
  width: 48px; height: 48px;
  border: 1px solid var(--border-subtle); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
}
.principle-icon svg {
  width: 20px; height: 20px; stroke: var(--accent);
  fill: none; stroke-width: 1.5;
}
.principle-title {
  font-size: 21px; font-weight: 500; letter-spacing: 1px;
  margin-bottom: 10px; color: var(--cream);
}
.principle-desc {
  font-size: 20px; font-weight: 300; line-height: 1.75; color: var(--text-dim);
}

/* ===== CTA + FOOTER WRAPPER ===== */
.cta-spacer {
  height: 100vh;
  scroll-snap-align: start;
}
.cta-footer-wrap {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 100vh;
  display: flex; flex-direction: column;
  z-index: 1;
  background: var(--dark);
  opacity: 0;
  pointer-events: none;
  will-change: opacity;
}

/* ===== CTA ===== */
.cta-section {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 120px 48px;
  position: relative;
}
.cta-section::before {
  content: ''; position: absolute; bottom: 0; left: 50%;
  transform: translateX(-50%); width: 600px; height: 400px;
  background: radial-gradient(ellipse, var(--glow-weak) 0%, transparent 70%);
  pointer-events: none;
}
.cta-inner {
  position: relative; z-index: 1;
  opacity: 0; transform: translateY(16px);
  transition: opacity 0.6s ease 0.1s, transform 0.6s ease 0.1s;
}
.cta-footer-wrap.revealed .cta-inner {
  opacity: 1; transform: translateY(0);
}
.cta-headline {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(42px, 6vw, 72px); font-weight: 400;
  line-height: 1.2; color: var(--cream); margin-bottom: 20px;
}
.cta-sub {
  font-size: 23px; font-weight: 300; color: var(--muted);
  margin-bottom: 40px; line-height: 1.7;
}

/* ===== FOOTER ===== */
footer {
  padding: 48px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.footer-left { font-size: 17px; font-weight: 300; letter-spacing: 2px; color: var(--text-faint); }
.footer-right { font-size: 17px; font-weight: 300; letter-spacing: 2px; color: var(--text-faint); font-style: italic; }

/* ===== ANIMATIONS ===== */
@keyframes fadeUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse { 0%, 100% { opacity: 0.3; } 50% { opacity: 0.8; } }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  nav { padding: 16px 24px; }
  .nav-links { display: none; }

  /* Disable the fixed-panel scroll choreography: flow as a single column.
     !important beats the inline opacity/transform that the desktop JS writes
     (the JS guard also clears those, but this prevents any pre-JS flash). */
  .hero,
  .gc-panel,
  .cta-footer-wrap {
    position: static !important;
    height: auto !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: none !important;
    will-change: auto;
  }
  .hero-spacer,
  .gc-spacer,
  .cta-spacer { display: none !important; }
  html { scroll-snap-type: none; }

  /* Content is normally revealed by the JS-added .revealed class, which never
     fires on mobile — force the revealed visual state so the text is visible. */
  .gc-content,
  .cta-inner { opacity: 1 !important; transform: none !important; }
  .gc-accent-line { transform: scaleX(1) !important; opacity: 1 !important; }
  .gc-scroll-hint { display: none; }   /* desktop-only scroll affordance */

  /* Section rhythm for the now auto-height panels */
  .hero { min-height: 100vh; min-height: 100dvh; padding: 96px 24px 64px; }
  .gc-panel { padding: 72px 24px; align-items: flex-start; }
  .gc-panel + .gc-panel,
  .cta-footer-wrap { border-top: 1px solid var(--border-subtle); }
  .gc-panel--why::before { display: none; }

  .gc-inner { grid-template-columns: 1fr; gap: 32px; }
  .gc-label-side { align-items: center; text-align: center; }
  .gc-content { text-align: center; }
  .gc-accent-line { margin: 0 auto; }
  .principles { padding: 60px 24px; }
  .principles-inner { grid-template-columns: 1fr; gap: 36px; }
  .cta-section { padding: 80px 24px; }
  footer { padding: 32px 24px; flex-direction: column; gap: 12px; text-align: center; }

  /* Shrink oversized fixed-px elements that overflow a ~390px phone */
  .hero::before { width: 320px; height: 280px; }
  .cta-section::before { width: 320px; height: 240px; }
  .hero-monogram .mono-g { padding: 24px 26px 20px; }
  .hero-monogram .letter-w { font-size: 84px; }

  /* Lower the clamp() minimums so headlines fit narrow screens */
  .hero-headline { font-size: clamp(32px, 9.5vw, 96px); }
  .gc-word { font-size: clamp(48px, 16vw, 144px); }

  /* Hero CTAs: stack vertically, centered, equal width, single-line labels */
  .hero-actions { flex-direction: column; gap: 12px; width: 100%; }
  .hero-actions .btn-primary,
  .hero-actions .btn-ghost {
    width: 100%; max-width: 300px; text-align: center;
    font-size: 17px; padding: 15px 28px; letter-spacing: 1.5px;
  }

  .gc-headline { font-size: clamp(26px, 6.5vw, 45px); }
  .cta-headline { font-size: clamp(32px, 9vw, 72px); }
  .hero-sub { font-size: 18px; }
  .gc-body { font-size: 18px; line-height: 1.7; }
  .cta-sub { font-size: 18px; }

  /* Overflow backstop */
  img, svg { max-width: 100%; height: auto; }
}
