/* Glassmorphism 2.0 — antjanus.com redesign 006
   Every readable surface is a frosted panel over a living mesh-gradient backdrop.
   Legibility comes from fill opacity, not from luck: panels carry enough tint that
   text contrast holds against the brightest blob behind them. */

/* ---------- Primitives ---------- */
:root {
  --slate-950: #0c1626;
  --slate-800: #2c3a4f;
  --slate-650: #44526a;
  --brand: #364f6a;
  --brand-deep: #2a3f54;
  --brand-ice: #a9c8ea;
  --white: #ffffff;

  --font-sans: "Geist", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Instrument Serif", "Fraunces", Georgia, serif;
  --font-mono: "Geist Mono", "JetBrains Mono", ui-monospace, Menlo, monospace;

  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 28px;
  --r-xl: 36px;
  --r-pill: 999px;

  --page-max: 1240px;
  --gutter: clamp(16px, 4vw, 40px);
  --blur: 18px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* ---------- Semantic tokens: light ---------- */
:root {
  color-scheme: light;
  --ground: #e6ecf6;
  --ink: var(--slate-950);
  --ink-2: var(--slate-800);
  --ink-3: var(--slate-650);
  --link: var(--brand);
  --link-hover: var(--brand-deep);

  --glass: rgba(255, 255, 255, .60);
  --glass-strong: rgba(255, 255, 255, .84);
  --glass-reading: rgba(255, 255, 255, .88);
  --glass-tint: rgba(54, 79, 106, .08);
  --glass-border: rgba(255, 255, 255, .78);
  --glass-edge: rgba(24, 40, 68, .10);
  --glass-shadow: 0 24px 60px -28px rgba(20, 36, 66, .35), 0 2px 6px -2px rgba(20, 36, 66, .08);
  --specular: rgba(255, 255, 255, .62);
  --rim: inset 0 1px 0 rgba(255, 255, 255, .9), inset 0 -1px 0 rgba(24, 40, 68, .05);

  --smoke: rgba(12, 22, 38, .92);
  --smoke-ink: #eef3fb;
  --smoke-ink-2: #c7d3e3;

  --btn-bg: rgba(42, 63, 84, .94);
  --btn-bg-hover: #1f3247;
  --btn-ink: #ffffff;

  --chip: rgba(255, 255, 255, .55);
  --chip-border: rgba(24, 40, 68, .14);
  --focus: #1d5fd1;
  --code-bg: rgba(13, 20, 34, .90);
  --code-ink: #e5ecf6;

  --ok: #1c6e52;
  --warn: #7e610f;
  --bad: #a03227;
  --signal: #a65210;

  /* mesh blobs — overridden per page */
  --b1: #6f98d8;
  --b2: #f2a077;
  --b3: #a58df0;
  --b4: #6fd0bd;
  --mesh-alpha: .95;
}

/* ---------- Semantic tokens: dark ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ground: #060a13;
    --ink: #eef3fb;
    --ink-2: #c8d3e2;
    --ink-3: #a3b0c3;
    --link: #a9c8ea;
    --link-hover: #d4e5f7;
    --glass: rgba(16, 24, 40, .56);
    --glass-strong: rgba(13, 19, 32, .82);
    --glass-reading: rgba(11, 16, 27, .88);
    --glass-tint: rgba(169, 200, 234, .06);
    --glass-border: rgba(255, 255, 255, .13);
    --glass-edge: rgba(0, 0, 0, .4);
    --glass-shadow: 0 30px 70px -30px rgba(0, 0, 0, .8), 0 2px 8px -2px rgba(0, 0, 0, .4);
    --specular: rgba(255, 255, 255, .14);
    --rim: inset 0 1px 0 rgba(255, 255, 255, .16), inset 0 -1px 0 rgba(0, 0, 0, .3);
    --smoke: rgba(4, 7, 14, .78);
    --btn-bg: rgba(169, 200, 234, .95);
    --btn-bg-hover: #d4e5f7;
    --btn-ink: #0b1524;
    --chip: rgba(255, 255, 255, .07);
    --chip-border: rgba(255, 255, 255, .16);
    --focus: #8fc0ff;
    --code-bg: rgba(3, 6, 12, .78);
    --ok: #4fbe93; --warn: #ddb44a; --bad: #ee8579; --signal: #e39a4a;
    --b1: #274f86; --b2: #7a3f28; --b3: #43338c; --b4: #155f59;
    --mesh-alpha: .9;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #060a13;
  --ink: #eef3fb;
  --ink-2: #c8d3e2;
  --ink-3: #a3b0c3;
  --link: #a9c8ea;
  --link-hover: #d4e5f7;
  --glass: rgba(16, 24, 40, .56);
  --glass-strong: rgba(13, 19, 32, .82);
  --glass-reading: rgba(11, 16, 27, .88);
  --glass-tint: rgba(169, 200, 234, .06);
  --glass-border: rgba(255, 255, 255, .13);
  --glass-edge: rgba(0, 0, 0, .4);
  --glass-shadow: 0 30px 70px -30px rgba(0, 0, 0, .8), 0 2px 8px -2px rgba(0, 0, 0, .4);
  --specular: rgba(255, 255, 255, .14);
  --rim: inset 0 1px 0 rgba(255, 255, 255, .16), inset 0 -1px 0 rgba(0, 0, 0, .3);
  --smoke: rgba(4, 7, 14, .78);
  --btn-bg: rgba(169, 200, 234, .95);
  --btn-bg-hover: #d4e5f7;
  --btn-ink: #0b1524;
  --chip: rgba(255, 255, 255, .07);
  --chip-border: rgba(255, 255, 255, .16);
  --focus: #8fc0ff;
  --code-bg: rgba(3, 6, 12, .78);
  --ok: #4fbe93; --warn: #ddb44a; --bad: #ee8579; --signal: #e39a4a;
  --b1: #274f86; --b2: #7a3f28; --b3: #43338c; --b4: #155f59;
  --mesh-alpha: .9;
}

/* Per-page mesh palettes: each section of the site has its own weather. */
body[data-page="ai"] { --b1: #8a74f0; --b2: #5cc4e6; --b3: #df8fcf; --b4: #7a9ff0; }
body[data-page="writing"] { --b1: #6cc9a3; --b2: #789fdc; --b3: #e4c46e; --b4: #8fb7ea; }
body[data-page="projects"] { --b1: #efb05c; --b2: #6f98d8; --b3: #ef8d72; --b4: #7cc3e0; }
body[data-page="about"] { --b1: #f0957a; --b2: #8fabee; --b3: #f1c66e; --b4: #b48fe6; }
body[data-page="patterns"] { --b1: #5fbde2; --b2: #8698d6; --b3: #86d6bf; --b4: #ad9eee; }
body[data-page="article"] { --b1: #8fa9e2; --b2: #b7a0ef; --b3: #eeb18e; --b4: #88cfc4; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body[data-page="ai"] { --b1: #3b2c8e; --b2: #145a72; --b3: #6b2a63; --b4: #243f86; }
  :root:not([data-theme="light"]) body[data-page="writing"] { --b1: #155c47; --b2: #23457a; --b3: #5e4c17; --b4: #2d4f7c; }
  :root:not([data-theme="light"]) body[data-page="projects"] { --b1: #6f4a17; --b2: #274f86; --b3: #6d2d20; --b4: #1b5670; }
  :root:not([data-theme="light"]) body[data-page="about"] { --b1: #6e3324; --b2: #2b3f82; --b3: #5d4817; --b4: #4b2d78; }
  :root:not([data-theme="light"]) body[data-page="patterns"] { --b1: #17566e; --b2: #2d3a78; --b3: #1b5b4c; --b4: #41337f; }
  :root:not([data-theme="light"]) body[data-page="article"] { --b1: #26407a; --b2: #3e2f7a; --b3: #5a3322; --b4: #1a5550; }
}
:root[data-theme="dark"] body[data-page="ai"] { --b1: #3b2c8e; --b2: #145a72; --b3: #6b2a63; --b4: #243f86; }
:root[data-theme="dark"] body[data-page="writing"] { --b1: #155c47; --b2: #23457a; --b3: #5e4c17; --b4: #2d4f7c; }
:root[data-theme="dark"] body[data-page="projects"] { --b1: #6f4a17; --b2: #274f86; --b3: #6d2d20; --b4: #1b5670; }
:root[data-theme="dark"] body[data-page="about"] { --b1: #6e3324; --b2: #2b3f82; --b3: #5d4817; --b4: #4b2d78; }
:root[data-theme="dark"] body[data-page="patterns"] { --b1: #17566e; --b2: #2d3a78; --b3: #1b5b4c; --b4: #41337f; }
:root[data-theme="dark"] body[data-page="article"] { --b1: #26407a; --b2: #3e2f7a; --b3: #5a3322; --b4: #1a5550; }

/* ---------- Solid mode: the user (or the OS) turned transparency off ---------- */
:root[data-glass="solid"] {
  --glass: #f7f9fc; --glass-strong: #ffffff; --glass-reading: #ffffff; --chip: #eef2f8;
  --blur: 0px;
}
:root[data-glass="solid"][data-theme="dark"] {
  --glass: #111a2a; --glass-strong: #0d1523; --glass-reading: #0d1523; --chip: #1a2436;
}
@media (prefers-color-scheme: dark) {
  :root[data-glass="solid"]:not([data-theme="light"]) { --glass: #111a2a; --glass-strong: #0d1523; --glass-reading: #0d1523; --chip: #1a2436; }
}
@media (prefers-reduced-transparency: reduce) {
  :root { --glass: #f7f9fc; --glass-strong: #ffffff; --glass-reading: #ffffff; --blur: 0px; }
  :root[data-theme="dark"] { --glass: #111a2a; --glass-strong: #0d1523; --glass-reading: #0d1523; }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 110px; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--ground);
  background-image:
    radial-gradient(38vmax 30vmax at 92% 38%, color-mix(in srgb, var(--b3) 70%, transparent), transparent 70%),
    radial-gradient(40vmax 30vmax at 4% 56%, color-mix(in srgb, var(--b4) 65%, transparent), transparent 70%),
    radial-gradient(42vmax 32vmax at 80% 78%, color-mix(in srgb, var(--b2) 65%, transparent), transparent 70%),
    radial-gradient(40vmax 30vmax at 14% 94%, color-mix(in srgb, var(--b1) 70%, transparent), transparent 70%);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.125rem;
  line-height: 1.6;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--link-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 8px; }
h1, h2, h3, h4 { color: var(--ink); line-height: 1.12; margin: 0; letter-spacing: -.02em; font-weight: 600; }
p { margin: 0; }
.serif { font-family: var(--font-serif); font-style: italic; font-weight: 400; letter-spacing: -.01em; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 16px; top: -60px; z-index: 100; padding: 10px 16px; border-radius: var(--r-pill); background: var(--btn-bg); color: var(--btn-ink); }
.skip-link:focus { top: 16px; }

/* ---------- The backdrop ---------- */
.mesh { position: fixed; inset: 0; z-index: -2; overflow: hidden; pointer-events: none; }
.mesh::after {
  /* optional painted mesh from assets/, layered over the CSS blobs; absent file = no-op */
  content: ""; position: absolute; inset: 0; background: url("assets/mesh-backdrop-light.jpg") center / cover no-repeat; opacity: .55; mix-blend-mode: soft-light;
}
:root[data-theme="dark"] .mesh::after { background-image: url("assets/mesh-backdrop-dark.jpg"); }
.blob { position: absolute; border-radius: 50%; opacity: var(--mesh-alpha); filter: blur(10px); will-change: transform; }
.blob-1 { width: 62vmax; height: 62vmax; left: -18vmax; top: -22vmax; background: radial-gradient(circle at 50% 50%, var(--b1) 0%, transparent 66%); animation: drift-a 38s var(--ease) infinite alternate; }
.blob-2 { width: 55vmax; height: 55vmax; right: -16vmax; top: 4vmax; background: radial-gradient(circle at 50% 50%, var(--b2) 0%, transparent 64%); animation: drift-b 44s var(--ease) infinite alternate; }
.blob-3 { width: 50vmax; height: 50vmax; left: 18vmax; bottom: -24vmax; background: radial-gradient(circle at 50% 50%, var(--b3) 0%, transparent 64%); animation: drift-c 50s var(--ease) infinite alternate; }
.blob-4 { width: 36vmax; height: 36vmax; right: 12vmax; bottom: 6vmax; background: radial-gradient(circle at 50% 50%, var(--b4) 0%, transparent 66%); animation: drift-a 57s var(--ease) infinite alternate-reverse; }
.grain {
  position: absolute; inset: -50%; opacity: .16; mix-blend-mode: overlay;
  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='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@keyframes drift-a { to { transform: translate3d(8vmax, 6vmax, 0) scale(1.08); } }
@keyframes drift-b { to { transform: translate3d(-10vmax, 8vmax, 0) scale(.92); } }
@keyframes drift-c { to { transform: translate3d(6vmax, -10vmax, 0) scale(1.1); } }

/* ---------- Glass material ---------- */
.glass {
  position: relative;
  background: linear-gradient(var(--glass-tint), var(--glass-tint)), var(--glass);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(170%);
  backdrop-filter: blur(var(--blur)) saturate(170%);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  box-shadow: var(--rim), var(--glass-shadow), 0 0 0 1px var(--glass-edge);
  isolation: isolate;
}
.glass::before {
  /* specular sheen; follows the pointer on hoverable panels */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  background:
    radial-gradient(420px circle at var(--mx, 12%) var(--my, 0%), var(--specular), transparent 60%),
    linear-gradient(160deg, var(--specular) 0%, transparent 34%);
  opacity: .9;
}
.glass.strong { background: var(--glass-strong); }
.glass.reading { background: var(--glass-reading); }
.glass.smoke { background: var(--smoke); color: var(--smoke-ink); border-color: rgba(255,255,255,.14); }
.glass.smoke .eyebrow { color: #a9c8ea; }
.glass.smoke h2, .glass.smoke h3, .glass.smoke h4 { color: var(--smoke-ink); }
.glass.smoke p, .glass.smoke li { color: var(--smoke-ink-2); }
.glass.smoke a:not(.btn) { color: #bcd6f3; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: var(--glass-strong); }
}
.lift { transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.lift:hover { transform: translateY(-3px); }

/* ---------- Layout ---------- */
.wrap { width: min(var(--page-max), 100% - 2 * var(--gutter)); margin-inline: auto; }
main { padding-top: 112px; padding-bottom: 40px; }
.section { margin-block: clamp(56px, 8vw, 104px); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 28px; }
.section-head h2 { font-size: clamp(2rem, 3.6vw, 2.9rem); }
.section-head p { color: var(--ink-2); margin-top: 8px; max-width: 60ch; }
.eyebrow { font-family: var(--font-mono); font-size: .875rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; }
.lede { font-size: clamp(1.2rem, 1.8vw, 1.45rem); color: var(--ink-2); line-height: 1.5; max-width: 60ch; }
.grid { display: grid; gap: 20px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .cols-3, .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .cols-2, .cols-3, .cols-4 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Nav dock ---------- */
.dock-wrap { position: fixed; top: 14px; left: 0; right: 0; z-index: 50; padding-inline: var(--gutter); pointer-events: none; }
.dock {
  pointer-events: auto; margin-inline: auto; max-width: 1080px;
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px;
  border-radius: var(--r-pill);
  background: var(--glass-strong);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 650; letter-spacing: -.01em; min-height: 44px; }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand .word { font-size: 1.05rem; }
.brand .word span { color: var(--ink-3); font-weight: 450; }
.dock-links { display: flex; gap: 2px; margin: 0 auto; padding: 0; list-style: none; }
.dock-links a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: var(--r-pill);
  color: var(--ink-2); text-decoration: none; font-size: 1rem; font-weight: 500; transition: background .15s, color .15s;
}
.dock-links a:hover { background: var(--chip); color: var(--ink); }
.dock-links a[aria-current="page"] { background: var(--btn-bg); color: var(--btn-ink); }
.dock-links a.ai-link:not([aria-current]) { background: linear-gradient(120deg, rgba(123, 97, 255, .16), rgba(56, 189, 248, .16)); color: var(--ink); }
.dock-tools { display: flex; gap: 6px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--chip-border); background: var(--chip); color: var(--ink); cursor: pointer; padding: 0;
  transition: background .15s;
}
.icon-btn:hover { background: var(--glass-strong); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-ink); }
.menu-btn { display: none; }
.sun { display: none; }
:root[data-theme="dark"] .sun { display: block; }
:root[data-theme="dark"] .moon { display: none; }
.mobile-sheet { display: none; }
@media (max-width: 900px) {
  .dock-links { display: none; }
  .menu-btn { display: inline-grid; }
  .dock-tools { margin-left: auto; }
  .brand .word span { display: none; }
  .mobile-sheet[data-open="true"] {
    display: block; pointer-events: auto; margin: 10px auto 0; max-width: 1080px; padding: 10px; border-radius: var(--r-lg);
    background: var(--glass-strong);
  }
  .mobile-sheet ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
  .mobile-sheet a { display: flex; min-height: 48px; align-items: center; padding: 0 16px; border-radius: var(--r-md); color: var(--ink); text-decoration: none; font-size: 1.1rem; font-weight: 500; }
  .mobile-sheet a[aria-current="page"] { background: var(--btn-bg); color: var(--btn-ink); }
}

/* ---------- Buttons, chips, links ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px;
  border-radius: var(--r-pill); font: 600 1rem/1 var(--font-sans); text-decoration: none; cursor: pointer; border: 1px solid transparent;
  transition: background .15s, transform .15s, color .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--btn-bg); color: var(--btn-ink); box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 10px 24px -12px rgba(20,36,66,.6); }
.btn-primary:hover { background: var(--btn-bg-hover); color: var(--btn-ink); }
.btn-glass { background: var(--chip); color: var(--ink); border-color: var(--chip-border); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.btn-glass:hover { background: var(--glass-strong); color: var(--ink); }
.btn-text { color: var(--ink-2); padding-inline: 6px; text-decoration: underline; text-decoration-color: var(--chip-border); text-underline-offset: 5px; font-weight: 500; }
.btn-text:hover { color: var(--ink); text-decoration-color: currentColor; }
.btn.is-success { background: var(--ok); color: #fff; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 3px 12px; border-radius: var(--r-pill);
  background: var(--chip); border: 1px solid var(--chip-border); color: var(--ink-2);
  font: 500 .875rem/1.3 var(--font-mono); text-decoration: none;
}
a.chip:hover { color: var(--ink); background: var(--glass-strong); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-toggle { cursor: pointer; min-height: 44px; padding: 0 18px; font: 500 1rem/1 var(--font-sans); border-radius: var(--r-pill); border: 1px solid var(--chip-border); background: var(--chip); color: var(--ink-2); }
.pill-toggle:hover { color: var(--ink); background: var(--glass-strong); }
.pill-toggle[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-ink); border-color: transparent; }
.more-link { font-weight: 600; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; min-height: 44px; }
.more-link:hover { text-decoration: underline; }
.badge { font: 600 .8125rem/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; padding: 5px 9px; border-radius: 8px; border: 1px solid currentColor; }
.badge.new { color: var(--ok); }
.badge.updated { color: var(--signal); }

/* ---------- Page hero (non-home) ---------- */
.page-hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: stretch; }
.page-hero .glass { padding: clamp(28px, 4vw, 52px); }
.page-hero h1 { font-size: clamp(2.8rem, 6.4vw, 5.4rem); letter-spacing: -.035em; margin-block: 14px 18px; }
.hero-art { border-radius: var(--r-lg); overflow: hidden; min-height: 280px; background: linear-gradient(135deg, var(--b1), var(--b3)); position: relative; }
.hero-art img { width: 100%; height: 100%; object-fit: cover; }
.hero-art .glass { position: absolute; left: 16px; right: 16px; bottom: 16px; padding: 16px 20px; border-radius: var(--r-md); }
@media (max-width: 860px) { .page-hero { grid-template-columns: minmax(0, 1fr); } .hero-art { min-height: 220px; } }

/* ---------- Home ---------- */
.home-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: clamp(20px, 3vw, 36px); align-items: center; min-height: min(760px, calc(100vh - 140px)); }
.portrait { position: relative; aspect-ratio: 4 / 5; border-radius: var(--r-xl); overflow: hidden; background: linear-gradient(160deg, var(--b1), var(--b2)); box-shadow: var(--glass-shadow); }
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 30% 30%; }
.portrait .lens {
  position: absolute; right: 18px; bottom: 18px; left: 18px; padding: 18px 20px; border-radius: var(--r-md);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px;
}
.stat b { display: block; font-size: clamp(1.6rem, 2.6vw, 2.2rem); letter-spacing: -.03em; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat span { font: 500 .875rem/1.3 var(--font-mono); color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; }
.hero-copy h1 { font-size: clamp(3rem, 6.6vw, 6rem); letter-spacing: -.045em; line-height: .98; }
.hero-copy h1 .serif { font-size: 1.08em; letter-spacing: -.02em; }
.hero-copy .glass { padding: clamp(24px, 3vw, 36px); margin-top: 28px; }
.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 22px; }
@media (max-width: 900px) {
  .home-hero { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .portrait { aspect-ratio: 4 / 3.6; }
  .hero-copy { order: -1; }
}
@media (max-width: 480px) { .portrait { aspect-ratio: 4 / 4.6; } .portrait .lens { padding: 14px; } }

.shelf-card { display: grid; grid-template-rows: auto 1fr; overflow: hidden; text-decoration: none; color: inherit; }
.shelf-card .thumb { margin: 10px 10px 0; border-radius: calc(var(--r-lg) - 10px); overflow: hidden; aspect-ratio: 16 / 9; background: linear-gradient(135deg, var(--b1), var(--b3)); }
.shelf-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.shelf-card:hover .thumb img { transform: scale(1.04); }
.shelf-card .body { padding: 20px 22px 24px; display: flex; flex-direction: column; gap: 10px; }
.shelf-card h3 { font-size: 1.45rem; }
.shelf-card p { color: var(--ink-2); }
.shelf-card:hover h3 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.meta { font: 500 .875rem/1.4 var(--font-mono); color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 4px 12px; }

/* list rows inside a panel */
.rows { list-style: none; margin: 0; padding: 8px; }
.row { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 12px; border-radius: var(--r-md); text-decoration: none; color: inherit; transition: background .15s; }
.row:hover { background: var(--chip); }
.row + .row { margin-top: 2px; }
.row .mini { width: 96px; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: linear-gradient(135deg, var(--b2), var(--b3)); }
.row .mini img { width: 100%; height: 100%; object-fit: cover; }
.row h3 { font-size: 1.2rem; line-height: 1.3; letter-spacing: -.01em; }
.row p { color: var(--ink-2); font-size: 1rem; margin-top: 4px; }
.row .when { font: 500 .875rem/1 var(--font-mono); color: var(--ink-3); white-space: nowrap; }
@media (max-width: 640px) {
  .row { grid-template-columns: 72px minmax(0, 1fr); gap: 14px; }
  .row .mini { width: 72px; }
  .row .when { grid-column: 2; }
}
.rows.no-thumb .row { grid-template-columns: minmax(0, 1fr) auto; }
@media (max-width: 640px) { .rows.no-thumb .row { grid-template-columns: minmax(0, 1fr); } .rows.no-thumb .row .when { grid-column: 1; } }

.tile { padding: 24px; display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: inherit; }
.tile h3 { font-size: 1.3rem; }
.tile p { color: var(--ink-2); }
.tile .orb { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 30% 25%, rgba(255,255,255,.95), transparent 45%), linear-gradient(140deg, var(--b1), var(--b3)); box-shadow: inset 0 -4px 10px rgba(0,0,0,.12), 0 8px 18px -8px rgba(20,36,66,.5); color: #0c1626; }
.tile .orb svg { width: 22px; height: 22px; }
.tile .type { margin-top: auto; }
.split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; }
@media (max-width: 900px) { .split { grid-template-columns: minmax(0, 1fr); } }
.panel-pad { padding: clamp(22px, 3vw, 34px); }
.link-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 6px; }
.link-list a { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 52px; padding: 8px 14px; border-radius: var(--r-md); text-decoration: none; color: var(--ink); background: var(--chip); border: 1px solid var(--chip-border); }
.link-list a:hover { background: var(--glass-strong); }
.link-list small { font: 500 .875rem/1.2 var(--font-mono); color: var(--ink-3); }

/* ---------- Projects ---------- */
.jump { position: sticky; top: 88px; z-index: 20; display: flex; gap: 6px; padding: 6px; border-radius: var(--r-pill); width: fit-content; max-width: 100%; overflow-x: auto; scrollbar-width: none; margin-bottom: 28px; background: var(--glass-strong); }
.jump a { white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: var(--r-pill); color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 1rem; }
.jump a:hover { background: var(--chip); color: var(--ink); }
.jump a.is-active { background: var(--btn-bg); color: var(--btn-ink); }
.jump .count { font: 500 .875rem/1 var(--font-mono); opacity: .8; }
.featured { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); overflow: hidden; }
.featured .copy { padding: clamp(26px, 4vw, 48px); display: flex; flex-direction: column; gap: 16px; }
.featured h3 { font-size: clamp(2rem, 3.5vw, 3rem); }
.featured .art { position: relative; min-height: 320px; background: linear-gradient(135deg, #1b2c44, #364f6a); }
.featured .art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.featured .art .glass { position: absolute; left: 18px; right: 18px; bottom: 18px; padding: 16px 20px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-radius: var(--r-md); }
@media (max-width: 860px) { .featured { grid-template-columns: minmax(0, 1fr); } }
.proj-card { overflow: hidden; display: flex; flex-direction: column; }
.proj-card .shot { margin: 10px 10px 0; border-radius: calc(var(--r-lg) - 10px); overflow: hidden; aspect-ratio: 16 / 10; background: #0d1422; position: relative; }
.proj-card .shot img { width: 100%; height: 100%; object-fit: cover; }
.proj-card .shot.term::after { content: "terminal recording"; position: absolute; left: 12px; top: 12px; font: 500 .8125rem/1 var(--font-mono); color: #d6e2f2; background: rgba(0,0,0,.55); padding: 6px 9px; border-radius: 8px; }
.proj-card .shot.none { display: grid; place-items: center; background: radial-gradient(circle at 30% 20%, rgba(255,255,255,.5), transparent 50%), linear-gradient(135deg, var(--b1), var(--b3), var(--b2)); }
.proj-card .shot.none span { font: 600 2.4rem/1 var(--font-serif); font-style: italic; color: #0c1626; opacity: .75; }
.proj-card .body { padding: 18px 22px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.proj-card h3 { font-size: 1.35rem; }
.proj-card p { color: var(--ink-2); }
.proj-card .foot { margin-top: auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding-top: 6px; }
.stars { font: 600 .9375rem/1 var(--font-mono); color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Writing archive ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px; border-radius: var(--r-lg); margin-bottom: 18px; }
.search-field { flex: 1 1 280px; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 16px; border-radius: var(--r-pill); background: var(--glass-strong); border: 1px solid var(--chip-border); }
.search-field svg { width: 20px; height: 20px; color: var(--ink-3); flex: none; }
.search-field input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: 400 1.05rem/1.2 var(--font-sans); padding: 12px 0; }
.search-field input::placeholder { color: var(--ink-3); }
.search-field input:focus { outline: none; }
.search-field:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.year-group { padding: 8px 0; }
.year-group + .year-group { border-top: 1px solid var(--chip-border); }
.year-label { font: 600 1rem/1 var(--font-mono); color: var(--ink-3); padding: 18px 20px 6px; letter-spacing: .06em; }
.coll-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.coll-dot.dg { background: #1f9d6f; }
.coll-dot.dt { background: #c27a12; }
.empty { text-align: center; padding: 48px 20px; display: grid; gap: 10px; justify-items: center; }
.empty h3 { font-size: 1.4rem; }
.empty p { color: var(--ink-2); }
.result-line { font: 500 .9375rem/1.4 var(--font-mono); color: var(--ink-3); margin: 0 6px 12px; }

/* ---------- AI + stories ---------- */
.consult { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; padding: 22px 26px; }
.consult p { font-size: 1.2rem; color: var(--ink); max-width: 56ch; }
.story-stage { position: relative; border-radius: var(--r-xl); overflow: hidden; padding: clamp(22px, 4vw, 48px); background: #0b1020; isolation: isolate; }
.story-stage > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; opacity: .75; }
.story-stage::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(6,10,20,.35), rgba(6,10,20,.8)); }
.story-stage .intro { max-width: 640px; color: #eef3fb; }
.story-stage .intro h2 { color: #fff; font-size: clamp(2.6rem, 6vw, 4.6rem); }
.story-stage .intro p { color: #d5deeb; margin-top: 12px; font-size: 1.15rem; }
.story-stage .notice { margin-top: 18px; display: inline-flex; gap: 10px; align-items: center; padding: 10px 16px; border-radius: var(--r-pill); background: rgba(255, 214, 140, .16); border: 1px solid rgba(255, 214, 140, .45); color: #ffe3b0; font-size: 1rem; }
.stories { margin-top: 32px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.story { overflow: hidden; text-decoration: none; display: flex; flex-direction: column; }
.story .glass-img { aspect-ratio: 3 / 2; overflow: hidden; margin: 8px 8px 0; border-radius: calc(var(--r-lg) - 8px); }
.story .glass-img img { width: 100%; height: 100%; object-fit: cover; }
.story .body { padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.story .part { font: 600 .875rem/1 var(--font-mono); color: #ffd28a; letter-spacing: .08em; text-transform: uppercase; }
.story h3 { font-size: 1.3rem; color: #fff; }
.story p { color: #cfd8e6; font-size: 1rem; }
.story .read { margin-top: auto; color: #bcd6f3; font-weight: 600; }
.story:hover h3 { text-decoration: underline; text-underline-offset: 4px; }
.coming { margin-top: 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.coming > div { padding: 18px 20px; border-radius: var(--r-md); border: 1px dashed rgba(255,255,255,.3); color: #cfd8e6; font-size: 1rem; }
.coming b { color: #fff; display: block; margin-bottom: 4px; font-size: 1.05rem; }
@media (max-width: 900px) { .stories, .coming { grid-template-columns: minmax(0, 1fr); } }

/* ---------- About ---------- */
.about-hero { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 20px; align-items: stretch; }
.about-hero .portrait { aspect-ratio: auto; min-height: 520px; }
.about-hero .portrait img { object-position: center 30%; }
.about-hero .intro { padding: clamp(26px, 4vw, 52px); display: flex; flex-direction: column; gap: 18px; justify-content: center; }
.about-hero h1 { font-size: clamp(3rem, 6.6vw, 5.6rem); letter-spacing: -.045em; }
@media (max-width: 860px) { .about-hero { grid-template-columns: minmax(0, 1fr); } .about-hero .portrait { min-height: 380px; } }
.stat-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--chip-border); border-radius: var(--r-md); overflow: hidden; }
.stat-strip > div { background: var(--glass-strong); padding: 16px 18px; }
@media (max-width: 420px) { .stat-strip { grid-template-columns: minmax(0, 1fr); } }
.career-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 22px; }
.career-bar span { font: 500 .875rem/1.2 var(--font-mono); padding: 8px 12px; border-radius: var(--r-pill); background: var(--chip); border: 1px solid var(--chip-border); color: var(--ink-2); }
.career-bar span b { color: var(--ink); font-family: var(--font-sans); font-weight: 600; font-size: 1rem; margin-right: 4px; }
.timeline { display: grid; gap: 16px; }
.phase { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; padding: 26px; }
.phase h3 { font-size: 1.5rem; }
.phase .period { font: 600 .9375rem/1 var(--font-mono); color: var(--ink-3); margin-top: 10px; display: block; }
.phase p { color: var(--ink-2); }
.phase ul { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.phase li { padding-left: 18px; position: relative; color: var(--ink); }
.phase li::before { content: ""; position: absolute; left: 0; top: .6em; width: 8px; height: 8px; border-radius: 50%; background: linear-gradient(135deg, var(--b1), var(--b3)); box-shadow: 0 0 0 2px var(--glass-border); }
.phase li small { display: block; color: var(--ink-2); font-size: 1rem; margin-top: 4px; }
@media (max-width: 760px) { .phase { grid-template-columns: minmax(0, 1fr); gap: 10px; } }
.principles { padding: clamp(26px, 4vw, 48px); }
.principles ol { list-style: none; margin: 24px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.principles li { padding: 20px; border-radius: var(--r-md); background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); font: italic 400 1.5rem/1.25 var(--font-serif); color: #f0f4fa; }
.principles li span { display: block; font: 500 .875rem/1 var(--font-mono); font-style: normal; color: #a9c8ea; margin-bottom: 10px; }
.cap-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 24px; }
.cap-grid > div { padding: 22px; border-radius: var(--r-md); background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); }
.cap-grid h3 { font-size: 1.3rem; }
.cap-grid p { margin: 6px 0 14px; }
.cap-grid .chip { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.2); color: #e2eaf5; }
@media (max-width: 760px) { .cap-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Article ---------- */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 4px; z-index: 60; background: transparent; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--b1), var(--b3), var(--b2)); box-shadow: 0 0 12px var(--b3); }
.art-head { padding: clamp(26px, 4vw, 52px); display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 32px; align-items: center; }
.art-head h1 { font-size: clamp(2.4rem, 5vw, 4.2rem); letter-spacing: -.035em; margin: 14px 0 16px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 1rem; }
.crumbs a { text-decoration: none; font-weight: 600; }
.art-head .banner { border-radius: var(--r-md); overflow: hidden; aspect-ratio: 16 / 9; background: linear-gradient(135deg, var(--b1), var(--b2)); box-shadow: var(--glass-shadow); }
.art-head .banner img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 900px) { .art-head { grid-template-columns: minmax(0, 1fr); } }
.art-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; margin-top: 24px; align-items: start; }
.toc { position: sticky; top: 100px; padding: 20px; }
.toc ol { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 2px; }
.toc a { display: block; padding: 8px 12px; border-radius: 10px; color: var(--ink-2); text-decoration: none; font-size: 1rem; line-height: 1.35; border-left: 3px solid transparent; }
.toc a:hover { background: var(--chip); color: var(--ink); }
.toc a[aria-current="true"] { color: var(--ink); background: var(--chip); border-left-color: var(--link); font-weight: 600; }
.toc .md-link { margin-top: 16px; font-size: .9375rem; }
.toc-mobile { display: none; }
@media (max-width: 1080px) {
  .art-layout { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
  .toc-mobile { display: block; padding: 4px 8px; margin-bottom: 16px; }
  .toc-mobile summary { cursor: pointer; min-height: 52px; display: flex; align-items: center; padding: 0 12px; font-weight: 600; }
  .toc-mobile ol { margin: 0 0 12px; padding: 0 0 0 30px; display: grid; gap: 4px; }
  .toc-mobile a { display: block; padding: 6px 0; }
}
.prose { padding: clamp(24px, 5vw, 64px); }
.prose > * { max-width: 700px; margin-inline: auto; }
.prose > pre, .prose > .code, .prose > .callout { max-width: 820px; }
.prose p, .prose li { font-size: 1.1875rem; line-height: 1.72; color: var(--ink); }
.prose p + p, .prose * + p { margin-top: 1.15em; }
.prose h2 { font-size: clamp(1.8rem, 3vw, 2.4rem); margin-top: 2.2em; margin-bottom: .6em; scroll-margin-top: 110px; }
.prose h2 .serif { font-size: 1.1em; }
.prose ol { margin-top: 1em; padding-left: 1.4em; display: grid; gap: .35em; }
.prose code:not(pre code) { font: 500 .92em/1.3 var(--font-mono); background: var(--chip); border: 1px solid var(--chip-border); padding: 1px 6px; border-radius: 6px; }
.code { margin-top: 1.6em; margin-bottom: 1.6em; border-radius: var(--r-md); overflow: hidden; background: var(--code-bg); border: 1px solid rgba(255,255,255,.1); box-shadow: 0 20px 40px -24px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.08); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.code-bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 8px 8px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.code-bar .lang { font: 600 .875rem/1 var(--font-mono); color: #a9c8ea; letter-spacing: .08em; }
.code-bar .dots { display: inline-flex; gap: 6px; margin-right: 12px; }
.code-bar .dots i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,.22); }
.copy-btn { min-height: 36px; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.08); color: #e5ecf6; font: 500 .875rem/1 var(--font-sans); cursor: pointer; }
.copy-btn:hover { background: rgba(255,255,255,.16); }
.code pre { margin: 0; padding: 18px 20px 22px; overflow-x: auto; font: 400 .9375rem/1.65 var(--font-mono); color: var(--code-ink); tab-size: 2; }
.tok-k { color: #c9a8ff; } .tok-s { color: #9fe0b5; } .tok-c { color: #8e9bb0; font-style: italic; } .tok-t { color: #8cc8ff; } .tok-f { color: #ffd08a; }
.callout { margin-block: 1.6em; padding: 18px 22px 18px 20px; border-radius: var(--r-md); border: 1px solid var(--chip-border); background: var(--chip); display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; }
.callout .ico { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font: 700 1rem/1 var(--font-sans); color: #0c1626; }
.callout p { margin: 0 !important; font-size: 1.0625rem; }
.callout .label { display: block; font: 600 .875rem/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 6px; color: var(--ink-3); }
.callout.why .ico { background: linear-gradient(135deg, #a9c8ea, #7fa4d6); }
.callout.question { border-style: dashed; }
.callout.question .ico { background: linear-gradient(135deg, #f3b995, #e9d59a); }
.callout.note .ico { background: linear-gradient(135deg, #92d6c8, #a9c8ea); }
.callout.skill { background: linear-gradient(120deg, rgba(123,97,255,.12), rgba(56,189,248,.12)); }
.callout.skill .ico { background: linear-gradient(135deg, #b9a9ef, #7fd0ea); }
.after { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; margin-top: 24px; }
@media (max-width: 860px) { .after { grid-template-columns: minmax(0, 1fr); } }
.share-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.news form { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.news input[type="email"] { flex: 1 1 220px; min-height: 48px; padding: 0 18px; border-radius: var(--r-pill); border: 1px solid var(--chip-border); background: var(--glass-strong); color: var(--ink); font: 400 1rem var(--font-sans); }
.news input[type="email"]::placeholder { color: var(--ink-3); }
.news .consent { display: flex; gap: 10px; align-items: start; font-size: 1rem; color: var(--ink-2); flex-basis: 100%; }
.news .consent input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--brand); }
.form-msg { flex-basis: 100%; font-size: 1rem; min-height: 1.4em; }
.form-msg.is-error { color: var(--bad); }
.form-msg.is-success { color: var(--ok); font-weight: 600; }

/* ---------- Patterns ---------- */
.three-ways { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 22px; }
.three-ways > div { padding: 18px; border-radius: var(--r-md); background: var(--chip); border: 1px solid var(--chip-border); }
.three-ways h3 { font-size: 1.2rem; display: flex; gap: 10px; align-items: center; }
.three-ways h3 i { font: 600 .875rem/1 var(--font-mono); font-style: normal; color: var(--ink-3); }
.three-ways p { color: var(--ink-2); margin-top: 6px; font-size: 1rem; }
@media (max-width: 800px) { .three-ways { grid-template-columns: minmax(0, 1fr); } }
.pat-card { display: flex; flex-direction: column; overflow: hidden; }
.pat-card .specimen { margin: 8px 8px 0; height: 168px; border-radius: calc(var(--r-lg) - 8px); background: var(--glass-strong); border: 1px solid var(--chip-border); position: relative; overflow: hidden; display: grid; place-items: center; }
.pat-card .body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.pat-card .top { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.pat-card h2 { font-size: 1.3rem; letter-spacing: -.015em; }
.pat-card h2 a { color: var(--ink); text-decoration: none; }
.pat-card h2 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.pat-card h2 a:hover { text-decoration: underline; }
.pat-card p { color: var(--ink-2); font-size: 1rem; }
.pat-card .chips { margin-top: auto; padding-top: 4px; }
.pat-card .chip { position: relative; z-index: 1; }
/* specimens: tiny schematic sketches per category */
.sp { display: flex; gap: 6px; align-items: end; width: 70%; }
.sp i { flex: 1; border-radius: 6px; background: linear-gradient(180deg, var(--b1), var(--b3)); opacity: .9; }
.sp-data i:nth-child(1) { height: 40px; } .sp-data i:nth-child(2) { height: 76px; } .sp-data i:nth-child(3) { height: 58px; } .sp-data i:nth-child(4) { height: 96px; } .sp-data i:nth-child(5) { height: 30px; }
.sp-layout { display: grid; grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 44px 44px; gap: 6px; width: 70%; }
.sp-layout i { border-radius: 8px; background: linear-gradient(135deg, var(--b2), var(--b3)); opacity: .85; }
.sp-layout i:first-child { grid-row: span 2; }
.sp-inter { display: grid; gap: 8px; width: 64%; }
.sp-inter i { height: 22px; border-radius: 999px; background: var(--chip); border: 1px solid var(--chip-border); }
.sp-inter i:nth-child(2) { background: linear-gradient(90deg, var(--b1), var(--b4)); width: 78%; }
.sp-forms { display: grid; gap: 8px; width: 68%; }
.sp-forms i { height: 30px; border-radius: 10px; border: 1.5px solid var(--chip-border); background: var(--glass); }
.sp-forms i:last-child { width: 44%; justify-self: end; background: var(--btn-bg); border: 0; }
.sp-color { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; width: 70%; }
.sp-color i { aspect-ratio: 1; border-radius: 50%; }
.sp-color i:nth-child(1) { background: var(--b1); } .sp-color i:nth-child(2) { background: var(--b2); } .sp-color i:nth-child(3) { background: var(--b3); } .sp-color i:nth-child(4) { background: var(--b4); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.select { min-height: 44px; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid var(--chip-border); background: var(--glass-strong); color: var(--ink); font: 500 1rem var(--font-sans); }
.count-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 4px 18px; }
.count-row output { font: 500 1rem/1 var(--font-mono); color: var(--ink-2); }

/* pattern detail */
.back { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; text-decoration: none; font-weight: 600; }
.uses { columns: 2 240px; column-gap: 32px; margin: 12px 0 0; padding-left: 1.1em; }
.uses li { color: var(--ink-2); margin-bottom: 6px; break-inside: avoid; }
.panes { margin-top: 24px; overflow: hidden; }
.pane-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 10px; border-bottom: 1px solid var(--chip-border); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs [role="tab"] { min-height: 44px; padding: 0 16px; border-radius: var(--r-pill); border: 1px solid transparent; background: transparent; color: var(--ink-2); font: 500 1rem var(--font-sans); cursor: pointer; }
.tabs [role="tab"]:hover { background: var(--chip); color: var(--ink); }
.tabs [role="tab"][aria-selected="true"] { background: var(--btn-bg); color: var(--btn-ink); }
.pane-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pane-actions .btn { min-height: 44px; }
[role="tabpanel"] { padding: clamp(16px, 3vw, 28px); }
[role="tabpanel"][hidden] { display: none; }
.pane-code { background: var(--code-bg); border-radius: var(--r-md); margin: 0; padding: 18px 20px; overflow-x: auto; color: var(--code-ink); font: 400 .9375rem/1.65 var(--font-mono); }
.pane-note { font-size: 1rem; color: var(--ink-2); margin-bottom: 14px; }
.prompt-text p + p { margin-top: 1em; }
.prompt-text { max-width: 72ch; }
.stage { background: var(--ground); border-radius: var(--r-md); padding: clamp(14px, 3vw, 28px); border: 1px solid var(--chip-border); }
.stage .cap { font-size: 1rem; color: var(--ink-2); margin: 0 0 12px; }
.stage .cap + .hss-strip + .cap { margin-top: 26px; }
.hss-strip { display: grid; gap: 1px; background: var(--chip-border); border: 1px solid var(--chip-border); border-radius: 10px; overflow: hidden; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 21rem) { .hss-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 52rem) { .hss-strip.four { grid-template-columns: repeat(4, minmax(0, 1fr)); } .hss-strip.five { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.hss-tile { background: var(--glass-strong); padding: 14px 16px; display: grid; gap: 4px; text-align: left; border: 0; color: var(--ink); font: inherit; min-width: 0; }
.hss-tile .l { font: 500 .8125rem/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); overflow-wrap: anywhere; }
.hss-tile .v { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.1; }
.hss-tile .v.missing { color: var(--ink-3); }
.hss-tile .u { font-size: .9375rem; color: var(--ink-2); }
button.hss-tile { cursor: pointer; min-height: 44px; }
button.hss-tile:hover { background: var(--glass); }
button.hss-tile[aria-pressed="true"] { background: color-mix(in srgb, var(--brand) 18%, var(--glass-strong)); box-shadow: inset 0 -3px 0 var(--link); }
.hss-list { list-style: none; margin: 14px 0 0; padding: 0; border: 1px solid var(--chip-border); border-radius: 10px; overflow: hidden; }
.hss-list li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--glass-strong); font-size: 1rem; }
.hss-list li + li { border-top: 1px solid var(--chip-border); }
.hss-list li[hidden] { display: none; }
.hss-status { font: 500 .875rem/1.2 var(--font-mono); white-space: nowrap; }
.hss-live { margin-top: 10px; font-size: 1rem; color: var(--ink-2); }
.neighbors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 24px; }
.neighbors a { padding: 20px 22px; text-decoration: none; display: grid; gap: 6px; }
.neighbors a:last-child { text-align: right; }
.neighbors b { color: var(--ink); font-size: 1.2rem; }
@media (max-width: 640px) { .neighbors { grid-template-columns: minmax(0, 1fr); } .neighbors a:last-child { text-align: left; } }

/* ---------- Footer ---------- */
.site-foot { margin-top: 80px; padding-bottom: 28px; }
.foot-panel { padding: clamp(26px, 4vw, 44px); display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.5fr; gap: 28px; }
.foot-panel h2 { font: 600 .875rem/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 14px; }
.foot-panel ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.foot-panel ul a { display: inline-flex; min-height: 40px; align-items: center; color: var(--ink); text-decoration: none; font-size: 1rem; }
.foot-panel ul a:hover { text-decoration: underline; }
.foot-panel .blurb { color: var(--ink-2); margin-top: 12px; font-size: 1rem; }
.foot-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 18px 8px 0; font-size: 1rem; color: var(--ink-2); }
.glass-toggle-row { display: inline-flex; align-items: center; gap: 10px; }
@media (max-width: 900px) { .foot-panel { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .foot-panel { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .lift:hover { transform: none; }
}

/* UI pattern library article */
.prose .prose-fig { margin: 1.8em 0; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--chip-border); }
.prose .prose-fig img { width: 100%; height: auto; display: block; }
.prose .callout-body p + p { margin-top: .7em !important; }
.prose .live-pattern a.btn { white-space: normal; text-decoration: none; }
.prose p code { overflow-wrap: anywhere; }
