/* ==========================================================================
   Demo sites — shared base. Each demo adds its own theme file that sets the
   tokens below and its own components (demo-<slug>.css).
   ========================================================================== */

@font-face {
  font-family: 'Public Sans';
  src: url('../fonts/public-sans-latin.woff2') format('woff2');
  font-weight: 400 700; font-style: normal; font-display: swap;
}

:root {
  --bg: #fff;
  --ink: #1d1d1d;
  --muted: #5b5b5b;
  --soft: #f4f4f4;
  --line: #e2e2e2;
  --accent: #333;        /* button fill */
  --on-accent: #fff;     /* text on the accent fill */
  --accent-ink: #333;    /* accent used as text on --bg */
  --field: #8a8a8a;      /* form field borders, ≥ 3:1 */
  --font-display: system-ui, sans-serif;
  --font-body: 'Public Sans', -apple-system, 'Segoe UI', system-ui, sans-serif;
  --radius: 10px;
  --max: 1160px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 1.0625rem/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0; }
h1 { font-size: clamp(2.1rem, 1.5rem + 2.6vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 1.25rem + 1vw, 2.1rem); }
h3 { font-size: 1.2rem; }
p, ul, ol, dl, figure { margin: 0; }
ul[class], ol[class] { list-style: none; padding: 0; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--accent-ink); outline-offset: 3px; border-radius: 4px; }
.d-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.d-wrap { width: min(100% - 2 * clamp(1rem, 4vw, 2.5rem), var(--max)); margin-inline: auto; }
.d-section { padding-block: clamp(3rem, 2rem + 4vw, 5.5rem); }

/* Skip link */
.skip-link { position: absolute; left: 1rem; top: -100px; z-index: 50; padding: .6rem 1rem; background: var(--ink); color: var(--bg); border-radius: 6px; }
.skip-link:focus { top: 4.5rem; }

/* ── Demo banner (always first, never hidden) ─────────────────────────── */
.demo-banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .25rem 1.25rem;
  padding: .55rem 1rem; background: #55273c; color: #fff;
  font: 400 .875rem/1.4 var(--font-body); text-align: center;
}
.demo-banner a { color: #fff; font-weight: 700; white-space: nowrap; }
.demo-banner :focus-visible { outline-color: #fff; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.d-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 48px; padding: .75rem 1.4rem; border-radius: var(--radius);
  font: 700 1rem/1.2 var(--font-body); text-decoration: none; cursor: pointer;
  border: 2px solid transparent; transition: transform .15s, background-color .15s, border-color .15s;
}
.d-btn:hover { transform: translateY(-1px); }
.d-btn--accent { background: var(--accent); color: var(--on-accent); }
.d-btn--ghost { border-color: currentColor; color: var(--ink); background: transparent; }
.d-btn--sm { min-height: 40px; padding: .5rem 1rem; font-size: .9375rem; }

/* ── Header & nav ─────────────────────────────────────────────────────── */
.d-header { background: var(--bg); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.d-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; min-height: 4.5rem; }
.d-brand { text-decoration: none; }
.d-nav { display: flex; align-items: center; gap: 1.75rem; }
.d-nav ul { display: flex; gap: 1.5rem; list-style: none; margin: 0; padding: 0; }
.d-nav ul a { text-decoration: none; font-weight: 600; font-size: .975rem; padding-block: .4rem; border-bottom: 2px solid transparent; }
.d-nav ul a:hover, .d-nav ul a[aria-current="page"] { border-bottom-color: var(--accent-ink); }
.d-nav-toggle {
  display: none; min-height: 44px; padding: .4rem 1rem; border-radius: var(--radius);
  font: 700 .95rem var(--font-body); color: var(--ink); background: transparent; border: 2px solid var(--ink); cursor: pointer;
}

/* ── Forms (never submit) ─────────────────────────────────────────────── */
.d-form { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.d-field { display: grid; gap: .35rem; align-content: end; } /* inputs line up even when a label wraps */
.d-field--wide { grid-column: 1 / -1; }
.d-field label { font-weight: 600; font-size: .9375rem; }
.d-opt { font-weight: 400; color: var(--muted); }
.d-field input, .d-field select, .d-field textarea {
  width: 100%; min-height: 46px; padding: .65rem .8rem; font: inherit; color: var(--ink);
  background: #fff; border: 1.5px solid var(--field); border-radius: calc(var(--radius) * .6);
}
.d-field input, .d-field select { height: 48px; }
.d-field input:focus, .d-field select:focus, .d-field textarea:focus { outline: 3px solid var(--accent-ink); outline-offset: 1px; }
.d-field .d-btn { justify-self: start; margin-top: .25rem; }
.d-form__note { font-size: .875rem; color: var(--muted); }
.d-form__done { padding: .8rem 1rem; border-radius: var(--radius); background: var(--soft); font-weight: 600; }

/* ── Footer ───────────────────────────────────────────────────────────── */
.d-footer { background: var(--ink); color: var(--bg); padding-block: 3rem 1.5rem; font-size: .9375rem; }
.d-footer__grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; }
.d-footer__brand { margin-bottom: .75rem; }
.d-footer__title { font-weight: 700; margin-bottom: .35rem; }
.d-footer__base { margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid rgba(255, 255, 255, .2); font-size: .8125rem; }
.d-footer :focus-visible { outline-color: var(--bg); }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .d-nav-toggle { display: inline-flex; align-items: center; }
  .d-nav {
    position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 1rem;
    padding: 1rem clamp(1rem, 4vw, 2.5rem) 1.5rem; background: var(--bg); border-bottom: 1px solid var(--line);
  }
  .js .d-nav:not(.is-open) { display: none; }
  .d-nav ul { flex-direction: column; gap: .25rem; }
  .d-nav ul a { display: block; padding-block: .6rem; }
  .d-header { position: relative; }
  .d-footer__grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .d-form { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation: none !important; }
}
