/* ClawHunt v5 — base: reset, type, layout primitives, accessibility. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 24px);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  font-weight: 420;
  font-stretch: 100%;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01" on, "cv05" on;
  overflow-x: clip;
}

:lang(zh) body,
html[lang="zh-CN"] body {
  line-height: 1.72;
  letter-spacing: 0.01em;
}

img,
svg,
video,
canvas,
picture {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

p,
h1,
h2,
h3,
h4,
h5,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0;
}

table {
  border-collapse: collapse;
  width: 100%;
}

::selection {
  background: color-mix(in oklab, var(--accent) 26%, transparent);
  color: var(--ink);
}

:focus {
  outline: none;
}

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

[hidden] {
  display: none !important;
}

/* ── type roles ─────────────────────────────── */

.t-display-xl,
.t-display,
.t-h1,
.t-h2 {
  font-family: var(--font-sans);
  font-weight: 700;
  text-wrap: balance;
}

.t-display-xl {
  font-size: var(--fs-display-xl);
  line-height: 0.86;
  font-stretch: var(--wdth-display);
  font-weight: 720;
  letter-spacing: var(--track-display);
}

.t-display {
  font-size: var(--fs-display);
  line-height: 0.93;
  font-stretch: var(--wdth-display);
  font-weight: 690;
  letter-spacing: var(--track-display);
}

.t-h1 {
  font-size: var(--fs-h1);
  line-height: 1.02;
  font-stretch: var(--wdth-head);
  font-weight: 660;
  letter-spacing: var(--track-head);
}

.t-h2 {
  font-size: var(--fs-h2);
  line-height: 1.06;
  font-stretch: var(--wdth-head);
  font-weight: 640;
  letter-spacing: var(--track-head);
}

.t-h3 {
  font-size: var(--fs-h3);
  line-height: 1.2;
  font-weight: 620;
  letter-spacing: -0.012em;
}

.t-h4 {
  font-size: var(--fs-h4);
  line-height: 1.3;
  font-weight: 620;
  letter-spacing: -0.006em;
}

.t-lede {
  font-size: var(--fs-body-l);
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 44ch;
  text-wrap: pretty;
}

.t-body {
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--ink-2);
  text-wrap: pretty;
}

.t-small {
  font-size: var(--fs-small);
  line-height: 1.5;
  color: var(--ink-2);
}

.t-micro {
  font-size: var(--fs-micro);
  line-height: 1.4;
  color: var(--ink-3);
}

.t-read {
  font-family: var(--font-read);
  font-size: 1.1875rem;
  line-height: 1.66;
  font-weight: 400;
  font-optical-sizing: auto;
  color: var(--ink);
}

.t-quote {
  font-family: var(--font-read);
  font-style: italic;
  font-weight: 380;
  font-size: clamp(1.4rem, 2.2vw, 2rem);
  line-height: 1.32;
  letter-spacing: -0.01em;
}

/* Standalone figures (prices, stats, dates) use proportional lining figures: Mona Sans
   draws its tabular zero slashed, which reads as "Ø" in "$0" or "0%". Columns that must
   align opt back in with .t-tab (tables do this already). */
.t-num {
  font-variant-numeric: lining-nums proportional-nums;
}

.t-tab {
  font-variant-numeric: tabular-nums lining-nums;
}

.t-code,
code,
kbd,
samp,
pre {
  font-family: var(--font-code);
  font-size: 0.875em;
}

/* CJK glyphs are square and wide: the Latin display scale is far too big for them */
:lang(zh) .t-display-xl {
  font-size: clamp(2.9rem, 6.4vw, 6.75rem);
  letter-spacing: 0;
  line-height: 1.08;
}

:lang(zh) .t-display {
  font-size: clamp(2.3rem, 4.4vw, 4.5rem);
  letter-spacing: 0;
  line-height: 1.12;
}

:lang(zh) .t-h1 {
  font-size: clamp(2rem, 3.3vw, 3.1rem);
  letter-spacing: 0;
  line-height: 1.18;
}

:lang(zh) .t-h2 {
  font-size: clamp(1.6rem, 2.4vw, 2.3rem);
  letter-spacing: 0;
  line-height: 1.2;
}

/* CJK can break between any two characters, which splits words in big headings
   ("建 / 设者"). Break at punctuation and spaces instead; a phrase wider than the line
   may still wrap anywhere rather than overflow. */
:lang(zh) :is(h1, h2, h3, .t-display-xl, .t-display, .t-h1, .t-h2, .t-h3) {
  word-break: keep-all;
  overflow-wrap: anywhere;
}

/* ── layout primitives ──────────────────────── */

.wrap {
  width: 100%;
  max-width: calc(var(--max) + var(--margin) * 2);
  margin-inline: auto;
  padding-inline: var(--margin);
}

.wrap--narrow {
  max-width: calc(880px + var(--margin) * 2);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gutter);
}

.section {
  padding-block: var(--section);
}

.section--tight {
  padding-block: var(--section-tight);
}

/* The "field label" split: a narrow column names the block, a wide one carries it. */
.split {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 9fr);
  gap: var(--s-6) var(--gutter);
  align-items: start;
}

.split__label {
  position: sticky;
  top: calc(var(--header-h) + 32px);
  font-size: var(--fs-small);
  line-height: 1.45;
  color: var(--ink-2);
  font-weight: 560;
  padding-top: 0.6em;
}

.split__label .t-read {
  font-size: 1.05rem;
  font-style: italic;
  font-weight: 420;
  color: var(--ink-2);
}

@media (max-width: 900px) {
  .split {
    grid-template-columns: minmax(0, 1fr);
  }

  .split__label {
    position: static;
    padding-top: 0;
  }
}

.stack > * + * {
  margin-top: var(--stack, var(--s-4));
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--cluster, var(--s-3));
  align-items: center;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: -80px;
  z-index: 1000;
  background: var(--btn);
  color: var(--btn-ink);
  padding: 10px 16px;
  border-radius: var(--r-pill);
  font-weight: 600;
  transition: top var(--t-med) var(--ease-out);
}

.skip-link:focus-visible {
  top: 16px;
}

/* ── the tank: story-page hero frame ───────────── */

.tank {
  position: relative;
  margin: var(--tank-inset);
  border-radius: var(--r-tank);
  overflow: clip;
  isolation: isolate;
  min-height: min(92svh, 980px);
  background: var(--bg-deep);
  box-shadow: 0 0 0 1px var(--tank-edge) inset;
}

.tank::after {
  /* the glass edge: a faint inner rim that catches light at the top */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 5;
  box-shadow:
    0 1px 0 0 rgb(255 255 255 / 0.55) inset,
    0 0 0 1px rgb(11 34 48 / 0.06) inset;
}

[data-theme="dark"] .tank::after {
  box-shadow:
    0 1px 0 0 rgb(255 255 255 / 0.08) inset,
    0 0 0 1px rgb(255 255 255 / 0.04) inset;
}

.tank__canvas,
.tank__poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.tank__poster {
  object-fit: cover;
  z-index: 0;
}

.tank__canvas {
  z-index: 1;
}

.tank__content {
  position: relative;
  z-index: 3;
}

@media (max-width: 640px) {
  .tank {
    --r-tank: 24px;
    min-height: 88svh;
  }
}

/* ── reduced motion ─────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
