/* ============================================================
   Attune - base.css
   Reset, typography, and the shared "shell": layout primitives,
   buttons, the top bar, the wave divider, the footer, and the
   reveal-motion system. Everything here is reused across pages.
   Page-specific sections live in their own file (e.g. home.css).
   Load order: tokens.css -> base.css -> <page>.css
   ============================================================ */

/* ---------- reset & document ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: clamp(1.05rem, 0.97rem + 0.4vw, 1.22rem);
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ---------- links & focus ---------- */
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-deep); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

/* skip link */
.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--accent); color: var(--paper);
  padding: .6em 1em; border-radius: 2px; z-index: 100;
}
.skip:focus { left: 1rem; top: 1rem; }

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

/* ---------- headings ---------- */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--ink);
  line-height: 1.12;
  letter-spacing: -0.012em;
  margin: 0;
}

/* ---------- layout primitives ---------- */
.wrap {
  width: 100%; max-width: 72rem; margin: 0 auto;
  padding-left: clamp(1.4rem, 5vw, 3rem);
  padding-right: clamp(1.4rem, 5vw, 3rem);
}
.col { max-width: var(--measure); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: .78rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--highlight-deep); font-weight: 500; margin: 0 0 1.4rem;
}

/* generic section shell (reusable) */
.section { padding-top: var(--pad-y); padding-bottom: var(--pad-y); scroll-margin-top: 5.5rem; }
.section h2 { font-size: clamp(1.9rem, 1.3rem + 2.2vw, 3rem); margin-bottom: 1.6rem; max-width: 16em; }
.section p { margin: 0 0 1.25rem; }
.section p:last-child { margin-bottom: 0; }
.lead-p { font-size: clamp(1.12rem, 1.02rem + 0.35vw, 1.32rem); color: var(--ink-soft); }
.tint { background: var(--paper-2); }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; font-family: var(--font-body); font-size: 1.06rem;
  cursor: pointer; border-radius: 2px; text-decoration: none;
  transition: background .25s ease, color .25s ease, border-color .25s ease;
}
.btn-primary { background: var(--accent); color: var(--paper); padding: .82em 1.7em; border: 1px solid var(--accent); }
.btn-primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: var(--paper); }
.btn-text {
  display: inline-flex; align-items: center; min-height: 44px;
  color: var(--accent); background: none; border: 0; padding: .4em 0;
  text-decoration: underline; text-decoration-color: var(--highlight); text-underline-offset: 5px;
}
.btn-text:hover { color: var(--accent-deep); text-decoration-color: var(--highlight-deep); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.05) blur(6px);
  border-bottom: 1px solid transparent;
  transition: border-color .4s ease, background .4s ease;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 4.6rem; }

.brand { display: inline-flex; align-items: center; gap: .5rem; font-family: var(--font-display); font-weight: 500; font-size: 1.5rem; color: var(--ink); text-decoration: none; letter-spacing: .01em; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 1.5em; height: 1.5em; flex-shrink: 0; object-fit: contain; }
/* On dark footers the brand must re-declare its color (the base .brand rule sets --ink) and the green PNG glyph is inverted to paper. */
.foot-dark .brand, .foot-dark .brand:hover { color: var(--paper); }
.foot-dark .brand-mark { display: none; }
.foot-dark .brand::before {
  /* The glyph PNG recolored to the clay highlight: a clay fill clipped by the glyph's alpha. */
  content: ""; display: inline-block; flex-shrink: 0; width: 1.5em; height: 1.5em;
  background: var(--highlight);
  -webkit-mask: url('../img/kodama-glyph.png') center / contain no-repeat;
  mask: url('../img/kodama-glyph.png') center / contain no-repeat;
}

.nav { display: flex; align-items: center; gap: 2rem; }
.nav a {
  color: var(--ink-soft); text-decoration: none; font-size: 1rem;
  padding: .3em 0; border-bottom: 1px solid transparent;
  transition: border-color .25s ease, color .25s ease;
}
.nav a:hover { color: var(--ink); border-bottom-color: var(--accent-soft); }
.nav a.quiet { color: var(--muted); font-size: .92rem; }
.nav a.quiet:hover { color: var(--accent); }

.menu-btn { display: none; background: none; border: 0; font-family: var(--font-body); font-size: 1rem; color: var(--ink); cursor: pointer; padding: .4em; }

@media (max-width: 860px) {
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; }
  .nav {
    position: absolute; top: 4.6rem; left: 0; right: 0;
    flex-direction: column; align-items: flex-start; gap: 0;
    background: var(--paper);
    padding: 0 clamp(1.4rem, 5vw, 3rem);
    max-height: 0; overflow: hidden;
    transition: max-height .35s ease, padding .35s ease;
  }
  .nav.open {
    max-height: 24rem;
    padding: .5rem clamp(1.4rem, 5vw, 3rem) 1.4rem;
    border-bottom: 1px solid var(--line);
  }
  .nav a { width: 100%; padding: .85em 0; border-bottom: 1px solid var(--line); }
  .nav a:last-child { border-bottom: 0; }
}

/* ---------- shared public-site navigation ---------- */
.site-header .wrap { max-width: 76rem; gap: 1.5rem; }
.site-header .brand { flex: 0 0 auto; }
.site-header .site-nav { margin-left: auto; gap: clamp(1rem, 2vw, 1.7rem); }
.site-header .site-nav a { white-space: nowrap; font-size: .95rem; }
.site-header .site-nav .site-login { color: var(--muted); }
.site-header .site-nav .site-cta {
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: var(--paper);
  padding: .58rem 1rem;
}
.site-header .site-nav .site-cta:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: var(--paper); }
.site-nav-divider { width: 1px; height: 1.25rem; background: var(--line); }

.audience-route {
  margin: 1.5rem 0 2rem;
  padding: 1rem 1.15rem;
  border-left: 2px solid var(--accent-soft);
  background: color-mix(in srgb, var(--paper-2) 62%, transparent);
  color: var(--ink-soft);
  font-size: 1rem;
}
.site-footer-quicklinks {
  display: flex;
  flex-wrap: wrap;
  gap: .2rem 1.8rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--line);
}
.site-footer-quicklinks a { display: inline-block; padding: .6rem 0; color: var(--ink-soft); font-size: 1rem; text-decoration: none; }
.site-footer-quicklinks a:hover { color: var(--accent); }

@media (max-width: 1020px) {
  .site-header .menu-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin-left: auto; }
  .site-header .site-nav {
    position: absolute; top: 4.6rem; left: 0; right: 0;
    flex-direction: column; align-items: flex-start; gap: 0;
    margin-left: 0; background: var(--paper);
    padding: 0 clamp(1.4rem, 5vw, 3rem);
    max-height: 0; overflow: hidden;
    transition: max-height .35s ease, padding .35s ease;
  }
  .site-header .site-nav.open { max-height: 34rem; padding: .5rem clamp(1.4rem, 5vw, 3rem) 1.4rem; border-bottom: 1px solid var(--line); }
  .site-header .site-nav a { width: 100%; padding: .85em 0; border-bottom: 1px solid var(--line); }
  .site-header .site-nav .site-cta { margin-top: .8rem; width: auto; padding: .65rem 1rem; }
  .site-nav-divider { display: none; }
}

/* ---------- wave divider (the settling signature) ---------- */
.wave { display: block; width: 100%; height: clamp(56px, 9vw, 92px); }
.wave svg { display: block; width: 100%; height: 100%; }
.wave path {
  fill: none; stroke: var(--accent-soft); stroke-width: 1.4; opacity: .55;
  stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke;
}

/* ---------- footer ---------- */
.foot { background: var(--paper-2); border-top: 1px solid var(--line); padding-top: clamp(3.5rem, 7vw, 5rem); padding-bottom: 3.5rem; }
.foot .grid { display: flex; flex-wrap: wrap; gap: 3rem 4.5rem; justify-content: space-between; align-items: flex-start; }
.foot .brand-block { max-width: 22rem; }
.foot .brand { font-size: 1.7rem; }
.foot .tag { color: var(--muted); margin: .75rem 0 0; font-size: 1.05rem; }
.foot nav { display: flex; flex-direction: column; gap: .1rem; }
.foot nav a { display: inline-block; padding: .5rem 0; color: var(--ink-soft); text-decoration: none; font-size: 1.05rem; }
.foot nav a:hover { color: var(--accent); }

.crisis {
  margin-top: 3.4rem; padding: 1.7rem 1.9rem;
  border: 1px solid var(--line); border-radius: 3px;
  background: color-mix(in srgb, var(--paper) 60%, var(--paper-2)); max-width: 46rem;
}
.crisis p { margin: 0; font-size: 1.05rem; line-height: 1.6; color: var(--ink-soft); }
.crisis a { color: var(--accent); }
.scope { margin-top: 2.9rem; font-size: 1rem; color: var(--muted); max-width: 46rem; line-height: 1.65; }
.contact { margin-top: 1.5rem; font-size: .95rem; color: var(--muted); }
.contact a { color: var(--accent); }
.legal { margin-top: 2.4rem; font-size: .95rem; line-height: 1.6; color: var(--muted); }

/* ---------- reveal motion ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .3s ease, transform .3s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* Hero-only safety net: if the JS reveal (main.js) never fires .in - a
   delayed/throttled requestAnimationFrame, or the script failing outright
   after adding .reveal - the hero must not stay invisible forever. This
   forces it visible on a fixed timer, independent of JS. */
.hero-inner > .eyebrow.reveal,
.hero-inner > h1.reveal,
.hero-inner > .lede.reveal,
.hero-inner > .hero-actions.reveal,
.hero-inner > .hero-outcomes.reveal {
  animation: reveal-fallback .3s ease 1s forwards;
}
@keyframes reveal-fallback { to { opacity: 1; transform: none; } }
