/* Shared by every page under /post/. Tokens and header geometry match the homepage (/index.html). */
:root{
  color-scheme: light;
  --bg:#ffffff;
  --ink:#171717;
  --muted:#666666;
  --rule:#e2e2e2;
  --surface:#f7f7f7;
  --accent:#171717;
  /* Figure series, validated against this page surface. Assign in order; never reuse for text. */
  --fig-1:#2a78d6;
  --fig-2:#eb6834;
  --fig-3:#1baf7a;
  --fig-ink:#666666;
  --fig-grid:#e2e2e2;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    color-scheme: dark;
    --bg:#111111;
    --ink:#ededed;
    --muted:#a3a3a3;
    --rule:#303030;
    --surface:#1a1a1a;
    --accent:#ededed;
    --fig-1:#3987e5;
    --fig-2:#d95926;
    --fig-3:#199e70;
    --fig-ink:#a3a3a3;
    --fig-grid:#303030;
  }
}
:root[data-theme="dark"]{
  color-scheme: dark;
  --bg:#111111;
  --ink:#ededed;
  --muted:#a3a3a3;
  --rule:#303030;
  --surface:#1a1a1a;
  --accent:#ededed;
  --fig-1:#3987e5;
  --fig-2:#d95926;
  --fig-3:#199e70;
  --fig-ink:#a3a3a3;
  --fig-grid:#303030;
}

*{ box-sizing:border-box; }
body{
  margin:0;
  font:17px/1.55 Charter,"Bitstream Charter","Sitka Text",Cambria,Georgia,"Songti SC",serif;
  background:var(--bg);
  color:var(--ink);
  -webkit-font-smoothing:antialiased;
}
.wrap{
  max-width:860px;
  margin:0 auto;
  padding:88px 32px 48px;
}

a{
  color:inherit;
  text-decoration:underline;
  text-decoration-color:var(--muted);
  text-decoration-thickness:1px;
  text-underline-offset:3px;
  transition:color .12s ease, text-decoration-color .12s ease;
}
a:hover{ color:var(--accent); text-decoration-color:currentColor; }
a:focus-visible, button:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; border-radius:2px; }

/* ---------- Header: same position as the homepage's Posts and theme controls ---------- */
.site-head{
  position:relative;
  height:46px;
  margin-bottom:48px;
}
.brand{
  position:absolute;
  top:-3px;
  left:0;
  font-size:22px;
  line-height:46px;
  text-decoration:none;
}
.actions{
  position:absolute;
  top:-3px;
  right:0;
  display:flex;
  align-items:center;
  gap:18px;
  height:46px;
}
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:40px;
  height:40px;
  padding:0;
  border:0;
  background:none;
  font:inherit;
  font-size:15px;
  color:var(--ink);
  text-decoration:none;
  cursor:pointer;
}
.btn-text{ padding:0 6px; }
.btn svg{
  width:20px;
  height:20px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.5;
  stroke-linecap:round;
  stroke-linejoin:round;
}
/* Keeps the 40px hit area while the icon lines up with the right edge of the page. */
.theme-toggle{ margin-right:-12px; }
.theme-toggle[hidden]{ display:none; }
.theme-toggle[data-next="dark"] .icon-sun,
.theme-toggle[data-next="light"] .icon-moon{ display:none; }

h1{
  margin:0;
  font-size:32px;
  font-weight:700;
  line-height:1.15;
  letter-spacing:-.01em;
}
footer{
  margin-top:72px;
  font-size:14px;
  color:var(--muted);
}

/* ---------- Posts page ---------- */
.post-filter{
  display:flex;
  flex-wrap:wrap;
  gap:4px 18px;
  margin:20px 0 0;
  font-size:16px;
}
.post-filter a{ color:var(--muted); text-decoration:none; }
.post-filter a:hover{ color:var(--ink); }
.post-filter a[aria-current="true"]{
  color:var(--ink);
  text-decoration:underline;
  text-decoration-color:currentColor;
}
.post-filter + .post-list{ margin-top:16px; }
.post-list{ margin:28px 0 0; padding:0; list-style:none; }
.post-item{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  column-gap:24px;
  padding:18px 0;
  border-top:1px solid var(--rule);
}
.post-item[hidden]{ display:none; }
.post-item h2{
  margin:0;
  font-size:20px;
  font-weight:700;
  line-height:1.32;
}
.post-item time{
  justify-self:end;
  font-size:16px;
  line-height:26px;
  color:var(--muted);
  font-variant-numeric:lining-nums;
}
.post-item p{
  grid-column:1;
  max-width:660px;
  margin:4px 0 0;
  font-size:16px;
  line-height:1.42;
  color:var(--muted);
}
.post-item .post-cat{ grid-column:2; grid-row:2; justify-self:end; margin-top:6px; font-size:13px; text-align:right; }
.post-cat a, .post-meta a{
  display:inline-block;
  padding:2px 8px;
  border:1px solid var(--rule);
  border-radius:6px;
  background:var(--surface);
  line-height:1.4;
  color:var(--muted);
  text-decoration:none;
}
.post-cat a:hover, .post-meta a:hover{ color:var(--ink); border-color:currentColor; }

/* ---------- A post ---------- */
.post-title{ max-width:720px; }
.post-meta{ margin:10px 0 32px; font-size:16px; color:var(--muted); }
.post-meta a{ font-size:13px; }
.post-body p, .post-body ul, .post-body ol, .post-body blockquote, .post-body h2, .post-body h3, .post-body hr{ max-width:660px; }
.post-body p{ margin:0 0 18px; line-height:1.6; }
.post-body h2{ margin:36px 0 12px; font-size:22px; font-weight:700; line-height:1.25; }
.post-body h3{ margin:28px 0 10px; font-size:18px; font-weight:700; line-height:1.3; }
.post-body hr{ margin:40px 0 20px; border:0; border-top:1px solid var(--rule); }
.post-body .small{ font-size:15px; line-height:1.5; color:var(--muted); }
/* Visible on purpose: a page with one of these is not ready to publish. */
.todo{
  padding:0 4px;
  border:1px dashed var(--muted);
  border-radius:4px;
  font-size:.9em;
  color:var(--muted);
}

/* Figures may run past the text column, up to the page's right edge. */
figure{ margin:28px 0; }
figure img{ display:block; width:100%; height:auto; }
figcaption{ max-width:660px; margin-top:8px; font-size:15px; line-height:1.45; color:var(--muted); }
.datalinks{ font-size:14px; }
.figlegend{
  display:flex;
  flex-wrap:wrap;
  gap:4px 18px;
  margin:0 0 6px;
  padding:0;
  list-style:none;
  font-size:14px;
  line-height:1.4;
}
.figlegend .sw{ margin-right:7px; }
.figrow{ display:flex; flex-wrap:wrap; gap:8px 16px; }
.figrow .panel{ flex:1 1 0; min-width:0; }
.figrow svg{
  display:block;
  width:100%;
  height:auto;
  font-family:inherit;
  font-variant-numeric:lining-nums;
}
.figtip{
  position:fixed;
  z-index:10;
  display:none;
  max-width:320px;
  padding:7px 10px;
  border:1px solid var(--rule);
  border-radius:8px;
  background:var(--bg);
  box-shadow:0 2px 8px rgba(0,0,0,.08);
  font-size:13.5px;
  line-height:1.45;
  color:var(--ink);
  pointer-events:none;
  font-variant-numeric:lining-nums;
}
.figtip .dim{ color:var(--muted); }
.sw{ display:inline-block; width:12px; height:3px; margin-right:6px; border-radius:2px; vertical-align:middle; }
.sw.dash{ background:repeating-linear-gradient(90deg,var(--fig-ink) 0 3px,transparent 3px 5px); }

@media (max-width:700px){
  .figrow{ flex-direction:column; }
  .figrow .panel{ flex:none; width:100%; }
}
@media (max-width:640px){
  .wrap{ padding:56px 20px 36px; }
  .site-head{ height:40px; margin-bottom:36px; }
  .brand{ line-height:40px; }
  .actions{ height:40px; }
  h1{ font-size:28px; }
  .post-item{ grid-template-rows:auto 1fr; }
  .post-item h2{ grid-row:1 / span 2; }
  .post-item p{ grid-column:1 / -1; }
  .post-item .post-cat{ grid-column:2; }
  footer{ margin-top:48px; }
}
