/*
 * Onepct 2026 redesign: base layer.
 * Reset, type, layout helpers, buttons, links, form controls, FAQ accordion
 * and the default reveal state. Load after tokens.css. Page files add only
 * page-specific rules (public/css/redesign/pages/<page>.css).
 *
 * Motion rules here follow the Onepct motion plan: only transform, opacity and
 * clip-path animate; hover effects only on (hover: hover) and (pointer: fine);
 * prefers-reduced-motion keeps fades and colour changes and drops movement.
 */

/* ── Reset ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis: none;
  overflow-x: clip;
}
img, svg, video, canvas, picture { display: block; max-width: 100%; }
img { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
ul[role='list'], ol[role='list'] { list-style: none; padding: 0; }
h1, h2, h3, h4, p { overflow-wrap: break-word; }
/* In-page anchors glide (on html itself: Safari never focuses a clicked link,
   so html:focus-within jumped) and stop below the fixed nav. Reduced motion
   jumps. Long reads set their own, longer offset with a more specific [id] rule. */
[id] { scroll-margin-top: 96px; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* ── Focus ───────────────────────────────────────────────────────────── */
:focus-visible {
  outline: 3px solid var(--emerald);
  outline-offset: 3px;
  border-radius: 4px;
}
.on-ink :focus-visible, .on-ink:focus-visible { outline-color: var(--paper); }

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: calc(var(--z-menu) + 1);
  padding: 12px 18px;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform var(--dur-hover) var(--ease-out);
}
.skip-link:focus { transform: 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;
}

/* ── Layout ──────────────────────────────────────────────────────────── */
.wrap {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section { padding-block: var(--section-y); }
.bg-paper-2 { background: var(--paper-2); }
.bg-ink { background: var(--ink); color: var(--paper); }

/* Show/hide copy that differs between the desktop and mobile Paper boards. */
@media (min-width: 768px) { .only-mobile { display: none !important; } }
@media (max-width: 767px) { .only-desktop { display: none !important; } }

/* ── Type ────────────────────────────────────────────────────────────── */
.display, .h1, .h2, .h3 {
  font-family: var(--font-display);
  font-weight: 800;
}
.display { font-size: var(--fs-hero); line-height: var(--lh-hero); letter-spacing: -0.035em; }
.h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); letter-spacing: var(--tracking-tight); }
.h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); letter-spacing: -0.025em; }
.h3 { font-size: var(--fs-h3); line-height: 1.15; letter-spacing: -0.015em; font-weight: 700; }
.lead { font-size: var(--fs-lead); line-height: 1.48; color: var(--text-2); }
.body-l { font-size: var(--fs-body-l); line-height: 1.55; color: var(--text-2); }
.muted { color: var(--muted); }
.small { font-size: var(--fs-small); line-height: 1.3; }
.label {
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  line-height: 16px;
  text-transform: uppercase;
}
.num { font-family: var(--font-display); font-weight: 800; font-variant-numeric: tabular-nums; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  --btn-bg: var(--emerald);
  --btn-fg: var(--ink);
  --btn-bg-hover: #13A96B;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 16px 26px;
  border-radius: var(--radius-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  line-height: 20px;
  text-decoration: none;
  white-space: nowrap;
  border: 0;
  transition: transform var(--dur-press) var(--ease-out),
              background-color 150ms ease, color 150ms ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn--lg { padding: 18px 30px; font-size: 17px; line-height: 22px; }
.btn--sm { padding: 11px 18px; font-size: 14px; line-height: 18px; }
.btn--block { display: flex; width: 100%; }
.btn--ink { --btn-bg: var(--ink); --btn-fg: var(--paper); --btn-bg-hover: #1D3029; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: var(--btn-bg-hover); }
}

/* ── Links: Paper's 1px underline, plus a line that draws from the left ─ */
.link {
  position: relative;
  display: inline-block;
  font-size: 15px;
  font-weight: 600;
  line-height: 18px;
  text-decoration: underline 1px;
  text-underline-position: from-font;
  text-underline-offset: 2px;
  padding-block: 13px; /* 44px tap target without changing the visual line height */
  margin-block: -13px;
}
.link::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  bottom: 11px;
  height: 2px;
  background: currentColor;
  clip-path: inset(0 100% 0 0);
  transition: clip-path 200ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .link:hover::after { clip-path: inset(0 0 0 0); }
}

/* ── Chips ───────────────────────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  line-height: 16px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--emerald); flex-shrink: 0; }
.tag-example {
  display: inline-block;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  background: var(--amber-soft);
  color: var(--amber-text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 14px;
}

/* ── Form controls ───────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__label { font-size: 13px; font-weight: 600; line-height: 16px; color: var(--ink); }
.input {
  width: 100%;
  min-height: 48px;
  padding: 14px;
  border: 1px solid var(--line-input);
  border-radius: var(--radius-input);
  background: var(--white);
  color: var(--ink);
  font-size: 15px;
  line-height: 18px;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.input::placeholder { color: var(--placeholder); opacity: 1; }
.input:focus { outline: none; border-color: var(--deep-green); box-shadow: 0 0 0 3px rgb(22 190 121 / 0.35); }
.input[aria-invalid='true'] { border-color: var(--error); }
.field__error {
  color: var(--error);
  font-size: 13px;
  line-height: 16px;
  opacity: 0;
  transition: opacity var(--dur-hover) ease;
}
.field__error.is-shown { opacity: 1; }

/* Yes / No / Not sure pills: real radio inputs, styled as chips */
.choice { border: 0; padding: 0; min-width: 0; }
.choice__legend { padding: 0; margin-bottom: 8px; }
.choice__row { display: flex; flex-wrap: wrap; gap: 8px; }
.choice__opt { position: relative; }
.choice__opt input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.choice__opt span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 9px 18px;
  border: 1px solid var(--line-input);
  border-radius: var(--radius-pill);
  font-size: 14px;
  line-height: 18px;
  color: var(--ink);
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.choice__opt input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--paper); font-weight: 600; }
.choice__opt input:focus-visible + span { outline: 3px solid var(--emerald); outline-offset: 2px; }

/* ── FAQ accordion: <details> without JS, animated grid rows with JS ─── */
.faq__item { border-top: 1px solid var(--line); }
.faq__item:last-child { border-bottom: 1px solid var(--line); }
.faq__q {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  padding-block: 24px;
  list-style: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-display);
  font-size: clamp(18px, 16.5px + 0.38vw, 22px);
  font-weight: 700;
  line-height: 1.27;
  color: var(--ink);
}
.faq__q::-webkit-details-marker { display: none; }
.faq__icon {
  position: relative;
  flex-shrink: 0;
  width: 24px;
  height: 28px;
  color: var(--deep-green);
}
.faq__icon::before, .faq__icon::after {
  content: '';
  position: absolute;
  left: 4px; right: 4px;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  background: currentColor;
  border-radius: 2px;
  transition: transform var(--dur-faq) var(--ease-out);
}
.faq__icon::after { transform: rotate(90deg); }
.faq:not(.faq--js) .faq__item[open] .faq__icon::after,
.faq--js .faq__item.is-open .faq__icon::after { transform: rotate(180deg); }
.faq__a { color: var(--text-2); font-size: clamp(15px, 14.25px + 0.19vw, 17px); line-height: 1.58; max-width: 640px; }
.faq__a-inner { padding-bottom: 24px; }
/* JS upgrade (motion.js): the panel stays in the DOM and animates 0fr → 1fr */
.faq--js .faq__panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--dur-faq) var(--ease-out);
}
.faq--js .faq__item.is-open .faq__panel { grid-template-rows: 1fr; }
.faq--js .faq__panel > .faq__a { overflow: hidden; min-height: 0; }
.faq__pending { color: var(--muted); font-style: italic; }

/* ── Default section reveal (motion.js adds .is-in) ──────────────────── */
/* Only hidden when JS is running (html.js, set inline in <head>) so content
   is always readable without JS. */
@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal] {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity var(--dur-reveal) var(--ease-out), transform var(--dur-reveal) var(--ease-out);
    transition-delay: calc(var(--i, 0) * var(--stagger));
  }
}
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] {
    opacity: 0;
    transition: opacity var(--dur-reveal) ease;
    transition-delay: calc(var(--i, 0) * var(--stagger));
  }
}
.js [data-reveal].is-in { opacity: 1; transform: none; }

/* ── Live graphics (js/redesign/graphics/runner.js) ──────────────────── */
/* The runner lays a canvas exactly over the still ([data-gfx-poster] or the
   host's own background) and cross-fades it in after its first frame. Without
   JS or with reduced motion no canvas exists and the still stays. */
.gfx-canvas {
  position: absolute;
  display: block;
  pointer-events: none;
  opacity: 0;
  transition: opacity 600ms var(--ease-out);
}
.gfx-live > .gfx-canvas { opacity: 1; }
.gfx-live > [data-gfx-poster] { opacity: 0; transition: opacity 600ms var(--ease-out); }
[data-graphic].gfx-done { background-image: none; }

/* ── Hover, press and focus states (site-wide) ───────────────────────── */
/* Hover only where a real pointer hovers; touch gets press feedback (:active).
   Every movement is dropped under reduced motion; colour changes stay. */
a, button, summary, label { -webkit-tap-highlight-color: transparent; }
.btn:focus-visible { outline-offset: 3px; }
.link:active, .faq__q:active { opacity: 0.72; }

/* FAQ rows: soft ground on hover, the +/− icon turns emerald and nudges */
.faq__q { transition: background-color var(--dur-hover) ease, color var(--dur-hover) ease; border-radius: 12px; }
.faq__icon::before, .faq__icon::after { transition: transform var(--dur-faq) var(--ease-out), background-color var(--dur-hover) ease; }
@media (hover: hover) and (pointer: fine) {
  .faq__q:hover { background: var(--paper-2); box-shadow: -12px 0 0 var(--paper-2), 12px 0 0 var(--paper-2); }
  .faq__q:hover .faq__icon::before, .faq__q:hover .faq__icon::after { background: var(--emerald); }
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .faq__icon { transition: transform var(--dur-hover) var(--ease-out); }
  .faq__q:hover .faq__icon { transform: translateY(2px); }
}
.faq__q:focus-visible { outline-offset: 4px; }

/* Form fields: border darkens on hover; the focus ring fades in (120 ms) */
.input:not(:focus):not([aria-invalid='true']) { transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease; }
@media (hover: hover) and (pointer: fine) {
  .input:hover:not(:focus):not([aria-invalid='true']) { border-color: var(--muted); }
  .choice__opt:hover input:not(:checked) + span { border-color: var(--ink); }
}
.choice__opt input:active + span { transform: scale(0.97); transition: transform var(--dur-press) var(--ease-out); }

@media (prefers-reduced-motion: reduce) {
  .btn:active, .choice__opt input:active + span { transform: none; }
  .link::after { transition: none; }
}

/* ── Halftone photos (site.js initHalftone) ──────────────────────────── */
/* The full-colour twin of an img[data-ht] sits exactly over it (same classes,
   so the same fit, radius and hover zoom) and fades in on hover or focus:
   the green tint drops to zero, the dots stay. Hover on fine pointers only. */
img.ht-color {
  position: absolute;
  margin: 0;
  max-width: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms var(--ease-out), transform 600ms var(--ease-out);
}
[data-ht-card]:focus-within img.ht-color.is-ready { opacity: 1; }
@media (hover: hover) and (pointer: fine) {
  [data-ht-card]:hover img.ht-color.is-ready,
  img[data-ht='self']:hover + img.ht-color.is-ready { opacity: 1; }
}
