/* base system — reset, type scale, shell, controls */

*, *::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;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.85;
  font-feature-settings: "palt" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* height:auto is load-bearing: we ship width/height attributes on every <img>
   against CLS, and the HTML height hint beats aspect-ratio without it */
img, video, iframe { max-width: 100%; height: auto; display: block; }

a { color: inherit; text-underline-offset: 0.18em; }
p { margin: 0 0 1.1em; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-head); font-weight: 600; line-height: 1.4; letter-spacing: 0.01em; }
ul, ol { margin: 0 0 1.1em; padding-left: 1.2em; }
li { margin-bottom: 0.4em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.4rem 0; }

:focus-visible {
  outline: 2px solid var(--tally);
  outline-offset: 2px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  padding: 0.7rem 1.1rem; background: var(--night); color: #fff;
  font-size: 0.86rem;
}
.skip-link:focus { left: 0.6rem; top: 0.6rem; }

.container { width: min(var(--max), calc(100% - var(--gutter) * 2)); margin-inline: auto; }
.container--narrow { width: min(50rem, calc(100% - var(--gutter) * 2)); }

.section { padding: clamp(3.4rem, 7vw, 6rem) 0; }
.section--tint { background: var(--paper-2); }
.section--paper { background: var(--surface); }
.section--ink { background: var(--night); color: #eceee9; }
.section--ink h2, .section--ink h3 { color: #fff; }

/* ── type scale ─────────────────────────────────────────────── */
.h-display { font-size: clamp(2rem, 4.4vw, 3.3rem); line-height: 1.28; letter-spacing: 0.005em; }
.h-1 { font-size: clamp(1.75rem, 3.2vw, 2.5rem); line-height: 1.34; }
.h-2 { font-size: clamp(1.3rem, 2.1vw, 1.7rem); line-height: 1.45; }
.lede { font-size: 1.04rem; color: var(--ink-soft); max-width: 42rem; }

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--slate);
  margin-bottom: 0.9rem;
}

.section-head { max-width: 46rem; margin-bottom: clamp(1.8rem, 3.5vw, 2.8rem); }
.section-head p { color: var(--ink-soft); margin-bottom: 0; }

/* ── controls ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  padding: 0.82rem 1.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.94rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.18s var(--ease-out), color 0.18s var(--ease-out),
              border-color 0.18s var(--ease-out), transform 0.12s var(--ease-out);
}
.btn:active { transform: scale(0.985); }
.btn--primary { background: var(--tally); color: #fff; }
.btn--primary:hover { background: var(--tally-deep); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover { border-color: var(--ink); background: rgba(22, 24, 26, 0.04); }
.btn--sm { padding: 0.55rem 1rem; font-size: 0.85rem; }
.section--ink .btn--ghost { color: #eceee9; border-color: rgba(255,255,255,0.34); }
.section--ink .btn--ghost:hover { background: rgba(255,255,255,0.09); border-color: #fff; }

/* ── shell: topbar ──────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: rgba(241, 242, 238, 0.94);
  backdrop-filter: saturate(150%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  min-height: var(--topbar-h);
  display: flex; align-items: center; gap: 1.4rem;
}
.brand { display: flex; align-items: baseline; gap: 0.55rem; text-decoration: none; margin-right: auto; }
.brand__mark {
  font-family: var(--font-mono); font-size: 0.94rem; font-weight: 500;
  letter-spacing: 0.06em; color: var(--ink);
}
.brand__ja { font-size: 0.72rem; color: var(--muted); letter-spacing: 0.04em; }

.nav { display: flex; align-items: center; gap: 1.35rem; }
.nav__link {
  position: relative;
  font-size: 0.88rem; font-weight: 500; text-decoration: none; color: var(--ink-soft);
  padding: 0.3rem 0 0.55rem;
  transition: color 0.16s var(--ease-out);
}
.nav__link:hover { color: var(--ink); }
.nav__link.is-active { color: var(--ink); }
.nav__link.is-active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: 2px; background: var(--tally);
}
.topbar__cta { margin-left: 0.4rem; }

.burger {
  display: none; width: 2.6rem; height: 2.6rem; padding: 0;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: transparent; cursor: pointer;
}
.burger span {
  display: block; width: 1.1rem; height: 1.5px; margin: 0.24rem auto;
  background: var(--ink); transition: transform 0.2s var(--ease-out), opacity 0.2s;
}
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(0.38rem) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-0.38rem) rotate(-45deg); }

@media (max-width: 900px) {
  .burger { display: block; }
  .nav {
    position: absolute; inset: var(--topbar-h) 0 auto; z-index: 59;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 0.6rem var(--gutter) 1.2rem;
    background: var(--paper); border-bottom: 1px solid var(--line);
  }
  .nav[hidden] { display: none; }
  .nav__link { padding: 0.75rem 0; border-bottom: 1px solid var(--line); font-size: 0.96rem; }
  .nav__link.is-active::after { display: none; }
  .nav__link.is-active { color: var(--tally); }
  .topbar__cta { display: none; }
}

/* ── footer ─────────────────────────────────────────────────── */
.footer { background: var(--night); color: #b9bfc4; padding: clamp(2.8rem, 5vw, 4rem) 0 1.6rem; }
.footer a { color: #e6e9e5; }
.footer h4 { color: #fff; font-size: 0.9rem; margin-bottom: 0.7rem; font-family: var(--font-body); font-weight: 700; }
.footer__grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 2rem; }
.footer__about p { font-size: 0.88rem; margin-bottom: 0.5em; color: #a3aaaf; }
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer li { margin-bottom: 0.45em; font-size: 0.88rem; }
.footer__bottom {
  display: flex; flex-wrap: wrap; gap: 0.8rem 1.4rem; justify-content: space-between;
  margin-top: 2.4rem; padding-top: 1.2rem; border-top: 1px solid rgba(255,255,255,0.13);
  font-size: 0.8rem; color: #8b9296;
}
.footer__legal { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
.footer__cookie-btn {
  padding: 0; border: 0; background: none; color: #e6e9e5;
  font: inherit; cursor: pointer; text-decoration: underline;
}
@media (max-width: 860px) { .footer__grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .footer__grid { grid-template-columns: 1fr; gap: 1.6rem; } }

/* ── forms ──────────────────────────────────────────────────── */
.field { margin-bottom: 1.05rem; }
.field label { display: block; font-size: 0.86rem; font-weight: 700; margin-bottom: 0.4rem; }
.field .hint { display: block; font-size: 0.78rem; color: var(--muted); font-weight: 400; margin-top: 0.15rem; }
.field input, .field textarea, .field select {
  width: 100%; padding: 0.72rem 0.85rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  font: inherit; line-height: 1.6;
  transition: border-color 0.16s var(--ease-out), box-shadow 0.16s var(--ease-out);
}
.field input:hover, .field textarea:hover, .field select:hover { border-color: var(--slate); }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--tally);
  box-shadow: 0 0 0 3px var(--tally-tint);
}
.field textarea { min-height: 8.5rem; resize: vertical; }
.field select {
  appearance: none; -webkit-appearance: none; padding-right: 2.6rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='7' viewBox='0 0 11 7'%3E%3Cpath d='M1 1l4.5 4.5L10 1' stroke='%234b5a66' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.9rem center; background-size: 11px 7px;
}
.field--check { display: grid; grid-template-columns: auto 1fr; gap: 0.6rem; align-items: start; font-size: 0.86rem; color: var(--ink-soft); }
.field--check input { margin-top: 0.35rem; accent-color: var(--tally); }
.form__note { font-size: 0.8rem; color: var(--muted); }

/* ── reveal (used sparingly — see custom.css for which sections opt in) ── */
[data-reveal] { opacity: 0; transform: translateY(12px); transition: opacity 0.55s var(--ease-out), transform 0.55s var(--ease-out); }
[data-reveal].is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  .btn:active { transform: none; }
}

/* ── consent drawer ─────────────────────────────────────────── */
.consent-drawer {
  position: fixed; inset: auto 0 0; z-index: 120;
  background: var(--surface); border-top: 2px solid var(--night);
  box-shadow: var(--shadow-lg);
}
.consent-drawer[hidden] { display: none; }
.consent-drawer__inner {
  width: min(46rem, calc(100% - 2rem)); margin-inline: auto; padding: 1.3rem 0 1.5rem;
  max-height: 80vh; overflow-y: auto;
}
.consent-rows[hidden] { display: none; }
.consent-drawer__more {
  margin-right: auto; padding: 0; border: 0; background: none;
  font: inherit; font-size: 0.84rem; color: var(--slate);
  text-decoration: underline; cursor: pointer;
}
.consent-drawer__more:hover { color: var(--ink); }
.consent-drawer__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.consent-drawer__head h2 { font-size: 1.12rem; }
.consent-drawer__close { border: 0; background: none; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--muted); }
.consent-drawer p { font-size: 0.88rem; color: var(--ink-soft); }
.consent-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.7rem 0; border-top: 1px solid var(--line);
}
.consent-row strong { font-size: 0.9rem; }
.consent-row p { margin: 0.1rem 0 0; font-size: 0.8rem; color: var(--muted); }
.consent-toggle { position: relative; flex: none; width: 2.7rem; height: 1.5rem; }
.consent-toggle input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.consent-toggle span {
  position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong);
  transition: background-color 0.18s var(--ease-out);
}
.consent-toggle span::after {
  content: ""; position: absolute; top: 0.19rem; left: 0.19rem;
  width: 1.12rem; height: 1.12rem; border-radius: 50%; background: #fff;
  transition: transform 0.18s var(--ease-out);
}
.consent-toggle input:checked + span { background: var(--signal); }
.consent-toggle input:checked + span::after { transform: translateX(1.2rem); }
.consent-toggle--locked span { background: var(--slate-soft); }
.consent-toggle input:focus-visible + span { outline: 2px solid var(--tally); outline-offset: 2px; }
.consent-drawer__actions { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: flex-end; margin-top: 1.1rem; }
