/* ============================================================
   CIRCADIAN — Design System
   Palette: deep indigo night + warm amber dawn + near-white surface
   Typography: Instrument Serif (display) + DM Sans (body)
   ============================================================ */

/* ---------- TOKENS ---------- */
:root,
[data-theme='light'] {
  /* Surfaces */
  --color-bg: #F6F5F2;
  --color-surface: #FAFAF8;
  --color-surface-2: #FFFFFF;
  --color-border: #E2E0DB;
  --color-divider: #ECEAE6;

  /* Text */
  --color-text: #1A1814;
  --color-text-muted: #6E6C67;
  --color-text-faint: #B8B6B0;

  /* Brand */
  --color-primary: #3B2D8A;       /* deep indigo */
  --color-primary-hover: #2B1F6E;
  --color-accent: #C97A2C;        /* warm amber */
  --color-accent-light: #F5E4CC;

  /* Rhythm colors for the chart */
  --color-night: #3B2D8A;
  --color-dawn: #C97A2C;
  --color-peak: #7C5CE8;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(26,24,20,0.06);
  --shadow-md: 0 4px 16px rgba(26,24,20,0.08);
  --shadow-lg: 0 12px 40px rgba(26,24,20,0.1);

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* Type */
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.95rem + 0.25vw, 1.125rem);
  --text-lg:   clamp(1.125rem, 1rem    + 0.75vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1.2rem  + 1.25vw, 2.25rem);
  --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.5rem);
  --text-hero: clamp(2.8rem,   1rem    + 5.5vw,  6rem);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Fonts */
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Transitions */
  --t: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Widths */
  --w-narrow: 640px;
  --w-default: 1000px;
  --w-wide: 1200px;
}

[data-theme='dark'] {
  --color-bg: #0E0D0C;
  --color-surface: #141311;
  --color-surface-2: #1A1917;
  --color-border: #2A2926;
  --color-divider: #222120;
  --color-text: #E8E6E2;
  --color-text-muted: #7A7874;
  --color-text-faint: #4A4846;
  --color-primary: #7C6ED4;
  --color-primary-hover: #9486E0;
  --color-accent: #E09040;
  --color-accent-light: #3A2A14;
  --color-night: #7C6ED4;
  --color-dawn: #E09040;
  --color-peak: #A090F0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.25);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #0E0D0C;
    --color-surface: #141311;
    --color-surface-2: #1A1917;
    --color-border: #2A2926;
    --color-divider: #222120;
    --color-text: #E8E6E2;
    --color-text-muted: #7A7874;
    --color-text-faint: #4A4846;
    --color-primary: #7C6ED4;
    --color-primary-hover: #9486E0;
    --color-accent: #E09040;
    --color-accent-light: #3A2A14;
    --color-night: #7C6ED4;
    --color-dawn: #E09040;
    --color-peak: #A090F0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.25);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.35);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
  }
}

/* ---------- BASE ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-bg);
}

img, svg { display: block; max-width: 100%; height: auto; }
ul[role='list'], ol[role='list'] { list-style: none; }
h1,h2,h3,h4,h5,h6 { text-wrap: balance; line-height: 1.15; }
p, li { text-wrap: pretty; }

a { color: inherit; text-decoration: none; }
button { cursor: pointer; background: none; border: none; font: inherit; color: inherit; }

::selection { background: rgba(124,94,232,0.2); color: var(--color-text); }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; border-radius: var(--radius-sm); }

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

/* ---------- LAYOUT ---------- */
.container {
  width: 100%;
  max-width: var(--w-default);
  margin: 0 auto;
  padding: 0 var(--space-6);
}
.container-narrow {
  width: 100%;
  max-width: var(--w-narrow);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

/* ---------- NAV ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in oklch, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--color-divider);
  transition: box-shadow var(--t);
}
.nav.scrolled { box-shadow: var(--shadow-sm); }

.nav-inner {
  max-width: var(--w-wide);
  margin: 0 auto;
  padding: 0 var(--space-6);
  height: 60px;
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--text-sm);
  letter-spacing: 0.01em;
  color: var(--color-text);
  flex-shrink: 0;
  transition: opacity var(--t);
}
.logo:hover { opacity: 0.75; }
.logo svg { flex-shrink: 0; }

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin-left: auto;
}
.nav-links a {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  transition: color var(--t);
}
.nav-links a:hover { color: var(--color-text); }

.nav-cta {
  padding: var(--space-2) var(--space-5);
  background: var(--color-primary);
  color: #fff !important;
  border-radius: var(--radius-full, 9999px);
  font-weight: 500;
  transition: background var(--t), transform var(--t) !important;
}
.nav-cta:hover { background: var(--color-primary-hover) !important; transform: translateY(-1px); }

.theme-toggle {
  margin-left: var(--space-4);
  padding: var(--space-2);
  color: var(--color-text-muted);
  border-radius: var(--radius-md);
  transition: color var(--t), background var(--t);
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--color-text); background: var(--color-divider); }

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: 9999px;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: background var(--t), color var(--t), transform var(--t), box-shadow var(--t);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 2px 12px rgba(59,45,138,0.25);
}
.btn-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: 0 4px 20px rgba(59,45,138,0.35);
}

.btn-ghost {
  color: var(--color-text-muted);
  background: transparent;
}
.btn-ghost:hover { color: var(--color-text); background: var(--color-divider); }

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
}

/* ---------- HERO ---------- */
.hero {
  position: relative;
  min-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: clamp(var(--space-20), 12vw, var(--space-32)) var(--space-6);
}

/* Animated arc rings */
.hero-bg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.arc-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid var(--color-primary);
  opacity: 0.08;
  animation: pulseRing 6s ease-in-out infinite;
}
.arc-ring-1 { width: 320px; height: 320px; animation-delay: 0s; }
.arc-ring-2 { width: 520px; height: 520px; opacity: 0.05; animation-delay: 1.5s; }
.arc-ring-3 { width: 720px; height: 720px; opacity: 0.03; animation-delay: 3s; }

@keyframes pulseRing {
  0%, 100% { transform: scale(1); opacity: var(--base-op, 0.08); }
  50% { transform: scale(1.03); opacity: calc(var(--base-op, 0.08) * 1.6); }
}
.arc-ring-2 { --base-op: 0.05; }
.arc-ring-3 { --base-op: 0.03; }

/* Orbiting dot */
.arc-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 0 16px 4px color-mix(in oklch, var(--color-accent) 50%, transparent);
  animation: orbitDot 12s linear infinite;
  transform-origin: 0 0;
}

@keyframes orbitDot {
  from { transform: rotate(0deg) translateX(160px) rotate(0deg); }
  to   { transform: rotate(360deg) translateX(160px) rotate(-360deg); }
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 640px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
}

.eyebrow {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
  background: var(--color-accent-light);
  padding: var(--space-1) var(--space-3);
  border-radius: 9999px;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: var(--text-hero);
  font-weight: 400;
  line-height: 1.08;
  color: var(--color-text);
}
.hero h1 em {
  font-style: italic;
  color: var(--color-primary);
}

.hero-sub {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  max-width: 52ch;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  justify-content: center;
}

/* ---------- RHYTHM SECTION ---------- */
.rhythm-section {
  padding: clamp(var(--space-16), 8vw, var(--space-32)) 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-divider);
  border-bottom: 1px solid var(--color-divider);
}

.section-label {
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-4);
}

.rhythm-section h2 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 400;
  margin-bottom: var(--space-4);
}

.section-sub {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  max-width: 52ch;
  margin-bottom: var(--space-12);
}
.section-sub em { color: var(--color-text); font-style: italic; }

/* Chart */
.rhythm-chart {
  position: relative;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-6) var(--space-6);
  overflow: hidden;
}

.curve-svg {
  width: 100%;
  height: auto;
  display: block;
  margin-bottom: var(--space-4);
}
.curve-line {
  stroke-dasharray: 1200;
  stroke-dashoffset: 1200;
  animation: drawLine 2.5s ease forwards;
}
@keyframes drawLine {
  to { stroke-dashoffset: 0; }
}

.time-labels {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-variant-numeric: tabular-nums;
  padding: 0 var(--space-2);
}

.zone-labels {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(100% - 40px);
  pointer-events: none;
}
.zone {
  position: absolute;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  white-space: nowrap;
}
.zone-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.zone-dot--peak { background: var(--color-peak); box-shadow: 0 0 8px var(--color-peak); }
.zone-dot--secondary { background: var(--color-primary); }
.zone-dot--rest { background: var(--color-text-faint); }

/* ---------- STEPS ---------- */
.steps-section {
  padding: clamp(var(--space-16), 8vw, var(--space-32)) 0;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-12);
}

.step {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.step-num {
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--color-text-faint);
}

.step h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 400;
  color: var(--color-text);
}

.step p {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: 1.7;
}

/* ---------- FEATURES ---------- */
.features-section {
  padding: clamp(var(--space-16), 8vw, var(--space-32)) 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-divider);
  border-bottom: 1px solid var(--color-divider);
}

.features-section h2 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 400;
  margin-top: var(--space-4);
  margin-bottom: var(--space-12);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}

.feature-card {
  padding: var(--space-8);
  border-radius: var(--radius-lg);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: box-shadow var(--t), transform var(--t);
}
.feature-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.feature-icon {
  color: var(--color-primary);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in oklch, var(--color-primary) 10%, transparent);
  border-radius: var(--radius-md);
}

.feature-card h4 {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--color-text);
}

.feature-card p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.65;
  max-width: none;
}

/* ---------- PHILOSOPHY ---------- */
.philosophy-section {
  padding: clamp(var(--space-20), 10vw, var(--space-32)) 0;
}

blockquote {
  position: relative;
  padding-left: var(--space-6);
  border-left: 2px solid var(--color-primary);
}
blockquote p {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 400;
  font-style: italic;
  line-height: 1.5;
  color: var(--color-text);
  max-width: none;
}

/* ---------- CTA SECTION ---------- */
.cta-section {
  padding: clamp(var(--space-16), 8vw, var(--space-32)) 0;
  padding-bottom: clamp(var(--space-20), 10vw, var(--space-32));
}

.cta-inner {
  background: color-mix(in oklch, var(--color-primary) 6%, var(--color-surface));
  border: 1px solid color-mix(in oklch, var(--color-primary) 20%, var(--color-border));
  border-radius: var(--radius-xl);
  padding: clamp(var(--space-12), 6vw, var(--space-20));
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
}

.cta-logo {
  color: var(--color-primary);
  opacity: 0.6;
}

.cta-inner h2 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 400;
}

.cta-inner > p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  max-width: none;
}

.cta-buttons {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  justify-content: center;
}

/* ---------- FOOTER ---------- */
.site-footer {
  padding: var(--space-10) 0;
  border-top: 1px solid var(--color-divider);
}

.footer-inner {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  flex-wrap: wrap;
}

.logo-sm span { font-size: var(--text-xs); }

.footer-links {
  display: flex;
  gap: var(--space-6);
  margin-left: auto;
}
.footer-links a {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  transition: color var(--t);
}
.footer-links a:hover { color: var(--color-text); }

.footer-copy {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  max-width: none;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
  .nav-links a:not(.nav-cta) { display: none; }

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

  .features-grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
  }
  .footer-links { margin-left: 0; }

  .zone { display: none; }
}

@media (max-width: 520px) {
  .features-grid {
    grid-template-columns: 1fr;
  }
  .arc-ring-1 { width: 240px; height: 240px; }
  .arc-ring-2 { width: 380px; height: 380px; }
  .arc-ring-3 { width: 520px; height: 520px; }
  @keyframes orbitDot {
    from { transform: rotate(0deg) translateX(120px) rotate(0deg); }
    to   { transform: rotate(360deg) translateX(120px) rotate(-360deg); }
  }
}
