/* Base: reset, type roles, links, layout, header, buttons, footer.
   Loaded on every page, right after tokens.css. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: var(--t-body); line-height: 1.6;
  font-feature-settings: "cv05" 1, "ss03" 1;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }
main { overflow-x: clip; }   /* full-bleed band without a horizontal scrollbar; keeps sticky working */

/* ---------- type roles ---------- */
h1, h2, h3 { margin: 0; font-weight: 600; text-wrap: balance; }
h2 { font-size: var(--t-h2); letter-spacing: -0.02em; line-height: 1.15; }
h3, h4 { margin: 0; font-size: var(--t-body); font-weight: 600; letter-spacing: -0.01em; line-height: 1.35; }
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; list-style: none; }
.display { font-size: var(--fs-display); letter-spacing: -0.035em; line-height: 1; }
.display .line { display: block; }
.lede { font-size: var(--t-title); color: var(--muted); letter-spacing: -0.01em; line-height: 1.5; max-width: 52ch; }
.caption { font-size: var(--t-caption); color: var(--muted); line-height: 1.5; }
.num { font-variant-numeric: tabular-nums; }
.quiet { color: var(--muted); font-size: var(--t-small); }

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

/* ---------- links: underline draws in ---------- */
a { color: var(--accent-text); text-decoration: none; }
.link {
  background: linear-gradient(currentColor, currentColor) no-repeat 0 100% / 0% 1px;
  padding-bottom: 2px;
  transition: background-size 200ms var(--ease-out), color 160ms ease;
}
.link:focus-visible { background-size: 100% 1px; }
@media (hover: hover) and (pointer: fine) { .link:hover { background-size: 100% 1px; } }

/* ---------- layout ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--pad); }
.skip { position: absolute; left: -9999px; top: 8px; }
.skip:focus { left: 8px; z-index: 100; background: var(--surface); color: var(--text); padding: 10px 14px; border-radius: var(--radius-sm); }
.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; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 66px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; font-size: var(--t-title); letter-spacing: -0.02em; }
.brand .mark { width: 42px; height: 25px; display: block; }
.site-nav { display: flex; align-items: center; gap: var(--s-6); }
.site-nav .link { color: var(--muted); font-size: var(--t-small); font-weight: 500; }
@media (hover: hover) and (pointer: fine) { .site-nav .link:hover { color: var(--text); } }
.site-nav .link[aria-current="page"] { color: var(--text); background-size: 100% 1px; }

/* theme toggle; `.theme-swap` switches every transition off for the two frames of a swap
   (fallback when View Transitions aren't available) */
.theme-toggle {
  display: grid; place-items: center; width: 44px; height: 44px; margin-right: -5px; padding: 0;
  background: none; border: 0; border-radius: 50%; color: var(--muted); cursor: pointer;
  transition: color 160ms ease, transform 160ms var(--ease-out);
}
.theme-toggle svg { width: 17px; height: 17px; transition: transform 320ms var(--ease-io); }
:root[data-theme="dark"] .theme-toggle svg { transform: rotate(180deg); }
.theme-toggle:active { transform: scale(.94); }
@media (hover: hover) and (pointer: fine) { .theme-toggle:hover { color: var(--text); } }
.theme-swap, .theme-swap * { transition: none !important; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 22px;
  border-radius: var(--radius-sm); font-size: var(--t-small); font-weight: 500; letter-spacing: -0.01em;
  border: 1px solid transparent; cursor: pointer; touch-action: manipulation;
  /* `translate` is the magnetic pull (motion layer); it composes with the :active scale */
  transition: transform 160ms var(--ease-out), translate 260ms var(--ease-out), background-color 160ms ease, border-color 160ms ease;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:active { background: var(--accent-press); }
.btn-quiet { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-store { background: var(--text); color: var(--bg); }
.btn-store:active { background: color-mix(in srgb, var(--text) 85%, var(--bg)); }
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: color-mix(in srgb, var(--accent) 90%, var(--text)); }
  .btn-quiet:hover { border-color: var(--muted); }
}
.actions { display: flex; flex-wrap: wrap; gap: var(--s-4); margin-top: var(--s-7); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: var(--s-8) 0; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: var(--s-6); flex-wrap: wrap; }
.foot-brand { display: grid; gap: var(--s-3); }
.foot-brand .brand { font-size: var(--t-body); }
.foot-brand .brand .mark { width: 36px; height: 21px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); padding-bottom: 4px; }
.site-footer nav .link { color: var(--muted); font-size: var(--t-small); }
@media (hover: hover) and (pointer: fine) { .site-footer nav .link:hover { color: var(--text); } }

@media (max-width: 620px) {
  .brand span { display: none; }
  .site-nav { gap: var(--s-4); }
}
