/* shell.css — pknull.ai notebook shell
   palette + base + layout + lists + cards + post + journal integration */

@font-face{
  font-family: "JetBrainsMono Nerd Font";
  src: url("../fonts/JetBrainsMonoNerdFontMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ── Palette + tokens ────────────────────────────────────────── */
:root{
  /* gruvbox LIGHT palette — warm retro (default) */
  --paper:        #FBF1C7;
  --paper-2:      #F2E5BC;
  --paper-3:      #EBDBB2;
  --ink:          #3C3836;
  --ink-2:        #504945;
  --ink-3:        #665C54; /* gruvbox fg3 — was fg4 (#7C6F64) but failed WCAG AA on paper */
  --accent:       #9D0006;
  --accent-soft:  #CC241D;
  --mark:         #FABD2F;
  --rule:         #D5C4A1;
  --stripe:       rgba(157,0,6,.06);
  --code-bg:      rgba(157,0,6,.07);
  --th-bg:        rgba(213,196,161,.5);
  --grain:        rgba(124,111,100,.06);
  --grain-2:      rgba(124,111,100,.05);
  --link-uline:   rgba(157,0,6,.35);
  --bq-bg:        rgba(157,0,6,.04);
  --gb-aqua:      #427B58;
  --gb-blue:      #076678;
  --gb-purple:    #8F3F71;
  --gb-orange:    #AF3A03;
  --gb-green:     #79740E;

  --f-sans:  "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-serif: "Source Serif 4", ui-serif, Georgia, "Times New Roman", serif;
  --f-mono:  "JetBrainsMono Nerd Font", "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --measure: 720px;
  --wide:    1100px;
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 72px;

  --fs-body: 17px;
  --lh-body: 1.65;
}

:root[data-mode="dark"]{
  --paper:        #282828;
  --paper-2:      #32302F;
  --paper-3:      #3C3836;
  --ink:          #EBDBB2;
  --ink-2:        #D5C4A1;
  --ink-3:        #BDAE93; /* bumped from #A89984 for WCAG AA on paper / paper-3 */
  --accent:       #FF6453; /* lifted from #FB4934 for WCAG AA contrast on paper */
  --accent-soft:  #FE8019;
  --mark:         #FABD2F;
  --rule:         #504945;
  --stripe:       rgba(251,73,52,.08);
  --code-bg:      rgba(251,73,52,.12);
  --th-bg:        rgba(80,73,69,.55);
  --grain:        rgba(235,219,178,.04);
  --grain-2:      rgba(235,219,178,.035);
  --link-uline:   rgba(251,73,52,.4);
  --bq-bg:        rgba(251,73,52,.06);
}

/* ── Base ────────────────────────────────────────────────────── */
*,*::before,*::after{ box-sizing: border-box; }
html,body{ margin:0; padding:0; }
body{
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-serif);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-feature-settings: "onum" 1, "kern" 1, "liga" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .25s ease, color .25s ease;
}
body::before{
  content:"";
  position: fixed; inset:0;
  pointer-events:none;
  background-image:
    radial-gradient(var(--grain) 1px, transparent 1px),
    radial-gradient(var(--grain-2) 1px, transparent 1px);
  background-size: 3px 3px, 7px 7px;
  background-position: 0 0, 1px 2px;
  opacity:.9;
  z-index:0;
}

a{ color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--link-uline); }
a:hover{ color: var(--accent-soft); border-bottom-color: var(--accent-soft); }
a:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; }

h1,h2,h3,h4,h5,h6{
  font-family: var(--f-sans);
  color: var(--ink);
  letter-spacing: -0.01em;
  margin: 0 0 .4em;
  line-height: 1.18;
  text-wrap: balance;
}
h1{ font-size: 2.25rem; font-weight: 700; letter-spacing: -0.02em; }
h2{ font-size: 1.5rem;  font-weight: 600; margin-top: 2em; }
h3{ font-size: 1.15rem; font-weight: 600; margin-top: 1.6em; }
h4{ font-size: 1.05rem; font-weight: 600; margin-top: 1.4em; }
h5,h6{ font-size: 1rem; font-weight: 600; margin-top: 1.2em; }

p{ margin: 0 0 1em; text-wrap: pretty; }

code, kbd, samp{
  font-family: var(--f-mono);
  font-size: .88em;
  background: var(--code-bg);
  color: var(--ink);
  padding: 1px 5px;
  border-radius: 3px;
}
pre{
  font-family: var(--f-mono);
  font-size: .86em;
  line-height: 1.55;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: var(--s-4) var(--s-5);
  overflow-x: auto;
  margin: var(--s-5) 0;
  position: relative;
}
pre code{ background: none; padding:0; border-radius:0; }

hr{
  border: 0;
  border-top: 1px solid var(--rule);
  margin: var(--s-6) 0;
}

blockquote{
  margin: var(--s-5) 0;
  padding: .4em var(--s-5);
  border-left: 3px solid var(--accent);
  background: var(--bq-bg);
  color: var(--ink-2);
  font-style: italic;
}
blockquote > p:last-child{ margin-bottom: 0; }

img{ max-width: 100%; height: auto; }

/* Selection: gruvbox yellow background + always-dark text so it stays
   legible in both light and dark modes (the highlight color is the same
   saturated yellow regardless of theme). */
::selection{ background: var(--mark); color: #3C3836; }
::-moz-selection{ background: var(--mark); color: #3C3836; }

::-webkit-scrollbar{ width: 8px; height: 8px; }
::-webkit-scrollbar-track{ background: var(--paper-2); }
::-webkit-scrollbar-thumb{ background: var(--rule); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover{ background: var(--ink-3); }

.mono{ font-family: var(--f-mono); }
.sans{ font-family: var(--f-sans); }
.caps{ text-transform: uppercase; letter-spacing: .08em; }
.dim { color: var(--ink-3); }
.small{ font-size: .82rem; }

/* ── Tables ──────────────────────────────────────────────────── */
.tbl-wrap{
  overflow-x: auto;
  margin: var(--s-5) 0;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper-2);
}
table{
  width: 100%;
  border-collapse: collapse;
  font-family: var(--f-sans);
  font-size: .92rem;
  margin: var(--s-5) 0;
}
th, td{
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
th{
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
  background: var(--th-bg);
}
tr:last-child td{ border-bottom: 0; }
tbody tr:hover{ background: var(--stripe); }

/* ── Shell grid ──────────────────────────────────────────────── */
.shell{
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto 1fr;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}
.shell > *{ min-width: 0; }

/* ── Header ──────────────────────────────────────────────────── */
.nb-hd{
  max-width: var(--wide);
  width: 100%;
  margin: 0 auto;
  padding: 28px var(--s-5) 22px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--s-6);
  border-bottom: 1px solid var(--rule);
}
.brand{
  display: flex; align-items: center; gap: 10px;
  font-family: var(--f-sans);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: .12em;
  color: var(--ink);
  border: 0;
}
.brand:hover{ color: var(--accent); border: 0; }
.brand-glyph{
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 0;
}
.brand-glyph svg{
  display: block;
}
.brand-domain{ letter-spacing: 0; text-transform: lowercase; color: var(--ink-3); }
.nb-nav{
  justify-self: center;
  display: flex;
  gap: var(--s-5);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-family: var(--f-sans);
  font-size: .82rem;
}
.nb-nav a{
  color: var(--ink-2);
  border: 0;
  padding-bottom: 3px;
  border-bottom: 1px solid transparent;
}
.nb-nav a:hover{ color: var(--accent); }
.nb-nav a.on{
  color: var(--ink);
  border-bottom-color: var(--accent);
}
.nb-meta{ display: flex; align-items: center; gap: var(--s-3); }
.live-dot{
  width: 6px; height: 6px; border-radius: 50%;
  background: #4a7c2a;
  box-shadow: 0 0 0 3px rgba(74,124,42,.18);
  display: inline-block;
}

/* mode toggle button — sits in .nb-meta */
.mode-toggle{
  appearance: none;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-2);
  font-family: var(--f-mono);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 4px 9px;
  border-radius: 2px;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
  min-height: 28px;
  /* Reserve room for the longest label ("LIGHT") so the button doesn't
     reflow the header when AUTO ↔ LIGHT ↔ DARK rotate. */
  min-width: 64px;
  line-height: 1;
  text-align: center;
}
.mode-toggle:hover{ color: var(--accent); border-color: var(--accent); }
.mode-toggle:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 820px){
  .nb-hd{ grid-template-columns: 1fr; text-align: center; gap: var(--s-4); padding: 22px var(--s-4) 16px; }
  .nb-nav{ justify-self: center; }
  .nb-meta{ justify-self: center; }
}

/* ── Main ────────────────────────────────────────────────────── */
.main{
  max-width: var(--wide);
  width: 100%;
  margin: 0 auto;
  padding: var(--s-7) var(--s-5) var(--s-8);
}
.main--post{ max-width: var(--measure); }

.main--post .tbl-wrap,
.main--post pre{
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}
.main--post .img-ph.wide,
.main--post .figure{
  margin-left: calc(50% - 50vw + var(--s-5));
  margin-right: calc(50% - 50vw + var(--s-5));
  max-width: none;
  width: auto;
}
@media (min-width: 1100px){
  .main--post .img-ph.wide,
  .main--post .figure{
    margin-left: calc((var(--measure) - 1060px)/2);
    margin-right: calc((var(--measure) - 1060px)/2);
  }
}

/* ── Page header ─────────────────────────────────────────────── */
.page-hd{
  margin-bottom: var(--s-6);
  padding-bottom: var(--s-5);
  border-bottom: 1px solid var(--rule);
}
.hd-kicker{ margin-bottom: 6px; font-family: var(--f-mono); font-size: .82rem; }
.hd-kicker a{ border: 0; color: var(--ink-3); }
.hd-kicker a:hover{ color: var(--accent); }
.page-hd h1{ margin-bottom: .25em; }
.page-lede{
  font-size: 1.05rem;
  color: var(--ink-2);
  max-width: 70ch;
  margin: 0;
}

/* ── Now-strip (top status bar, above header) ───────────────── */
.now-strip{
  background: var(--paper-2);
  border-bottom: 1px solid var(--rule);
  font-family: var(--f-mono);
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: .04em;
}
.now-strip-inner{
  max-width: var(--wide);
  margin: 0 auto;
  padding: 9px var(--s-5);
  display: flex;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: var(--s-5);
}
.now-item{ display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.now-key{ color: var(--accent); letter-spacing: .12em; flex-shrink: 0; }
.now-val{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.now-val em{ color: var(--ink); font-style: italic; }
.now-val a{ color: var(--ink); border-bottom: 1px dotted var(--ink-3); }
.now-val a:hover{ color: var(--accent); border-bottom-color: var(--accent); }
@media (max-width: 720px){
  .now-strip{ display: none; }
}

/* ── Home: hero with marginalia "Standing" panel ─────────────── */
.hero{
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--s-7);
  align-items: end;
  padding-bottom: var(--s-7);
  margin-bottom: var(--s-7);
  border-bottom: 1px solid var(--rule);
  max-width: none;
}
@media (max-width: 900px){
  .hero{ grid-template-columns: 1fr; gap: var(--s-5); align-items: start; }
}
.hero-kicker{
  font-family: var(--f-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-3);
  margin-bottom: var(--s-3);
}
.hero-kicker::before{ content: "// "; color: var(--accent); }
.hero-title{
  font-family: var(--f-sans);
  font-weight: 700;
  font-size: clamp(2rem, 4.2vw, 3rem);
  line-height: 1.08;
  letter-spacing: -.022em;
  margin: 0 0 var(--s-4);
  color: var(--ink);
  text-wrap: balance;
}
.hero-title em{
  font-family: var(--f-mono);
  font-style: normal;
  font-weight: 500;
  color: var(--accent);
  font-size: .82em;
  padding: 0 .15em;
}
.hero-lede{
  font-family: var(--f-serif);
  font-size: 1.12rem;
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 58ch;
  margin: 0 0 var(--s-5);
  text-wrap: pretty;
}
.hero-lede a{ color: var(--ink); border-bottom: 1px solid var(--accent); }
.hero-lede a:hover{ color: var(--accent); }
.hero-actions{ display: flex; gap: 10px; flex-wrap: wrap; }

.btn-pri, .btn-sec{
  font-family: var(--f-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .04em;
  padding: 10px 18px;
  border-radius: 2px;
  border: 1px solid var(--accent);
  text-transform: uppercase;
}
.btn-pri{ background: var(--accent); color: var(--paper); }
.btn-pri:hover{ background: var(--accent-soft); color: var(--paper); border-color: var(--accent-soft); }
.btn-sec{ background: transparent; color: var(--accent); }
.btn-sec:hover{ background: var(--stripe); color: var(--accent-soft); border-color: var(--accent-soft); }

.hero-aside{
  border-left: 1px solid var(--rule);
  padding-left: var(--s-5);
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.6;
}
.aside-hd{
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--ink-3);
  font-size: 10.5px;
  margin-bottom: 12px;
}
.aside-list{ margin: 0; padding: 0; }
.aside-row{
  display: grid; grid-template-columns: 64px 1fr; gap: 10px;
  padding: 6px 0;
  border-top: 1px dashed var(--rule);
}
.aside-row dt{ color: var(--accent); margin: 0; }
.aside-row dd{ margin: 0; color: var(--ink); }

/* ── Home: two-up split ─────────────────────────────────────── */
.home-split{
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: var(--s-7);
  margin-bottom: var(--s-7);
}
@media (max-width: 900px){ .home-split{ grid-template-columns: 1fr; gap: var(--s-6); } }

.col-hd{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 10px;
  margin-bottom: var(--s-5);
  border-bottom: 1px solid var(--rule);
}
.col-hd h2{
  margin: 0;
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: 1.05rem;
  letter-spacing: .02em;
  text-transform: lowercase;
  color: var(--ink);
}
.col-hd h2::before{ content: "~/"; color: var(--accent); margin-right: 2px; }
.col-hd h2 em{ font-style: normal; }
.col-hd a{
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--ink-3);
  border: 0;
}
.col-hd a:hover{ color: var(--accent); }

/* ── Home: featured posts (photo-led) ───────────────────────── */
.post-feat-list{ list-style: none; margin: 0; padding: 0; }
.post-feat{ border-bottom: 1px solid var(--rule); }
.post-feat-link{
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: var(--s-5);
  padding: var(--s-5) 0;
  color: var(--ink);
  border: 0;
  align-items: start;
}
.post-feat-link:hover{ color: var(--ink); border: 0; }
.post-feat-link:hover .post-feat-blurb{ color: var(--accent); }
.post-feat-img{
  width: 180px; height: 124px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  overflow: hidden;
  position: relative;
  display: grid;
  place-items: center;
  background-image: repeating-linear-gradient(45deg, var(--paper-2) 0 8px, var(--paper-3) 8px 16px);
}
.post-feat-img img{
  width: 100%; height: 100%; object-fit: cover; display: block;
  filter: saturate(.92) contrast(1.02);
}
.post-feat-img .ph-date{
  font-family: var(--f-mono); font-size: 12px; color: var(--ink-3);
}
.post-feat-meta{
  display: flex; gap: 10px; align-items: center;
  font-family: var(--f-mono);
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: .04em;
  margin-bottom: 8px;
}
.post-feat-meta-sep{ opacity: .4; }
.post-feat-blurb{
  margin: 0;
  color: var(--ink);
  font-family: var(--f-serif);
  font-size: 1.06rem;
  line-height: 1.45;
  max-width: 56ch;
  text-wrap: pretty;
  transition: color .12s ease;
}
@media (max-width: 600px){
  .post-feat-link{ grid-template-columns: 1fr; }
  .post-feat-img{ width: 100%; height: 180px; }
}

/* ── Home: project cards with promoted etymology ────────────── */
.proj-card{ border-bottom: 1px solid var(--rule); list-style: none; }
.proj-card .proj-link{
  display: block;
  padding: var(--s-5) 0;
  color: var(--ink);
  border: 0;
}
.proj-card .proj-link:hover{ color: var(--ink); border: 0; }
.proj-card .proj-link:hover .proj-card-name{ color: var(--accent); }
.proj-card-head{
  margin-bottom: 4px;
}
.proj-card-name{
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: 1.15rem;
  letter-spacing: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  transition: color .12s ease;
}
.proj-dot{
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block;
  background: var(--ink-3);
  flex-shrink: 0;
}
.proj-card.state-active .proj-dot{ background: var(--gb-green); box-shadow: 0 0 0 3px rgba(121,116,14,.18); }
.proj-card.state-inactive .proj-dot{ background: var(--ink-3); }
.proj-card.state-archived .proj-dot{ background: var(--ink-3); opacity: .5; }
.proj-card-state{
  font-family: var(--f-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.proj-card.kind-writing .proj-card-state{ color: #B57614; }
.proj-card.kind-coding .proj-card-state{ color: var(--gb-blue); }
.proj-card-lede{
  font-size: 1rem;
  color: var(--ink-2);
  margin: 0 0 var(--s-3);
  max-width: 50ch;
  text-wrap: pretty;
}
.proj-card-etym{
  font-family: var(--f-mono);
  font-size: 11.5px;
  color: var(--ink-3);
  padding-left: var(--s-3);
  border-left: 2px solid var(--mark);
  line-height: 1.55;
}
.proj-card-etym-word{ color: var(--accent); font-weight: 500; }

/* ── Post lists ──────────────────────────────────────────────── */
.post-list{ list-style: none; padding: 0; margin: 0; }

.post-list.tight li + li{ border-top: 1px dashed var(--rule); }
.post-list.tight a{
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: var(--s-4);
  align-items: baseline;
  padding: 10px 0;
  border: 0;
  color: var(--ink);
}
.post-list.tight a:hover{
  color: var(--accent);
  background: var(--stripe);
  padding-left: 8px;
  padding-right: 8px;
  margin-left: -8px;
  margin-right: -8px;
  border-radius: 3px;
}
.post-list.tight .pl-date{ font-variant-numeric: tabular-nums; font-family: var(--f-mono); font-size: .82rem; color: var(--ink-3); }
.post-list.tight .pl-title{ font-family: var(--f-sans); font-size: .98rem; }
.post-list.tight .pl-tag{ color: var(--accent); font-family: var(--f-mono); font-size: .78rem; }
@media (max-width: 560px){
  .post-list.tight a{ grid-template-columns: 1fr auto; }
  .post-list.tight .pl-date{ grid-column: 1 / -1; order: -1; }
}

.month-group{ margin-bottom: var(--s-6); }
.month-hd{
  font-size: .72rem; letter-spacing: .1em;
  padding: var(--s-4) 0 6px;
  color: var(--ink-3);
  font-family: var(--f-mono);
  text-transform: uppercase;
}

.post-list.big li{
  padding: var(--s-5) 0;
  border-top: 1px solid var(--rule);
}
.post-list.big li:last-child{ border-bottom: 1px solid var(--rule); }
.post-list.big a{ display: block; border: 0; color: var(--ink); }
.post-list.big a:hover .pl-title-big{ color: var(--accent); }
.pl-meta{
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 6px;
  color: var(--ink-3);
  font-family: var(--f-mono);
  font-size: .82rem;
}
.pl-meta .sep{ opacity: .5; }
.pl-meta .pl-tag{ color: var(--accent); }
.pl-title-big{
  font-family: var(--f-sans);
  font-weight: 600;
  font-size: 1.3rem;
  letter-spacing: -.01em;
  line-height: 1.25;
  margin-bottom: 6px;
  text-wrap: balance;
  transition: color .12s ease;
}
.pl-blurb{
  font-size: 1rem;
  max-width: 70ch;
  color: var(--ink-2);
}
.empty{
  padding: var(--s-6) 0;
  text-align: center;
  border-top: 1px dashed var(--rule);
  border-bottom: 1px dashed var(--rule);
  color: var(--ink-3);
}

/* ── Projects ────────────────────────────────────────────────── */
.proj-list{ list-style: none; padding: 0; margin: 0; }
.proj-row{
  padding: var(--s-4) 0;
  border-top: 1px dashed var(--rule);
}
.proj-row:first-child{ border-top: 0; padding-top: 0; }
.proj-row-a{
  display: block; border: 0; color: var(--ink);
}
.proj-row-a:hover .proj-name{ color: var(--accent); }
.proj-name{
  font-weight: 600;
  font-size: 1.02rem;
  font-family: var(--f-sans);
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 4px;
}
.proj-name > span:first-child{ flex: 1 1 auto; min-width: 0; }
.proj-name .proj-pill{ flex: 0 0 auto; margin-top: 3px; }
.proj-name .proj-pills{ margin-top: 3px; }
.proj-blurb{ font-size: .98rem; margin-bottom: 4px; max-width: 58ch; color: var(--ink-2); }

.proj-pill{
  font-family: var(--f-mono);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 2px 7px;
  border-radius: 2px;
  font-weight: 500;
  display: inline-block;
}
.proj-pills{
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

/* kind — what the project is */
.pill-coding { background: #076678; color: #FBF1C7; }   /* gruvbox blue / paper */
.pill-writing{ background: #FABD2F; color: #3C3836; }   /* gruvbox yellow / dark fg */

/* state — where it stands */
.pill-active   { background: #5C5408; color: #FBF1C7; }                                           /* darker gruvbox green for AA contrast on paper fg */
.pill-inactive { background: transparent; color: var(--ink-3); border: 1px solid var(--rule); }
.pill-archived { background: var(--paper-3); color: var(--ink-3); border: 1px solid var(--rule); }
/* legacy alias */
.pill-archive  { background: var(--paper-3); color: var(--ink-3); border: 1px solid var(--rule); }

.proj-card{
  padding: var(--s-5) 0;
  border-top: 1px solid var(--rule);
  position: relative; /* anchor for stretched title link */
}
.proj-card:last-child{ border-bottom: 1px solid var(--rule); }
.proj-card-hd{
  display: flex; align-items: flex-start; gap: var(--s-3);
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.proj-card-name-link{ border: 0; border-bottom: 0 !important; flex: 1 1 auto; min-width: 0; }
.proj-card-name-static{ border: 0; flex: 1 1 auto; min-width: 0; }
.proj-card-name{ font-size: 1.45rem; margin: 0; line-height: 1.15; transition: color .12s ease; }
/* Stretch the title link across the whole card so the entire area is clickable */
.proj-card-name-link::before{
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}
.proj-card:hover .proj-card-name{ color: var(--accent); }
.proj-card-hd .proj-pill{ flex: 0 0 auto; margin-top: 8px; }
.proj-card-hd .proj-pills{ margin-top: 8px; }
.proj-card--detail{ border-top: 0; padding-top: 0; }
.proj-card-lede{
  font-size: 1.05rem;
  color: var(--ink-2);
  max-width: 72ch;
  margin-bottom: var(--s-3);
}
.proj-etym{ margin-bottom: var(--s-3); color: var(--ink-3); font-size: .92rem; }
.proj-etym .mono{ color: var(--accent); }
.proj-etym a{ position: relative; z-index: 2; }
.proj-card-meta{ display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-family: var(--f-mono); font-size: .82rem; }
/* Inline links inside the card (github/component repos, Read →) sit above the stretched overlay */
.proj-card-meta a{ position: relative; z-index: 2; }

/* ── Post (single entry) ─────────────────────────────────────── */
.post-hd{
  margin-bottom: var(--s-6);
  padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--rule);
}
.post-hd h1{
  font-size: clamp(1.8rem, 3.3vw, 2.4rem);
  margin-bottom: var(--s-3);
}
.post-meta{ display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-family: var(--f-mono); font-size: .82rem; color: var(--ink-3); }
.post-body .lede{
  font-size: 1.14rem;
  color: var(--ink-2);
  border-left: 2px solid var(--accent);
  padding-left: var(--s-4);
  font-style: italic;
  margin: var(--s-4) 0;
}
.post-body ol, .post-body ul{
  padding-left: 1.4em;
  margin: 1em 0;
}
.post-body li{ margin-bottom: .4em; }
.post-nav{
  display: flex; justify-content: space-between; gap: var(--s-4);
  margin-top: var(--s-7);
  padding-top: var(--s-4);
  border-top: 1px solid var(--rule);
  font-family: var(--f-mono);
  font-size: .88rem;
}
.post-nav a{ max-width: 45%; border: 0; color: var(--ink-2); }
.post-nav a:hover{ color: var(--accent); }

.back-link{
  margin-bottom: var(--s-5);
  font-family: var(--f-mono);
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.back-link a{ border: 0; color: var(--ink-3); }
.back-link a:hover{ color: var(--accent); }

.entry-footer{
  margin-top: var(--s-4);
  font-family: var(--f-mono);
  font-size: .82rem;
  color: var(--ink-3);
}
.entry-footer a{ border: 0; color: var(--ink-2); }
.entry-footer a:hover{ color: var(--accent); }

.read-time{
  font-family: var(--f-mono);
  font-size: .78rem;
  color: var(--ink-3);
  margin: -.4em 0 var(--s-3);
}

/* figures / placeholders */
.figure{ margin: var(--s-5) 0; }
.img-ph{
  background: repeating-linear-gradient(45deg, var(--paper-2) 0 8px, var(--paper-3) 8px 16px);
  border: 1px solid var(--rule);
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  color: var(--ink-3);
}
.img-ph.square{ aspect-ratio: 1; }
.img-ph.wide{ aspect-ratio: 21 / 9; }
.figure figcaption{ margin-top: 8px; text-align: center; color: var(--ink-3); font-size: .9rem; }

/* ── Home: About block (under recent entries) ───────────────── */
.home-about{
  grid-column: 1;
  margin-top: 0;
}
.about-body{
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: var(--s-5);
  align-items: start;
}
.about-portrait img{
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--rule);
  border-radius: 2px;
}
.about-bio p{ margin: 0 0 .75em; }
.about-bio p:last-child{ margin-bottom: 0; }
@media (max-width: 640px){
  .about-body{ grid-template-columns: 1fr; }
  .about-portrait{ max-width: 180px; }
}

/* ── Home: Elsewhere (link grid below the split) ────────────── */
.home-links{
  margin-top: var(--s-7);
}

.link-grid{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-5);
  margin-top: var(--s-4);
}
@media (max-width: 640px){
  .link-grid{ grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 360px){
  .link-grid{ grid-template-columns: 1fr; }
}
.link-col .col-hd{
  display: block;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 4px;
  margin-bottom: 8px;
  font-size: .72rem;
  letter-spacing: .1em;
  color: var(--ink-3);
}
.link-col ul.plain{ list-style: none; padding: 0; margin: 0; }
.link-col ul.plain li{ margin-bottom: 2px; }

/* ── Footer ──────────────────────────────────────────────────── */
.nb-ft{
  max-width: var(--wide);
  width: 100%;
  margin: 0 auto;
  padding: var(--s-6) var(--s-5);
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: auto auto auto minmax(0, 1fr);
  gap: var(--s-6);
  align-items: start;
}
@media (max-width: 900px){
  .nb-ft{ grid-template-columns: 1fr 1fr; }
  .ft-col-wide{ grid-column: 1 / -1; }
}
@media (max-width: 480px){
  .nb-ft{ grid-template-columns: 1fr; gap: var(--s-5); }
  .ft-col-wide{ grid-column: auto; }
}
.ft-col{ display: flex; flex-direction: column; gap: 6px; font-size: .9rem; }
.ft-hd{ margin-bottom: 4px; font-family: var(--f-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); }
.ft-col a{ color: var(--ink-2); border: 0; }
.ft-col a:hover{ color: var(--accent); }

.ft-colophon{
  font-size: .85rem;
  color: var(--ink-2);
  margin: 0 0 var(--s-3);
  max-width: 60ch;
  line-height: 1.55;
}
.ft-license{
  font-family: var(--f-mono);
  font-size: .72rem;
  color: var(--ink-3);
  margin: 0;
  line-height: 1.5;
}
.ft-formula{
  font-family: var(--f-mono);
  font-size: .72rem;
  color: var(--ink-3);
}

.validation-badges{
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}
.validation-badges a{ border: 0; }
.validation-badges img{ opacity: .55; transition: opacity .2s ease; }
.validation-badges a:hover img{ opacity: 1; }

.footer-icons{
  display: grid;
  grid-template-columns: repeat(2, 32px);
  gap: 12px;
  align-items: center;
  justify-items: center;
}
.footer-icons img{
  width: 32px;
  height: 32px;
  opacity: .35;
  animation: sigil-pulse 4s ease-in-out infinite;
  /* invert hardcoded-black sigils to ink in dark mode so they stay visible */
}
.footer-icons img:nth-child(2){ animation-delay: 1.3s; }
.footer-icons img:nth-child(3){ animation-delay: 2.6s; }
.footer-icons img:nth-child(4){ animation-delay: 3.9s; }
:root[data-mode="dark"] .footer-icons img{ filter: invert(1); }
@keyframes sigil-pulse{
  0%, 100%{ opacity: .3; }
  50%{ opacity: .55; }
}

/* ── Code toolbar (copy / expand) ────────────────────────────── */
.code-toolbar{
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity .2s ease;
  z-index: 2;
}
pre:hover .code-toolbar,
pre:focus-within .code-toolbar{ opacity: 1; }
.code-copy,
.code-expand{
  appearance: none;
  background: var(--paper);
  color: var(--ink-3);
  border: 1px solid var(--rule);
  border-radius: 2px;
  font-family: var(--f-mono);
  font-size: .72rem;
  text-transform: lowercase;
  letter-spacing: .04em;
  padding: 3px 8px;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.code-copy:hover,
.code-expand:hover{ color: var(--accent); border-color: var(--accent); }
.code-copy.copied{ color: var(--gb-green); border-color: var(--gb-green); }

pre.expanded{
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  width: 100vw;
  max-width: 100vw;
  border-radius: 0;
  padding-left: var(--s-5);
  padding-right: var(--s-5);
}
pre.expanded .code-toolbar{ right: var(--s-5); }

/* ── Toast ───────────────────────────────────────────────────── */
.toast{
  position: fixed;
  bottom: var(--s-5);
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  padding: 10px 18px;
  border-radius: 3px;
  font-family: var(--f-sans);
  font-size: .9rem;
  opacity: 0;
  transition: transform .3s ease, opacity .3s ease;
  z-index: 10000;
  max-width: 90vw;
  text-align: center;
  border: 1px solid var(--rule);
  background: var(--paper-2);
  color: var(--ink);
}
.toast-visible{
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.toast-error{ background: var(--accent); color: var(--paper); border-color: var(--accent); }
.toast-success{ background: var(--gb-green); color: #FBF1C7; border-color: var(--gb-green); }
.toast-info{ background: var(--paper-2); color: var(--ink); }

/* ── Consent banner ──────────────────────────────────────────── */
.consent-banner{
  position: fixed;
  bottom: var(--s-5);
  left: 50%;
  transform: translateX(-50%);
  max-width: 420px;
  width: calc(100% - var(--s-6));
  background: var(--paper-2);
  border: 1px solid var(--rule);
  padding: var(--s-4) var(--s-5);
  z-index: 1000;
  text-align: center;
  box-shadow: 0 2px 14px rgba(0,0,0,.12);
  border-radius: 3px;
}
.consent-banner p{
  margin: 0 0 var(--s-3);
  font-size: .92rem;
  color: var(--ink);
}
.consent-banner #consent-title{
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-family: var(--f-mono);
  font-size: .8rem;
}
.consent-buttons{
  display: flex;
  gap: var(--s-3);
  justify-content: center;
}
.consent-buttons button,
.button-primary{
  appearance: none;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: 2px;
  min-height: 36px;
}
.consent-buttons button:hover,
.button-primary:hover{ color: var(--accent); border-color: var(--accent); }
.consent-buttons button.button-primary,
.button-primary{
  background: var(--accent);
  color: var(--paper);
  border-color: var(--accent);
}
.consent-buttons button.button-primary:hover,
.button-primary:hover{
  background: var(--accent-soft);
  color: var(--paper);
  border-color: var(--accent-soft);
}

/* ── Giscus ──────────────────────────────────────────────────── */
.giscus-section{
  max-width: var(--measure);
  width: 100%;
  margin: var(--s-7) auto 0;
  padding: var(--s-6) var(--s-5) 0;
  border-top: 1px solid var(--rule);
}
.giscus-section h2{
  font-size: 1.2rem;
  margin: 0 0 var(--s-4);
  font-family: var(--f-sans);
}
.giscus-section .giscus{ min-height: 150px; }

/* ── Skip link / sr-only / error ─────────────────────────────── */
.skip-link{
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus{
  position: fixed;
  top: var(--s-3);
  left: var(--s-3);
  width: auto;
  height: auto;
  overflow: visible;
  background: var(--paper);
  color: var(--accent);
  padding: 8px 16px;
  z-index: 100;
  border: 2px solid var(--accent);
  border-radius: 2px;
}
.sr-only{
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}
.error-state{
  text-align: center;
  padding: var(--s-7) var(--s-4);
  color: var(--ink-3);
}
.error-state p{ margin: var(--s-3) 0; }
.error-state a{ color: var(--accent); }

/* ── Mermaid container ───────────────────────────────────────── */
.mermaid{
  text-align: center;
  margin: var(--s-5) 0;
  padding: var(--s-4);
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow-x: auto;
}

/* ── Reduced motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
  .toast{ transition: opacity .1s ease; transform: translateX(-50%) translateY(0); }
}

/* ── Print ───────────────────────────────────────────────────── */
@media print{
  .nb-hd, .nb-ft, .giscus-section, .toast, .consent-banner, .code-toolbar, .skip-link, .mode-toggle{ display: none !important; }
  body::before{ display: none; }
  *, *::before, *::after{
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  a, a:visited{ text-decoration: underline; }
  a[href]:after{ content: " (" attr(href) ")"; }
  pre, blockquote{ border: 1px solid #999; page-break-inside: avoid; }
  thead{ display: table-header-group; }
  tr, img{ page-break-inside: avoid; }
  p, h2, h3{ orphans: 3; widows: 3; }
  h2, h3{ page-break-after: avoid; }
}
