/* DelveTalk: the Field Notebook by day, the Night Herbarium and Ledger by night.
   Day: ruled paper with a margin, iron-gall ink, pressed-flower accents, a botanical mark beside every door. Night: slate, bone, the garden's colours.
   Receipts are stamped tickets: the stamp's icon and word are in the markup, so a screen reader and the plain-text view keep them; colour only repeats them.
   A refusal is set as large as the card body: the moment a spell fails is when the page must be easiest to read.
   The palette is the two token blocks below and nothing else; site/style.css carries the same tokens, and tests/test_theme.py
   checks every text-on-surface pair in both for WCAG AA. Change a colour here and in site/style.css, then run that test. */

:root, [data-theme=light] {
  color-scheme: light;
  --paper: #f3ead6; --leaf: #fbf6e8; --tint: #efe3c8; --rtint: #f7e3d9; --rule: #d6c7a6;
  --ink: #2a2118; --soft: #4a3f33; --muted: #6b5c48;
  --amber: #8a5300; --violet: #6a3d9a; --silver: #585d64; --terracotta: #a3361f; --sage: #3d6b35;
  --glow: #d99a1e; --button: #6a3d9a; --bink: #fbf6e8;
  --ruleline: #dde0d4; --margin: #c98f84;
  --ruling: linear-gradient(var(--margin), var(--margin)) max(5px, calc(50% - 24rem + 2px)) 0 / 1px 100% no-repeat,
    linear-gradient(var(--margin), var(--margin)) max(8px, calc(50% - 24rem + 5px)) 0 / 1px 100% no-repeat,
    repeating-linear-gradient(transparent 0 27px, var(--ruleline) 27px 28px);
  --sprig: "❀ " / "";
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    color-scheme: dark;
    --paper: #0d1117; --leaf: #161b22; --tint: #1d1a12; --rtint: #2a1517; --rule: #30363d;
    --ink: #e6edf3; --soft: #c9d1d9; --muted: #8b949e;
    --amber: #e3b341; --violet: #bc8cff; --silver: #9aa3ad; --terracotta: #f85149; --sage: #8fc49a;
    --glow: #f0883e; --button: #bc8cff; --bink: #0d1117;
  --ruleline: #1a1f27; --margin: #30363d; --ruling: none; --sprig: none;
  }
}
[data-theme=dark] {
  color-scheme: dark;
  --paper: #0d1117; --leaf: #161b22; --tint: #1d1a12; --rtint: #2a1517; --rule: #30363d;
  --ink: #e6edf3; --soft: #c9d1d9; --muted: #8b949e;
  --amber: #e3b341; --violet: #bc8cff; --silver: #9aa3ad; --terracotta: #f85149; --sage: #8fc49a;
  --glow: #f0883e; --button: #bc8cff; --bink: #0d1117;
  --ruleline: #1a1f27; --margin: #30363d; --ruling: none; --sprig: none;
}
:root {
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

/* ---- the page */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; background: var(--ruling) var(--paper); color: var(--ink); font: 17px/1.65 var(--serif); overflow-wrap: break-word; }
[data-theme] { background: var(--ruling) var(--paper); color: var(--ink); }
header, main, footer { max-width: 48rem; margin: 0 auto; padding: 0 16px; }
header { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1.25rem; padding-top: 1.1rem; padding-bottom: .6rem; border-bottom: 3px double var(--rule); }
header nav { display: flex; flex-wrap: wrap; gap: .2rem 1rem; margin-right: auto; }
header nav a { color: var(--soft); text-decoration: none; font: .85rem var(--mono); letter-spacing: .08em; text-transform: lowercase; }
header .who { color: var(--muted); font: .8rem var(--mono); }
.mark { color: var(--ink); text-decoration: none; font: 700 1.15rem var(--serif); letter-spacing: .14em; text-transform: uppercase; }
.mark::before { content: "❦ "; content: "❦ " / ""; color: var(--amber); letter-spacing: 0; }
main { padding-top: 1.25rem; padding-bottom: 3rem; }
footer { border-top: 1px solid var(--rule); padding-top: .75rem; padding-bottom: 2rem; color: var(--muted); font-size: .85rem; }
h1, h2 { font-family: var(--serif); font-weight: 400; line-height: 1.2; }
h1 { font-size: 1.9rem; margin: .5rem 0 .75rem; }
h2 { font-size: .78rem; font-family: var(--mono); text-transform: uppercase; letter-spacing: .18em; color: var(--muted); margin: 2rem 0 .5rem; }
h2::before { content: var(--sprig); color: var(--margin); letter-spacing: 0; }  /* the notebook's pressed flower; none at night */
h1.title small { display: block; font-size: .95rem; color: var(--muted); font-style: italic; }
a { color: var(--violet); text-underline-offset: .2em; text-decoration-thickness: 1px; }
section { margin: 1.25rem 0; }
p.lede { font-size: 1.12rem; color: var(--soft); }
code, kbd { font: .86em var(--mono); background: var(--tint); padding: 0 .25em; border-radius: 2px; }
pre { font: 14px/1.5 var(--mono); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ---- the card: the same bytes an agent reads, framed with illuminated corners and never reflowed */
.frame { position: relative; margin: 1rem 0; width: fit-content; max-width: 100%; font: 14px/1.5 var(--mono);
  border: 1px solid var(--rule); background: var(--leaf);
  background-image:
    linear-gradient(var(--glow), var(--glow)), linear-gradient(var(--glow), var(--glow)),
    linear-gradient(var(--glow), var(--glow)), linear-gradient(var(--glow), var(--glow));
  background-size: 16px 2px, 2px 16px, 16px 2px, 2px 16px;
  background-position: top right, top right, bottom left, bottom left;
  background-repeat: no-repeat; }
.frame::before, .frame::after { content: ""; position: absolute; width: 16px; height: 16px; border: 2px solid var(--glow); pointer-events: none; }
.frame::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.frame::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
.card { margin: 0; padding: 1.1rem 1.25rem; max-width: calc(72ch + 2.5rem); overflow-x: auto; white-space: pre; color: var(--ink); background: transparent; tab-size: 4; }
.card::first-line { color: var(--amber); font-weight: 700; }
.frame.offer { background-color: var(--tint); }
.state { background: var(--leaf); border: 1px solid var(--rule); padding: .75rem 1rem; }

/* ---- spells: a left amber rule; parameter slots as dashed underlines */
pre.spell { margin: 1rem 0; padding: .75rem 1rem; background: var(--tint); border-left: 3px solid var(--glow); overflow-x: auto; white-space: pre; color: var(--ink); }
.slot { color: var(--muted); border-bottom: 1px dashed var(--muted); }

/* ---- botanical marks, one per kind, wherever a kind stands in a list (presentation only: read from the id) */
.kind::before { content: "⁕"; content: "⁕" / ""; display: inline-block; width: 1.4em; color: var(--sage); font-style: normal; text-decoration: none; }
.kind[data-id="garden"]::before { content: "✾"; content: "✾" / ""; color: var(--amber); }
.kind[data-id*="/bell/"]::before { content: "⚘"; content: "⚘" / ""; color: var(--amber); }
.kind[data-id^="env/"]::before { content: "❦"; content: "❦" / ""; color: var(--violet); }
.kind[data-id^="wake/"]::before { content: "☙"; content: "☙" / ""; color: var(--violet); }
.kind[data-id="tide"]::before, .kind[data-id^="tide/"]::before { content: "❧"; content: "❧" / ""; color: var(--silver); }
.kind[data-id*="deal"]::before { content: "✤"; content: "✤" / ""; color: var(--sage); }
.kind[data-id="rooms"]::before, .kind[data-id*="scene"]::before { content: "❁"; content: "❁" / ""; color: var(--violet); }
.kind[data-id*="place"]::before { content: "✿"; content: "✿" / ""; color: var(--sage); }
.kind[data-id*="thing"]::before { content: "❃"; content: "❃" / ""; color: var(--sage); }
.kind[data-id="anthology"]::before, .kind[data-id^="anthology/"]::before { content: "❋"; content: "❋" / ""; color: var(--amber); }
.kind[data-id="workshop"]::before, .kind[data-id^="workshop/"]::before { content: "✥"; content: "✥" / ""; color: var(--silver); }
.kind[data-id="directory"]::before { content: "❖"; content: "❖" / ""; color: var(--violet); }
ul.index { list-style: none; padding: 0; columns: 15rem; column-gap: 2rem; }
ul.index li { break-inside: avoid; padding: .1rem 0; font: .9rem var(--mono); }
ul.index a { text-decoration: none; }

/* ---- the one warm tag, and archival codes */
.yours { margin-left: .4em; color: var(--amber); font: 600 .78rem var(--mono); font-variant: small-caps; letter-spacing: .06em; }
.code { display: inline-block; font: 500 .75rem var(--mono); color: var(--silver); border: 1px solid var(--rule); padding: 0 .4em; letter-spacing: .05em; font-variant-numeric: tabular-nums; }
.codes { display: flex; flex-wrap: wrap; gap: .5rem; align-items: baseline; }

/* ---- doors: unmistakable at rest (brackets, a button face, an underline across the label), lit on hover, ringed on focus */
.doors { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; padding: 0; }
.door, button { display: inline-flex; align-items: baseline; gap: .15em; font: 600 .85rem/1.4 var(--mono); letter-spacing: .08em; text-decoration: none;
  padding: .45rem .8rem; border: 1px solid var(--rule); border-radius: 2px; cursor: pointer; }
.door { color: var(--violet); background: linear-gradient(currentColor, currentColor) center bottom .3rem / calc(100% - 2.6rem) 1px no-repeat, var(--leaf);
  border-color: var(--violet); box-shadow: 0 2px 0 var(--violet); }
.door::before { content: "["; content: "[" / ""; color: var(--muted); margin-right: .2em; }
.door::after { content: "]"; content: "]" / ""; color: var(--muted); margin-left: .2em; }
.door .kind::before { width: 1.2em; }
.door:hover, .door:focus-visible { color: var(--ink); border-color: var(--glow); box-shadow: 0 2px 0 var(--glow), 0 0 0 1px var(--glow), 0 0 18px -4px var(--glow); }
.door:focus-visible, button:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
.door:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--violet); }
button { background: var(--button); color: var(--bink); border-color: var(--button); }
button:hover, button:focus-visible { box-shadow: 0 0 0 1px var(--glow), 0 0 18px -4px var(--glow); }
button.ask { background: var(--leaf); color: var(--violet); border-color: var(--rule); }

/* ---- receipts: stamped tickets with perforated edges; the stamp carries its icon and word (● admitted, § refused, … suspended, — quiet)
   in the markup, so colour only repeats what the words say. A refusal's clause is a note in the ticket's margin. */
ol.ledger { list-style: none; padding: 0; margin: .5rem 0; container: ledger / inline-size; }
.slip.refused .line { font-size: 15px; }
.slip { display: grid; grid-template-columns: auto auto 1fr; grid-template-areas: "stamp code name" "by by by" "clause clause clause"; align-items: center;
  gap: .2rem .75rem; margin: .6rem 0; padding: .6rem 1.1rem; background: var(--leaf); border: 1px solid var(--rule); font: .9rem/1.5 var(--serif);
  -webkit-mask: radial-gradient(circle at 0 50%, #0000 3.5px, #000 4px) 0 0 / 51% 12px repeat-y, radial-gradient(circle at 100% 50%, #0000 3.5px, #000 4px) 100% 0 / 51% 12px repeat-y;
  mask: radial-gradient(circle at 0 50%, #0000 3.5px, #000 4px) 0 0 / 51% 12px repeat-y, radial-gradient(circle at 100% 50%, #0000 3.5px, #000 4px) 100% 0 / 51% 12px repeat-y; }
.slip.refused { background: var(--rtint); }
.stamp, .slip .fate { grid-area: stamp; justify-self: start; padding: .05rem .45rem; border: 2px solid currentColor; border-radius: 4px; color: var(--silver);
  font: 700 .72rem/1.35 var(--mono); text-transform: uppercase; letter-spacing: .12em; white-space: nowrap; transform: rotate(-3deg); }
.slip.admitted .stamp { color: var(--sage); }
.slip.refused .stamp, .slip.refused .fate { color: var(--terracotta); }
.slip.suspended .stamp { color: var(--amber); }
.slip .code { grid-area: code; }
.slip .name { grid-area: name; font-variant: small-caps; letter-spacing: .08em; font-size: 1.05rem; color: var(--ink); }
.slip .by { grid-area: by; font: .78rem var(--mono); color: var(--muted); border-top: 1px dashed var(--rule); padding-top: .2rem; }
.slip .line { grid-column: 1 / -1; font: 14px/1.5 var(--mono); white-space: pre-wrap; color: var(--ink); }
.slip .stamp + .line { grid-column: 2 / -1; grid-row: 1; }
.slip > * { min-width: 0; overflow-wrap: anywhere; }
.slip .clause { grid-area: clause; font: 1rem/1.5 var(--serif); color: var(--ink); border-top: 1px dotted var(--terracotta); padding-top: .3rem; }
@container ledger (min-width: 36rem) {  /* room for a margin: the clause moves beside the ticket, as a note in a notebook's margin */
  .slip { grid-template-columns: auto auto 1fr minmax(0, 15rem); grid-template-areas: "stamp code name clause" "by by by clause"; }
  .slip .clause { border: 0; border-left: 2px solid var(--terracotta); padding: 0 0 0 .7rem; }
}
.quiet { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .3rem .7rem; margin: 1rem 0; padding: .6rem 1rem;
  color: var(--muted); font-style: italic; letter-spacing: .08em; border: 1px dashed var(--muted); border-radius: 2px; }
.quiet .stamp { color: var(--muted); font-style: normal; }
@media (prefers-reduced-motion: no-preference) {
  .slip.fresh { animation: settle .7s cubic-bezier(.2, .8, .2, 1) both; }
}
@keyframes settle { from { opacity: 0; transform: translateY(-8px) rotate(-.8deg); } to { opacity: 1; transform: none; } }

/* ---- forms, tables, the rest of the ledger */
form { margin: .75rem 0; display: grid; gap: .5rem; justify-items: start; }
label { display: grid; gap: .2rem; width: 100%; font: .8rem var(--mono); color: var(--muted); letter-spacing: .04em; }
textarea, input { width: 100%; font: 14px/1.5 var(--mono); background: var(--leaf); color: var(--ink); border: 1px solid var(--rule); border-radius: 2px; padding: .55rem .7rem; }
textarea:focus, input:focus { border-color: var(--amber); }
ol.steps { padding-left: 1.4rem; }
ol.steps li { margin: .5rem 0 1rem; }
ol.steps li::marker { color: var(--amber); font-family: var(--mono); }
table { border-collapse: collapse; width: 100%; font-size: .85rem; display: block; overflow-x: auto; }
td, th { text-align: left; padding: .3rem .5rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { color: var(--muted); font: 600 .72rem var(--mono); text-transform: uppercase; letter-spacing: .1em; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; }
dt { color: var(--muted); font: .8rem var(--mono); }
dd { margin: 0; overflow-wrap: anywhere; }
.refusal { padding: 1rem 1.25rem; background: var(--rtint); border: 1px solid var(--rule); border-left: 3px solid var(--terracotta); }
.refusal .fate { font: .8rem var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--terracotta); margin: 0; }
.refusal p, .refusal .hint { font: 1rem/1.55 var(--serif); color: var(--ink); }
.refusal .hint { padding-left: .6rem; border-left: 2px solid var(--terracotta); }
.specimen { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 1rem; }
.specimen > div { padding: 1rem; border: 1px solid var(--rule); min-width: 0; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr)); gap: .4rem; padding: 0; list-style: none; font: .72rem var(--mono); }
.swatches li { display: flex; gap: .4rem; align-items: center; }
.swatches li::before { content: ""; width: 1.2rem; height: 1.2rem; border: 1px solid var(--rule); background: var(--c); flex: none; }
/* ---- objects as small cards; methods as forms; code as listings */
ul.cards { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); gap: .5rem; }
.minicard { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .5rem; min-width: 0; padding: .5rem .75rem; background: var(--leaf);
  border: 1px solid var(--rule); border-top: 2px solid var(--rule); font: .88rem var(--mono); overflow-wrap: anywhere; }
.minicard a { text-decoration: none; }
.word { font: 600 .72rem var(--mono); letter-spacing: .1em; color: var(--amber); }
.word::before { content: "["; content: "[" / ""; } .word::after { content: "]"; content: "]" / ""; }
details.action { margin: .5rem 0; padding: .4rem .8rem; background: var(--leaf); border: 1px solid var(--rule); }
details.action[open] { border-left: 3px solid var(--glow); }
details > summary { cursor: pointer; font: 600 .9rem var(--mono); color: var(--violet); }
label small { color: var(--muted); font-style: italic; letter-spacing: 0; }
select { font: 14px var(--mono); background: var(--leaf); color: var(--ink); border: 1px solid var(--rule); border-radius: 2px; padding: .45rem .6rem; }
pre.listing { margin: .75rem 0; padding: .75rem 1rem; background: var(--leaf); border: 1px solid var(--rule); overflow-x: auto; white-space: pre; color: var(--ink); }
pre.listing.law { white-space: pre-wrap; overflow-wrap: anywhere; border-left: 3px solid var(--violet); }
dd > dl, dd > ol { margin: .15rem 0 .35rem; padding-left: .75rem; border-left: 1px solid var(--rule); }
dd > ol { padding-left: 1.75rem; }
/* ---- the frog (fwog-gpt6.delve.town), a botanical plate: in the specimen's margin, the site's colophon, and quiet's glyph */
.frog { color: var(--sage); stroke-width: 1.2; }
.frog .bloom { color: var(--violet); }
.frog .vein { stroke-width: .6; }
.frog .eye { fill: currentColor; }
.frog .fill { fill: var(--paper); }
.frog.glyph { width: 1.1em; height: 1.1em; flex: none; color: var(--muted); stroke-width: 1.3; }
.colophon { position: relative; display: flex; align-items: flex-end; gap: 1rem; margin: 1rem 0 1.5rem; color: var(--soft); font-style: italic; }
.colophon .frog { flex: none; width: 7.5rem; height: auto; }
.colophon p { margin: 0; }
@media (min-width: 66rem) { .colophon .frog { position: absolute; right: calc(100% + 1.5rem); bottom: 0; width: 8.5rem; } }
@media (max-width: 34rem) {
  body { font-size: 16px; }
  h1 { font-size: 1.55rem; }
  .card { font-size: 12.5px; }
  dl { grid-template-columns: 1fr; }
}
