*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: var(--hdr); }
:root { --hdr: 72px; }
@media (max-width: 860px) { :root { --hdr: 118px; } }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1.0625rem/1.65 var(--font-body);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }
img, svg { max-width: 100%; display: block; }
img { height: auto; } /* width/height attributes would otherwise stretch images */
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 .5em; font-weight: 800; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
#main:focus { outline: none; }
h1:focus { outline: none; }
h1:focus-visible { outline: 3px solid var(--accent); }
mark { background: linear-gradient(transparent 58%, var(--hl) 58%); color: inherit; padding: 0 .06em; }
.ic { width: 1.1em; height: 1.1em; flex: none; }
.mute { color: var(--mute); }
.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; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 8px; z-index: 130; }
.skip:focus { left: 8px; }

.wrap-wide { width: 100%; max-width: 1240px; margin-inline: auto; padding-inline: 28px; }
@media (max-width: 640px) { .wrap-wide { padding-inline: 16px; } }

/* ---------- premium backdrop: three light pools + faded halftone ripple (two corners) ---------- */
.backdrop { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.backdrop i { position: absolute; inset: 0; }
.pools {
  background:
    radial-gradient(42vmax 34vmax at 6% 4%, var(--pool-a), transparent 70%),
    radial-gradient(36vmax 30vmax at 96% 18%, var(--pool-b), transparent 70%),
    radial-gradient(48vmax 34vmax at 70% 108%, var(--pool-c), transparent 70%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 55%, transparent), transparent 46%);
}
.ripple {
  background: var(--ripple);
  -webkit-mask: url('/images/ripple-tl.svg') left top / min(760px, 70vw) no-repeat, url('/images/ripple-br.svg') right bottom / min(760px, 70vw) no-repeat;
  mask: url('/images/ripple-tl.svg') left top / min(760px, 70vw) no-repeat, url('/images/ripple-br.svg') right bottom / min(760px, 70vw) no-repeat;
}

/* progress bar */
#progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60; pointer-events: none; }
#progress span { display: block; height: 100%; width: 0; background: var(--accent); }

/* ---------- header ---------- */
#top { position: sticky; top: 0; z-index: 50; border-bottom: 1px solid transparent; transition: border-color .2s; }
/* Blur lives on a pseudo-element: backdrop-filter on #top itself would clip the fixed drawer and scrim to the header. */
#top::before { content: ''; position: absolute; inset: 0; z-index: -1; background: color-mix(in srgb, var(--paper) 82%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
#top.stuck { border-bottom-color: var(--line); }
.bar { max-width: 1240px; margin: 0 auto; padding: 12px 28px; display: grid; grid-template-columns: auto auto 1fr auto; gap: 16px; align-items: center; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 900 1.45rem var(--font-display); letter-spacing: -0.03em; }
.logo-mark { width: 34px; height: 34px; }

.depth-sw { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.depth-sw button { display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; color: var(--mute); font: 600 .9rem var(--font-body); padding: 7px 14px; border-radius: 999px; cursor: pointer; transition: background .2s, color .2s; }
.depth-sw button:hover { color: var(--ink); }
.depth-sw button[aria-pressed='true'] { background: var(--ink); color: var(--paper); }
.dd { display: inline-flex; gap: 2px; align-items: flex-end; }
.dd i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .3; }
.dd i:nth-child(2) { width: 6px; height: 6px; }
.dd i:nth-child(3) { width: 8px; height: 8px; }
.dd i.on { opacity: 1; }

.find { display: flex; align-items: center; gap: 10px; min-width: 0; max-width: 360px; justify-self: end; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 9px 16px; color: var(--mute); font: 500 .95rem var(--font-body); cursor: text; }
.find:hover { border-color: var(--ink); }
.find-ic { display: inline-flex; }
.find-tx { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
kbd { font: 500 .78rem var(--font-mono); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; background: var(--paper); color: var(--mute); }
.menu-btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); font: 700 .92rem var(--font-body); padding: 9px 16px; border-radius: 999px; cursor: pointer; }
.menu-btn:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

@media (max-width: 860px) {
  .bar { grid-template-columns: 1fr auto auto; grid-template-areas: 'brand find menu' 'depth depth depth'; padding: 10px 16px; gap: 10px 12px; }
  .brand { grid-area: brand; }
  .find { grid-area: find; width: auto; padding: 10px 12px; }
  .find-tx, .find kbd { display: none; }
  .menu-btn { grid-area: menu; }
  .depth-sw { grid-area: depth; display: grid; grid-template-columns: repeat(3, 1fr); }
  .depth-sw button { justify-content: center; padding: 8px 6px; }
}

/* ---------- drawer (modal) ---------- */
.scrim { position: fixed; inset: 0; background: color-mix(in srgb, #140e12 52%, transparent); z-index: 70; }
.drawer { position: fixed; inset: 0 0 0 auto; width: min(420px, 100%); background: var(--surface); z-index: 80; padding: 24px 30px 24px; transform: translateX(105%); transition: transform .35s var(--ease), visibility 0s linear .35s; display: flex; flex-direction: column; overflow-y: auto; border-left: 1px solid var(--line); visibility: hidden; box-shadow: var(--shadow); }
.drawer.open { transform: none; visibility: visible; transition: transform .35s var(--ease); }
.drawer-x { flex: none; align-self: flex-end; border: 1px solid var(--line); background: transparent; color: var(--ink); width: 42px; height: 42px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; }
.drawer-x:hover { background: var(--ink); color: var(--paper); }
.d-list { list-style: none; margin: 0 0 24px; padding: 0; }
.d-list a { display: flex; align-items: baseline; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); text-decoration: none; font: 800 1.6rem var(--font-display); letter-spacing: -0.02em; }
.d-list a i { font: 500 .8rem var(--font-mono); color: var(--mute); font-style: normal; }
.d-list a:hover, .d-list a[aria-current='page'] { color: var(--accent); }
.d-shelves { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 6px; }
.d-shelves a { display: flex; align-items: center; gap: 12px; text-decoration: none; padding: 9px 12px; border-radius: 12px; font-weight: 600; }
.d-shelves a i { width: 14px; height: 14px; border-radius: 50%; background: var(--c); }
.d-shelves a em { margin-left: auto; font: 500 .8rem var(--font-mono); color: var(--mute); font-style: normal; }
.d-shelves a:hover, .d-shelves a[aria-current='page'] { background: var(--ct); }
.d-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; }

/* ---------- shared bits ---------- */
.eyebrow { font: 500 .78rem var(--font-mono); text-transform: uppercase; letter-spacing: .12em; color: var(--mute); margin: 0 0 .9em; }
.lede { font-size: 1.25rem; line-height: 1.55; color: var(--mute); max-width: 56ch; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; font: 700 .98rem var(--font-body); padding: 12px 22px; border-radius: 999px; border: 2px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer; text-decoration: none; transition: transform .2s var(--ease), background .2s, color .2s; white-space: nowrap; }
.btn:hover { transform: translateY(-2px); }
.btn:disabled { opacity: .6; cursor: progress; transform: none; }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-accent:hover { background: var(--surface); color: var(--accent); }
.btn-line:hover { background: var(--ink); color: var(--paper); }
.btn.block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; font: 600 .95rem var(--font-body); color: var(--accent); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.field { width: 100%; font: 400 1rem var(--font-body); color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 16px; transition: border-color .2s, box-shadow .2s; }
.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 24%, transparent); }
.field[aria-invalid='true'] { border-color: var(--rose); }
textarea.field { resize: vertical; line-height: 1.5; }
.mono-area { font-family: var(--font-mono); font-size: .9rem; }
.lbl { display: block; font: 700 .85rem var(--font-body); margin: 18px 0 6px; }
.check { display: flex; align-items: center; gap: 10px; margin: 14px 0; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; font: 600 .9rem var(--font-body); padding: 7px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; transition: background .2s, border-color .2s; }
.chip i { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--mute)); }
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed='true'] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip[aria-pressed='true'] i { box-shadow: 0 0 0 2px var(--paper); }
.sec-head { margin-bottom: 28px; }
.sec-head h2 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); margin: 0; }
.sec-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head { padding-top: 48px; padding-bottom: 24px; }
.page-head h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); max-width: 18ch; }
.empty { color: var(--mute); padding: 32px 0; }
.alert { background: var(--rose-tint); color: var(--rose); border-radius: 12px; padding: 10px 14px; font-weight: 600; margin-bottom: 8px; }
.table-wrap { overflow-x: auto; }

/* depth layers: html[data-depth] decides how many are visible */
html[data-depth='glance'] .lay-2, html[data-depth='glance'] .lay-3, html[data-depth='read'] .lay-3 { display: none !important; }

/* toast */
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 120; display: grid; gap: 8px; }
.toast { background: var(--ink); color: var(--paper); padding: 11px 20px; border-radius: 999px; font-weight: 600; animation: pop .3s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(10px); } }

/* page entrance, loading skeleton, error state */
#main { min-height: 70vh; }
#main.enter { animation: rise .45s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.skel { padding-top: 48px; display: grid; gap: 16px; }
.skel i { display: block; height: 18px; border-radius: 10px; background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.skel i.h { height: 54px; width: min(620px, 80%); }
.skel i.s { width: 40%; }
.skel i.b { height: 180px; border-radius: var(--r); }
@keyframes shimmer { to { background-position: -200% 0; } }
.fail { padding-top: 72px; max-width: 640px; }
.fail h1 { font-size: clamp(2rem, 5vw, 3rem); }
.fail-actions { display: flex; gap: 12px; flex-wrap: wrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ---------- search modal ---------- */
.ask { position: fixed; inset: 0; background: color-mix(in srgb, #140e12 55%, transparent); z-index: 110; display: none; align-items: flex-start; justify-content: center; padding: 12vh 16px 0; }
.ask.open { display: flex; }
.ask-box { width: min(640px, 100%); background: var(--surface); border-radius: var(--r-lg); padding: 22px 24px; border: 1px solid var(--line); box-shadow: var(--shadow); position: relative; }
.ask-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.ask-lbl { display: block; font: 500 .78rem var(--font-mono); text-transform: uppercase; letter-spacing: .12em; color: var(--mute); }
.ask-x { border: 1px solid var(--line); background: transparent; color: var(--ink); width: 36px; height: 36px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; }
.ask-x:hover { background: var(--ink); color: var(--paper); }
.ask-box input { width: 100%; font: 800 1.5rem var(--font-display); border: 0; border-bottom: 3px solid var(--ink); background: transparent; color: var(--ink); padding: 6px 0 10px; letter-spacing: -0.02em; }
.ask-box input:focus { outline: none; border-color: var(--accent); }
.ask-list { margin: 14px 0 0; padding: 0; list-style: none; display: grid; max-height: 50vh; overflow-y: auto; }
.ask-list a { display: flex; gap: 14px; align-items: baseline; padding: 11px 10px; border-radius: 10px; text-decoration: none; font-weight: 600; }
.ask-list a i { font: 500 .8rem var(--font-mono); color: var(--c); font-style: normal; }
.ask-list a:hover, .ask-list a[aria-selected='true'] { background: var(--ct); }
.ask-none, .ask-hint { color: var(--mute); font-size: .9rem; margin: 10px 0 0; }

/* ---------- footer ---------- */
.foot { background: var(--foot-bg); color: var(--foot-ink); margin-top: 64px; padding: 48px 0 24px; }
.foot-main { max-width: 1240px; margin: 0 auto; padding: 0 28px; display: grid; grid-template-columns: 1fr 1.3fr .7fr; gap: 48px; }
.foot-word { display: flex; align-items: center; gap: 14px; font: 900 clamp(2.4rem, 5vw, 3.6rem) var(--font-display); letter-spacing: -0.04em; margin: 0 0 8px; line-height: 1; }
.foot-mark { width: 48px; height: 48px; }
.foot-tag { color: var(--foot-mute); margin: 0; }
.foot-sub h2 { font-size: 1.35rem; letter-spacing: -0.01em; }
.foot-sub p { color: var(--foot-mute); }
.sub-form { display: flex; gap: 10px; }
.sub-form .field { flex: 1 1 auto; min-width: 0; background: var(--foot-field); border-color: var(--foot-line); color: var(--foot-ink); }
.sub-form .btn { flex: none; background: var(--foot-ink); border-color: var(--foot-ink); color: var(--foot-bg); }
.sub-form .btn:hover { background: transparent; color: var(--foot-ink); }
.sub-status { margin: 10px 0 0; font-size: .95rem; min-height: 1.4em; color: var(--foot-ink); }
.sub-status.err { color: #ffb3c0; }
.sub-status a { color: inherit; }
.foot-nav { display: grid; gap: 10px; align-content: start; }
.foot-nav a { text-decoration: none; font-weight: 600; color: var(--foot-ink); opacity: .85; }
.foot-nav a:hover { opacity: 1; text-decoration: underline; }
.foot-note { max-width: 1240px; margin: 40px auto 0; padding: 20px 28px 0; border-top: 1px solid var(--foot-line); color: var(--foot-mute); font-size: .9rem; }
@media (max-width: 860px) { .foot-main { grid-template-columns: 1fr; gap: 28px; padding: 0 16px; } .foot-note { padding-inline: 16px; } }
@media (max-width: 420px) { .sub-form { flex-direction: column; } }
