:root {
  --bg: #0d1117;
  --surface: #111923;
  --surface-2: #0f151d;
  --text: #e6edf3;
  --muted: #8fa3b8;
  --line: #283847;
  --accent: #38bdf8;
  --shell: 1180px;
  --radius: 18px;
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { background: var(--bg); color: var(--text); scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  background:
    linear-gradient(rgba(56, 189, 248, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, .025) 1px, transparent 1px),
    var(--bg);
  background-size: 40px 40px;
  color: var(--text);
}
a { color: inherit; }
.shell { width: min(calc(100% - 40px), var(--shell)); margin-inline: auto; }
.skip-link { position: fixed; left: 16px; top: -80px; z-index: 100; background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 8px; }
.skip-link:focus { top: 16px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px);
}
.site-header__inner { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.brand { text-decoration: none; font: 800 24px/1 var(--font-mono); letter-spacing: -.06em; }
.brand span { color: var(--accent); }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; }
.site-nav a { color: var(--muted); text-decoration: none; font: 700 11px/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.site-nav a:hover, .site-nav a:focus-visible { color: var(--text); }
.theme-lab-link { border: 1px solid var(--line); border-radius: 999px; padding: 9px 12px; }

.site-main { min-height: calc(100vh - 150px); }
.eyebrow { color: var(--accent); font: 700 11px/1.3 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; }
.text-link { color: var(--accent); text-decoration: none; font: 700 11px/1.3 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.text-link:hover, .text-link:focus-visible { text-decoration: underline; text-underline-offset: .25em; }

.home-hero { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, .5fr); gap: clamp(36px, 7vw, 96px); align-items: end; padding: clamp(72px, 10vw, 140px) 0 78px; border-bottom: 1px solid var(--line); }
.home-hero h1 { max-width: 980px; margin: 18px 0 24px; font-family: var(--font-heading, var(--font-sans)); font-size: clamp(58px, 9vw, 118px); font-weight: var(--heading-weight, 800); line-height: .88; letter-spacing: -.075em; text-transform: var(--heading-transform, none); }
.home-hero p { max-width: 760px; margin: 0; color: var(--muted); font-size: clamp(18px, 2vw, 22px); line-height: 1.55; }
.home-telemetry { display: grid; grid-template-columns: 1fr auto; gap: 12px 24px; padding: 22px 0 3px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font: 11px/1.3 var(--font-mono); }
.home-telemetry span { color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.home-telemetry strong { color: var(--text); font-weight: 700; }
.home-section { padding: 72px 0; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.section-heading h2, .home-panel h2 { margin: 8px 0 0; font-family: var(--font-heading, var(--font-sans)); font-size: clamp(34px, 5vw, 58px); font-weight: var(--heading-weight, 800); line-height: .98; letter-spacing: -.045em; text-transform: var(--heading-transform, none); }
.section-heading__rule { flex: 1; height: 1px; margin-bottom: 7px; background: var(--line); }
.featured-story { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; padding: clamp(28px, 5vw, 48px); border: var(--border-size, 1px) solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--card-shadow); }
.featured-story__meta, .story-card__meta { display: flex; gap: 14px; color: var(--accent); font: 700 10px/1.3 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.featured-story h3 { max-width: 950px; margin: 0; font-family: var(--font-heading, var(--font-sans)); font-size: clamp(42px, 7vw, 84px); font-weight: var(--heading-weight, 800); line-height: .95; letter-spacing: -.055em; text-transform: var(--heading-transform, none); }
.featured-story h3 a, .story-card h3 a, .latest-row h3 a { text-decoration: none; }
.featured-story h3 a:hover, .featured-story h3 a:focus-visible, .story-card h3 a:hover, .story-card h3 a:focus-visible, .latest-row h3 a:hover, .latest-row h3 a:focus-visible { color: var(--accent); }
.featured-story p { max-width: 760px; margin: 0; color: var(--muted); font-size: 18px; line-height: 1.6; }
.featured-secondary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 18px; }
.story-card { min-height: 260px; display: flex; flex-direction: column; padding: 24px; border: var(--border-size, 1px) solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--card-shadow); }
.story-card h3 { margin: auto 0 14px; font-family: var(--font-heading, var(--font-sans)); font-size: 28px; font-weight: var(--heading-weight, 800); line-height: 1.02; letter-spacing: -.035em; text-transform: var(--heading-transform, none); }
.story-card p { margin: 0; color: var(--muted); line-height: 1.5; }
.latest-list { border-top: 1px solid var(--line); }
.latest-row { display: grid; grid-template-columns: 130px 1fr auto; gap: 24px; align-items: start; padding: 24px 0; border-bottom: 1px solid var(--line); }
.latest-row time { color: var(--muted); font: 11px/1.4 var(--font-mono); text-transform: uppercase; }
.latest-row h3 { margin: 0 0 7px; font-family: var(--font-heading, var(--font-sans)); font-size: clamp(24px, 3vw, 36px); font-weight: var(--heading-weight, 800); line-height: 1.06; letter-spacing: -.03em; text-transform: var(--heading-transform, none); }
.latest-row p { max-width: 760px; margin: 0; color: var(--muted); line-height: 1.5; }
.latest-row > span { color: var(--accent); font-family: var(--font-mono); }
.topic-cloud { display: flex; flex-wrap: wrap; gap: 10px; }
.topic-chip { padding: 9px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font: 700 10px/1 var(--font-mono); letter-spacing: .05em; text-transform: uppercase; }
.home-closing-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; }
.home-panel { min-height: 320px; display: flex; flex-direction: column; align-items: flex-start; padding: 30px; border: var(--border-size, 1px) solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--card-shadow); }
.home-panel p { max-width: 620px; color: var(--muted); font-size: 17px; line-height: 1.6; }
.home-panel .text-link { margin-top: auto; }

.post-shell { width: min(calc(100% - 40px), 980px); margin: 0 auto; padding: clamp(58px, 8vw, 104px) 0 96px; }
.post-header { padding-bottom: 38px; border-bottom: 1px solid var(--line); margin-bottom: 34px; }
.post-kicker { margin: 0 0 16px; color: var(--accent); font: 700 11px/1.3 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; }
.post-header h1 { max-width: 900px; margin: 0; font-size: clamp(44px, 7vw, 78px); line-height: .98; letter-spacing: -.055em; }
.post-description { max-width: 760px; margin: 22px 0 0; color: var(--muted); font-size: clamp(18px, 2vw, 22px); line-height: 1.55; }
.post-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; color: var(--muted); font: 12px/1.5 var(--font-mono); }

.archive-notice { display: grid; grid-template-columns: 90px 1fr; gap: 22px; margin: 0 0 44px; padding: 20px 22px; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 90%, var(--accent) 10%); }
.archive-notice__year { color: var(--accent); font: 800 clamp(28px, 5vw, 44px)/1 var(--font-mono); letter-spacing: -.06em; }
.archive-notice__label { margin: 0 0 6px; color: var(--accent); font: 700 11px/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; }
.archive-notice p:last-child { max-width: 720px; margin: 0; color: var(--muted); line-height: 1.55; }

.post-content { font-size: 18px; line-height: 1.78; overflow-wrap: anywhere; }
.post-content > :first-child { margin-top: 0; }
.post-content h2, .post-content h3, .post-content h4 { position: relative; scroll-margin-top: 110px; margin-top: 2em; line-height: 1.18; letter-spacing: -.025em; }
.post-content h2 { font-size: 1.75em; }
.post-content h3 { font-size: 1.35em; }
.post-content p, .post-content ul, .post-content ol, .post-content blockquote { max-width: 760px; }
.post-content li + li { margin-top: .35em; }
.post-content a { color: var(--accent); text-underline-offset: .18em; }
.post-content img { display: block; max-width: 100%; height: auto; margin: 32px 0; border: 1px solid var(--line); border-radius: max(4px, calc(var(--radius) * .65)); }
.post-content pre { max-width: 100%; overflow-x: auto; margin: 0; padding: 24px; border: 0; background: transparent; color: var(--code-text, #dbeafe); font: 14px/1.7 var(--font-mono); tab-size: 2; }
.post-content code { font-family: var(--font-mono); }
.post-content :not(pre) > code { padding: .14em .38em; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); font-size: .88em; }
.post-content blockquote { margin-left: 0; padding: 4px 0 4px 22px; border-left: 3px solid var(--accent); color: var(--muted); }
.post-content table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.post-content th, .post-content td { padding: 10px 14px; border: 1px solid var(--line); text-align: left; }

.code-block, .post-content .highlight { position: relative; max-width: 920px; margin: 30px 0; overflow: hidden; border: 1px solid var(--line); border-radius: max(4px, calc(var(--radius) * .8)); background: var(--code-bg, #081018); }
.code-copy { position: absolute; top: 10px; right: 10px; z-index: 2; padding: 7px 9px; border: 1px solid color-mix(in srgb, var(--line) 70%, white 10%); border-radius: 7px; background: color-mix(in srgb, var(--code-bg, #081018) 86%, transparent); color: var(--code-text, #dbeafe); cursor: pointer; font: 700 10px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.code-copy:hover, .code-copy:focus-visible { border-color: var(--accent); outline: none; }
.heading-anchor { position: absolute; right: 100%; top: 0; padding-right: 9px; color: var(--muted) !important; opacity: 0; text-decoration: none; font-family: var(--font-mono); font-weight: 400; }
.post-content h2:hover .heading-anchor, .post-content h3:hover .heading-anchor, .heading-anchor:focus-visible { opacity: 1; }

.highlight .c, .highlight .cm, .highlight .c1, .highlight .cs { color: #7f8c98; font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kt { color: #c792ea; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sc, .highlight .sd, .highlight .se, .highlight .sh, .highlight .si, .highlight .sx { color: #c3e88d; }
.highlight .m, .highlight .mi, .highlight .mf, .highlight .mh, .highlight .mo { color: #f78c6c; }
.highlight .na, .highlight .nb, .highlight .nc, .highlight .nf, .highlight .nn, .highlight .nt { color: #82aaff; }
.highlight .o, .highlight .ow { color: #89ddff; }
.highlight .p { color: var(--code-text, #dbeafe); }

.post-navigation { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 68px; padding-top: 30px; border-top: 1px solid var(--line); }
.post-navigation__item { min-height: 132px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; }
.post-navigation__item:hover, .post-navigation__item:focus-visible { border-color: var(--accent); outline: none; }
.post-navigation__item--next { text-align: right; }
.post-navigation__label { display: block; margin-bottom: 18px; color: var(--accent); font: 700 10px/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.post-navigation__item strong { display: block; font: var(--heading-weight, 800) 20px/1.15 var(--font-heading, var(--font-sans)); }

.site-footer { border-top: 1px solid var(--line); color: var(--muted); }
.site-footer__inner { min-height: 76px; display: flex; justify-content: space-between; align-items: center; gap: 20px; font: 12px/1.4 var(--font-mono); }

@media (max-width: 900px) {
  .home-hero { grid-template-columns: 1fr; }
  .featured-secondary { grid-template-columns: 1fr; }
  .story-card { min-height: 190px; }
  .home-closing-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .site-header__inner { align-items: flex-start; padding-block: 20px; }
  .site-nav { justify-content: flex-end; gap: 12px 16px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .section-heading__rule { display: none; }
  .latest-row { grid-template-columns: 1fr auto; gap: 10px 18px; }
  .latest-row time { grid-column: 1 / -1; }
  .latest-row p { display: none; }
  .post-content { font-size: 17px; }
  .archive-notice { grid-template-columns: 1fr; }
  .archive-notice__year { font-size: 30px; }
  .post-navigation { grid-template-columns: 1fr; }
  .post-navigation__item--next { text-align: left; }
  .heading-anchor { position: static; padding-right: 7px; opacity: .55; }
  .site-footer__inner { align-items: flex-start; flex-direction: column; justify-content: center; }
}

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