/* stevenrichards.link — site theme.
   One stylesheet, no framework, no third-party requests.
   Colours are tokens on :root, switched by [data-theme] on <html>. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-wght-italic.woff2") format("woff2");
}

:root {
  --bg: #fbfbfa;
  --bg-elev: #ffffff;
  --bg-sunk: #f2f3f5;
  --ink: #15171b;
  --ink-2: #3a414c;
  --ink-3: #535b67;
  --rule: #e3e5e9;
  --rule-strong: #cfd3d9;
  --accent: #1f55d0;
  --accent-hover: #1743a8;
  --accent-soft: rgba(31, 85, 208, 0.08);
  --accent-ink: #ffffff;
  --code-bg: #f1f3f6;
  --btn-border: #c9ced6;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --measure: 46rem;
  --page: 72rem;
  --gutter: clamp(1rem, 4vw, 2rem);
  --radius: 10px;
  --header-h: 64px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0e1013;
  --bg-elev: #15181d;
  --bg-sunk: #1a1e24;
  --ink: #eceef2;
  --ink-2: #c4c9d1;
  --ink-3: #a3aab5;
  --rule: #2a3039;
  --rule-strong: #3d4550;
  --accent: #82abff;
  --accent-hover: #a9c4ff;
  --accent-soft: rgba(130, 171, 255, 0.12);
  --accent-ink: #0e1013;
  --code-bg: #12161b;
  --btn-border: #5b6573;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 1rem); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; }
img { height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.015em; margin: 0; color: var(--ink); }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
kbd {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.1em 0.4em;
  border: 1px solid var(--rule-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--ink-3);
  background: var(--bg-elev);
}
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
.muted { color: var(--ink-3); }
.container { width: 100%; max-width: var(--page); margin-inline: auto; padding-inline: var(--gutter); }
.skip-link { position: absolute; left: -999px; top: 0.5rem; z-index: 100; background: var(--bg-elev); padding: 0.5rem 1rem; border-radius: 6px; }
.skip-link:focus { left: 0.5rem; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.crumb { display: inline-block; font-size: 0.9rem; color: var(--ink-3); margin-bottom: 0.75rem; }
.crumb::before { content: "← "; }
.crumb:hover { color: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5em;
  height: 2.6rem; padding: 0 1.1rem;
  border: 1px solid var(--btn-border); border-radius: 8px;
  background: var(--bg-elev); color: var(--ink);
  font: 500 0.95rem/1 var(--font-sans);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.btn:hover { border-color: var(--ink-3); color: var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn-small { height: 2.2rem; padding: 0 0.85rem; font-size: 0.9rem; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-width: 2.4rem; height: 2.4rem; padding: 0 0.55rem;
  border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--bg-sunk); color: var(--ink); }
.text-link { display: inline-flex; align-items: center; gap: 0.4em; font-weight: 500; margin-top: 1.25rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  -webkit-backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.header-inner { display: flex; align-items: center; gap: 1.5rem; height: var(--header-h); }
.brand { font-weight: 650; font-size: 1.02rem; letter-spacing: -0.01em; color: var(--ink); white-space: nowrap; }
.brand:hover { color: var(--ink); }
.site-nav { margin-left: auto; }
.site-nav ul { display: flex; gap: 0.25rem; list-style: none; }
.site-nav a {
  display: block; padding: 0.45rem 0.7rem; border-radius: 7px;
  color: var(--ink-2); font-size: 0.93rem; font-weight: 500;
}
.site-nav a:hover { color: var(--ink); background: var(--bg-sunk); }
.site-nav a[aria-current="page"] { color: var(--ink); background: var(--bg-sunk); }
.header-actions { display: flex; align-items: center; gap: 0.15rem; }
.kbd-hint { display: none; }
.search-label { display: none; }
@media (min-width: 1100px) {
  .search-open { border-color: var(--rule); background: var(--bg-elev); color: var(--ink-3); min-width: 13rem; justify-content: flex-start; padding: 0 0.6rem; }
  .search-open:hover { border-color: var(--rule-strong); color: var(--ink-2); }
  .search-label { display: inline; font-size: 0.9rem; margin-right: auto; }
  .kbd-hint { display: inline; }
}
[data-theme="light"] .when-dark, [data-theme="dark"] .when-light { display: none; }
.nav-toggle { display: none; }

@media (max-width: 1020px) {
  .nav-toggle { display: inline-flex; }
  .site-nav {
    position: absolute; top: var(--header-h); left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--rule);
    display: none; padding: 0.5rem var(--gutter) 1rem;
  }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; }
  .site-nav a { padding: 0.7rem 0.5rem; font-size: 1rem; }
  .header-actions { margin-left: auto; }
}

/* ---------- Home ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3rem; align-items: center;
  padding-top: clamp(3rem, 8vw, 6rem); padding-bottom: clamp(2.5rem, 6vw, 4.5rem);
}
.hero h1 {
  font-size: clamp(2.75rem, 2rem + 4vw, 4.5rem);
  font-weight: 750; letter-spacing: -0.035em; line-height: 1.02;
  margin: 0.6rem 0 0.9rem;
}
.hero h1 .dot { color: var(--accent); }
.hero-lead { font-size: clamp(1.5rem, 1.15rem + 1.6vw, 2.15rem); font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; color: var(--ink-2); max-width: 30ch; }
.hero-sub { margin-top: 1rem; font-size: 1.08rem; color: var(--ink-3); max-width: 46ch; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-top: 2rem; }
.social { display: flex; gap: 0.15rem; list-style: none; margin-left: 0.25rem; }
[data-theme="dark"] .hero-avatar, [data-theme="dark"] .about-photo { filter: brightness(0.9); }
.hero-avatar {
  width: clamp(180px, 22vw, 280px); aspect-ratio: 1; object-fit: cover;
  border-radius: 24px; background: var(--bg-elev);
  border: 1px solid var(--rule); box-shadow: var(--shadow);
}

.section {
  display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 2.5rem;
  padding-top: 3rem; padding-bottom: 3rem;
  border-top: 1px solid var(--rule);
}
.section-label {
  font-family: var(--font-mono); font-size: 0.9rem; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-2);
  padding-top: 0.25rem;
}
.section-body { max-width: var(--measure); }
.about { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2rem; align-items: start; }
.about-photo { width: 160px; height: 160px; object-fit: cover; border-radius: 14px; border: 1px solid var(--rule); }
.about-text { font-size: 1.12rem; color: var(--ink-2); line-height: 1.7; }
.about-text p + p { margin-top: 0.9rem; }
.section-body > .muted { margin-top: 1.5rem; margin-bottom: 0.75rem; font-size: 0.95rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; list-style: none; }
.chips li {
  font-size: 0.88rem; font-weight: 500; color: var(--ink-2);
  padding: 0.3rem 0.7rem; border-radius: 999px;
  background: var(--bg-sunk); border: 1px solid var(--rule);
}
.chips.small li { font-size: 0.8rem; padding: 0.2rem 0.6rem; }

.timeline { list-style: none; }
.timeline li { position: relative; padding-left: 1.5rem; padding-bottom: 1.75rem; border-left: 1px solid var(--rule-strong); }
.timeline li:last-child { padding-bottom: 0.25rem; }
.timeline li::before {
  content: ""; position: absolute; left: -5px; top: 0.4rem;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.timeline li:first-child::before { background: var(--accent); }
.timeline-date { font-family: var(--font-mono); font-size: 0.85rem; color: var(--ink-3); margin-bottom: 0.25rem; }
.timeline h3 { font-size: 1.08rem; font-weight: 600; }
.timeline .at { font-weight: 450; color: var(--ink-3); }
.timeline li > p:last-child, .edu-detail { margin-top: 0.4rem; color: var(--ink-2); }
.edu-detail ul { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; margin-top: 0.6rem; padding: 0; }
.edu-detail ul li { font-size: 0.82rem; font-weight: 500; padding: 0.2rem 0.6rem !important; margin: 0 !important; border-radius: 999px; background: var(--bg-sunk); border: 1px solid var(--rule) !important; color: var(--ink-2); }
.edu-detail ul li { padding: 0; border: 0; margin: 0.15rem 0; }
.edu-detail ul li::before { display: none; }
.edu-detail p + p { margin-top: 0.4rem; }

.sub-heading { font-size: 1.05rem; font-weight: 600; margin-top: 2.5rem; margin-bottom: 1rem; }
.certs ul { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 0.5rem; }
.certs > ul > li {
  padding: 0.6rem 0.85rem; border: 1px solid var(--rule); border-radius: 8px;
  background: var(--bg-elev); font-size: 0.93rem; line-height: 1.4;
}
.certs > ul > li:has(> ul) { grid-column: 1 / -1; order: -1; }
.certs li ul { display: grid; grid-template-columns: 1fr; gap: 0.35rem; margin-top: 0.55rem; }
.certs li ul li { font-size: 0.9rem; }
.certs li ul li::before { content: "↳ "; color: var(--ink-3); }
.certs a { color: var(--accent); text-decoration: none; }
.certs a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 0.2em; }

.card { background: var(--bg-elev); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.project-grid { display: grid; gap: 1.25rem; }
.project { display: grid; grid-template-columns: 15rem minmax(0, 1fr); }
.project img { width: 100%; height: 100%; object-fit: cover; border-right: 1px solid var(--rule); }
.card-body { padding: 1.25rem 1.4rem; display: grid; gap: 0.75rem; align-content: start; justify-items: start; }
.card-body h3 { font-size: 1.1rem; font-weight: 600; }
.card-body p { color: var(--ink-2); }

.achievement-list { list-style: none; display: grid; gap: 1.25rem; }
.achievement-list h3 { font-size: 1.05rem; font-weight: 600; }
.achievement-list p { color: var(--ink-2); margin-top: 0.3rem; }

.contact { display: grid; gap: 1.25rem; justify-items: start; }
.contact-text { font-size: 1.12rem; color: var(--ink-2); max-width: 46ch; }

/* ---------- Post lists ---------- */
.post-list { list-style: none; }
.post-row {
  position: relative;
  display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: 1rem;
  padding: 1rem 0.75rem; margin-inline: -0.75rem; border-radius: 8px;
  border-bottom: 1px solid var(--rule); transition: background 0.15s;
}
.post-row:hover { background: var(--bg-sunk); }
.post-row h3 a::after { content: ""; position: absolute; inset: 0; border-radius: 8px; }
.post-row:first-child { padding-top: 0.25rem; }
.post-row time { font-family: var(--font-mono); font-size: 0.86rem; color: var(--ink-3); padding-top: 0.2rem; white-space: nowrap; }
.post-row h3 { font-size: 1.08rem; font-weight: 600; line-height: 1.35; }
.post-row h3 a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
.post-row h3 a:hover { color: var(--accent); text-decoration-color: currentColor; }
.post-row p { margin-top: 0.25rem; color: var(--ink-3); font-size: 0.95rem; }

.listing { max-width: calc(var(--measure) + 2 * var(--gutter) + 6.5rem); padding-top: clamp(2.5rem, 6vw, 4rem); padding-bottom: 4rem; }
.listing-header { margin-bottom: 2rem; }
.listing-header h1 { font-size: clamp(2rem, 1.6rem + 2vw, 2.75rem); font-weight: 720; letter-spacing: -0.03em; }
.listing-header p { margin-top: 0.6rem; font-size: 1.05rem; max-width: 52ch; }
.year { font-family: var(--font-mono); font-size: 0.88rem; font-weight: 500; color: var(--ink-3); margin: 2.25rem 0 0.5rem; letter-spacing: 0.04em; }
.listing .year:first-of-type { margin-top: 0; }

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; }
.tags a {
  display: inline-block; font-size: 0.82rem; font-weight: 500;
  padding: 0.2rem 0.6rem; border-radius: 999px;
  color: var(--accent); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.tags a:hover { color: var(--accent-hover); border-color: var(--accent); }
.tag-cloud a { font-size: 0.92rem; padding: 0.35rem 0.8rem; }
.tag-cloud .count { color: var(--ink-3); font-family: var(--font-mono); font-size: 0.8em; margin-left: 0.2em; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 0.75rem; margin-bottom: 2rem; }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; border: 1px solid var(--rule); }
.notfound h1 { font-size: 2.5rem; margin: 0.5rem 0 0.75rem; }
.notfound p { margin-bottom: 1.5rem; }
.notfound .btn + .btn { margin-left: 0.5rem; }

/* ---------- Post ---------- */
.post { padding-top: clamp(2rem, 5vw, 3.5rem); padding-bottom: 4rem; max-width: calc(var(--measure) + 2 * var(--gutter)); }
.post.has-toc { max-width: calc(var(--measure) + clamp(2.5rem, 5vw, 4.5rem) + 15.5rem + 2 * var(--gutter)); }
.post-header { max-width: var(--measure); margin-bottom: 2rem; }
.post-header h1 {
  font-size: clamp(1.9rem, 1.5rem + 1.7vw, 2.6rem);
  font-weight: 700; letter-spacing: -0.025em; line-height: 1.12;
  text-wrap: balance;
}
.post-meta { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; color: var(--ink-3); font-size: 0.93rem; }
.post-header .tags { margin-top: 1rem; }
.post-body { display: block; }
.post.has-toc .post-body { display: grid; grid-template-columns: minmax(0, var(--measure)) 15.5rem; gap: clamp(2.5rem, 5vw, 4.5rem); }

.toc-side { position: sticky; top: calc(var(--header-h) + 1.5rem); align-self: start; max-height: calc(100vh - var(--header-h) - 3rem); overflow: auto; font-size: 0.9rem; }
.toc-title { font-family: var(--font-mono); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 0.75rem; }
.toc ul { list-style: none; }
.toc ul ul { padding-left: 0.85rem; }
.toc li { margin: 0; }
.toc a {
  display: block; padding: 0.3rem 0 0.3rem 0.85rem; line-height: 1.35;
  color: var(--ink-3); border-left: 2px solid var(--rule);
}
.toc ul ul a { font-size: 0.95em; }
.toc a:hover { color: var(--ink); }
[data-theme="dark"] .toc a:not(.active) { color: var(--ink-2); }
.toc a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 550; }
.toc-inline { display: none; }

@media (max-width: 1080px) {
  .post.has-toc .post-body { display: block; }
  .toc-side { display: none; }
  .toc-inline {
    display: block; max-width: var(--measure); margin-bottom: 2rem;
    border: 1px solid var(--rule); border-radius: var(--radius); background: var(--bg-elev);
  }
  .toc-inline summary { cursor: pointer; padding: 0.8rem 1rem; font-weight: 600; font-size: 0.95rem; }
  .toc-inline nav { padding: 0 1rem 0.9rem; }
}

.post-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
  max-width: var(--measure); margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--rule);
}
.post-nav-link {
  display: block; padding: 1rem 1.15rem; border: 1px solid var(--rule); border-radius: var(--radius);
  color: var(--ink); font-weight: 600; line-height: 1.35; background: var(--bg-elev);
}
.post-nav-link:hover { border-color: var(--accent); color: var(--ink); }
.post-nav-link span { display: block; font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 0.35rem; }
.post-nav-link.prev { grid-column: 2; text-align: right; }

/* ---------- Prose (post content) ---------- */
.prose { font-size: 1.075rem; line-height: 1.75; color: var(--ink-2); min-width: 0; }
.prose > * + * { margin-top: 1.25em; }
.prose h1, .prose h2, .prose h3, .prose h4 { color: var(--ink); position: relative; scroll-margin-top: calc(var(--header-h) + 1rem); }
.prose h1 { font-size: 1.6rem; font-weight: 700; margin-top: 2.1em; letter-spacing: -0.02em; }
.prose h1::after { content: ""; display: block; width: 2.5rem; height: 3px; border-radius: 2px; background: var(--accent); margin-top: 0.45em; }
.prose h2 { font-size: 1.4rem; font-weight: 700; margin-top: 2em; }
.prose h3 { font-size: 1.15rem; font-weight: 650; margin-top: 2em; }
.prose h4 { font-size: 1.02rem; font-weight: 650; margin-top: 1.8em; }
.prose > :first-child { margin-top: 0; }
.prose h1 + *, .prose h2 + *, .prose h3 + *, .prose h4 + * { margin-top: 0.7em; }
.prose .anchor { margin-left: 0.4em; color: var(--ink-3); opacity: 0; font-weight: 400; text-decoration: none; transition: opacity 0.15s; }
.prose h1:hover .anchor, .prose h2:hover .anchor, .prose h3:hover .anchor, .prose h4:hover .anchor, .prose .anchor:focus { opacity: 1; }

.prose a {
  color: var(--accent);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
}
.prose a:hover { text-decoration-color: currentColor; }
.prose strong { color: var(--ink); font-weight: 650; }
.prose em { font-style: italic; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { padding-left: 0.2rem; }
.prose li + li { margin-top: 0.4em; }
.prose li > ul, .prose li > ol { margin-top: 0.4em; }
.prose ul li::marker { color: var(--ink-3); }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5em 0; }

.prose blockquote {
  margin: 1.5em 0; padding: 0.25em 0 0.25em 1.1em;
  border-left: 3px solid var(--accent); color: var(--ink-2); font-style: italic;
}

.prose img { display: block; margin: 2em auto; border-radius: 8px; }
.prose p > a:only-child:has(> img) { display: block; text-decoration: none; }
.prose p:has(> img:only-child), .prose p:has(> a:only-child > img) { margin-top: 2em; margin-bottom: 2em; }
[data-theme="dark"] .prose img[src$=".svg"] { filter: brightness(0.92); }

.prose :not(pre) > code {
  font-family: var(--font-mono); font-size: 0.86em;
  padding: 0.12em 0.38em; border-radius: 5px;
  background: var(--bg-sunk); border: 1px solid var(--rule); color: var(--ink);
  overflow-wrap: anywhere;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.prose td code { white-space: nowrap; }

/* Code blocks: chroma classes (syntax.css) on a shared surface */
.prose .highlight { position: relative; margin: 1.6em 0; }
.prose pre {
  margin: 0; padding: 1rem 1.15rem; overflow-x: auto;
  font-family: var(--font-mono); font-size: 0.9rem; line-height: 1.6;
  background: var(--code-bg) !important; color: var(--ink);
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  tab-size: 2;
}
.prose pre code { font-family: inherit; background: none; padding: 0; border: 0; color: var(--ink); }
.prose .chroma { background: var(--code-bg) !important; }
.copy-btn {
  position: absolute; top: 0.5rem; right: 0.5rem;
  font: 500 0.75rem/1 var(--font-sans); padding: 0.4rem 0.6rem;
  border: 1px solid var(--rule-strong); border-radius: 6px;
  background: var(--bg-elev); color: var(--ink-2); cursor: pointer;
  opacity: 0; transition: opacity 0.15s;
}
.highlight:hover .copy-btn, .copy-btn:focus-visible, .copy-btn.done { opacity: 1; }
@media (hover: none) { .copy-btn { opacity: 1; } }

/* Tables */
.prose table {
  width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.95rem; line-height: 1.5;
  display: block; overflow-x: auto;
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
}
.prose table:not(:has(td:nth-child(4))) { display: table; }
.prose th, .prose td { text-align: left; padding: 0.6rem 0.85rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.prose thead th { font-weight: 600; color: var(--ink); background: var(--bg-sunk); border-bottom: 1px solid var(--rule-strong); }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose td { color: var(--ink-2); }
.prose tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--bg-sunk) 70%, transparent); }

/* ---------- Search ---------- */
.search-dialog {
  width: min(40rem, calc(100vw - 2rem)); max-height: min(70vh, 34rem);
  margin: 12vh auto auto; padding: 0;
  border: 1px solid var(--rule-strong); border-radius: 14px;
  background: var(--bg-elev); color: var(--ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}
.search-dialog::backdrop { background: rgba(10, 12, 16, 0.45); backdrop-filter: blur(2px); }
.search-form { display: flex; align-items: center; gap: 0.6rem; padding: 0.85rem 1rem; border-bottom: 1px solid var(--rule); color: var(--ink-3); }
.search-form input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); font: 400 1.05rem var(--font-sans); }
.search-close { border: 0; background: none; cursor: pointer; padding: 0; }
.search-results { list-style: none; overflow-y: auto; max-height: calc(min(70vh, 34rem) - 4rem); padding: 0.4rem; }
.search-results a { display: block; padding: 0.7rem 0.8rem; border-radius: 8px; color: var(--ink); }
.search-results a:hover, .search-results a[aria-selected="true"] { background: var(--accent-soft); }
.search-results .r-title { font-weight: 600; }
.search-results .r-meta { font-size: 0.82rem; color: var(--ink-3); margin-top: 0.15rem; }
.search-results .empty { padding: 1rem; color: var(--ink-3); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--rule); margin-top: 2rem; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 1.75rem; padding-bottom: 2rem; color: var(--ink-3); font-size: 0.9rem; }
.footer-links { display: flex; gap: 0.25rem; list-style: none; }
.footer-links a { display: inline-flex; padding: 0.45rem; border-radius: 7px; color: var(--ink-3); }
.footer-links a:hover { color: var(--ink); background: var(--bg-sunk); }

/* ---------- Small screens ---------- */
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; gap: 2rem; }
  .hero-avatar { width: 120px; border-radius: 20px; }
  .section { grid-template-columns: 1fr; gap: 1rem; padding-top: 2.25rem; padding-bottom: 2.25rem; }
  .project { grid-template-columns: 1fr; }
  .certs > ul { display: block; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--bg-elev); padding: 0.35rem 0.9rem; }
  .certs > ul > li { border: 0; border-radius: 0; background: none; padding: 0.5rem 0; border-bottom: 1px solid var(--rule); }
  .certs > ul > li:last-child { border-bottom: 0; }
  .project img { border-right: 0; border-bottom: 1px solid var(--rule); aspect-ratio: 16 / 9; }
  .post-row { grid-template-columns: 1fr; gap: 0.15rem; }
  .about { grid-template-columns: 1fr; }
  .about-photo { order: -1; width: 96px; height: 96px; }
  .prose { font-size: 1.04rem; }
  .post-header { margin-bottom: 1.25rem; }
  .post-meta, .post-header .tags { margin-top: 0.75rem; }
  .toc-inline { margin-bottom: 1.25rem; }
  .prose h1 { margin-top: 1.7em; }
  .post-header h1 { font-size: clamp(1.65rem, 6.5vw, 2.2rem); line-height: 1.18; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav-link.prev { grid-column: auto; text-align: left; }
}

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

@media print {
  .site-header, .site-footer, .toc, .post-nav, .copy-btn, .search-dialog { display: none !important; }
  body { background: #fff; color: #000; }
}
