/* =============================================================================
   Tael — brand design system (single source of truth: docs/brand.md).
   Tokens map 1:1 to the canonical brand table. Never hardcode raw hex in
   markup or components — reference a token.
   ========================================================================== */

:root {
  /* --- Color tokens --------------------------------------------------- */
  --bg: #0a0d1c;            /* canvas — deep indigo night (default theme) */
  --surface: #12172b;       /* cards / sections */
  --surface-raised: #1b2240;/* elevated surfaces, menus */
  --gold: #c9a24b;          /* primary accent: headings, hairlines, icons, borders */
  --gold-light: #e6c878;    /* hover / active / highlight */
  --ember: #f2b85c;         /* glow on primary CTAs / render action */
  --star-light: #ffe6a8;    /* brightest highlight / focus rings */
  --cream: #ece3ce;         /* body text on dark */
  --muted: #9fb0c0;         /* secondary / caption text */
  --ink: #15203a;           /* text on light/cream surfaces; wordmark on light */
  --oxblood: #7a2e2e;       /* destructive / alert only */

  /* Translucent helpers derived from tokens */
  --gold-hairline: rgba(201, 162, 75, 0.28);
  --gold-faint: rgba(201, 162, 75, 0.12);
  --ember-glow: rgba(242, 184, 92, 0.45);
  --night-veil: rgba(10, 13, 28, 0.72);

  /* --- Type ----------------------------------------------------------- */
  --font-display: "Cinzel", "Trajan Pro", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* --- Shape (radius scale from brand.md) ----------------------------- */
  --radius-card: 22px;
  --radius-btn: 15px;
  --radius-input: 12px;

  /* --- Spacing (4px base grid) ---------------------------------------- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;
  --space-24: 96px;

  /* --- Motion (weighty cinematic eases) ------------------------------- */
  --ease-cine: cubic-bezier(0.4, 0, 0.2, 1);
  --dur: 360ms;

  /* --- Layout --------------------------------------------------------- */
  --container: 1120px;
  --nav-h: 72px;
}

/* =============================================================================
   Reset / base
   ========================================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  /* faint vertical lift + ember warmth toward the top, like the app icon field */
  background-image:
    radial-gradient(120% 80% at 50% -10%, rgba(27, 34, 64, 0.65) 0%, rgba(10, 13, 28, 0) 60%);
  background-attachment: fixed;
  color: var(--cream);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
}

img, svg, video { display: block; max-width: 100%; }

a {
  color: var(--gold-light);
  text-decoration: none;
  transition: color var(--dur) var(--ease-cine);
}
a:hover { color: var(--star-light); }

/* =============================================================================
   Typography
   ========================================================================== */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cream);
  margin: 0 0 var(--space-4);
}

h1 { font-size: clamp(2.6rem, 7vw, 4.75rem); letter-spacing: 0.08em; }
h2 { font-size: clamp(1.9rem, 4vw, 2.9rem); }
h3 { font-size: clamp(1.25rem, 2.4vw, 1.6rem); letter-spacing: 0.05em; }

p { margin: 0 0 var(--space-4); }

.eyebrow {
  font-family: var(--font-display);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 0.78rem;
  color: var(--gold);
}

.lead { font-size: clamp(1.1rem, 2vw, 1.35rem); color: var(--cream); }
.muted { color: var(--muted); }
.text-gold { color: var(--gold); }

/* =============================================================================
   Layout helpers
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.section { padding-block: clamp(var(--space-16), 10vw, var(--space-24)); }

main { flex: 1 0 auto; }

/* Gold hairline divider (constellation-friendly) */
.hairline {
  height: 1px;
  border: 0;
  background: linear-gradient(
    90deg,
    transparent,
    var(--gold-hairline) 18%,
    var(--gold-hairline) 82%,
    transparent
  );
  margin: 0;
}

/* Screen-reader-only (visually hidden, still announced) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip link for keyboard users */
.skip-link {
  position: absolute;
  left: -999px;
  top: var(--space-2);
  z-index: 1000;
  background: var(--surface-raised);
  color: var(--cream);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-btn);
  border: 1px solid var(--gold-hairline);
}
.skip-link:focus { left: var(--space-4); }

/* Visible focus rings everywhere (starLight) */
:focus-visible {
  outline: 2px solid var(--star-light);
  outline-offset: 2px;
  border-radius: 4px;
}

/* =============================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.01em;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius-btn);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--dur) var(--ease-cine),
    box-shadow var(--dur) var(--ease-cine),
    background-color var(--dur) var(--ease-cine),
    border-color var(--dur) var(--ease-cine),
    color var(--dur) var(--ease-cine);
}
.btn:hover { transform: translateY(-1px); }

/* Primary — gold fill with an ember glow */
.btn-primary {
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  color: var(--ink);
  box-shadow: 0 0 0 1px rgba(201, 162, 75, 0.5),
    0 8px 30px -8px var(--ember-glow);
}
.btn-primary:hover {
  background: linear-gradient(180deg, var(--star-light), var(--gold-light));
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--gold-light),
    0 12px 38px -8px var(--ember-glow);
}

/* Secondary — gold outline */
.btn-outline {
  background: transparent;
  color: var(--gold-light);
  border-color: var(--gold-hairline);
}
.btn-outline:hover {
  color: var(--star-light);
  border-color: var(--gold-light);
  box-shadow: 0 0 24px -10px var(--ember-glow);
}

/* =============================================================================
   Navbar
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  transition: background-color var(--dur) var(--ease-cine),
    box-shadow var(--dur) var(--ease-cine),
    backdrop-filter var(--dur) var(--ease-cine);
}
/* Condense on scroll — JS toggles .is-scrolled */
.site-header.is-scrolled {
  background: var(--night-veil);
  backdrop-filter: saturate(140%) blur(10px);
  box-shadow: 0 1px 0 0 var(--gold-hairline);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  width: 100%;
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--cream);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.18em;
  font-size: 1.15rem;
  text-transform: uppercase;
}
.nav-brand:hover { color: var(--cream); }
.nav-brand .mark { width: 30px; height: 30px; color: var(--gold); }

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  color: var(--cream);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  padding: var(--space-2) 0;
  position: relative;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 1px;
  background: var(--gold);
  transition: width var(--dur) var(--ease-cine);
}
.nav-links a:hover { color: var(--gold-light); }
.nav-links a:hover::after,
.nav-links a[aria-current="page"]::after { width: 100%; }

.nav-cta { display: flex; align-items: center; gap: var(--space-3); }

/* Mobile menu toggle */
.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--gold-hairline);
  border-radius: var(--radius-input);
  color: var(--gold-light);
  width: 42px;
  height: 42px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.nav-toggle svg { width: 20px; height: 20px; }

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .nav-links,
  .nav .nav-cta {
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-6) var(--space-6);
    background: var(--night-veil);
    backdrop-filter: saturate(140%) blur(12px);
    border-bottom: 1px solid var(--gold-hairline);
  }
  .nav .nav-cta { top: auto; }
  .nav:not(.is-open) .nav-links,
  .nav:not(.is-open) .nav-cta { display: none; }
  .nav-links a { padding: var(--space-3) 0; }
}

/* =============================================================================
   Footer
   ========================================================================== */

.site-footer {
  border-top: 1px solid var(--gold-hairline);
  background: var(--surface);
  padding-block: var(--space-16) var(--space-8);
  flex-shrink: 0;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: var(--space-8);
}
.footer-brand .mark { width: 40px; height: 40px; color: var(--gold); margin-bottom: var(--space-3); }
.footer-brand p { color: var(--muted); max-width: 30ch; }
.footer-col h4 {
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  color: var(--gold);
  margin-bottom: var(--space-3);
}
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: var(--space-2); }
.footer-col a { color: var(--cream); font-size: 0.95rem; }
.footer-col a:hover { color: var(--gold-light); }

.footer-base {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-top: var(--space-12);
  padding-top: var(--space-6);
  border-top: 1px solid var(--gold-faint);
  color: var(--muted);
  font-size: 0.85rem;
}
.footer-base .mark { width: 22px; height: 22px; color: var(--gold); opacity: 0.8; }

@media (max-width: 860px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: var(--space-6); }
  .footer-brand { grid-column: 1 / -1; }
  .footer-base { flex-direction: column-reverse; align-items: flex-start; }
}

/* =============================================================================
   Constellation / starfield accent (hero + section flourishes)
   ========================================================================== */

.starfield {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.starfield .star {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--star-light);
  opacity: 0.35;
  animation: twinkle 4.5s var(--ease-cine) infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.18; transform: scale(0.8); }
  50% { opacity: 0.7; transform: scale(1.15); }
}

/* Soft ember glow blob usable behind hero content / section accents */
.ember-glow {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, var(--ember-glow) 0%, rgba(242, 184, 92, 0) 70%);
  filter: blur(8px);
  pointer-events: none;
  z-index: 0;
}

/* =============================================================================
   Cards (used from M2 onward; defined here so the system is complete)
   ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--gold-faint);
  border-radius: var(--radius-card);
  padding: var(--space-6);
  transition: border-color var(--dur) var(--ease-cine),
    transform var(--dur) var(--ease-cine);
}
.card:hover { border-color: var(--gold-hairline); }

/* =============================================================================
   Reduced motion — disable all twinkles/pulses/transitions
   ========================================================================== */

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