/* ==========================================================================
   AJORA — Trust Sage stylesheet
   Single source of design tokens for the marketing site.
   Brand reference: docs/brand/ajora_brand_design_system.md (canonical).
   Edit tokens in :root; everything downstream inherits them.
   ========================================================================== */

:root {
  /* --- Trust Sage palette (exact hex — do not vary) --- */
  --primary: #0D3D33;   /* hero / dark sections          */
  --brand:   #1B6353;   /* buttons, links, active states */
  --ink:     #0F1F1C;   /* body copy, headings on light  */
  --accent:  #C4956C;   /* gold — eyebrows, signature, badges, accents ONLY */
  --cream:   #F5EFE6;   /* cards on dark, soft sections   */
  --paper:   #FFFFFF;   /* pure white                     */
  --muted:   #5C6B68;   /* secondary text                 */
  --rule:    #D6D0C2;   /* dividers, borders              */
  --warning: #B45309;   /* real errors only               */
  --on-dark-soft: #DDD6C7; /* 70% white — secondary text on dark */
  --muted-on-dark: #9AA8A3; /* AA-passing muted for fine print on dark (ink/primary) */

  /* --- Type ---
     Fonts load async (off the critical path). The *-Fallback faces below are
     metric-adjusted so the fallback occupies the same space as the webfont,
     so the swap causes ~no layout shift (CLS) on text-heavy pages. */
  --font-display: 'Lora', 'Lora Fallback', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', 'Inter Fallback', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  /* --- Spacing (4pt base) --- */
  --sp-1: 0.25rem;  --sp-2: 0.5rem;   --sp-3: 0.75rem;  --sp-4: 1rem;
  --sp-5: 1.5rem;   --sp-6: 2rem;     --sp-8: 3rem;     --sp-10: 4rem;
  --sp-12: 6rem;

  /* --- Radius --- */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 20px; --r-pill: 999px;

  /* --- Layout --- */
  --maxw: 1120px;
  --maxw-narrow: 760px;

  --shadow-card: 0 1px 2px rgba(15, 31, 28, 0.04), 0 8px 24px rgba(15, 31, 28, 0.06);
}

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

/* Metric-adjusted fallbacks — match the webfont's box so the swap doesn't shift layout. */
@font-face {
  font-family: 'Inter Fallback';
  src: local('Arial');
  ascent-override: 90.49%;
  descent-override: 22.56%;
  line-gap-override: 0.00%;
  size-adjust: 107.06%;
}
@font-face {
  font-family: 'Lora Fallback';
  src: local('Georgia');
  ascent-override: 90.30%;
  descent-override: 24.72%;
  line-gap-override: 0.00%;
  size-adjust: 111.42%;
}

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

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;        /* 17px base for comfortable reading */
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'kern' 1;
}

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 var(--sp-4);
  text-wrap: balance;
}

p { margin: 0 0 var(--sp-4); }
p:last-child { margin-bottom: 0; }

a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
a:hover { text-decoration: none; }

ul, ol { margin: 0; padding: 0; list-style: none; }

/* ==========================================================================
   Accessibility helpers
   ========================================================================== */

.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: -100px;
  z-index: 1000;
  background: var(--brand);
  color: var(--paper);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-md);
  text-decoration: none;
  font-weight: 600;
  transition: top 0.15s ease;
}
.skip-link:focus { top: var(--sp-4); }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
/* On the dark hero, keep focus rings visible against deep forest. */
.section--dark :focus-visible { outline-color: var(--accent); }

.visually-hidden {
  position: absolute !important;
  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(--maxw);
  margin-inline: auto;
  padding-inline: var(--sp-5);
}

.section { padding-block: var(--sp-12); }
.section--dark { background: var(--primary); color: var(--paper); }
.section--cream { background: var(--cream); }
.section--light { background: var(--paper); }
.section--tight { padding-block: var(--sp-10); }

.section__head { max-width: var(--maxw-narrow); margin-bottom: var(--sp-8); }
.section__head--center { margin-inline: auto; text-align: center; }

/* Eyebrow — gold or brand, tracked-out caps. Never body. */
.eyebrow {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 var(--sp-4);
}
.section--cream .eyebrow,
.section--light .eyebrow { color: var(--brand); }
/* The heritage names line is allowed gold on light as a decorative eyebrow. */
.eyebrow--gold { color: var(--accent) !important; }

.section__title {
  font-size: clamp(1.9rem, 1.4rem + 2.2vw, 2.85rem);
  margin-bottom: var(--sp-4);
}
.section--dark .section__title { color: var(--paper); }

.section__lead {
  font-size: clamp(1.1rem, 1.02rem + 0.4vw, 1.3rem);
  color: var(--muted);
  max-width: 56ch;
}
.section--dark .section__lead { color: var(--on-dark-soft); }
.section__head--center .section__lead { margin-inline: auto; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 48px;
  padding: var(--sp-3) var(--sp-6);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  border-radius: var(--r-md);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.05s ease;
}
.btn:active { transform: translateY(1px); }

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

.btn--secondary {
  background: transparent;
  color: var(--brand);
  border-color: var(--brand);
}
.btn--secondary:hover { background: var(--brand); color: var(--paper); }

/* On dark backgrounds (hero + dark sections) the secondary needs light text + borders. */
.section--dark .btn--secondary,
.hero .btn--secondary {
  color: var(--paper);
  border-color: rgba(245, 239, 230, 0.55);
}
.section--dark .btn--secondary:hover,
.hero .btn--secondary:hover {
  background: var(--cream);
  color: var(--primary);
  border-color: var(--cream);
}

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

/* ==========================================================================
   Header / nav
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--primary);
  color: var(--paper);
  transition: box-shadow 0.2s ease;
}
/* Shadow lifts the bar off the page once you start scrolling (toggled in main.js). */
.site-header--scrolled { box-shadow: 0 4px 20px rgba(15, 31, 28, 0.22); }

/* Keep in-page anchor targets clear of the sticky bar. */
main section[id] { scroll-margin-top: 84px; }
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5);
  padding-block: var(--sp-4);
}

.brand-lockup { display: flex; align-items: center; gap: var(--sp-4); text-decoration: none; }
.brand-lockup img { height: 34px; width: auto; }
.brand-signature {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--accent);
  white-space: nowrap;
}

.nav { display: flex; align-items: center; gap: var(--sp-6); }
.nav__links { display: flex; align-items: center; gap: var(--sp-6); }
.nav__links a {
  color: var(--on-dark-soft);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  padding-block: var(--sp-2);
}
.nav__links a:hover { color: var(--paper); }
.nav .btn { min-height: 42px; padding-block: var(--sp-2); }

/* ==========================================================================
   Hero
   ========================================================================== */

.hero { background: var(--primary); color: var(--paper); overflow: hidden; }
.hero .container {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: var(--sp-10);
  padding-block: var(--sp-12) var(--sp-12);
}

.hero__eyebrow { color: var(--accent); }
.hero__title {
  font-size: clamp(2.4rem, 1.6rem + 3.4vw, 4rem);
  color: var(--paper);
  margin-bottom: var(--sp-5);
}
.hero__title em { color: var(--accent); font-style: italic; }
.hero__sub {
  font-size: clamp(1.1rem, 1.02rem + 0.5vw, 1.3rem);
  color: var(--on-dark-soft);
  max-width: 52ch;
  margin-bottom: var(--sp-6);
}
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--sp-4); margin-bottom: var(--sp-6); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--accent);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-pill);
}
.badge::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--primary);
}

/* Hero signature visual: rotating savings circle around the monogram. */
.hero__signature {
  display: flex;
  align-items: center;
  justify-content: center;
}
.rotor { width: min(380px, 80%); aspect-ratio: 1; }
.rotor__ring { transform-origin: 200px 200px; animation: rotor-spin 48s linear infinite; }
.rotor__node { fill: var(--accent); }
.rotor__node--active { fill: var(--cream); }

@keyframes rotor-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .rotor__ring { animation: none; }
}

/* ==========================================================================
   Cards (problem / protection / audience)
   ========================================================================== */

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

.card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  height: 100%;
}
.section--cream .card { background: var(--paper); border-color: var(--rule); }
.section--dark .card {
  background: var(--cream);
  border-color: transparent;
  color: var(--ink);
}
.card__title {
  font-size: 1.2rem;
  margin-bottom: var(--sp-2);
}
.card__body { color: var(--muted); margin: 0; font-size: 1rem; }
.section--dark .card .card__body { color: var(--muted); }

/* Featured card — gold left rule for protection layers. */
.card--feature { border-left: 3px solid var(--accent); }

.card__icon {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-md);
  background: rgba(27, 99, 83, 0.08);
  color: var(--brand);
  margin-bottom: var(--sp-4);
}
.card__icon svg { width: 24px; height: 24px; }

/* Numbered steps (How it works) */
.steps { counter-reset: step; }
.step__num {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--paper);
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--sp-4);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Heritage strip
   ========================================================================== */

.heritage { text-align: center; }
.heritage__line {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 1.05rem + 1.1vw, 1.85rem);
  line-height: 1.4;
  color: var(--paper);
  max-width: 40ch;
  margin: 0 auto var(--sp-8);
  text-wrap: balance;
}
.heritage__line em { color: var(--accent); font-style: italic; }

.pills { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sp-3); }
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: rgba(245, 239, 230, 0.10);
  border: 1px solid rgba(245, 239, 230, 0.22);
  color: var(--on-dark-soft);
  font-size: 0.85rem;
  font-weight: 500;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-pill);
}
.pill svg { width: 16px; height: 16px; color: var(--accent); }

/* ==========================================================================
   Microcopy accent line
   ========================================================================== */

.microline {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--accent);
  font-size: 1.05rem;
  margin-top: var(--sp-5);
}
.section--light .microline { color: var(--brand); }

/* ==========================================================================
   Waitlist form
   ========================================================================== */

.waitlist { background: var(--primary); color: var(--paper); }
.waitlist__inner { max-width: 620px; margin-inline: auto; text-align: center; }

.form {
  margin-top: var(--sp-6);
  text-align: left;
}
.form__row {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: var(--sp-3);
  align-items: end;
}
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field__label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--on-dark-soft);
}
.field input,
.field select {
  font-family: var(--font-body);
  font-size: 1rem;
  min-height: 48px;
  padding: var(--sp-3) var(--sp-4);
  background: var(--cream);
  color: var(--ink);
  border: 2px solid transparent;
  border-radius: var(--r-md);
  width: 100%;
}
.field input::placeholder { color: var(--muted); }
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
}
.field input[aria-invalid="true"] { border-color: var(--warning); }

.form .btn { min-height: 48px; white-space: nowrap; }

/* Honeypot — hidden from humans, visible to bots. */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px; height: 1px;
  overflow: hidden;
}

.form__note {
  font-size: 0.85rem;
  color: var(--on-dark-soft);
  margin-top: var(--sp-4);
  text-align: center;
}
.form__note a { color: var(--cream); }

.form__status {
  margin-top: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  font-weight: 600;
  text-align: center;
}
.form__status[hidden] { display: none; }
.form__status--success { background: rgba(245, 239, 230, 0.14); color: var(--cream); border: 1px solid var(--accent); }
/* Error: semantic colour carried by the Warning border + background tint and by the
   message text itself; the text uses on-palette light tones for AA contrast on dark. */
.form__status--error { background: rgba(180, 83, 9, 0.22); color: var(--cream); border: 1px solid var(--warning); }
.field__error {
  color: var(--on-dark-soft);
  font-size: 0.85rem;
  font-weight: 600;
  min-height: 1.1em;
}

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

.site-footer {
  background: var(--ink);
  color: var(--on-dark-soft);
  padding-block: var(--sp-10) var(--sp-8);
  font-size: 0.92rem;
}
.footer__top {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: var(--sp-8);
  padding-bottom: var(--sp-8);
  border-bottom: 1px solid rgba(245, 239, 230, 0.14);
}
.footer__brand img { height: 30px; margin-bottom: var(--sp-4); }
.footer__signature {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--accent);
  font-size: 1rem;
}
.footer__social {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-5);
}
.footer__social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  color: var(--on-dark-soft);
  transition: color 0.15s ease, background-color 0.15s ease;
}
.footer__social a:hover { color: var(--paper); background: rgba(245, 239, 230, 0.08); }
.footer__social svg { width: 20px; height: 20px; }
.footer__col h3 {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--paper);
  margin-bottom: var(--sp-4);
}
.footer__col a { color: var(--on-dark-soft); text-decoration: none; display: block; padding-block: var(--sp-3); }
.footer__col a:hover { color: var(--paper); text-decoration: underline; }

.footer__disclaimer {
  margin-top: var(--sp-6);
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--muted-on-dark);
  max-width: 78ch;
}
.footer__legal {
  margin-top: var(--sp-6);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--muted-on-dark);
}
.footer__legal a { color: var(--on-dark-soft); text-decoration: underline; text-underline-offset: 2px; }
.footer__legal a:hover { color: var(--paper); }

/* ==========================================================================
   Legal pages (privacy / terms)
   ========================================================================== */

.legal { padding-block: var(--sp-10); }
.legal .container { max-width: var(--maxw-narrow); }
.legal h1 { font-size: clamp(2rem, 1.6rem + 2vw, 2.8rem); margin-bottom: var(--sp-3); }
.legal h2 { font-size: 1.4rem; margin-top: var(--sp-8); margin-bottom: var(--sp-3); }
.legal h3 { font-size: 1.1rem; margin-top: var(--sp-5); }
.legal p, .legal li { color: var(--ink); }
.legal ul { list-style: disc; padding-left: var(--sp-5); margin-bottom: var(--sp-4); }
.legal li { margin-bottom: var(--sp-2); }
.legal__meta { color: var(--muted); font-size: 0.92rem; }

.callout {
  background: rgba(196, 149, 108, 0.12);
  border: 1px solid var(--accent);
  border-radius: var(--r-md);
  padding: var(--sp-5);
  margin-bottom: var(--sp-8);
}
.callout strong { color: var(--ink); }
.callout p { margin-bottom: 0; color: var(--ink); }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1024px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .footer__top { grid-template-columns: 1fr 1fr; }
  .brand-signature { display: none; }
}

@media (max-width: 860px) {
  :root { --sp-12: 4.5rem; }
  .hero .container {
    grid-template-columns: 1fr;
    text-align: center;
    padding-block: var(--sp-10);
  }
  .hero__signature { order: -1; }              /* signature stacks above on mobile */
  .rotor { width: min(260px, 64%); }
  .hero__sub { margin-inline: auto; }
  .hero__actions { justify-content: center; }
  .nav__links { display: none; }               /* keep CTA, drop in-page anchors on small screens */
  .grid--3, .grid--2 { grid-template-columns: 1fr; }
  .form__row { grid-template-columns: 1fr; }
  .footer__top { grid-template-columns: 1fr; gap: var(--sp-6); }
  .section__head { text-align: left; }
}

@media (max-width: 480px) {
  .grid--4 { grid-template-columns: 1fr; }
  .container { padding-inline: var(--sp-4); }
  .site-header .container { gap: var(--sp-3); }
  .brand-lockup img { height: 28px; }
}

/* Respect reduced motion globally for any transition-heavy element. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
