/* ============================================================================
   Broadsheet — theme layer (shared by Bionic Page and Bionic Docs)
   Tokens, reset, base typography, masthead, buttons, footer, motion.
   The per-site accent lives in identity.css; everything here is the press.
   ========================================================================== */

:root {
  /* paper & ink */
  --paper: #f8f6f1;
  --paper-2: #f0ece2;
  --card: #fcfaf5;
  --ink: #1c1710;
  --body: #48412f;
  --mute: #7a7060;
  --line: #ded6c4;
  --line-strong: #c4b99f;

  /* the site's ink — overridden per site in identity.css */
  --accent: #4238c4;
  --accent-ink: #322a9e;
  --accent-bright: #8f86ff;
  --accent-soft: rgba(66, 56, 196, 0.08);
  --on-accent: #fbf9f4;

  --good: #0f766e;
  --good-soft: rgba(15, 118, 110, 0.09);

  /* warm shadows */
  --shadow-1: 0 1px 2px rgba(28, 23, 16, 0.05), 0 1px 1px rgba(28, 23, 16, 0.03);
  --shadow-2: 0 2px 6px rgba(28, 23, 16, 0.06), 0 10px 28px -10px rgba(28, 23, 16, 0.14);
  --shadow-3: 0 4px 14px rgba(28, 23, 16, 0.08), 0 24px 56px -14px rgba(28, 23, 16, 0.22);

  /* type */
  --serif: "Iowan Old Style", "New York", ui-serif, Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  /* radii */
  --r-s: 8px;
  --r-m: 12px;
  --r-l: 20px;
  --r-pill: 999px;

  /* layout */
  --measure: 1120px;
  --gutter: 24px;
  --masthead-h: 64px;

  color-scheme: light;
}

[data-theme="dark"] {
  --paper: #16130d;
  --paper-2: #1c1811;
  --card: #201b13;
  --ink: #f0e9db;
  --body: #cbc1ac;
  --mute: #968b76;
  --line: #312a1f;
  --line-strong: #463d2d;

  --accent: #9a90ff;
  --accent-ink: #b3acff;
  --accent-bright: #9a90ff;
  --accent-soft: rgba(154, 144, 255, 0.12);
  --on-accent: #17131f;

  --good: #2dd4bf;
  --good-soft: rgba(45, 212, 191, 0.12);

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 2px 8px rgba(0, 0, 0, 0.45), 0 10px 28px -10px rgba(0, 0, 0, 0.6);
  --shadow-3: 0 4px 16px rgba(0, 0, 0, 0.5), 0 24px 56px -14px rgba(0, 0, 0, 0.7);

  color-scheme: dark;
}

/* ------------------------------------------------------------------ reset */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--masthead-h) + 20px);
  -webkit-text-size-adjust: 100%;
}
body {
  background: var(--paper);
  color: var(--body);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.25s ease, color 0.25s ease;
}
img, svg, video, canvas { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
ul, ol { padding: 0; list-style: none; }
code, kbd, samp { font-family: var(--mono); font-size: 0.88em; }
code {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.08em 0.34em;
  color: var(--ink);
}
::selection { background: var(--accent-soft); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 200;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  border-radius: var(--r-s);
  font-size: 0.85rem;
  transition: top 0.18s ease;
}
.skip-link:focus-visible { top: 12px; }

/* ------------------------------------------------------------- typography */
h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 400;
  color: var(--ink);
  line-height: 1.12;
  text-wrap: balance;
}
p { text-wrap: pretty; }
strong, b { font-weight: 650; }

.mono { font-family: var(--mono); }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--mute); }

.container {
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* The painted word: the product speaking for itself. Heads carry the ink;
   tails stay quiet. Only dim mode wraps tails, so .bp-tail is a dim affair. */
.bionic b.bp-head, b.bp-head { font-weight: 680; color: var(--ink); font-style: inherit; }
.bionic .bp-tail { opacity: 0.55; }

/* ------------------------------------------------------------------ grain */
.grain {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}
[data-theme="dark"] .grain { mix-blend-mode: screen; opacity: 0.06; }

/* --------------------------------------------------------------- masthead */
.masthead {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.masthead__inner {
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--gutter);
  height: var(--masthead-h);
  display: flex;
  align-items: center;
  gap: 20px;
}
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 9px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.22rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand__mark {
  align-self: center;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--line);
}
.brand__mark .icon { width: 16px; height: 16px; }
.brand__tag {
  font-family: var(--sans);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mute);
}
.masthead__links {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-inline: auto;
}
.masthead__links a {
  color: var(--body);
  font-size: 0.84rem;
  font-weight: 500;
  padding: 7px 11px;
  border-radius: var(--r-s);
  text-decoration: none;
}
.masthead__links a:hover { color: var(--ink); background: var(--accent-soft); }
.masthead__actions { display: flex; align-items: center; gap: 8px; }
.masthead__gh {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--body);
  font-size: 0.84rem;
  font-weight: 500;
  padding: 7px 10px;
  border-radius: var(--r-s);
  text-decoration: none;
}
.masthead__gh:hover { color: var(--ink); background: var(--accent-soft); }
.masthead__gh .icon { width: 17px; height: 17px; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--body);
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--card);
}
.theme-toggle:hover { border-color: var(--line-strong); color: var(--ink); }
.theme-toggle .icon { width: 15px; height: 15px; }
.theme-toggle__moon { display: none; }
[data-theme="dark"] .theme-toggle__sun { display: none; }
[data-theme="dark"] .theme-toggle__moon { display: block; }

.nav-toggle {
  display: none;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  background: var(--card);
  color: var(--body);
}
.nav-toggle .icon { width: 18px; height: 18px; }

.mobile-nav {
  display: none;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.mobile-nav.is-open { display: block; }
.mobile-nav a {
  display: block;
  padding: 13px var(--gutter);
  color: var(--body);
  font-size: 0.95rem;
  border-top: 1px solid var(--line);
  text-decoration: none;
}
.mobile-nav a:hover { background: var(--accent-soft); color: var(--ink); }

@media (max-width: 960px) {
  .masthead__links { display: none; }
  .masthead__gh span { display: none; }
  .nav-toggle { display: grid; }
}
@media (max-width: 560px) {
  .masthead__inner { gap: 12px; }
  .brand__tag { display: none; }
  .theme-toggle { padding: 8px; }
  .theme-toggle span { display: none; }
}

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 0.92rem;
  font-weight: 560;
  padding: 12px 22px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease,
    border-color 0.18s ease, color 0.18s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn .icon { width: 16px; height: 16px; }
.btn--accent {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-1);
}
.btn--accent:hover { background: var(--accent-ink); transform: translateY(-1px); box-shadow: var(--shadow-2); }
.btn--outline {
  border-color: var(--line-strong);
  color: var(--ink);
  background: transparent;
}
.btn--outline:hover { background: var(--card); border-color: var(--ink); transform: translateY(-1px); }
.btn--ghost { color: var(--body); }
.btn--ghost:hover { color: var(--ink); background: var(--accent-soft); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* small text-with-rule chips used under the hero buttons */
.flagline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
}
.flagline li { display: inline-flex; align-items: center; }
.flagline li + li::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--line-strong);
  margin-inline: 14px;
}

/* ------------------------------------------------------------------ icons */
.icon {
  width: 1.15em;
  height: 1.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.icon--fill { fill: currentColor; stroke: none; }
.icon--mute { color: var(--mute); }
.icon--good { color: var(--good); }

/* ----------------------------------------------------------------- footer */
.footer { margin-top: 110px; }
.footer__rule {
  border: 0;
  border-top: 3px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  height: 5px;
  margin-bottom: 64px;
}
.footer__mark {
  font-family: var(--serif);
  font-size: clamp(3rem, 9vw, 5.6rem);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-align: center;
  margin-bottom: 72px;
  user-select: none;
}
.footer__mark .bp-tail { opacity: 0.38; }
.footer__cols {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 56px;
}
.footer__brand p:first-of-type {
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--ink);
  margin-bottom: 8px;
}
.footer__brand .footer__tagline { font-size: 0.9rem; line-height: 1.6; max-width: 30ch; }
.footer__cols h2 {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
  margin-bottom: 14px;
}
.footer__cols ul { display: grid; gap: 9px; font-size: 0.9rem; }
.footer__cols a { color: var(--body); }
.footer__cols a:hover { color: var(--accent); }
.footer__cols li { color: var(--body); }
.footer__meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-block: 22px 30px;
  font-size: 0.8rem;
  color: var(--mute);
}
@media (max-width: 860px) {
  .footer__cols { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .footer__cols { grid-template-columns: 1fr; gap: 28px; }
}

/* ----------------------------------------------------------------- motion */
[data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s cubic-bezier(0.2, 0.6, 0.2, 1), transform 0.7s cubic-bezier(0.2, 0.6, 0.2, 1);
}
[data-reveal].is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------------ print */
@media print {
  .masthead, .grain, .mobile-nav { display: none; }
  body { background: #fff; }
}
