/* berith's tokens and structure (docs/plan.html §12). Colours are CSS variables that UnoCSS utilities map to
   in uno.config.ts, so templates carry no hex colours. Three themes define the same token names; the
   dark block is written twice, once for the device's preference and once for an explicit choice.
   Paper and iron-gall ink, an ink blue for links and actions, a wax-seal red kept for rules and gaps. */

@font-face { font-family: "EB Garamond"; src: url("/fonts/eb-garamond-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("/fonts/eb-garamond-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("/fonts/eb-garamond-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Source Sans 3"; src: url("/fonts/source-sans-3-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Source Sans 3"; src: url("/fonts/source-sans-3-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Source Sans 3"; src: url("/fonts/source-sans-3-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Source Sans 3"; src: url("/fonts/source-sans-3-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --c-paper: #f3efe6; --c-panel: #ebe5d8; --c-card: #faf7f0; --c-ink: #211d18; --c-muted: #655d52; --c-rule: #d6cdbb;
  --c-blue: #1f4e79; --c-blue-soft: #d9e4ef; --c-seal: #9b2226; --c-seal-soft: #f3dcd9;
  --c-gold: #8a6a12; --c-gold-soft: #f1e6c4; --c-ok: #2f6f4f; --c-warn: #9a5b00; --c-warn-bg: #f6e7cc;
  --text-scale: 1;
  --d-fast: 120ms; --d-med: 240ms; --d-slow: 480ms; --ease: cubic-bezier(.2, .8, .2, 1);
  --serif: "EB Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --shadow: 0 1px 2px rgba(33, 29, 24, .06), 0 4px 16px rgba(33, 29, 24, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --c-paper: #15130f; --c-panel: #25211b; --c-card: #1c1915; --c-ink: #ebe5d8; --c-muted: #a79d8d; --c-rule: #353026;
    --c-blue: #8fb8e0; --c-blue-soft: #1d2f42; --c-seal: #e5766f; --c-seal-soft: #3d1e1c;
    --c-gold: #dcb955; --c-gold-soft: #3a3117; --c-ok: #74c69d; --c-warn: #e0a85a; --c-warn-bg: #3a2c14;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --c-paper: #15130f; --c-panel: #25211b; --c-card: #1c1915; --c-ink: #ebe5d8; --c-muted: #a79d8d; --c-rule: #353026;
  --c-blue: #8fb8e0; --c-blue-soft: #1d2f42; --c-seal: #e5766f; --c-seal-soft: #3d1e1c;
  --c-gold: #dcb955; --c-gold-soft: #3a3117; --c-ok: #74c69d; --c-warn: #e0a85a; --c-warn-bg: #3a2c14;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  color-scheme: dark;
}
/* For older eyes and bright rooms: black on white, heavier rules, no soft tints carrying meaning. */
:root[data-theme="contrast"] {
  --c-paper: #ffffff; --c-panel: #f0f0f0; --c-card: #ffffff; --c-ink: #000000; --c-muted: #2b2b2b; --c-rule: #000000;
  --c-blue: #00338d; --c-blue-soft: #e3ecff; --c-seal: #8b0000; --c-seal-soft: #ffe5e5;
  --c-gold: #5c4400; --c-gold-soft: #fff3c4; --c-ok: #0b5a2a; --c-warn: #6b3d00; --c-warn-bg: #ffecc7;
  --shadow: none;
  color-scheme: light;
}
:root[data-text="large"] { --text-scale: 1.125; }
:root[data-text="larger"] { --text-scale: 1.25; }

html { font-size: calc(100% * var(--text-scale)); scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--c-paper); color: var(--c-ink); font: 1rem/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--c-blue); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--c-blue); outline-offset: 2px; border-radius: 4px; }
main:focus { outline: none; }
code, kbd, .mono { font-family: var(--mono); font-size: .86em; }
code { background: var(--c-panel); padding: .1em .35em; border-radius: 4px; }
kbd { background: var(--c-panel); border: 1px solid var(--c-rule); border-bottom-width: 2px; border-radius: 5px; padding: 0 .4em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; left: .5rem; top: -4rem; z-index: 50; background: var(--c-card); border: 1px solid var(--c-rule); border-radius: 8px; padding: .5rem .9rem; }
.skip-link:focus { top: .5rem; }
.js-only { display: none; }
.js .js-only { display: revert; }

/* ---------- the shell: the rail on the left, the work beside it ---------- */
.shell { display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; align-self: start; height: 100vh; display: flex; flex-direction: column; gap: .75rem; padding: 1.25rem 1rem; background: var(--c-card); border-right: 1px solid var(--c-rule); box-sizing: border-box; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font: 500 1.5rem/1 var(--serif); color: var(--c-ink); text-decoration: none; }
.rail-links { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; gap: 2px; }
.rail-links a { display: block; padding: .5rem .7rem; border-radius: 8px; color: var(--c-muted); text-decoration: none; font-weight: 600; min-height: 2.75rem; box-sizing: border-box; }
.rail-links a[aria-current="page"] { background: var(--c-blue-soft); color: var(--c-blue); }
.palette-open { font: inherit; font-size: .875rem; text-align: left; color: var(--c-muted); background: var(--c-panel); border: 1px solid var(--c-rule); border-radius: 999px; padding: .45rem .9rem; cursor: pointer; }
.rail-foot { margin-top: auto; display: grid; gap: .35rem; font-size: .875rem; }
.who { color: var(--c-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-btn { font: inherit; color: var(--c-blue); background: none; border: 0; padding: .4rem 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; min-height: 2.75rem; }
.work { min-width: 0; padding: 2rem clamp(1rem, 4vw, 3rem) 5rem; }
.work > main { max-width: 60rem; }
/* The four plan editors (plan §12): the work on the left, the findings panel on the right,
   which a save re-renders out of band. Below 60 rem the panel drops under the work. */
.plan-grid { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 1.5rem; align-items: start; margin-top: 1rem; }
.plan-panel { position: sticky; top: 1rem; }
@media (max-width: 60rem) {
  .plan-grid { grid-template-columns: minmax(0, 1fr); }
  .plan-panel { position: static; }
}

.site-header { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; padding: .9rem clamp(1rem, 4vw, 2rem); border-bottom: 1px solid var(--c-rule); }
.site-header .brand { margin-right: auto; }
.plain { padding: 2rem clamp(1rem, 4vw, 2rem) 4rem; max-width: 64rem; margin: 0 auto; }
.site-footer { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; padding: 1.5rem clamp(1rem, 4vw, 2rem); border-top: 1px solid var(--c-rule); color: var(--c-muted); font-size: .875rem; }
.verse { font: italic 1rem var(--serif); }

@media (max-width: 55rem) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--c-rule); padding: .75rem max(1rem, env(safe-area-inset-left)); }
  .rail-links { display: flex; flex-wrap: wrap; margin: 0; order: 3; width: 100%; }
  .rail-foot { margin: 0 0 0 auto; display: flex; align-items: center; gap: .75rem; }
  .palette-open { display: none !important; }
  .work { padding-top: 1.25rem; }
}

/* ---------- type ---------- */
.eyebrow { font: 600 .75rem var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--c-seal); margin: 0 0 .25rem; }
.display { font: 500 clamp(2.25rem, 6vw, 3.5rem)/1.05 var(--serif); margin: .25rem 0 .75rem; text-wrap: balance; }
.page-h { font: 500 2rem/1.15 var(--serif); margin: 0 0 .5rem; text-wrap: balance; }
.section-h { font: 500 1.4rem/1.25 var(--serif); margin: 0 0 .25rem; }
.lede { font-size: 1.125rem; color: var(--c-muted); max-width: 44rem; margin: 0; }
.hint { font-size: .875rem; color: var(--c-muted); }
.note { font-size: .9375rem; color: var(--c-muted); border-left: 3px solid var(--c-seal); padding-left: .9rem; max-width: 44rem; text-align: left; }
/* A slot the plan hasn't filled yet (plan §04): the seal red is kept for rules and gaps. */
mark.blank { background: var(--c-seal-soft); color: var(--c-seal); border-radius: 4px; padding: 0 .3em; }
/* A difference between two frozen versions (plan §05): struck words left, underlined words arrived. */
del.diff-del { background: var(--c-seal-soft); color: var(--c-seal); }
/* Ceremony mode (plan §07): one step at a time, large enough to read across the table. */
.ceremony { font-size: 2rem; line-height: 1.35; max-width: 40rem; margin: 1rem 0; }
ins.diff-ins { background: var(--c-blue-soft); color: var(--c-blue); text-decoration-thickness: 2px; }
.landing { text-align: center; padding-top: 2rem; }
.landing .lede, .landing .note { margin-left: auto; margin-right: auto; }

/* ---------- pieces ---------- */
.flash { background: var(--c-blue-soft); border: 1px solid var(--c-blue); border-radius: 10px; padding: .6rem .9rem; margin: 0 0 1.25rem; max-width: 60rem; }
.field-error { color: var(--c-seal); font-size: .875rem; margin: .25rem 0 0; }
.field[aria-invalid="true"] { border-color: var(--c-seal); }
.code-field { font: 1.5rem var(--mono); letter-spacing: .3em; text-align: center; }
.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 0; }
/* 44 px tall, as every control (plan §12); the small field keeps its small type and padding. */
.field-sm { min-height: 2.75rem; width: auto; padding: .25rem .5rem; font-size: .875rem; }
.plain-list { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .5rem; }
.chapters, .checks { margin: .75rem 0 0; padding: 0; list-style: none; display: grid; gap: .4rem; counter-reset: check; }
.chapters .num { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--c-blue); color: var(--c-card); font: 600 .75rem var(--mono); margin-right: .4rem; }
.checks li { counter-increment: check; padding-left: 2.1rem; position: relative; }
.checks li::before { content: counter(check); position: absolute; left: 0; top: .1rem; width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 1.5px solid var(--c-rule); color: var(--c-muted); font: 600 .7rem/1.5rem var(--mono); text-align: center; }
.choices { border: 0; margin: 0; padding: 0; display: grid; gap: .25rem; }
.choice { display: flex; align-items: center; gap: .6rem; min-height: 2.75rem; cursor: pointer; }
.choice input { width: 1.25rem; height: 1.25rem; accent-color: var(--c-blue); }
/* A fieldset that only groups: no border of its own, no padding; its top spacing is a utility's. */
.fieldset-plain { border: 0; padding: 0; margin-bottom: 0; }
/* One word longer than its box — a link — breaks anywhere. */
.break-all { word-break: break-all; }

.tbl { overflow-x: auto; border: 1px solid var(--c-rule); border-radius: 10px; background: var(--c-card); margin: .75rem 0 1.25rem; }
.tbl table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.tbl th, .tbl td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--c-rule); vertical-align: top; }
.tbl th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--c-muted); background: var(--c-panel); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }

/* A finding's level is chosen at render time: blocker, warning, wisdom (plan §05). */
.finding-blocker { color: var(--c-seal); border-color: var(--c-seal); background: var(--c-seal-soft); }
.finding-warning { color: var(--c-warn); border-color: var(--c-warn); background: var(--c-warn-bg); }
.finding-wisdom { color: var(--c-gold); border-color: var(--c-gold); background: var(--c-gold-soft); }
.finding-ok { color: var(--c-ok); border-color: var(--c-ok); }

/* The estate map's figure (plan §06): assets on the left, the paths' channels in the middle, takers on
   the right. The gap's line wears the seal red, kept for rules and gaps. */
.map { display: block; width: 100%; height: auto; margin: 1rem 0 1.25rem; }
.map-box rect { fill: var(--c-panel); stroke: var(--c-rule); }
.map-box text { fill: var(--c-ink); font: 600 .8125rem var(--sans); text-anchor: middle; }
.map-path { fill: none; stroke: var(--c-blue); stroke-width: 1.5; opacity: .65; }
.map-gap { stroke: var(--c-seal); stroke-width: 2; opacity: 1; stroke-dasharray: 5 4; }

/* An office taught as a catechism (plan §03). */
.qa { margin: .75rem 0 1.25rem; padding: 1rem 1.25rem; background: var(--c-card); border: 1px solid var(--c-rule); border-radius: 12px; }
.qa dt { font: 500 1.25rem/1.3 var(--serif); margin-top: .75rem; }
.qa dt:first-child { margin-top: 0; }
.qa dt::before { content: "Q. "; color: var(--c-seal); }
.qa dd { margin: .25rem 0 0; color: var(--c-muted); }
.qa dd::before { content: "A. "; color: var(--c-blue); font-weight: 700; }

.swatches { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: .6rem; margin: .75rem 0 1.25rem; }
.sw { border: 1px solid var(--c-rule); border-radius: 10px; overflow: hidden; background: var(--c-card); font-size: .8125rem; }
.sw i { display: block; height: 2.75rem; border-bottom: 1px solid var(--c-rule); }
.sw span { display: block; padding: .4rem .6rem .5rem; line-height: 1.3; }
.sw b { display: block; font: 500 .75rem var(--mono); }

/* The command palette: a native dialog, filtered in place (plan §12). */
/* The reset zeroes a dialog's own auto margins, so centring is restated here. */
.palette { width: min(34rem, calc(100vw - 2rem)); margin: 12vh auto auto; padding: 1rem; border: 1px solid var(--c-rule); border-radius: 14px; background: var(--c-card); color: var(--c-ink); box-shadow: var(--shadow); }
.palette::backdrop { background: rgba(0, 0, 0, .35); }
.palette ul { list-style: none; margin: .75rem 0; padding: 0; display: grid; gap: 2px; max-height: 50vh; overflow-y: auto; }
.palette a { display: block; padding: .55rem .75rem; border-radius: 8px; color: var(--c-ink); text-decoration: none; }
.palette a:focus-visible, .palette a[aria-selected="true"] { background: var(--c-blue-soft); color: var(--c-blue); outline: none; }
.palette li[hidden] { display: none; }

/* Hover effects only where a pointer can hover; larger targets where a finger does the pointing. */
@media (hover: hover) {
  .rail-links a:hover, .palette a:hover { background: var(--c-panel); color: var(--c-ink); }
  .palette-open:hover { border-color: var(--c-muted); }
}
@media (pointer: coarse) {
  .field, .btn, .btn-primary, .btn-seal { min-height: 3rem; }
}
/* Page-to-page transitions without a script, on opacity only (plan §12). */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: var(--d-fast); animation-timing-function: var(--ease); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}
/* The same reduction, written twice: once for the device's setting, once for the choice on the
   settings page (the bt_motion cookie, data-motion on the html). */
:root[data-motion="reduced"] { scroll-behavior: auto; }
:root[data-motion="reduced"] ::view-transition-old(root), :root[data-motion="reduced"] ::view-transition-new(root) { animation: none; }
@media print {
  .rail, .site-header, .site-footer, .flash, .palette { display: none !important; }
  .shell { display: block; }
  body { background: #fff; color: #000; }
}
