/* rifdent — site styles.
   palette: "ossuary" from presets/palettes.toml. swap these six values for
   another palette (oxide, cold, ash, sodium) and visual.js follows. */
:root {
  --ground: #0b0b0c;
  --shadow: #1d1e20;
  --metal: #8b8e90;
  --bone: #e7e2d7;
  --accent: #8e1d14;     /* rationed: only marks where you are */
  --accent2: #3f5a4e;

  --code: #0f0f11;       /* code block fill */
  --dim: #7d8083;       /* between shadow and metal, for secondary text */
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --measure: 64ch;
  color-scheme: dark;
}
/* light mode: the "paper" palette from presets/palettes.toml (ground is paper, bone is ink) */
:root[data-theme="light"] {
  --ground: #e8e5dd;
  --shadow: #c9c6bd;
  --metal: #26262a;      /* body text: near-black for reading on paper */
  --bone: #0e0e11;
  --accent: #7c1c15;
  --accent2: #2d4a5e;
  --dim: #46453f;        /* secondary text: still clearly legible on paper */
  --code: #dfdcd3;
  color-scheme: light;
}
/* thin dark-on-light type renders faintly (esp. firefox/windows): one weight heavier */
:root[data-theme="light"] body { font-weight: 400; }
:root[data-theme="light"] .name,
:root[data-theme="light"] h1, :root[data-theme="light"] h2, :root[data-theme="light"] h3 { font-weight: 400; }
:root[data-theme="light"] .mono { font-weight: 500; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--metal);
  font: 300 15px/1.7 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--bone); color: var(--ground); }

a { color: var(--bone); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
a:focus-visible, button:focus-visible { outline: 1px solid var(--bone); outline-offset: 4px; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 40px; } }

/* small, lowercase, widely tracked — the typography layer from typography.py */
.mono {
  font: 400 11px/1.6 var(--mono);
  letter-spacing: .22em;
  text-transform: lowercase;
}

/* ---------- header ---------- */
.site-head { position: relative; z-index: 2; }
.site-head .wrap {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 16px; flex-wrap: wrap; padding-top: 28px; padding-bottom: 28px;
}
.name {
  font: 300 17px/1 var(--sans); letter-spacing: .18em; color: var(--bone);
}
.name:hover { text-decoration: none; }
.nav { display: flex; gap: 22px; }
.nav a { color: var(--dim); }
.nav a:hover { color: var(--bone); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--bone); }
.theme-toggle {
  background: none; border: 0; padding: 0; cursor: pointer; color: var(--dim);
  border-left: 1px solid var(--shadow); padding-left: 22px;
}
.theme-toggle:hover { color: var(--bone); }
.nav a[aria-current="page"]::before {
  content: ""; display: inline-block; width: 4px; height: 4px; margin: 0 8px 2px 0;
  background: var(--accent); vertical-align: middle;
}
.home .site-head { position: absolute; top: 0; left: 0; right: 0; }

/* ---------- main ---------- */
main { flex: 1; padding: 40px 0 96px; }
.home main { padding-top: 0; }
h1, h2, h3 { color: var(--bone); font-weight: 300; line-height: 1.3; }
h1 { font-size: 26px; letter-spacing: .01em; margin: 0 0 8px; }
h2 { font-size: 18px; margin: 2.4em 0 .6em; }
h3 { font-size: 15px; font-weight: 400; margin: 2em 0 .4em; }
.lede { margin: 0 0 56px; max-width: var(--measure); }
.label { color: var(--dim); margin: 0 0 18px; }

/* ---------- home ---------- */
.hero {
  position: relative; height: 86vh; min-height: 440px; max-height: 1000px;
  background: var(--ground);
}
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero .listen {
  position: absolute; left: 16px; bottom: 22px; z-index: 2;
  background: none; border: 0; padding: 4px 0; cursor: pointer; color: var(--dim);
}
@media (min-width: 720px) { .hero .listen { left: 40px; } }
.hero .listen:hover, .hero .listen[aria-pressed="true"] { color: var(--bone); }
.hero .listen[aria-pressed="true"]::before {
  content: ""; display: inline-block; width: 4px; height: 4px; margin: 0 8px 2px 0;
  background: var(--accent); vertical-align: middle;
}
.hero .caption { position: absolute; right: 16px; bottom: 22px; z-index: 2; color: var(--dim); pointer-events: none; }
@media (min-width: 720px) { .hero .caption { right: 40px; } }

.home-grid { display: grid; grid-template-columns: 1fr; gap: 56px; padding-top: 72px; }
@media (min-width: 860px) { .home-grid { grid-template-columns: 1fr 1fr; gap: 80px; } }
.about p { margin: 0 0 1em; max-width: 52ch; }
.links { list-style: none; padding: 0; margin: 32px 0 0; display: flex; flex-wrap: wrap; gap: 6px 24px; }
.links a { color: var(--dim); }
.links a:hover { color: var(--bone); }

/* ---------- lists ---------- */
.list { list-style: none; padding: 0; margin: 0; }
.list li + li { border-top: 1px solid var(--shadow); }
.list a { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 16px 0; }
.list a:hover { text-decoration: none; }
@media (min-width: 640px) { .list a { grid-template-columns: 12ch 1fr; gap: 24px; } }
.list .date { color: var(--dim); padding-top: 4px; }
.list .t { color: var(--bone); }
.list a:hover .t { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.list .by { color: var(--dim); }
.list .s { display: block; color: var(--dim); font-size: 14px; margin-top: 2px; }
.empty { color: var(--dim); padding: 16px 0; }

/* ---------- article ---------- */
.entry-meta { color: var(--dim); margin: 0 0 48px; }
.entry-meta span + span::before { content: " · "; }
.prose { max-width: var(--measure); }
.prose p { margin: 0 0 1.2em; }
.prose strong { color: var(--bone); font-weight: 500; }
.prose a { text-decoration: underline; text-decoration-color: var(--dim); text-decoration-thickness: 1px; text-underline-offset: 4px; }
.prose a:hover { text-decoration-color: var(--bone); }
.prose img { max-width: 100%; height: auto; display: block; margin: 2em 0; }
.prose code { font: 13px var(--mono); color: var(--bone); }
.prose pre {
  background: var(--code); border-left: 1px solid var(--shadow);
  padding: 16px 18px; overflow-x: auto; font: 13px/1.6 var(--mono); color: var(--metal); margin: 1.6em 0;
}
.prose pre code { color: inherit; }
.prose blockquote { margin: 1.6em 0; padding: 0 0 0 18px; border-left: 1px solid var(--shadow); color: var(--dim); }
.prose ul, .prose ol { padding-left: 2.4ch; margin: 0 0 1.2em; }
.prose li { margin: .25em 0; }
.prose li::marker { color: var(--dim); }
.prose hr { border: 0; border-top: 1px solid var(--shadow); margin: 3em 0; }
.prose iframe { max-width: 100%; border: 0; }
.prose table { border-collapse: collapse; font-size: 14px; margin: 1.6em 0; }
.prose th, .prose td { text-align: left; padding: 6px 18px 6px 0; border-bottom: 1px solid var(--shadow); }
.back { display: inline-block; margin-top: 64px; color: var(--dim); }

/* ---------- gallery ---------- */
.gallery { columns: 1; column-gap: 24px; }
@media (min-width: 640px) { .gallery { columns: 2; } }
@media (min-width: 1000px) { .gallery { columns: 3; } }
.gallery button { all: unset; cursor: zoom-in; display: block; break-inside: avoid; margin: 0 0 40px; width: 100%; }
.gallery figure { margin: 0; }
.gallery img { display: block; width: 100%; height: auto; background: var(--shadow); transition: opacity .2s; }
.gallery button:hover img { opacity: .82; }
.gallery button:focus-visible img { outline: 1px solid var(--bone); outline-offset: 4px; }
.gallery figcaption { margin-top: 10px; display: flex; justify-content: space-between; gap: 12px; color: var(--dim); }
.gallery figcaption span:first-child { color: var(--metal); }

dialog.lightbox {
  border: 0; background: var(--ground); color: var(--metal); padding: 0;
  width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0;
}
dialog.lightbox[open] { display: flex; flex-direction: column; }
dialog.lightbox::backdrop { background: var(--ground); }
dialog.lightbox .stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 56px 16px 16px; }
dialog.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
dialog.lightbox .cap {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap;
  padding: 16px 16px 24px; color: var(--dim);
}
@media (min-width: 720px) { dialog.lightbox .cap { padding: 16px 40px 28px; } }
dialog.lightbox .cap b { color: var(--bone); font-weight: 400; }
dialog.lightbox .ctl { display: flex; gap: 22px; }
dialog.lightbox button { background: none; border: 0; padding: 0; cursor: pointer; color: var(--dim); }
dialog.lightbox button:hover { color: var(--bone); }

/* ---------- footer ---------- */
.site-foot { padding: 0 0 32px; color: var(--dim); }
.site-foot .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
