/* ════════════════════════════════════════════════════════════════════
   cwwang.com — Che-Wei Wang, works 1997–2013
   Built on the CW&T Design System (colors_and_type.css tokens).
   ════════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: "Space Mono";
  src: url("/assets/fonts/SpaceMono-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Space Mono";
  src: url("/assets/fonts/SpaceMono-RegularItalic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Space Mono";
  src: url("/assets/fonts/SpaceMono-Bold.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Space Mono";
  src: url("/assets/fonts/SpaceMono-BoldItalic.woff2") format("woff2");
  font-weight: 700; font-style: italic; font-display: swap;
}

:root {
  /* ─── Type ───────────────────────────────────────────── */
  --font-mono: "Space Mono", "JetBrains Mono", "Menlo", "Courier New", monospace;

  --fs-12: 11px;
  --fs-14: 13px;
  --fs-16: 15px;
  --fs-18: 17px;
  --fs-20: 19px;
  --fs-24: 22px;
  --fs-32: 30px;
  --fs-48: 44px;
  --fs-64: 60px;

  --lh-tight: 1.15;
  --lh-snug: 1.35;
  --lh-body: 1.55;

  --ls-label: 0.04em;
  --ls-tight: -0.01em;

  /* ─── Ink + paper ─────────────────────────────────────── */
  --ink: #111111;
  --ink-soft: #4a4a4a;
  --ink-faint: #8a8a8a;
  --rule: #e3e3e3;
  --rule-soft: #efefef;
  --paper: #ffffff;
  --paper-2: #f6f5f2;
  --paper-3: #ececea;

  --signal-red: #d11d1d;

  /* ─── Spacing — 4px base ──────────────────────────────── */
  --sp-1: 4px;   --sp-2: 8px;   --sp-3: 12px;  --sp-4: 16px;
  --sp-5: 20px;  --sp-6: 24px;  --sp-8: 32px;  --sp-10: 40px;
  --sp-12: 48px; --sp-16: 64px; --sp-24: 96px;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --dur: 200ms;

  --bar-h: 44px;
  --gutter: var(--sp-6);
  --maxw: 1440px;
  --measure: 62ch;
}

/* ─── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--bar-h) + 16px); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--fs-16);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; height: auto; display: block; border: 0; }
h1, h2, h3, h4, h5, p, figure, table { margin: 0; }
button { font: inherit; color: inherit; }

a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: opacity var(--dur) var(--ease);
}
a:hover { opacity: 0.55; }
a:active { opacity: 0.8; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--paper); padding: var(--sp-2) var(--sp-4);
  text-decoration: none;
}
.skip:focus { left: 0; }

/* ─── Shared roles ──────────────────────────────────────── */
.label {
  font-size: var(--fs-14);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--ink-faint);
}
.id-label {
  font-weight: 700;
  font-size: var(--fs-14);
  letter-spacing: 0.06em;
  color: var(--ink);
}
.id-label__expansion {
  font-weight: 400;
  font-size: var(--fs-14);
  color: var(--ink-faint);
  letter-spacing: 0.02em;
}
.hr { height: 1px; background: var(--rule); border: 0; margin: 0; }

/* ─── Header bar ────────────────────────────────────────── */
.bar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4);
  height: var(--bar-h);
  padding: 0 var(--gutter);
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.bar__mark {
  font-weight: 700;
  font-size: var(--fs-14);
  letter-spacing: 0.08em;
  text-decoration: none;
  white-space: nowrap;
}
.bar__nav {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-14);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
}
.bar__nav a { text-decoration: none; }
.bar__nav a:hover { text-decoration: underline; }
.dot { color: var(--ink-faint); }

/* ─── Layout ────────────────────────────────────────────── */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.wrap--post { max-width: 980px; }

/* ─── Masthead ──────────────────────────────────────────── */
.masthead { padding: var(--sp-12) 0 var(--sp-10); }
.masthead__id { margin-bottom: var(--sp-10); }
.masthead__id .id-label__expansion { display: block; margin-top: var(--sp-1); }
.masthead__h1 {
  font-weight: 700;
  font-size: clamp(44px, 11vw, 132px);
  line-height: 0.92;
  letter-spacing: -0.03em;
  margin-bottom: var(--sp-6);
}
.masthead__lede {
  max-width: var(--measure);
  color: var(--ink-soft);
  font-size: var(--fs-18);
  line-height: var(--lh-body);
}
.masthead--cat { padding-bottom: var(--sp-8); }
.masthead__h1--cat {
  font-size: clamp(32px, 7vw, 76px);
  margin-top: var(--sp-8);
}

/* ─── Spec tables — honest key/value, hairline rules ────── */
.specs { padding: var(--sp-10) 0; }
.spec-table {
  width: 100%;
  max-width: 860px;
  border-collapse: collapse;
  font-size: var(--fs-14);
}
.spec-table th, .spec-table td {
  text-align: left;
  vertical-align: top;
  padding: var(--sp-3) var(--sp-4) var(--sp-3) 0;
  border-bottom: 1px solid var(--rule-soft);
  font-weight: 400;
}
.spec-table tr:last-child th,
.spec-table tr:last-child td { border-bottom: 0; }
.spec-table th {
  width: 180px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: var(--ls-label);
  white-space: nowrap;
}
.spec-table--tight { margin-top: var(--sp-6); }
.spec-table--tight th { width: 140px; }

/* ─── Filter controls ───────────────────────────────────── */
.controls { padding: var(--sp-8) 0 var(--sp-6); }
.controls__row {
  display: flex;
  align-items: baseline;
  gap: var(--sp-6);
}
.controls__row > .label { flex: 0 0 auto; width: 72px; padding-top: 2px; }
.controls__row--status { margin-top: var(--sp-5); }
.count { font-size: var(--fs-14); color: var(--ink-soft); }

.filts { display: flex; flex-wrap: wrap; gap: 0; }
.filt {
  background: none;
  border: 1px solid var(--rule);
  border-radius: 0;
  margin: 0 -1px -1px 0;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-14);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity var(--dur) var(--ease);
}
.filt:hover { opacity: 0.55; }
.filt__n { color: var(--ink-faint); margin-left: var(--sp-1); }
.filt.is-on {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
  position: relative;
  z-index: 1;
}
.filt.is-on .filt__n { color: var(--paper); opacity: 0.6; }

/* ─── Work grid ─────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-8) var(--sp-5);
  padding: var(--sp-4) 0 var(--sp-16);
}
.tile {
  display: block;
  text-decoration: none;
  transition: opacity var(--dur) var(--ease);
}
.tile:hover { opacity: 0.55; }
.tile[hidden] { display: none; }
.tile__img {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  overflow: hidden;
}
.tile__img img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
}
.tile__img--text {
  display: flex;
  align-items: flex-start;
  padding: var(--sp-4);
  background: var(--paper-2);
}
.tile__img--text p {
  font-size: var(--fs-14);
  line-height: var(--lh-snug);
  color: var(--ink-soft);
  overflow: hidden;
}
.tile__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  padding-top: var(--sp-2);
  font-size: var(--fs-14);
  line-height: var(--lh-snug);
}
.tile__title { color: var(--ink); }
.tile__year { color: var(--ink-faint); flex: 0 0 auto; }
.grid__empty {
  grid-column: 1 / -1;
  padding: var(--sp-16) 0;
  color: var(--ink-faint);
  font-size: var(--fs-14);
  text-transform: uppercase;
  letter-spacing: var(--ls-label);
}

/* ─── Post page ─────────────────────────────────────────── */
.post__head { padding: var(--sp-12) 0 var(--sp-8); }
.post__h1 {
  font-weight: 700;
  font-size: clamp(28px, 5.5vw, 52px);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  margin-top: var(--sp-6);
  max-width: 20ch;
}
.post__body { padding: var(--sp-10) 0 var(--sp-12); }
.post__body > p,
.post__body > ul,
.post__body > ol,
.post__body > blockquote,
.post__body > h3,
.post__body > h4,
.post__body > pre,
.post__body > .dead-embed { max-width: var(--measure); }
.post__body p { margin: 0 0 var(--sp-5); }
.post__body h3 {
  font-size: var(--fs-20);
  font-weight: 700;
  margin: var(--sp-10) 0 var(--sp-4);
  line-height: var(--lh-snug);
}
.post__body h4 {
  font-size: var(--fs-16);
  font-weight: 700;
  margin: var(--sp-8) 0 var(--sp-3);
}
.post__body ul, .post__body ol { margin: 0 0 var(--sp-5); padding-left: var(--sp-6); }
.post__body li { margin-bottom: var(--sp-2); }
.post__body blockquote {
  margin: 0 0 var(--sp-5);
  padding-left: var(--sp-5);
  border-left: 1px solid var(--rule);
  color: var(--ink-soft);
}
.post__body pre {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  padding: var(--sp-4);
  overflow-x: auto;
  font-size: var(--fs-14);
  line-height: var(--lh-snug);
  margin: 0 0 var(--sp-5);
  max-width: 100%;
}
.post__body code {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  padding: 1px 6px;
  font-size: 0.95em;
}
.post__body pre code { background: none; border: 0; padding: 0; }

/* ── Plates ──────────────────────────────────────────────
   A run of images with no prose between them becomes one contact-sheet
   grid. A lone image gets the full plate width, uncropped. */
.figs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: var(--sp-3);
  margin: 0 0 var(--sp-8);
  max-width: 100%;
}
.figs .fig {
  display: block;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--rule);
  background: var(--paper-2);
  overflow: hidden;
  text-decoration: none;
  transition: opacity var(--dur) var(--ease);
}
.figs .fig:hover { opacity: 0.55; }
.figs .fig img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
  border: 0; margin: 0;
}

.fig-solo {
  display: block;
  margin: 0 0 var(--sp-8);
  max-width: 860px;
}
.fig-solo .fig {
  display: block;
  text-decoration: none;
  transition: opacity var(--dur) var(--ease);
}
.fig-solo .fig:hover { opacity: 0.55; }
.fig-solo img {
  border: 1px solid var(--rule);
  background: var(--paper-2);
  width: 100%; height: auto;
  margin: 0;
}

/* Stray images left inside prose */
.post__body p img {
  border: 1px solid var(--rule);
  background: var(--paper-2);
  margin: var(--sp-2) 0;
  max-width: 100%;
}
.post__body .alignleft,
.post__body .alignright,
.post__body .aligncenter,
.post__body .alignnone { float: none; margin-left: 0; margin-right: 0; }

.embed {
  position: relative;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--rule);
  background: var(--paper-2);
  margin: 0 0 var(--sp-5);
  max-width: 860px;
}
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.dead-embed {
  font-size: var(--fs-14);
  color: var(--ink-faint);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  border: 1px solid var(--rule);
  padding: var(--sp-4);
  background: var(--paper-2);
}

/* ─── Prev / next ───────────────────────────────────────── */
.postnav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-5);
  padding: var(--sp-8) 0;
}
.pn {
  display: block;
  text-decoration: none;
  font-size: var(--fs-14);
  line-height: var(--lh-snug);
}
.pn .label { display: block; margin-bottom: var(--sp-2); }
.pn--next { text-align: right; }
.pn__t { display: block; }
.pn--empty { display: block; }

.backline {
  padding: 0 0 var(--sp-16);
  font-size: var(--fs-14);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
}
.backline a { text-decoration: none; }
.backline a:hover { text-decoration: underline; }

/* ─── Footer ────────────────────────────────────────────── */
.foot {
  border-top: 1px solid var(--rule);
  padding: var(--sp-6) var(--gutter) var(--sp-10);
  max-width: var(--maxw);
  margin: 0 auto;
}
.foot__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-2) 0;
  font-size: var(--fs-14);
}
.foot__row--sub { color: var(--ink-faint); }
.foot__row--sub a { color: var(--ink-faint); }
.foot__v { color: var(--ink-faint); letter-spacing: var(--ls-label); }

/* ─── Narrow ────────────────────────────────────────────── */
@media (max-width: 720px) {
  :root { --gutter: var(--sp-4); }
  .bar__nav { font-size: var(--fs-12); gap: var(--sp-1); }
  .masthead { padding: var(--sp-8) 0 var(--sp-6); }
  .masthead__id { margin-bottom: var(--sp-6); }
  .controls__row { flex-direction: column; gap: var(--sp-3); }
  .controls__row > .label { width: auto; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .spec-table th { width: 108px; white-space: normal; }
  .postnav { grid-template-columns: 1fr; }
  .pn--next { text-align: left; }
  .foot__row { flex-direction: column; gap: var(--sp-1); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 1ms !important; }
}

/* ─── Print ─────────────────────────────────────────────── */
@media print {
  .bar, .controls, .postnav, .backline, .skip { display: none; }
  a { text-decoration: none; }
  .tile__img, .post__body img { border: 1px solid #ccc; }
}
