/* Darkroom: the look of every carldmitchell.com page.
   The design system (tokens, rules, component guidelines) is at
   https://claude.ai/artifact/XBpcLYB9q2xyVmtcshSF7n and this file is its
   stylesheet for real sites: one file, no build step, images beside it in img/.

   Themes: Night is the default. Day follows the reader's system setting;
   data-theme="light" or "dark" on <html> forces one.
   Presets: classic is the default; data-preset="soft" or "harsh" on <html>
   swaps the ridge picture, the bloom and the grain.

   The Day values appear twice (system setting, forced). Keep the two blocks
   the same. The ?v= on each picture is there to get past browser and edge
   caches: raise it everywhere when tools/make_ridges.py redraws them. */

/* --- tokens ------------------------------------------------------------- */

:root {
  color-scheme: dark;
  --ground: #0a0a0a;
  --sky: #000000;
  --raised: #1a1a1a;
  --fill-mid: #3a3a3a;
  --ink-strong: #ffffff;
  --ink: #f5f5f5;
  --ink-body: #d0d0d0;
  --ink-dim: #a8a8a8;
  --line: #777777;
  --line-soft: #3a3a3a;
  --control-line: var(--ink-dim);
  --accent: #f5b83d;
  --on-fill: #0a0a0a;
  --focus: #ffffff;

  --bloom-text: 0 0 30px rgba(255, 255, 255, 0.5), 0 0 6px rgba(255, 255, 255, 0.35);
  --glow-text: var(--bloom-text);
  --glow-fill: 0 0 24px rgba(255, 255, 255, 0.22);
  --halo-text: 0 0 10px #000000, 0 0 3px #000000;
  --grain-opacity: 0.8;

  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: Figtree, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;

  --gap-chip: 8px;
  --row-pad: 12px;
  --gutter-narrow: 16px;
  --pane-pad: 22px;
  --stack: 24px;
  --pane-gap: 30px;
  --gutter: 40px;
  --hero-pad: 48px;

  --radius-pane: 16px;
  --radius-hero: 24px;
  --radius-pill: 999px;
}
:root[data-preset="soft"] { --grain-opacity: 0.5; --bloom-text: 0 0 44px rgba(255, 255, 255, 0.7), 0 0 10px rgba(255, 255, 255, 0.45); }
:root[data-preset="harsh"] { --grain-opacity: 1; --bloom-text: 0 0 8px rgba(255, 255, 255, 0.2); }

.dr-grain { background-image: url(img/grain-on-black.png?v=2); }
.dr-hero { background-image: url(img/ridge-night-classic.jpg?v=2); }
:root[data-preset="soft"] .dr-hero { background-image: url(img/ridge-night-soft.jpg?v=2); }
:root[data-preset="harsh"] .dr-hero { background-image: url(img/ridge-night-harsh.jpg?v=2); }

/* Day, from the system setting. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --ground: #ffffff;
    --sky: #ffffff;
    --raised: #ffffff;
    --fill-mid: #d9d9d9;
    --ink-strong: #000000;
    --ink: #0a0a0a;
    --ink-body: #2e2e2e;
    --ink-dim: #4a4a4a;
    --line: #6e6e6e;
    --line-soft: #d0d0d0;
    --accent: #b8400e;
    --on-fill: #ffffff;
    --focus: #0a0a0a;
    --glow-text: none;
    --glow-fill: none;
    --halo-text: 0 0 10px #ffffff, 0 0 3px #ffffff;
  }
  :root:not([data-theme="dark"]) .dr-grain { background-image: url(img/grain-on-white.png?v=2); }
  :root:not([data-theme="dark"]) .dr-hero { background-image: url(img/ridge-day-classic.jpg?v=2); }
  :root:not([data-theme="dark"])[data-preset="soft"] .dr-hero { background-image: url(img/ridge-day-soft.jpg?v=2); }
  :root:not([data-theme="dark"])[data-preset="harsh"] .dr-hero { background-image: url(img/ridge-day-harsh.jpg?v=2); }
}
/* Day, forced. */
:root[data-theme="light"] {
  color-scheme: light;
  --ground: #ffffff;
  --sky: #ffffff;
  --raised: #ffffff;
  --fill-mid: #d9d9d9;
  --ink-strong: #000000;
  --ink: #0a0a0a;
  --ink-body: #2e2e2e;
  --ink-dim: #4a4a4a;
  --line: #6e6e6e;
  --line-soft: #d0d0d0;
  --accent: #b8400e;
  --on-fill: #ffffff;
  --focus: #0a0a0a;
  --glow-text: none;
  --glow-fill: none;
  --halo-text: 0 0 10px #ffffff, 0 0 3px #ffffff;
}
:root[data-theme="light"] .dr-grain { background-image: url(img/grain-on-white.png?v=2); }
:root[data-theme="light"] .dr-hero { background-image: url(img/ridge-day-classic.jpg?v=2); }
:root[data-theme="light"][data-preset="soft"] .dr-hero { background-image: url(img/ridge-day-soft.jpg?v=2); }
:root[data-theme="light"][data-preset="harsh"] .dr-hero { background-image: url(img/ridge-day-harsh.jpg?v=2); }

/* --- base --------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { position: relative; min-height: 100vh; margin: 0; background: var(--ground); color: var(--ink); font-family: var(--font-body); font-size: 17px; line-height: 1.5; }
a { color: var(--ink); }
a:hover { text-decoration-thickness: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

/* --- page frame ---------------------------------------------------------- */

/* Grain: the first element in <body>, behind everything. */
.dr-grain { position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; opacity: var(--grain-opacity); background-size: 256px 256px; }

/* One column up to 1400px. The status line sits at the bottom of a short page. */
.dr-page { position: relative; width: 100%; max-width: 1400px; min-height: 100vh; margin: 0 auto; padding: 14px var(--gutter) var(--pane-pad); display: flex; flex-direction: column; gap: var(--stack); }
.dr-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 32px; }
.dr-main { display: flex; flex-direction: column; gap: var(--stack); }
.dr-skip { position: absolute; left: var(--gutter-narrow); top: -80px; z-index: 1; padding: 10px 18px; border-radius: var(--radius-pill); background: var(--ink); color: var(--on-fill); font-family: var(--font-mono); font-size: 15px; font-weight: 700; }
.dr-skip:focus { top: var(--gutter-narrow); }

/* Panes side by side, wrapping to one column. dr-col-main beside dr-col-side
   gives a wide column and a narrow one; plain dr-col gives equal columns. */
.dr-cols { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--pane-gap); }
/* Put the side column first in the HTML and add dr-cols-flip: it shows on the
   right when there is room, and above the main column when there is not. */
.dr-cols-flip { flex-direction: row-reverse; }
/* Room above a pane for the title that sits on its border. */
.dr-main > .dr-pane, .dr-main > .dr-cols { margin-top: var(--gap-chip); }
.dr-col { flex: 1 1 440px; min-width: 0; display: flex; flex-direction: column; gap: var(--pane-gap); }
.dr-col-main { flex: 999 1 520px; }
.dr-col-side { flex: 1 1 340px; }

/* --- nav ---------------------------------------------------------------- */

.dr-wordmark { padding: 10px 0; font-family: var(--font-mono); font-weight: 700; font-size: 16px; text-decoration: none; }
.dr-nav { display: flex; flex-wrap: wrap; gap: 4px 6px; font-family: var(--font-mono); font-size: 15px; }
.dr-nav a { padding: 11px 18px; border-radius: var(--radius-pill); text-decoration: none; }
.dr-nav a:hover { text-decoration: underline; }
.dr-nav a[aria-current="page"], .dr-nav a[aria-current="true"] { background: var(--accent); color: var(--on-fill); font-weight: 700; box-shadow: var(--glow-fill); }

/* --- hero and page head -------------------------------------------------- */

/* The hero carries the ridge picture, anchored to its bottom edge. The bottom
   padding keeps the text in the sky above the ridges. */
.dr-hero { position: relative; overflow: hidden; border: 1px solid var(--line-soft); border-radius: var(--radius-hero); padding: var(--gutter) var(--hero-pad) clamp(140px, 19vw, 240px); background-color: var(--sky); background-repeat: no-repeat; background-position: 20% bottom; background-size: max(100%, 758px) auto; }
.dr-hero-text { max-width: 464px; display: flex; flex-direction: column; gap: var(--row-pad); }
.dr-prompt { font-family: var(--font-mono); font-size: 15px; color: var(--ink-dim); overflow-wrap: anywhere; }
.dr-prompt b { font-weight: 400; color: var(--accent); }
.dr-hero h1 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: clamp(52px, 8vw, 98px); line-height: 0.98; letter-spacing: -0.03em; color: var(--ink-strong); text-shadow: var(--glow-text); }
.dr-hero p { margin: 0; font-size: 20px; text-shadow: var(--halo-text); }
.dr-hero strong { font-weight: 600; color: var(--accent); }

/* The head of an inner page: the same voice as the hero, without the picture. */
.dr-head { max-width: 820px; padding: var(--row-pad) 0 var(--gap-chip); display: flex; flex-direction: column; gap: var(--row-pad); }
.dr-head h1 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: clamp(32px, 5.4vw, 64px); line-height: 1.02; letter-spacing: -0.03em; color: var(--ink-strong); text-shadow: var(--glow-text); overflow-wrap: anywhere; }
.dr-head p { margin: 0; font-size: 20px; }
.dr-back { align-self: flex-start; padding: 10px 0; font-family: var(--font-mono); font-size: 15px; }

/* --- pane --------------------------------------------------------------- */

.dr-pane { position: relative; border: 1px solid var(--line); border-radius: var(--radius-pane); padding: var(--pane-pad); }
.dr-pane-title { position: absolute; top: -12px; left: 16px; max-width: calc(100% - 32px); margin: 0; padding: 0 var(--gap-chip); background: var(--ground); color: var(--accent); font-family: var(--font-mono); font-size: 15px; font-weight: 700; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dr-pane > :last-child { margin-bottom: 0; }
/* A list's rows carry their own padding, so pull it in to sit like other content. */
.dr-pane > .dr-list, .dr-pane > .dr-ranked, .dr-pane > .dr-facts { margin: -6px 0 -16px; }
/* A pane whose content sits in one row and wraps: text on the left, a control on the right. */
.dr-split { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--row-pad) var(--stack); }
.dr-split > p { flex: 999 1 300px; margin: 0; }
.dr-split > .dr-field-row { flex: 1 1 360px; }
.dr-split-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--stack); }

/* --- status mark and verdict --------------------------------------------- */

.dr-status { display: inline-flex; align-items: center; gap: var(--gap-chip); font-family: var(--font-mono); font-size: 14px; color: var(--ink); white-space: nowrap; }
.dr-status::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.dr-status-progress, .dr-status-paused, .dr-status-archived { color: var(--ink-dim); }
.dr-status-progress::before { background: none; border: 2px solid currentColor; }
.dr-status-paused::before { background: none; border-radius: 0; border-left: 3px solid currentColor; border-right: 3px solid currentColor; }
.dr-status-archived::before { height: 2px; border-radius: 0; }

.dr-verdict { display: inline-flex; align-items: center; gap: var(--gap-chip); padding: 6px 14px; border: 2px solid var(--ink); border-radius: var(--radius-pill); font-family: var(--font-mono); font-weight: 700; font-size: 14px; color: var(--ink); }
.dr-verdict svg { flex: none; width: 14px; height: 14px; }
.dr-verdict-supported { background: var(--ink); color: var(--on-fill); box-shadow: var(--glow-fill); }
.dr-verdict-complicated { background: var(--fill-mid); border-color: var(--line); }
.dr-verdict-unverified { border-style: dashed; border-color: var(--ink-dim); color: var(--ink-dim); }

/* --- lists -------------------------------------------------------------- */

.dr-list { list-style: none; margin: 0; padding: 0; }
.dr-list > li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 20px; padding: var(--row-pad) 0; border-bottom: 1px solid var(--line-soft); }
.dr-list > li:last-child { border-bottom: 0; }
.dr-list > li > .dr-status { flex: 0 0 128px; }
.dr-item { flex: 999 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.dr-item-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 14px; }
.dr-item-title { font-family: var(--font-display); font-weight: 700; font-size: 22px; line-height: 1.25; overflow-wrap: anywhere; }
a.dr-item-title { padding: 9px 0; margin: -9px 0; }
.dr-item-meta { font-family: var(--font-mono); font-size: 14px; color: var(--ink-dim); }
.dr-item-text { color: var(--ink-body); }

.dr-ranked { list-style: none; margin: 0; padding: 0; }
.dr-ranked > li { display: flex; align-items: center; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.dr-ranked > li:last-child { border-bottom: 0; }
.dr-rank { flex: none; min-width: var(--rank-width, 30px); font-family: var(--font-display); font-weight: 700; font-size: 30px; line-height: 1; text-align: center; font-variant-numeric: tabular-nums; color: var(--accent); }
.dr-ranked-body { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.dr-ranked-body a { font-weight: 600; }
.dr-ranked-body span { font-size: 15px; color: var(--ink-dim); }

/* Facts: a <dl> of short label and value rows, one <div> per pair. */
.dr-facts { margin: 0; }
.dr-facts > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 20px; padding: var(--row-pad) 0; border-bottom: 1px solid var(--line-soft); }
.dr-facts > div:last-child { border-bottom: 0; }
.dr-facts dt { flex: 0 0 64px; font-family: var(--font-mono); font-size: 14px; color: var(--ink-dim); }
.dr-facts dd { flex: 1 1 180px; min-width: 0; margin: 0; overflow-wrap: anywhere; }

/* --- forms -------------------------------------------------------------- */

.dr-btn { display: inline-flex; align-items: center; justify-content: center; height: 48px; padding: 0 26px; border: 0; border-radius: var(--radius-pill); background: var(--accent); color: var(--on-fill); font-family: var(--font-mono); font-size: 16px; font-weight: 700; white-space: nowrap; text-decoration: none; cursor: pointer; box-shadow: var(--glow-fill); }
.dr-btn:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.dr-btn-quiet { background: none; border: 2px solid var(--control-line); color: var(--ink); box-shadow: none; }
.dr-btn-small { height: 44px; padding: 0 18px; font-size: 14px; }
/* A button that reads as a link, for an action inside a line of text. */
.dr-btn-link { padding: 10px 0; border: 0; background: none; color: var(--ink); font: inherit; text-decoration: underline; cursor: pointer; }
.dr-btn-link:hover { text-decoration-thickness: 3px; }

.dr-form { max-width: 520px; display: flex; flex-direction: column; align-items: flex-start; gap: var(--stack); }
.dr-form > .dr-field { align-self: stretch; }
.dr-field { display: flex; flex-direction: column; gap: var(--gap-chip); }
.dr-field label { font-family: var(--font-mono); font-size: 15px; font-weight: 700; }
.dr-field-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap-chip); }
.dr-input { width: 100%; min-width: 0; height: 48px; margin: 0; padding: 0 18px; border: 2px solid var(--control-line); border-radius: var(--radius-pill); background: var(--raised); color: var(--ink); font-family: var(--font-mono); font-size: 16px; }
.dr-input::placeholder { color: var(--ink-dim); opacity: 1; }
.dr-field-row > .dr-input { flex: 1 1 160px; width: auto; }
textarea.dr-input { height: auto; min-height: 132px; padding: var(--row-pad) 18px; border-radius: var(--radius-pane); line-height: 1.5; resize: vertical; }
select.dr-input, .dr-field-row > select.dr-input { flex: none; width: auto; padding: 0 14px; }
.dr-help { margin: 0; font-size: 15px; color: var(--ink-dim); }

/* --- notice ------------------------------------------------------------- */

/* A message about what just happened. dr-notice-bad swaps the dot for a
   cross; the border and the words stay the same colour. */
.dr-notice { position: relative; margin: 0; padding: var(--row-pad) 18px var(--row-pad) 44px; border: 2px solid var(--ink); border-radius: var(--radius-pane); }
.dr-notice::before { content: ""; position: absolute; left: 18px; top: 20px; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.dr-notice-bad::before { left: 17px; top: 19px; width: 12px; height: 12px; border-radius: 0; background: linear-gradient(45deg, transparent calc(50% - 1px), currentColor calc(50% - 1px), currentColor calc(50% + 1px), transparent calc(50% + 1px)), linear-gradient(-45deg, transparent calc(50% - 1px), currentColor calc(50% - 1px), currentColor calc(50% + 1px), transparent calc(50% + 1px)); }
.dr-code { font-family: var(--font-mono); font-weight: 700; letter-spacing: 0.04em; white-space: nowrap; }

/* --- prose and tables ----------------------------------------------------- */

/* Long-form text: a README, an article. */
.dr-prose { max-width: 720px; color: var(--ink-body); line-height: 1.6; overflow-wrap: anywhere; }
.dr-prose > :first-child { margin-top: 0; }
.dr-prose > :last-child { margin-bottom: 0; }
.dr-prose h2, .dr-prose h3 { font-family: var(--font-display); font-weight: 700; color: var(--ink); }
.dr-prose h2 { margin: 40px 0 12px; font-size: 30px; line-height: 1.2; letter-spacing: -0.01em; }
.dr-prose h3 { margin: 36px 0 10px; font-size: 24px; line-height: 1.25; }
.dr-prose h4, .dr-prose h5 { margin: 26px 0 6px; font-weight: 600; color: var(--ink); }
.dr-prose h4 { font-size: 19px; }
.dr-prose h5 { font-size: 17px; }
.dr-prose p, .dr-prose ul, .dr-prose ol, .dr-prose pre, .dr-prose blockquote, .dr-prose .dr-table { margin: 0 0 16px; }
.dr-prose ul, .dr-prose ol { padding-left: 24px; }
.dr-prose li { margin-bottom: 6px; }
.dr-prose strong { font-weight: 600; color: var(--ink); }
.dr-prose code { font-family: var(--font-mono); font-size: 0.88em; color: var(--ink); }
.dr-prose pre { padding: 14px 18px; border: 1px solid var(--line-soft); border-radius: var(--radius-pane); background: var(--raised); font-size: 14px; line-height: 1.5; overflow-x: auto; overflow-wrap: normal; }
.dr-prose pre code { font-size: inherit; }
.dr-prose blockquote { padding: 2px 0 2px 18px; border-left: 3px solid var(--ink-dim); color: var(--ink-dim); }
.dr-prose blockquote p { margin: 0; }

.dr-table { overflow-x: auto; }
.dr-table table { width: 100%; border-collapse: collapse; font-size: 15px; overflow-wrap: normal; }
.dr-table th, .dr-table td { padding: 10px 18px 10px 0; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
.dr-table th { border-bottom-color: var(--line); font-family: var(--font-mono); font-size: 14px; font-weight: 700; color: var(--ink); }
.dr-table tbody tr:last-child td { border-bottom: 0; }
.dr-table td code, .dr-table th code { white-space: nowrap; }
/* Rows that hold a button: centre the cells on it. */
.dr-table-mid td { vertical-align: middle; }

/* --- status line ---------------------------------------------------------- */

.dr-statusline { margin-top: auto; padding-top: var(--gap-chip); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-family: var(--font-mono); font-size: 14px; color: var(--ink-dim); }
.dr-statusline-host { padding: 3px 12px; border-radius: var(--radius-pill); background: var(--ink); color: var(--on-fill); font-weight: 700; }

/* --- small screens and forced colours -------------------------------------- */

@media (max-width: 520px) {
  .dr-page { padding-left: var(--gutter-narrow); padding-right: var(--gutter-narrow); }
  .dr-hero { padding: 28px var(--pane-pad) clamp(140px, 19vw, 240px); }
  .dr-pane { padding-left: 18px; padding-right: 18px; }
  .dr-list > li > .dr-status { flex-basis: 100%; }
}
/* Marks drawn with a background would vanish in a forced-colours mode. */
@media (forced-colors: active) {
  .dr-status::before, .dr-notice::before, .dr-nav a[aria-current], .dr-statusline-host, .dr-btn { forced-color-adjust: none; }
}
