/* AYS base layer — CSS reset, brand custom properties, and a small set of
 * shared utility classes (`.container`, `.section-*`, `.btn-primary`).
 *
 * Separate from `src/styles/tokens.css`, which is the generated design-token
 * layer (`--ays-*` from `src/tokens.json`). As the redesign progresses the
 * utility classes here will migrate to consume `--ays-*` tokens or BDS
 * marketing classes, and this file shrinks toward a pure reset.
 *
 * Theme scoping: the default body palette stays dark (legacy AYS pages —
 * /about, /why, /pricing, /referral, etc. still rely on it). The Home page
 * opts into the cream/light palette by wrapping its content in `.ays-light`,
 * which flips background and text colors for descendants. Hero and bottom
 * CTA sections opt back out via their own dark gradient backgrounds.
 */
:root {
  --purple: #9b38c1;
  --pink: #fd4ea3;
  --grad: linear-gradient(135deg, #9b38c1, #fd4ea3);
  --grad-button: linear-gradient(180deg, var(--ays-button-bg-primary), var(--ays-button-bg-primary-bottom));
  --dark: #0d0010;
  --dark2: #160019;
  --white: #fff;
  --muted: rgba(255, 255, 255, 0.55);
  --border: rgba(255, 255, 255, 0.1);
  --serif: 'Poltawski Nowy', Georgia, serif;
  --sans: 'DM Sans', sans-serif;

  /* ── Section rhythm tokens ──
   * Single source of truth for the cadence every <section> follows on
   * Home, Pricing, and any future redesign. Sections with bespoke
   * needs (hero, inner-cta, footer) still override their own padding.
   * Non-section blocks (like the social-proof <div>) opt in by
   * applying the same custom properties. */
  --ays-section-padding-block: 80px;
  --ays-section-padding-inline: 80px;
  --ays-section-max-width: 1080px;

  /* Content cap shared by the dark page-hero and every legal-style
   * body container (`/referral`, `/cookies`, eventually `/privacy` +
   * `/terms`). Narrower than `--ays-section-max-width` so prose stays
   * readable and the hero's title block aligns vertically with the
   * legal body underneath — a single source of truth for that rhythm.
   * `.page-hero .container` and the per-page `.ays-{page}-legal-container`
   * rules read this variable. */
  --ays-legal-max-width: 820px;
}

/* Tablet ("responsive" tier in the design language). Vertical padding
 * holds; horizontal compresses. */
@media (max-width: 1024px) {
  :root {
    --ays-section-padding-inline: 56px;
  }
}

/* Mobile — both axes compress for tighter rhythm on small viewports. */
@media (max-width: 768px) {
  :root {
    --ays-section-padding-block: 40px;
    --ays-section-padding-inline: 24px;
  }
}

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

/* ── SKIP LINK ── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 10000;
  padding: 8px 16px;
  background: var(--ays-button-bg-primary);
  color: #fff;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
}
.skip-link:focus {
  top: 0;
}

/* ── FOCUS-VISIBLE ── */
:focus-visible {
  outline: 2px solid var(--ays-text-brand);
  outline-offset: 2px;
}
#main-content:focus {
  outline: none;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--sans);
  background: var(--dark);
  color: var(--white);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Home opts into the cream theme. The wrapping `<div class="ays-light">`
 * paints over the dark body background and flips default copy color. */
.ays-light {
  background: var(--ays-page-default);
  color: var(--ays-text-primary);
  /* Pulls cream up under the fixed nav and any negative margins. */
  min-height: 100vh;
}

/* ── BASE LAYOUT ──
 * Every <section> inherits the rhythm tokens defined above:
 *   Desktop  → 80px × 80px
 *   Tablet   → 80px × 56px
 *   Mobile   → 40px × 24px
 * Hero, AysCTASection (`.inner-cta`), and the footer override their
 * own padding when their design diverges from this baseline. */
section {
  padding: var(--ays-section-padding-block) var(--ays-section-padding-inline);
}

.container {
  max-width: var(--ays-section-max-width);
  margin: 0 auto;
}

/* ── SHARED SECTION TYPOGRAPHY ──
 * Default colors target dark backgrounds (legacy pages and the hero /
 * bottom CTA on Home). `.ays-light` descendants override below. */
.section-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pink);
  margin-bottom: 14px;
}

.section-title {
  font-family: var(--serif);
  font-size: clamp(32px, 4.5vw, 54px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}

.section-sub {
  font-size: 16px;
  color: var(--muted);
  line-height: 1.7;
  max-width: 520px;
  font-weight: 300;
}

/* Light-theme overrides for shared section typography. */
.ays-light .section-label {
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--ays-text-brand);
}

.ays-light .section-title {
  font-size: clamp(32px, 4.5vw, 48px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ays-text-primary);
}

.ays-light .section-sub {
  color: var(--ays-text-secondary);
  line-height: 1.6;
  font-weight: 400;
  max-width: 560px;
}

/* Dark sections inside `.ays-light` (hero, bottom CTA) restore inverse copy. */
.ays-light .section-on-dark .section-label { color: var(--ays-color-purple-400); }
.ays-light .section-on-dark .section-title { color: var(--white); }
.ays-light .section-on-dark .section-sub { color: var(--ays-text-inverse-secondary); }

/* ── SHARED BUTTONS ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  padding: 14px 32px;
  border-radius: 999px;
  background: var(--grad);
  color: #fff;
  text-decoration: none;
  transition: transform 0.2s, opacity 0.2s;
  letter-spacing: -0.01em;
}
.btn-primary:hover {
  transform: scale(1.03);
  opacity: 0.9;
}

/* On Home, the primary CTA uses the AYS purple vertical gradient + lift. */
.ays-light .btn-primary,
.section-on-dark .btn-primary {
  background: var(--grad-button);
  font-size: 18px;
  padding: 16px 32px;
  box-shadow: 0 8px 24px oklch(54.18% 0.2112 314.87 / 0.32);
}
.ays-light .btn-primary:hover,
.section-on-dark .btn-primary:hover {
  box-shadow: 0 12px 32px oklch(54.18% 0.2112 314.87 / 0.4);
}

/* ── A11Y — visually hidden content ──
 * Hides an element visually while keeping it discoverable for screen
 * readers. Used for `<caption>` labels on tables where the heading
 * above already conveys the table's purpose visually, but assistive
 * tech still benefits from an explicit table caption. Canonical
 * inset(50%) + clip-path pattern; preferred over `display:none` /
 * `visibility:hidden` which remove the element from the accessibility
 * tree. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
