/* Apex letter — standalone stylesheet. Fonts self-hosted, tokens from the Apex design system. */
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 400; src: url(fonts/inter-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 500; src: url(fonts/inter-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 600; src: url(fonts/inter-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 700; src: url(fonts/inter-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-display: swap; font-weight: 500; src: url(fonts/jetbrains-mono-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-display: swap; font-weight: 600; src: url(fonts/jetbrains-mono-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Fraunces Variable'; font-style: normal; font-display: swap; font-weight: 100 900; src: url(fonts/fraunces-latin-standard-normal.woff2) format('woff2-variations'); }

/*
  Apex design tokens — single source of truth in CSS.
  Values map 1:1 to apex-system-DESIGN.md. Do not introduce new palettes
  per section; reference these variables everywhere.

  To swap the real Apex brand gold: change --color-primary (and, if the
  brand supplies a matching tint, --color-accent). Nothing else needs to move.
*/

:root {
  /* ---- Color (from DESIGN.md `colors:`) ---- */
  --color-primary: #c9a227;        /* Apex gold — placeholder, swap for exact brand hex */
  --color-secondary: #191c21;
  --color-accent: #e6ce7a;         /* pale gold tint */
  --color-bg: #0a0a0a;
  --color-surface: #16181d;
  --color-text-primary: #ffffff;
  --color-text-secondary: #b8b8c0; /* bumped for readability on near-black */
  --color-border: #2a2a2e;
  --color-on-primary: #0a0a0a;     /* text/icons on top of a gold surface — always dark */

  /* Derived states (kept in the gold family, not new palettes) */
  --color-primary-hover: #d8b23a;  /* slightly brighter gold for hover */
  --color-surface-2: #1c1f26;      /* raised surface for nested cards */
  --color-border-strong: #3a3a40;
  --color-focus: var(--color-accent); /* high-contrast focus ring on dark */

  /* Warm gold atmosphere used behind the hero — gold-as-light, never a fill */
  --glow-gold-strong: rgba(201, 162, 39, 0.30);
  --glow-gold-soft: rgba(201, 162, 39, 0.10);

  /* ---- Typography (from DESIGN.md `typography:`) ---- */
  --font-display: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  /* Editorial display serif — used for the hero headline */
  --font-serif: 'Fraunces Variable', Georgia, 'Times New Roman', serif;

  /* Design-system size tokens (as authored) */
  --fs-display-lg: 4rem;   /* 64px */
  --fs-body-md: 1rem;      /* 16px */
  --fs-label-md: 0.75rem;  /* 12px */

  /* Responsive, readability-first scale.
     Body is rendered at 18px per the accessibility brief (45–70 audience),
     while --fs-body-md keeps the design-system 16px value above. */
  --fs-hero: clamp(2.75rem, 6.8vw, 5.25rem);   /* 44 → 84px — Anduril-scale display */
  --fs-h2: clamp(2rem, 3.8vw, 3rem);           /* 32 → 48px */
  --fs-h3: clamp(1.25rem, 1.6vw, 1.5rem);      /* 20 → 24px */
  --fs-lead: clamp(1.1875rem, 1.8vw, 1.375rem);/* 19 → 22px hero/lead */
  --fs-body: 1.125rem;                          /* 18px comfortable body */
  --fs-body-sm: 1rem;                           /* 16px min for any prose */
  --fs-label: 0.8125rem;                        /* 13px mono labels */
  --fs-stat: clamp(2.75rem, 6vw, 4rem);        /* big live-signal numbers */

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  --lh-tight: 1.04;   /* display */
  --lh-snug: 1.2;
  --lh-normal: 1.6;   /* body */

  --ls-label: 0.04em;    /* DESIGN.md label-md tracking */
  --ls-eyebrow: 0.16em;  /* wider tracking for uppercase mono eyebrows */

  /* ---- Spacing (from DESIGN.md `spacing:` base 8px) ---- */
  --space-1: 0.5rem;   /* 8 */
  --space-2: 1rem;     /* 16 (gap) */
  --space-3: 1.5rem;   /* 24 (card-padding) */
  --space-4: 2rem;     /* 32 */
  --space-5: 2.5rem;   /* 40 */
  --space-6: 3rem;     /* 48 */
  --space-8: 4rem;     /* 64 */
  --space-10: 5rem;    /* 80 (section-padding) */
  --gap: 1rem;         /* 16 */
  --card-padding: 1.5rem; /* 24 */

  /* Vertical rhythm for sections — cinematic breathing room on desktop */
  --section-padding-y: clamp(5rem, 9vw, 8.5rem); /* 80 → 136px — more negative space */

  /* ---- Radii (from DESIGN.md `rounded:`) ---- */
  --radius-card: 8px;
  --radius-control: 8px;
  --radius-pill: 9999px;

  /* ---- Layout ---- */
  --container-max: 1200px;
  --container-narrow: 760px;
  --page-gutter: clamp(1.25rem, 4vw, 2.5rem);
  --header-h: 72px;

  /* ---- Accessibility ---- */
  --tap-min: 44px;      /* minimum interactive target */
  --focus-ring: 3px;

  /* ---- Elevation (subtle, low-spread per DESIGN.md) ---- */
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.5), 0 10px 30px rgba(0, 0, 0, 0.35);

  /* ---- Motion (restrained, composed) ---- */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 160ms;
  --dur-med: 320ms;
  --dur-slow: 640ms;
}

/*
  Global base + shared primitives for the Apex site.
  Everything here reads from tokens.css. No raw hex/px palettes.
*/

/* ---------- Reset (light-touch) ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

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

body {
  min-height: 100dvh;
  background-color: var(--color-bg);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  font-weight: var(--fw-regular);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: var(--fw-medium);
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

/* ---------- Accessibility: focus + skip link ---------- */
:focus-visible {
  outline: var(--focus-ring) solid var(--color-focus);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Remove focus ring only when not keyboard-driven */
:focus:not(:focus-visible) {
  outline: none;
}

.skip-link {
  position: absolute;
  left: var(--space-2);
  top: -100px;
  z-index: 200;
  background: var(--color-primary);
  color: var(--color-on-primary);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-control);
  font-weight: var(--fw-semibold);
  transition: top var(--dur-fast) var(--ease-out);
}

.skip-link:focus {
  top: var(--space-2);
}

.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;
}

/* ---------- Layout primitives ---------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--page-gutter);
}

.container--narrow {
  max-width: var(--container-narrow);
}

.section {
  padding-block: var(--section-padding-y);
  border-top: 1px solid var(--color-border);
}

.section__head {
  max-width: 46rem;
  margin-bottom: var(--space-6);
}

.section__title {
  font-size: var(--fs-h2);
  margin-top: var(--space-2);
}

.section__lead {
  color: var(--color-text-secondary);
  font-size: var(--fs-lead);
  line-height: 1.5;
  margin-top: var(--space-3);
}

/* ---------- Mono eyebrow / labels (a signature of the system) ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--color-primary);
}

.eyebrow::before {
  content: '';
  width: 1.5rem;
  height: 1px;
  background: var(--color-primary);
  opacity: 0.7;
}

.label {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

/* ---------- Buttons (large targets, high contrast) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  min-height: 56px;              /* well above the 44px minimum */
  padding: 0.9rem 1.75rem;
  border-radius: var(--radius-control);
  border: 2px solid transparent;
  font-size: 1.125rem;
  font-weight: var(--fw-semibold);
  line-height: 1.1;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

/* Primary = gold fill, DARK text (never white) */
.btn--primary {
  background: var(--color-primary);
  color: var(--color-on-primary);
  border-color: var(--color-primary);
}

.btn--primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

/* Secondary = transparent fill, border outline, light text */
.btn--secondary {
  background: transparent;
  color: var(--color-text-primary);
  border-color: var(--color-border-strong);
}

.btn--secondary:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn--lg {
  min-height: 64px;
  padding: 1.05rem 2.25rem;
  font-size: 1.25rem;
}

.btn--block {
  width: 100%;
}

/* ---------- Scroll reveals (pure CSS, scroll-driven) ----------
   Reveals each section as it enters the viewport. No JS, so no flash of
   hidden content; on browsers without scroll-driven animations the @supports
   test fails and content is simply shown. Skipped for reduced motion. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .section,
    .page-header {
      animation: reveal-in linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 45%;
    }

    @keyframes reveal-in {
      from {
        opacity: 0;
        transform: translateY(22px);
      }
      to {
        opacity: 1;
        transform: none;
      }
    }
  }
}

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

/* ---------- Header / footer (slim, standalone) ---------- */
.site-header { position: sticky; top: 0; z-index: 100; background: transparent; border-bottom: 1px solid transparent; transition: background var(--dur-med) var(--ease-out), border-color var(--dur-med) var(--ease-out); }
.site-header.is-scrolled { background: color-mix(in srgb, var(--color-bg) 80%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom-color: var(--color-border); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 72px; }
.wordmark { display: inline-flex; align-items: center; gap: 0.55rem; text-decoration: none; color: var(--color-text-primary); }
.wordmark__mark { color: var(--color-primary); font-size: 1.05rem; line-height: 1; }
.wordmark__text { font-family: var(--font-mono); font-weight: var(--fw-semibold); letter-spacing: 0.22em; font-size: 1.05rem; }
.site-nav { display: flex; align-items: center; gap: var(--space-3); }
.site-nav__link { display: inline-flex; align-items: center; min-height: var(--tap-min); padding: 0 0.5rem; color: var(--color-text-primary); font-weight: var(--fw-medium); text-decoration: none; }
.site-nav__link:hover { color: var(--color-primary); }
.site-nav__cta { min-height: 48px; padding: 0.6rem 1.35rem; font-size: 1.0625rem; }
@media (max-width: 40rem) {
  .site-header__inner { flex-wrap: wrap; justify-content: center; gap: var(--space-2); padding-block: 0.75rem; }
  .wordmark { flex: 1 0 100%; justify-content: center; }
  .site-nav { flex-wrap: wrap; justify-content: center; gap: var(--space-2); }
}

.footer { border-top: 1px solid var(--color-border); padding-block: var(--space-8) var(--space-6); margin-top: var(--space-6); }
.footer__inner { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: var(--space-6); }
.footer__brand { display: flex; flex-direction: column; gap: var(--space-3); }
.footer__tagline { color: var(--color-text-secondary); font-size: var(--fs-body-sm); max-width: 22rem; }
.footer__heading { margin-bottom: var(--space-3); color: var(--color-text-secondary); }
.footer__col ul { list-style: none; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.footer__col a { display: inline-flex; align-items: center; min-height: var(--tap-min); color: var(--color-text-primary); text-decoration: none; font-size: var(--fs-body-sm); }
.footer__col a:hover { color: var(--color-primary); }
.footer__legal { margin-top: var(--space-8); padding-top: var(--space-5); border-top: 1px solid var(--color-border); display: flex; flex-direction: column; gap: var(--space-3); }
.footer__disclaimer { color: var(--color-text-secondary); font-size: var(--fs-body-sm); line-height: 1.5; max-width: 60rem; }
.footer__copyright { color: var(--color-text-secondary); font-size: var(--fs-body-sm); }

/* ---------- Page header (privacy) ---------- */
.page-header {
  padding-block: clamp(3.5rem, 8vw, 6rem) clamp(2.5rem, 5vw, 3.5rem);
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* A faint echo of the hero's gold light, kept very restrained */
.page-header::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(
    60% 80% at 50% -10%,
    var(--glow-gold-soft) 0%,
    transparent 60%
  );
  pointer-events: none;
}

.page-header__eyebrow {
  justify-content: center;
  margin-bottom: var(--space-3);
}

.page-header__title {
  font-size: var(--fs-hero);
  font-weight: var(--fw-medium);
  letter-spacing: -0.02em;
}

.page-header__lead {
  margin-top: var(--space-3);
  margin-inline: auto;
  max-width: 40rem;
  color: var(--color-text-secondary);
  font-size: var(--fs-lead);
  line-height: 1.5;
}

.page-header__actions:not(:empty) {
  margin-top: var(--space-5);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: center;
}


/* ---------- Letter page ---------- */
.letter-hero {
  padding-block: clamp(3.5rem, 8vw, 6rem) clamp(2.5rem, 5vw, 4rem);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.letter-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(60% 80% at 50% -10%, var(--glow-gold-soft) 0%, transparent 60%);
  pointer-events: none;
}

.letter-hero__eyebrow {
  justify-content: center;
  margin-bottom: var(--space-3);
}

.letter-hero__title {
  font-family: var(--font-serif);
  font-optical-sizing: auto;
  font-weight: 460;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  line-height: 1.05;
  letter-spacing: -0.018em;
  color: #f4efe6;
  max-width: 22ch;
  margin-inline: auto;
}

.letter-hero__sub {
  margin-top: var(--space-3);
  color: var(--color-text-secondary);
  font-size: var(--fs-lead);
}

.letter-form {
  margin-top: var(--space-5);
  max-width: 34rem;
  margin-inline: auto;
}

.letter-form__row {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

@media (min-width: 40rem) {
  .letter-form__row {
    flex-direction: row;
  }
}

.letter-form__input {
  flex: 1;
  min-height: var(--tap-min);
  padding: 0 var(--space-2);
  border-radius: var(--radius-control);
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-size: var(--fs-body);
}

.letter-form__input:focus-visible {
  outline: var(--focus-ring) solid var(--color-focus);
  outline-offset: 2px;
}

.letter-form__turnstile {
  margin-top: var(--space-2);
  display: flex;
  justify-content: center;
}

.letter-form__error {
  margin-top: var(--space-2);
  color: #e08b8b;
  font-size: var(--fs-body-sm);
}

.letter-form__success {
  margin-top: var(--space-2);
  color: var(--color-accent);
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
}

.letter-form__consent {
  margin-top: var(--space-2);
  color: var(--color-text-secondary);
  font-size: var(--fs-body-sm);
}

.letter-form__consent a {
  color: var(--color-accent);
}

.memo {
  display: grid;
  gap: var(--space-4);
}

.memo__entry {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: var(--card-padding);
}

.memo__label {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: var(--ls-label);
  color: var(--color-text-secondary);
  text-transform: uppercase;
}

.memo__headline {
  margin-top: var(--space-1);
  font-size: var(--fs-h3);
  font-weight: var(--fw-semibold);
}

.memo__line {
  margin-top: var(--space-2);
  color: var(--color-text-secondary);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
}

.memo__redacted {
  letter-spacing: -1.5px;
  color: var(--color-border-strong);
  user-select: none;
}

.scorecard {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-primary);
  border-radius: var(--radius-card);
  padding: var(--card-padding);
}

.scorecard__body {
  color: var(--color-text-secondary);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
}

.about__line {
  font-size: var(--fs-lead);
  line-height: 1.5;
}

.about__line--muted {
  margin-top: var(--space-2);
  color: var(--color-text-secondary);
  font-size: var(--fs-body);
}

.tiers {
  display: grid;
  gap: var(--space-3);
}

@media (min-width: 40rem) {
  .tiers {
    grid-template-columns: 1fr 1fr;
  }
}

.tier {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: var(--card-padding);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.tier__name {
  font-size: var(--fs-h3);
  font-weight: var(--fw-semibold);
}

.tier__price {
  font-size: var(--fs-stat);
  font-weight: var(--fw-medium);
  color: var(--color-accent);
  line-height: 1;
}

.tier__per {
  font-size: var(--fs-body);
  color: var(--color-text-secondary);
}

.tier__body {
  color: var(--color-text-secondary);
  font-size: var(--fs-body);
  flex: 1;
}

.tier__cta {
  align-self: flex-start;
}
</style>

/* ---------- Privacy page ---------- */
.privacy__section {
  margin-bottom: var(--space-6);
}

.privacy__heading {
  font-size: var(--fs-h3);
  font-weight: var(--fw-semibold);
  margin-bottom: var(--space-2);
}

.privacy__body {
  color: var(--color-text-secondary);
  font-size: var(--fs-body);
  line-height: 1.6;
}
</style>
