/* =========================================================
   Astrology Costa Rica — base stylesheet
   Built per CLAUDE.md §2–§7, §13. Vanilla CSS, no Tailwind.
   ========================================================= */

/* Cascade layers per §12 — guarantees vendor (Cal.com) can't override brand */
@layer reset, base, components, utilities;

/* -------------------- font loading (§3) --------------------
   Brand fonts loaded from /assets/fonts/. Google-Font substitutes
   (Italiana, Work Sans) remain in the fallback chain as a safety
   net if the .otf/.ttf ever fails to load. */

@font-face {
  font-family: 'ZT Shago';
  src: url('/assets/fonts/ZtShago-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: block; /* hero type — wait for it rather than flash a fallback */
}

@font-face {
  font-family: 'Alte Haas Grotesk';
  src: url('/assets/fonts/alte-haas-grotesk.regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Alte Haas Grotesk';
  src: url('/assets/fonts/alte-haas-grotesk.bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@import url('https://fonts.googleapis.com/css2?family=Italiana&family=Work+Sans:wght@400;700&display=swap');

/* -------------------- reset -------------------- */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  html { scroll-behavior: smooth; overflow-x: clip; }
  body { min-height: 100dvh; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: clip; }
  img, svg, video { display: block; max-width: 100%; height: auto; }
  ul { list-style: none; }
  a { color: inherit; text-decoration: none; }
  button { background: none; border: none; color: inherit; font: inherit; cursor: pointer; }
  :focus { outline: none; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
}

/* -------------------- base typography + body -------------------- */
@layer base {
  body {
    background: var(--bg);
    color: var(--fg);
    font-family: 'Alte Haas Grotesk', 'Work Sans', 'Helvetica Neue', Arial, sans-serif;
    font-size: 18px;
    line-height: 1.6;
    transition: background 200ms ease, color 200ms ease;
  }

  h1, h2, h3, h4 {
    font-family: 'ZT Shago', 'Italiana', Georgia, serif;
    font-weight: 400;
    line-height: 1.0;
    letter-spacing: -0.005em;
  }

  /* Type scale per §3 */
  .display-hero    { font-size: clamp(96px, 16vw, 240px); line-height: 0.92; letter-spacing: 0.005em; }
  .section-headline { font-size: clamp(40px, 8vw, 120px); line-height: 1.0; letter-spacing: -0.01em; overflow-wrap: break-word; }
  .sub-headline    { font-size: clamp(40px, 5vw, 72px); line-height: 1.1; }
  .body-large      { font-size: clamp(20px, 1.6vw, 26px); line-height: 1.55; }

  p { max-width: 62ch; }

  ::selection { background: var(--accent); color: var(--bg); }
}

/* -------------------- components (§6) -------------------- */
@layer components {

  /* skip-link */
  .skip-link {
    position: absolute; left: -9999px; top: 0;
    background: var(--fg); color: var(--bg);
    padding: 12px 16px;
    font-family: 'Alte Haas Grotesk', 'Work Sans', sans-serif;
    font-size: 13px; letter-spacing: 0.22em; text-transform: uppercase;
    z-index: 1000;
  }
  .skip-link:focus { left: 24px; top: 24px; }

  /* eyebrow / mono tag (§6) */
  .mono-sm {
    font-family: 'Alte Haas Grotesk', 'Work Sans', sans-serif;
    font-size: 11px; font-weight: 400;
    letter-spacing: 0.22em; text-transform: uppercase;
    color: var(--fg-dim);
  }
  .mono-md {
    font-family: 'Alte Haas Grotesk', 'Work Sans', sans-serif;
    font-size: 13px; font-weight: 400;
    letter-spacing: 0.22em; text-transform: uppercase;
    color: var(--fg-dim);
  }

  /* rule (§6) */
  .rule { height: 1px; background: var(--rule); border: 0; width: 100%; }

  /* reveals list (§6) */
  .reveals { list-style: none; padding: 0; margin: 0; }
  .reveals li {
    padding: 10px 0 10px 32px;
    position: relative;
    font-size: 19px;
    line-height: 1.55;
  }
  .reveals li::before {
    content: ""; position: absolute; left: 0; top: 22px;
    width: 16px; height: 1px; background: var(--accent);
  }

  /* numbered roman steps (§6) */
  .steps { display: grid; gap: 32px; }
  .step { display: grid; grid-template-columns: 140px 1fr; align-items: start; gap: 24px; }
  .step .k {
    font-family: 'ZT Shago', 'Italiana', Georgia, serif;
    font-size: 72px; line-height: 1; color: var(--accent);
  }
  .step .body h4 { font-size: 36px; line-height: 1.05; margin-bottom: 8px; }
  .step .body p { font-size: 17px; line-height: 1.6; color: var(--fg-dim); }
  @media (max-width: 768px) {
    .step { grid-template-columns: 1fr; gap: 8px; }
    .step .k { font-size: 56px; }
  }

  /* button / CTA (§6) — sharp corners */
  .btn {
    display: inline-block;
    padding: 18px 32px;
    background: var(--fg); color: var(--bg);
    font-family: 'Alte Haas Grotesk', 'Work Sans', sans-serif;
    font-size: 13px; font-weight: 400;
    letter-spacing: 0.22em; text-transform: uppercase;
    text-decoration: none;
    border: none; border-radius: 0;
    transition: opacity 200ms ease;
    min-height: 44px; /* §13 touch target */
  }
  .btn:hover, .btn:focus-visible { opacity: 0.85; }
  .btn--accent { background: var(--accent); color: var(--ink); }
  .btn--inverse { background: var(--bg); color: var(--fg); outline: 1px solid var(--fg); outline-offset: -1px; }

  .text-link {
    color: var(--accent);
    font-family: 'Alte Haas Grotesk', 'Work Sans', sans-serif;
    font-size: 14px; letter-spacing: 0.18em; text-transform: uppercase;
    border-bottom: 1px solid transparent;
    transition: border-color 200ms ease;
  }
  .text-link:hover { border-bottom-color: var(--accent); }

  /* form field (§6) */
  .field {
    border: none;
    border-bottom: 1px solid var(--rule);
    background: transparent;
    padding: 14px 0;
    font-family: 'Alte Haas Grotesk', 'Work Sans', sans-serif;
    font-size: 18px;
    color: var(--fg);
    width: 100%;
  }
  .field:focus { outline: none; border-bottom-color: var(--accent); }

  /* side rail (§5) */
  .side-rail {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%) rotate(180deg);
    writing-mode: vertical-rl;
    color: var(--fg-mute);
    font-size: 11px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    pointer-events: none;
  }
  @media (max-width: 1024px) { .side-rail { display: none; } }

  /* practitioner mark (§4) */
  .practitioner-mark { width: 48px; height: 48px; display: inline-block; }
  .practitioner-mark.placeholder {
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--rule);
    font-family: 'ZT Shago', 'Italiana', Georgia, serif;
    font-size: 22px; color: var(--accent);
    line-height: 1; padding-bottom: 2px;
  }
  @media (max-width: 768px) { .practitioner-mark, .practitioner-mark.placeholder { width: 40px; height: 40px; font-size: 18px; } }

  /* nav (§9) */
  .nav {
    position: fixed; top: 0; left: 0; right: 0;
    height: 80px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 clamp(24px, 4vw, 72px);
    z-index: 100;
    background: transparent;
    transition: background 220ms ease, border-color 220ms ease;
    border-bottom: 1px solid transparent;
  }
  .nav[data-scrolled="true"] {
    background: var(--bg);
    border-bottom-color: var(--rule);
  }
  .nav__brand {
    font-family: 'ZT Shago', 'Italiana', Georgia, serif;
    font-size: 18px; line-height: 1;
    letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--fg);
    white-space: nowrap;
  }
  .nav__links {
    display: flex; gap: 32px;
    font-family: 'Alte Haas Grotesk', 'Work Sans', sans-serif;
    font-size: 13px; letter-spacing: 0.22em; text-transform: uppercase;
  }
  .nav__links a { color: var(--fg); padding: 8px 0; }
  .nav__links a:hover { color: var(--accent); }
  .nav__links a[aria-current="page"] { color: var(--accent); }
  .nav__right { display: flex; align-items: center; gap: 16px; }
  .nav__lang { color: var(--fg-dim); font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; }
  .nav__lang a { padding: 0 4px; }
  .nav__lang a[aria-current="true"] { color: var(--fg); }
  .nav__cta {
    background: var(--fg); color: var(--bg);
    padding: 12px 18px;
    font-family: 'Alte Haas Grotesk', 'Work Sans', sans-serif;
    font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase;
    border-radius: 0;
  }
  .nav__cta:hover { opacity: 0.85; }
  @media (max-width: 900px) {
    .nav__links { display: none; }
  }
  @media (max-width: 540px) {
    .nav__lang { display: none; }
    .nav__cta { padding: 10px 14px; font-size: 11px; }
  }

  /* layout / sections */
  .section {
    padding: clamp(72px, 12vw, 140px) clamp(24px, 4vw, 88px);
    position: relative;
  }
  .section--tight { padding-block: clamp(56px, 8vw, 96px); }
  .container { max-width: 1320px; margin: 0 auto; width: 100%; }

  /* hero (home, /book, /book/thank-you) */
  .hero {
    min-height: 100dvh;
    display: grid;
    grid-template-rows: 1fr auto;
    padding: clamp(120px, 18vh, 200px) clamp(24px, 6vw, 88px) clamp(56px, 8vw, 88px);
    position: relative;
  }
  .hero__wordmark {
    font-family: 'ZT Shago', 'Italiana', Georgia, serif;
    font-weight: 400;
    font-size: clamp(44px, 15vw, 240px);
    line-height: 0.9;
    letter-spacing: 0.005em;
    text-transform: uppercase;
    overflow-wrap: break-word;
    max-width: 100%;
  }
  .hero__claim {
    font-family: 'ZT Shago', 'Italiana', Georgia, serif;
    font-size: clamp(28px, 3.4vw, 48px);
    line-height: 1.15;
    margin-top: 32px;
    max-width: 22ch;
    color: var(--fg-dim);
  }
  .hero__claim em { color: var(--accent); font-style: normal; } /* per §3 italicize-by-recolor */
  .hero__cta-row {
    display: flex; gap: 24px; align-items: center; flex-wrap: wrap;
    margin-top: clamp(48px, 6vw, 72px);
  }
  .hero__meta-row {
    display: flex; justify-content: space-between; align-items: end;
    gap: 16px 32px;
    flex-wrap: wrap;
    margin-top: clamp(48px, 6vw, 88px);
    color: var(--fg-mute);
  }
  .hero__meta-row > div { max-width: 38ch; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; }

  /* card grid (offerings preview) */
  .grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(24px, 3vw, 56px);
  }
  @media (max-width: 900px) { .grid-3 { grid-template-columns: 1fr; } }

  .card {
    display: flex; flex-direction: column;
    gap: 16px;
    padding-block: 8px;
    border-top: 1px solid var(--rule);
    padding-top: 32px;
  }
  .card__title { font-family: 'ZT Shago', 'Italiana', Georgia, serif; font-size: clamp(40px, 4.2vw, 64px); line-height: 1.0; }
  .card__desc { font-size: 17px; line-height: 1.55; color: var(--fg-dim); }
  .card__meta { display: flex; gap: 24px; font-family: 'Alte Haas Grotesk', 'Work Sans', sans-serif; font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--fg-mute); margin-top: auto; }
  .card__link { margin-top: 16px; }

  /* practitioner intro */
  .practitioner {
    display: grid; grid-template-columns: 5fr 7fr; gap: clamp(32px, 5vw, 88px);
    align-items: center;
  }
  @media (max-width: 900px) { .practitioner { grid-template-columns: 1fr; } }
  .practitioner__photo {
    aspect-ratio: 4 / 5;
    width: 100%;
    height: auto;
    object-fit: cover;
    object-position: 50% 30%;
    display: block;
    background: var(--ink);
    /* Subtle warm grade per CLAUDE.md §6 */
    filter: brightness(0.97) saturate(0.95);
  }
  [data-theme="ink"] .practitioner__photo { background: var(--cream); }
  .practitioner__intro { display: flex; flex-direction: column; gap: 24px; }
  .practitioner__name {
    font-family: 'ZT Shago', 'Italiana', Georgia, serif;
    font-size: clamp(56px, 6vw, 96px);
    line-height: 1.0;
  }
  .practitioner__byline { display: flex; align-items: center; gap: 16px; }
  .practitioner__copy { font-size: 19px; line-height: 1.6; color: var(--fg-dim); }

  /* testimonial block */
  .testimonials { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 5vw, 88px); }
  @media (max-width: 768px) { .testimonials { grid-template-columns: 1fr; } }
  .testimonial { display: flex; flex-direction: column; gap: 16px; padding-top: 32px; border-top: 1px solid var(--rule); }
  .testimonial__quote {
    font-family: 'ZT Shago', 'Italiana', Georgia, serif;
    font-size: clamp(28px, 2.6vw, 36px);
    line-height: 1.25;
  }
  .testimonial__quote em { color: var(--accent); font-style: normal; }

  /* CTA band (full-width ochre, per §9.3) */
  .cta-band {
    padding: clamp(72px, 10vw, 140px) clamp(24px, 6vw, 88px);
    text-align: left;
  }
  .cta-band__inner { max-width: 1320px; margin: 0 auto; display: grid; grid-template-columns: 1.5fr 1fr; gap: 56px; align-items: center; }
  @media (max-width: 768px) { .cta-band__inner { grid-template-columns: 1fr; gap: 32px; } }
  .cta-band__headline {
    font-family: 'ZT Shago', 'Italiana', Georgia, serif;
    font-size: clamp(48px, 6vw, 88px);
    line-height: 1.0;
  }
  .cta-band__sub { color: var(--fg-dim); font-size: 17px; line-height: 1.55; margin-top: 16px; max-width: 32ch; }

  /* footer */
  .footer {
    padding: 72px clamp(24px, 4vw, 88px);
    display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 48px;
    border-top: 1px solid var(--rule);
  }
  @media (max-width: 900px) { .footer { grid-template-columns: 1fr 1fr; } }
  @media (max-width: 540px) { .footer { grid-template-columns: 1fr; } }
  .footer h5 {
    font-family: 'Alte Haas Grotesk', 'Work Sans', sans-serif;
    font-size: 11px; font-weight: 400; letter-spacing: 0.22em; text-transform: uppercase;
    color: var(--fg-mute); margin-bottom: 16px;
  }
  .footer__brand {
    font-family: 'ZT Shago', 'Italiana', Georgia, serif;
    font-size: 40px; line-height: 0.95; letter-spacing: 0.005em; text-transform: uppercase;
    margin-bottom: 24px;
  }
  .footer ul li { padding: 4px 0; font-size: 14px; }
  .footer ul li a:hover { color: var(--accent); }
  .footer__legal { grid-column: 1 / -1; display: flex; justify-content: space-between; padding-top: 32px; border-top: 1px solid var(--rule); font-size: 12px; color: var(--fg-mute); letter-spacing: 0.18em; text-transform: uppercase; }
  @media (max-width: 540px) { .footer__legal { flex-direction: column; gap: 16px; } }

  /* /book — paths */
  .paths { display: grid; grid-template-columns: 3fr 2fr; gap: 56px; align-items: end; }
  @media (max-width: 900px) { .paths { grid-template-columns: 1fr; } }
  .path { display: flex; flex-direction: column; gap: 12px; }
  .path__title { font-family: 'ZT Shago', 'Italiana', Georgia, serif; font-size: clamp(40px, 4.4vw, 64px); line-height: 1.0; }
  .path__copy { color: var(--fg-dim); font-size: 17px; line-height: 1.55; max-width: 38ch; }

  /* article-like (about) */
  .article-grid { display: grid; grid-template-columns: 5fr 7fr; gap: clamp(40px, 5vw, 96px); align-items: start; }
  @media (max-width: 900px) { .article-grid { grid-template-columns: 1fr; } }
  .pull-quote {
    font-family: 'ZT Shago', 'Italiana', Georgia, serif;
    font-size: clamp(32px, 3.4vw, 48px);
    line-height: 1.2;
    padding: 48px 0;
    border-block: 1px solid var(--rule);
    margin: 48px 0;
  }
  .pull-quote em { color: var(--accent); font-style: normal; }
}

/* -------------------- utilities -------------------- */
@layer utilities {
  .stack > * + * { margin-top: var(--stack, 24px); }
  .stack-md > * + * { margin-top: 16px; }
  .stack-lg > * + * { margin-top: 32px; }
  .stack-xl > * + * { margin-top: 56px; }
  .center { text-align: center; }
  .hidden { display: none; }
  .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;
  }
}

/* -------------------- motion (§7) -------------------- */
.reveal-up { opacity: 0; transform: translateY(20px); transition: opacity 400ms ease-out, transform 400ms ease-out; }
.reveal-up.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal-up { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
