/*
═══════════════════════════════════════════════════════════════════════════════
  assets/css/theme.css  .  Light and dark themes (shared colour tokens)
═══════════════════════════════════════════════════════════════════════════════

  WHAT IT IS
    Every page keeps its own :root block with the Guild's ten colours
    (--parchment, --ink, --forest, --gold, ...). This file adds a few
    shared "role" tokens and, under html[data-theme="dark"], gives the
    PAPER colours a warm wood-brown dark version (the paper colours,
    parchment and cream, are the hardest on the eyes; one dark mode, warm
    brown, not grey). html[data-theme="dark"] outranks :root, so load
    order does not matter.

  WHAT FLIPS AND WHAT STAYS
    Flips (paper):  --cream (page), --parchment-bg (sections), --card
                    (cards and fields), --parchment-dk (rules), --ink,
                    --ink-soft, --ink-softer (body text), --stone (muted text), --forest-text
                    (headings on paper), --gold-text (small gold text on
                    paper), --rust, --ok, --danger, --error-bg, --link.
    Stays (chrome): --forest, --forest-lt, --gold, --gold-lt, --parchment
                    (light text on green), so green navs, green pages,
                    gold buttons and the language pill look the same in
                    both themes.

  ROLE TOKENS (use these, not the raw colour, for these jobs)
    --forest-text   heading/accent TEXT on paper. var(--forest) stays for
                    green surfaces and for text ON gold.
    --gold-text     small gold TEXT on paper (raw --gold is 2.7:1 there).
    --parchment-bg  a parchment-coloured SECTION background.
    --card          white cards, panels and input fields.
    --field-border  input and select edges (3:1 or more in both themes).
    --focus         keyboard focus outline (3:1 on paper and on green).
    --ok / --danger / --error-bg / --link   status colours.
    --crisis-bg     the crisis banner fill (same in both themes).

  GREEN PAGES
    Pages whose whole body is forest green (sign-in, join, donate, reset,
    claim, Representative sign-in/up/oath, welcome) put class
    "surface-forest" on <body>. That re-points the muted, hint, error and
    small-gold text tokens to light versions that read on green (they
    used the parchment versions before: 1.8 to 3.6:1).

  CONTRAST (WCAG 2.x, measured with the site's real colours)
    Dark: body text 12-14:1, muted 7-8.5:1, headings 8-9.5:1, small gold
    7-8:1, errors 6-7:1, field edges 3.7-4.3:1.
    Light fixes: small gold text 4.9:1+, green-page muted text 4.8:1+.
    Pages were measured in a browser in both themes.

  COMPANIONS
    assets/js/theme.js   sets data-theme before paint; the sun/crescent button
    offline.html         carries its own copy (it must work with nothing else)
═══════════════════════════════════════════════════════════════════════════════
*/

:root {
  color-scheme: light;
  --forest-text:  #1a2e1a;
  --ink-soft:     #3a2e1a;   /* secondary body copy, as before the theme */
  --ink-softer:   #4a3e2a;
  --gold-text:    #7d5f1c;
  --parchment-bg: #f4e8ce;
  --card:         #ffffff;
  --field-border: #8f7a5c;
  --focus:        #9a7a2a;
  --ok:           #2e6b1e;
  --danger:       #b83528;   /* the old #c0392b, a shade deeper: 4.5:1 on parchment too */
  --error-bg:     #fdecea;
  --link:         #7a5a16;
  --crisis-bg:    #7a3b1e;
  --rust:         #7a3b1e;
  --shadow:       rgba(26, 46, 26, 0.08);
}

html[data-theme="dark"] {
  color-scheme: dark;
  /* paper */
  --cream:        #1c1610;
  --parchment-bg: #2c2319;
  --card:         #261e16;
  --parchment-dk: #4a3e2d;
  --ink:          #ede4d0;
  --ink-soft:     #e3d8c2;
  --ink-softer:   #d9cdb4;
  --stone:        #c2b194;
  --forest-text:  #a8c69a;
  --gold-text:    #d4aa55;
  --field-border: #8a7a60;
  --focus:        #d4aa55;
  --rust:         #e39a74;
  --ok:           #8cc98a;
  --danger:       #f08a7e;
  --error-bg:     #3b1f15;
  --link:         #d4aa55;
  --shadow:       rgba(0, 0, 0, 0.45);
}

/* Green pages and green islands: light text roles for a green surface, in
   both themes. Used on <body> of the green pages and on green panels inside
   paper pages (for example the home page's join panel). */
.surface-forest {
  --stone:     #cdbd9f;
  --stone-lt:  #d6c8ab;
  --danger:    #f2b0a8;
  --gold-text: #e0bd6e;
  --focus:     #d4aa55;
  --link:      #e0bd6e;
}

/* Paper islands inside green pages (the rep-oath scroll): the paper text
   roles again, so the green page's light versions do not reach paper. */
.surface-paper {
  --stone:     #79654b;
  --gold-text: #7d5f1c;
  --danger:    #b83528;
  --focus:     #9a7a2a;
  --link:      #7a5a16;
}
html[data-theme="dark"] .surface-paper {
  --stone:     #c2b194;
  --gold-text: #d4aa55;
  --danger:    #f08a7e;
  --focus:     #d4aa55;
  --link:      #d4aa55;
}

/* Some translated strings carry their own <a style="color:var(--gold)">.
   Editing those strings would withdraw every reviewed translation of
   them, so the colour is corrected
   here instead: --gold-text is dark gold on paper and light gold on green. */
a[style*="color:var(--gold)"] { color: var(--gold-text) !important; }

/* Placeholders follow the muted text role instead of the browser grey. */
::placeholder { color: var(--stone); opacity: 1; }

/* Shared event/calendar filters: the labels remain visible after typing, and
   controls have a generous touch target without forcing horizontal scrolling.
   Keep this shared: both pages instantiate the same event-filters.js form. */
.event-filter-form { margin: 1rem 0; }
.event-main, .event-more-fields { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end; }
.event-main .event-area { flex: 1 1 16rem; }
.event-filter-form label { display: flex; flex-direction: column; gap: .3rem; min-width: 0; max-width: 100%; }
.event-filter-form input:not([type="checkbox"]),
.event-filter-form select, .event-filter-form button {
  box-sizing: border-box; min-height: 44px; max-width: 100%;
  padding: .55rem .7rem; font: inherit; color: var(--ink);
  background: var(--card); border: 1px solid var(--field-border); border-radius: 3px;
}
.event-filter-form input[type="checkbox"] { width: 24px; height: 24px; }
.event-filter-form button { cursor: pointer; }
/* Search is the one primary button: the Guild's gold with green text, the same
   pairing the page's own buttons use on hover (4.97:1, and neither colour changes
   between the light and dark themes). */
.event-filter-form button.event-search {
  background: var(--gold, #b8923a); border-color: var(--gold, #b8923a);
  color: var(--forest, #1a2e1a); font-weight: 600;
}
.event-filter-form button.event-search:hover { background: var(--gold-lt, #d4aa55); }
/* "More ways to search" is a plain native fold: keyboard-operable, a visible
   marker, and a touch-sized target. */
.event-more { margin-top: .4rem; }
.event-more summary { cursor: pointer; padding: .7rem 0; font-weight: 600; color: var(--forest-text, var(--ink)); }
.event-more summary:hover { color: var(--gold-text, var(--ink)); }
.event-more-fields { padding-bottom: .4rem; }
.event-filter-form :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (max-width: 480px) {
  .event-filter-form label { width: 100%; }
  .event-main .event-area { flex-basis: 100%; }
  .event-filter-form button { flex: 1 1 auto; }
}

/* Respect the device's motion preference across pages. These effects convey
   no state; keep their end events available while removing visible motion. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}

/* The crisis block keeps its fill in dark mode; a rust edge separates it
   from the dark page (2.2:1 without it). */
html[data-theme="dark"] .crisis-banner,
html[data-theme="dark"] [data-crisis] { outline: 1px solid var(--rust); }

/* ── The top bar (assets/js/theme.js) ──────────────────────────────────────
   Every public page opens with one slim bar: the Guild's name, a link home, at the start; the page's own links (or
   the site map) in the middle; the language and theme buttons at the end. One row at every width, opaque, scrolling
   away with the page, so it never covers what is being read. A page whose first content is its own <nav> keeps it as
   its bar (.guild-bar on the nav, its links moved into .guild-bar-links); its own size, margins and sticking stay,
   and only what makes it one opaque row is set here. Any other page gets a bar built by theme.js (.guild-bar-built):
   it stands at the very top of the page, whatever the page's own layout (a padded column, or a column centred in the
   window), and theme.js adds its height to the body's top padding, so the page's content starts below it as before.
   On a phone the middle part scrolls sideways within the row; the name and the buttons never move. The home page
   keeps its own top bar with the same buttons in it (#guild-bar-tools); the workspaces and consoles keep the
   floating buttons. */
.guild-bar { flex-direction: row !important; flex-wrap: nowrap !important; align-items: center !important; background-color: #1a2e1a !important;
  background-image: none !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
.guild-bar-built { position: absolute; top: 0; left: 0; right: 0; z-index: 60; box-sizing: border-box; height: 52px;
  display: flex; gap: .6rem; margin: 0; padding: 0 max(1rem, env(safe-area-inset-right, 0px)) 0 max(1rem, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid rgba(184, 146, 58, .3); color: #f4e8ce; font-family: 'Lato', sans-serif; line-height: 1.3; text-align: start; }
/* After a leading crisis line (the reach-out page) the bar stays in the page flow, under the line. */
.guild-bar-built.guild-bar-flow { position: relative; }
.guild-bar-brand { flex: 0 0 auto; white-space: nowrap; }
.guild-bar-built .guild-bar-brand { display: inline-flex; align-items: center; min-height: 44px; font-family: 'Cinzel', serif;
  font-size: .875rem; letter-spacing: .14em; text-transform: uppercase; color: #d4aa55; text-decoration: none; }
.guild-bar-brand:is(:hover, :focus-visible) { color: #f4e8ce; }
.guild-bar-links { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: .9rem; overflow-x: auto;
  overflow-y: hidden; scrollbar-width: none; white-space: nowrap; }
.guild-bar-links::-webkit-scrollbar { display: none; }
/* Its end fades out, so a row that runs past the edge shows that it goes on. */
.guild-bar-links { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 1.5rem), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 1.5rem), transparent); padding-inline-end: 1.5rem; }
[dir="rtl"] .guild-bar-links { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 1.5rem), transparent);
  mask-image: linear-gradient(to left, #000 calc(100% - 1.5rem), transparent); }
.guild-bar-links ul { display: flex !important; flex-wrap: nowrap !important; align-items: center; gap: .9rem !important; margin: 0 !important;
  padding: 0 !important; list-style: none; }
.guild-bar-links li { flex: 0 0 auto; }
/* The bar's links keep one line each: the row scrolls sideways instead of growing a second line. */
.guild-bar-links :is(a, span, button) { white-space: nowrap !important; }
.guild-bar-built .guild-bar-links a { display: inline-flex; align-items: center; min-height: 44px; font-family: 'Cinzel', serif;
  letter-spacing: .1em; text-transform: uppercase; color: rgba(244, 232, 206, .85); text-decoration: none; }
.guild-bar-built .guild-bar-links a:is(:hover, :focus-visible) { color: #d4aa55; }
.guild-bar-tools { flex: 0 0 auto; display: flex; align-items: center; gap: .4rem; margin-inline-start: auto; padding-inline-start: .4rem; }
.guild-bar-tools .guild-theme-btn { width: 44px; height: 44px; }
/* On a phone the name takes less room, the site map moves to the page's end (assets/js/i18n.js) and the middle part
   scrolls sideways; a brand's "Est. 2026" waits for a wider screen. */
@media (max-width: 720px) {
  .guild-bar .guild-bar-brand { font-size: .75rem !important; letter-spacing: .06em !important; }
  .guild-bar-brand > :not(:first-child) { display: none; }
  .guild-bar-sitemap, li:has(> .guild-bar-sitemap) { display: none !important; }
}
/* Where the page's look is the same in both themes (the green sign-in and gift pages), the theme button would change
   nothing, so it is not shown. A green page with a paper island (the Representatives' oath) keeps it. */
body.surface-forest:not(:has(.surface-paper)) .guild-bar-tools .guild-theme-btn { display: none; }
/* The eyebrow over a page's heading names the Guild: it is a link home too (theme.js wraps it). */
a.guild-crest-link { color: inherit; text-decoration: none; font: inherit; letter-spacing: inherit; }
a.guild-crest-link:is(:hover, :focus-visible) { text-decoration: underline; text-underline-offset: .25em; }
@media print { .guild-bar-built, .guild-bar-tools { display: none !important; } }

/* ── The sun/crescent button (assets/js/theme.js) ─────────────────────────
   Same look as the language pill beside it: gold fill, forest edge and
   icon, the same lift; hover inverts like every Guild control. */
.guild-theme-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.3rem; height: 2.3rem; padding: 0; flex: 0 0 auto;
  background: #b8923a; color: #1a2e1a;
  border: 1.5px solid rgba(26, 46, 26, 0.85); border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.32), 0 0 0 1px rgba(255, 255, 255, 0.08);
  cursor: pointer;
}
.guild-theme-btn:hover { background: #1a2e1a; color: #d4aa55; border-color: #d4aa55; }
/* i18n.js gives focused buttons 2px corners; this one stays round. */
.guild-theme-btn:focus-visible { border-radius: 999px; }
.guild-theme-btn svg { width: 1.15rem; height: 1.15rem; display: block; }
/* Beside the language pill: one row, the pill's menu still opens under the pill. */
#guild-floating-lang.has-theme-btn { display: flex; align-items: flex-start; gap: 0.4rem; }
#guild-floating-lang.has-theme-btn #guild-floating-lang-menu { left: calc(2.3rem + 0.4rem); }
/* Right-to-left pages reverse the row: the pill comes first, so its menu sits at the left edge. */
body[dir="rtl"] #guild-floating-lang.has-theme-btn #guild-floating-lang-menu { left: 0; }
/* A page with neither a bar nor the language pill gets the button on its own, at the bottom left like the pill. */
#guild-theme-float { position: fixed; bottom: 0.7rem; left: 0.7rem; z-index: 200; }
body:has(.mobile-menu.open) #guild-theme-float { display: none !important; }
@media (max-width: 720px) {
  .guild-theme-btn { width: 2.1rem; height: 2.1rem; }
  #guild-floating-lang.has-theme-btn #guild-floating-lang-menu { left: calc(2.1rem + 0.4rem); }
}
@media print { .guild-theme-btn, #guild-theme-float { display: none !important; } }

/* ── Back to top (assets/js/theme.js) ─────────────────────────────────────
   On a long page "↑ Top" floats at the bottom right, where a thumb reaches it, only while the reader is past the
   first screen AND moving back up the page; reading down, or pausing for a few seconds, puts it away, so it
   never rests over the text being read. The side is set with right, never inline-end (the consoles keep their
   language and theme buttons at the bottom left in either reading direction), and the link never widens past the
   middle of the screen. It sits above the page and below any modal overlay (50), the full-screen menu (110) and the
   language buttons (200). theme.js puts guild-top-ready on <html> before the first paint; without a script these
   rules never apply and the link is an ordinary link where the page puts it. */
html.guild-top-ready #back-to-top {
  position: fixed; right: 1.25rem; bottom: 1.5rem; z-index: 45; box-sizing: border-box;
  display: none; align-items: center; justify-content: center; gap: .4rem;
  min-width: 44px; min-height: 44px; max-width: calc(50vw - 1rem); margin: 0;
  padding: .5rem .85rem; border: 1px solid rgba(184, 146, 58, .75); border-radius: 999px;
  background: rgba(26, 46, 26, .94); color: #d4aa55; text-decoration: none; white-space: nowrap; overflow: hidden;
  font-family: 'Cinzel', serif; font-size: .8rem; letter-spacing: .08em; line-height: 1.2;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.32), 0 0 0 1px rgba(255, 255, 255, 0.08);
}
html.guild-top-ready #back-to-top.visible { display: inline-flex; }
html.guild-top-ready #back-to-top:hover { background: #b8923a; color: #1a2e1a; }
html.guild-top-ready #back-to-top:focus-visible { outline: 2px solid var(--focus) !important; outline-offset: 2px; border-radius: 999px; }
html.guild-top-ready #back-to-top span { color: inherit; font: inherit; letter-spacing: inherit; margin: 0; }
html.guild-top-ready #back-to-top span[aria-hidden="true"] { font-size: 1rem; line-height: 1; }
@media (max-width: 720px) { html.guild-top-ready #back-to-top { right: .9rem; bottom: 1rem; } }
@media print { #back-to-top { display: none !important; } }
/* Floating controls (the consoles' language and theme buttons) need scroll room so the final line can move above
   them. Buttons in a top bar float over nothing and need none. */
@media screen {
  body:has(#guild-floating-lang:not(.in-bar), #guild-theme-float) {
    padding-bottom: calc(6rem + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* Phones: where the language pill and theme button still float (the consoles), anything the page brings into view (a
   field, a question that has just appeared, a link's target) stops clear of them; and while a text field has focus
   they and the Top link at the bottom right step aside, because the on-screen keyboard lifts them over the very text
   being typed. */
@media (max-width: 720px) {
  html:has(#guild-floating-lang:not(.in-bar), #guild-theme-float) { scroll-padding-bottom: 3.6rem; }
  body:has(:is(input:not([type="checkbox"], [type="radio"], [type="button"], [type="submit"], [type="reset"], [type="hidden"]), select, textarea):focus)
    :is(#guild-floating-lang:not(.in-bar), #guild-theme-float, #back-to-top) { visibility: hidden; }
}

/* ── Twelve pixels at least, and thumb-sized targets ──────────────────────
   No words on a public page are smaller than 12 px, and what a thumb taps is at least 44 px tall. A link that takes
   its size from small surrounding words (a Book citation, a Living Book mention, the eyebrow link) is lifted with
   max(1em, .75rem), which never shrinks a larger one. Small labels with a size of their own are named here: the
   Floor's category labels, the calendar's kind labels, the Hub's phase badge, the governance page's status badges and
   card lines, the sweepstakes page's state pills and labels, the sign-in pages' account choices (the "In short"
   boxes' headings and buttons are sized where they are defined, below). Eyebrows drawn under 12 px are lifted by assets/js/theme.js,
   since some pages draw theirs larger. Targets: the bar's name, the way home, text fields and lists take 44 px; the
   eyebrow link gets a taller tap area without moving the page (padding and an equal negative margin); a Floor map pin
   keeps its 18 px dot inside a 44 px round tap area. */
a.lb-cite-link, a.living-book-link, a.guild-crest-link { font-size: max(1em, .75rem); }
.resource .cat, .ev-kind, .channel-phase-badge, body:has(.problem-send) :is(.badge, .card-meta),
body:has(#entry-title) :is(.status, .label), .tier-count:not(.tier-rock .tier-count) { font-size: .75rem !important; }
.capacity-switch-links :is(a, .current) { display: inline-flex !important; align-items: center; min-height: 44px; font-size: .8rem !important; }
.guild-bar .guild-bar-brand { display: inline-flex; align-items: center; min-height: 44px; }
a.guild-crest-link { display: inline-block; padding-block: 11px; margin-block: -11px; }
:is(a.home-link, a[data-i18n="ui.return_home"]) { padding-block: .9rem; }
:where(input:not([type="checkbox"], [type="radio"], [type="hidden"], [type="range"], [type="color"], [type="file"], [type="image"]), select) { min-height: 44px; }
.floor-pin { position: relative; }
.floor-pin::after { content: ''; position: absolute; inset: -13px; border-radius: 50%; }

/* ── The Floor map in the light theme ─────────────────────────────────────
   The light base map's saturated cyan sea and bright greens stood apart from the cream and gold page. Its tiles are
   drawn a little quieter and warmer in the light theme only; the pins, labels and controls above them keep their own
   colours, and the dark theme keeps its own flavour of the map. */
html:not([data-theme="dark"]) #floorLeaflet .leaflet-tile-pane { filter: saturate(.55) sepia(.18); }

/* ── Main buttons in the dark theme ───────────────────────────────────────
   A form's main button on a paper page is filled forest green with light words (.submit-btn on the contact, careers,
   report, help and help sign-in pages; .problem-send on governance; .search-send on search; .suggest-btn on the
   Floor). In the dark theme the page turns wood-brown and that green nearly vanished against it (about 1.1:1), so the
   main action looked like a plain box. There it takes the gold fill with forest words that the gift, sign-in and home
   pages already use in both themes (4.97:1 for the words, 6:1 against the dark page); hover lightens the gold as
   theirs does. The light theme keeps the forest buttons. */
html[data-theme="dark"] :is(.submit-btn, .problem-send, .search-send, .suggest-btn) {
  background-color: #b8923a !important; background-image: none !important; color: #1a2e1a !important; border-color: #b8923a !important; }
html[data-theme="dark"] :is(.submit-btn, .problem-send, .search-send, .suggest-btn):is(:hover, :focus-visible):not(:disabled) {
  background-color: #d4aa55 !important; border-color: #d4aa55 !important; }

/* ── A form's error line ──────────────────────────────────────────────────
   The sign-in, account and gift pages show a refused password or a failed step in .error-msg, which each page shows
   with .visible. At the pages' own small size it read as a faint line easy to miss, right where a person is stuck.
   Here it reads at body size and in bold, in the warning colour of the surface it sits on (light on the green pages,
   deep on paper), inside a frame with a thick warning edge on a faint warning tint. The page still decides when it
   shows; two classes outrank each page's one-class rule without !important. */
.error-msg.visible {
  font-size: 1rem; font-weight: 700; line-height: 1.5; color: var(--danger);
  margin-block: .6rem 1rem; padding: .65rem .85rem;
  border: 1px solid var(--danger); border-inline-start-width: 4px; border-radius: 3px;
  background: rgba(184, 53, 40, .14);
}

/* ── "In short" and "Read more" ──────────────────────────────────────────
   A small box at the top of a long page: three to five plain lines saying what
   the page is for and what most people need from it, because a long page is
   hard to start with. Every line must stay
   true to the page below it. "Read more" folds a longer section; its words stay
   on the page and are found by the browser's search. */
.in-short { margin: 0 auto 2rem; max-width: 760px; padding: 1rem 1.25rem 0.85rem; text-align: start;
  border: 1px solid rgba(184,146,58,.35); border-inline-start: 3px solid #b8923a; border-radius: 4px; background: rgba(184,146,58,.07); }
.in-short-title { font-family: 'Cinzel', serif; font-size: .8rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--gold-text); margin: 0 0 .5rem; line-height: 1.4; }
/* Start-side edge and indent, so the box reads right in right-to-left languages too. */
.in-short ul, .in-short ol { margin: 0 0 .35rem; padding: 0; padding-inline-start: 1.25rem; }
.in-short li { margin: .3rem 0; line-height: 1.55; font-size: .95rem; }
.in-short h3 { font-family: 'Cinzel', serif; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-text); margin: .9rem 0 .35rem; }
.in-short-actions { display: flex; flex-wrap: wrap; gap: .75rem 1rem; margin: .8rem 0 .2rem; }
.in-short-actions a { display: inline-flex; align-items: center; min-height: 44px; box-sizing: border-box; padding: .55rem 1rem; border-radius: 3px; border: 1px solid #b8923a; font-family: 'Cinzel', serif;
  font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; text-decoration: none; color: var(--gold-text); }
.in-short-actions a.primary { background: #b8923a; color: #1a2e1a; }
.in-short-actions a:hover, .in-short-actions a:focus-visible { background: #1a2e1a; color: #d4aa55; }
details.read-more { margin: 1.2rem 0; padding-top: .7rem; border-top: 1px solid rgba(184,146,58,.3); }
details.read-more > summary { cursor: pointer; font-family: 'Lato', sans-serif; font-size: 1rem; letter-spacing: normal; text-transform: none;
  color: var(--gold-text); padding: .3rem 0; }
details.read-more > summary .read-more-label { font-family: 'Cinzel', serif; font-size: .75em; letter-spacing: .1em; text-transform: uppercase; }
details.read-more[open] > summary { margin-bottom: .8rem; }

/* ── Month view (assets/js/month-grid.js) ─────────────────────────────────
   At the top of the Events and Rhythm pages: a quiet card with the month's days; a small gold dot marks a day
   with something on it, today is outlined, the chosen day is filled. Each day is a 44 px touch target. */
.month-grid { margin: 0 auto 2rem; max-width: 760px; padding: 1rem; border: 1px solid var(--parchment-dk, #e8d5ae); border-radius: 6px; background: var(--card); }
.mg-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .6rem; }
.mg-title { flex: 1; margin: 0; text-align: center; font-family: 'Cinzel', serif; font-size: 1rem; letter-spacing: .08em; color: var(--forest-text); }
.mg-nav { min-width: 44px; min-height: 44px; font-size: 1.4rem; line-height: 1; color: var(--gold-text); background: none; border: 1px solid var(--parchment-dk, #e8d5ae); border-radius: 4px; cursor: pointer; }
.mg-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.mg-table th { padding: .3rem 0; font-size: .72rem; font-weight: 400; letter-spacing: .06em; text-transform: uppercase; color: var(--stone); }
.mg-table td { padding: 2px; text-align: center; }
.mg-date { position: relative; width: 100%; min-height: 44px; font: inherit; font-size: .95rem; color: var(--ink); background: none; border: 1px solid transparent; border-radius: 4px; cursor: pointer; }
.mg-date:hover { border-color: var(--parchment-dk, #e8d5ae); }
.mg-date.has-items { font-weight: 600; }
.mg-date.is-today { border-color: var(--gold-text); }
.mg-date[aria-pressed="true"] { background: var(--parchment-bg); border-color: var(--gold-text); }
.mg-date:focus-visible, .mg-nav:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.mg-mark { position: absolute; left: 50%; bottom: 5px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--gold-text); }
.mg-panel { margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--parchment-dk, #e8d5ae); }
.mg-day-title { margin: 0 0 .4rem; font-size: 1rem; color: var(--forest-text); }
.mg-items { margin: 0; padding-inline-start: 1.2rem; }
.mg-items li { margin: .3rem 0; line-height: 1.5; }
.mg-items a { color: var(--link); }
.mg-none { margin: 0; color: var(--stone); }
/* Under each listed entry: a small button that brings the month view back to that entry's day. */
.see-on-calendar { display: inline-block; margin: .5rem .9rem 0 0; padding: .3rem .75rem; min-height: 44px; font: inherit; font-size: .82rem;
  color: var(--gold-text); background: none; border: 1px solid var(--parchment-dk, #e8d5ae); border-radius: 4px; cursor: pointer; }
.see-on-calendar:hover { border-color: var(--gold-text); }
.see-on-calendar:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

/* ── Long text reads upright ──────────────────────────────────────────────
   Italic is hard to read for more than a line, above all on a phone. Italic
   stays for short single lines: taglines, bridge lines, short quotes. A
   paragraph or a long quote that runs past about two lines on a phone carries
   "prose-upright" and reads upright in the body font and size. A quote keeps
   its own left rule or frame, and any attribution inside keeps its own style.
   Words set in <em> inside it stay italic, as emphasis. The rules win over a
   page's own italic styles, including inline ones, so one class is enough. */
.prose-upright { font-family: 'Lato', sans-serif !important; font-style: normal !important; font-size: 1rem !important;
  line-height: 1.7 !important; letter-spacing: normal !important; }

/* ── Skip to content, and the main landmark ───────────────────────────────
   Each page's first link takes keyboard and screen-reader users past the
   banner, navigation and any hero to where the page's content starts (the
   main landmark; on the home page, the first section after the hero). It is
   visually hidden at all times except while it has KEYBOARD focus
   (:focus-visible), so a tap never shows it and touch users never see it.
   Each page also carries the hidden style on the link itself, so it stays
   hidden even when this stylesheet has not loaded; the focus rule below
   therefore overrides with !important. A page laid out as one centred
   column in the body keeps that column inside its main wrapper
   (main-column). Jumping to the content leaves room for a sticky top bar. */
.skip-link {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link:focus-visible {
  position: fixed !important; top: 1rem; inset-inline-start: 1rem; z-index: 1000;
  width: auto !important; height: auto !important; margin: 0 !important; overflow: visible !important;
  clip: auto !important; clip-path: none !important; white-space: normal !important;
  padding: 0.6rem 1rem !important; border: 2px solid #d4aa55 !important; border-radius: 4px;
  outline: 3px solid #f4e8ce; outline-offset: 2px;
  background: #1a2e1a; color: #f4e8ce;
  font-family: 'Lato', sans-serif; font-size: 0.95rem; line-height: 1.4; text-decoration: none;
}
/* Browsers older than :focus-visible show it on any focus instead. */
@supports not selector(:focus-visible) {
  .skip-link:focus {
    position: fixed !important; top: 1rem; left: 1rem; z-index: 1000;
    width: auto !important; height: auto !important; margin: 0 !important; overflow: visible !important;
    clip: auto !important; clip-path: none !important; white-space: normal !important;
    padding: 0.6rem 1rem !important; border: 2px solid #d4aa55 !important; border-radius: 4px;
    background: #1a2e1a; color: #f4e8ce;
    font-family: 'Lato', sans-serif; font-size: 0.95rem; line-height: 1.4; text-decoration: none;
  }
}
.main-column { display: flex; flex-direction: column; align-items: center; align-self: stretch; }
main, [role="main"] { scroll-margin-top: 5rem; }
@media print { .skip-link { display: none !important; } }

/* ── Links with no colour of their own ───────────────────────────────────
   A link no page rule colours would show the browser's blue, or purple once
   visited; in dark mode the browser draws them lavender and lilac. None is a
   Guild colour and they read poorly on paper and on brown. Such a link takes
   the link role instead, before and after a visit (dark gold on paper, light
   gold in dark mode and on green surfaces). :where() gives this rule no
   weight, so any colour a page or a class sets still wins, and it sits before
   the green rule below so a plain link on green keeps that rule's gold. */
:where(a:link, a:visited) { color: var(--link); }

/* ── Links on green with no colour of their own ───────────────────────────
   A plain link on a green page (or the home page's green Living Book
   section) that no page rule colours would get the browser's default blue,
   which barely shows on the forest green. It takes the Guild's light gold
   instead (6.7:1 on the page green, 4.6:1 on the lighter card green).
   :where() gives this rule no weight, so any colour a page sets still wins.
   The green footers (home, Sweepstakes, welcome page) are included: their
   charities registration link otherwise showed in blue. */
:where(body.surface-forest a:not([class]), #living-book a:not([class]), footer a:not([class])) { color: var(--gold-lt, #d4aa55); }

/* ── Controls with no look of their own ──────────────────────────────────
   A button, list, text box, tick box or fold that no page rule styles is
   drawn by the browser: grey buttons and lists, fields filled white or black,
   blue ticks, the browser's plain fold triangle, and on phones button and list
   words in the system blue. None of these is the Guild's, and one control
   that looks unlike the rest reads as unfinished, at the moments that need
   trust most: joining, paying, asking for help. These rules fill in only what
   no page rule sets, in the site's own tokens: fields in the field colours
   (white or wood-brown with the field edge) and the site's reading font, so
   what a person types reads like the page and never in a heading face caught
   from its label; plain buttons in the words around them, outlined in gold
   like the site's quieter buttons; ticks in gold; fold triangles in the small
   gold of the site's own fold marks. :where() gives them no weight, so every
   page and class rule still wins. */
:where(select, textarea, input:not([type="checkbox"], [type="radio"], [type="button"], [type="submit"], [type="reset"], [type="file"], [type="range"], [type="color"], [type="image"])) {
  font-family: 'Lato', sans-serif; background-color: var(--card); color: var(--ink); border: 1px solid var(--field-border); border-radius: 3px; }
:where(button, input:is([type="button"], [type="submit"], [type="reset"])), :where(input[type="file"])::file-selector-button {
  font-family: inherit; background-color: transparent; color: var(--gold-text); border: 1px solid var(--gold); border-radius: 3px; cursor: pointer; }
:where(summary)::marker { color: var(--gold-text); }

/* ── Tick boxes and round choices ────────────────────────────────────────
   The browser colours only the ticked state of its own box. An unticked box is
   always its own grey (dark grey with a grey edge in the dark theme, white with
   a grey edge in the light one) and no page colour reaches it, so a form of
   gold-and-parchment fields showed grey boxes beside them. These rules draw the
   box on the page instead: the field fill and edge in both themes, gold with a
   green tick or dot once chosen, the site's outline for keyboard focus, and a
   thicker frame in forced-colours modes, where a person's own colours replace
   the fills and the frame is what tells a chosen box from an empty one.
   Unlike the rules above these are not weightless. Many pages style a bare
   `input` for their text fields (full width, padded, filled, a faint edge), and
   a drawn box must never take that look: a ticked box would show no tick and an
   empty one would nearly vanish on a dark page. So the fill, edge and shape
   are stated for each state, which puts them above such a class rule (the
   `:is(:checked, :not(:checked))` pair adds no condition, only that weight). A
   page's `width: auto` (the usual way to undo a full-width input) leaves a drawn
   box no width of its own, so the box keeps a floor of its own size. A page's
   own class rule for its boxes' size or spacing still wins. */
input[type="checkbox"], input[type="radio"] {
  -webkit-appearance: none; appearance: none; accent-color: var(--gold);
  display: inline-block; box-sizing: border-box; width: 1.125rem; height: 1.125rem; min-width: 1.125rem; min-height: 1.125rem; padding: 0; flex: none; vertical-align: -0.2em;
  background-position: center; background-repeat: no-repeat; background-size: 100% 100%; cursor: pointer; }
input[type="checkbox"]:not(:checked), input[type="radio"]:not(:checked) { background-color: var(--card); border: 2px solid var(--field-border); }
input[type="checkbox"]:checked, input[type="radio"]:checked { background-color: var(--gold); border: 2px solid var(--gold); }
input[type="checkbox"]:is(:checked, :not(:checked)) { border-radius: 3px; }
input[type="radio"]:is(:checked, :not(:checked)) { border-radius: 50%; }
input[type="checkbox"]:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%231a2e1a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
input[type="radio"]:checked { background-image: radial-gradient(circle, var(--forest, #1a2e1a) 0 36%, transparent 40%); }
input[type="checkbox"]:disabled, input[type="radio"]:disabled { opacity: 0.5; cursor: not-allowed; }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (forced-colors: active) {
  input[type="checkbox"]:checked, input[type="radio"]:checked { border-width: 6px; }
}

/* ── The Representative leaving form's buttons ─────────────────────────────
   assets/js/rep-leave.js draws one form into three pages: the workspace, which
   defines the .btn buttons, and the sign-in and Oath pages, which do not. There
   its buttons fell back to the small plain outline any button gets above, an
   odd look at a hard moment. These rules give the form the workspace's own
   button look wherever it is drawn (the text size comes from the site-wide
   reading size), with the 44 px touch floor on a phone. Resign is the filled
   gold confirm button, like the workspace's other confirm buttons; the second
   is the quiet outlined one. The id carries no weight, so where a page defines
   these classes itself, its own rules win. */
:where(#repLeave) .btn { font-family: 'Cinzel', serif; letter-spacing: 0.1em; text-transform: uppercase; border-radius: 3px;
  padding: 0.5rem 1.1rem; cursor: pointer; border: none; transition: background 0.2s, opacity 0.2s; }
:where(#repLeave) .btn:disabled { opacity: 0.5; cursor: not-allowed; }
:where(#repLeave) .btn-gold { background: var(--gold); color: var(--forest, #1a2e1a); }
:where(#repLeave) .btn-gold:hover:not(:disabled) { background: var(--gold-lt, #d4aa55); }
:where(#repLeave) .btn-ghost { background: none; color: var(--gold-text); border: 1px solid var(--gold); }
:where(#repLeave) .btn-ghost:hover:not(:disabled) { border-color: var(--gold-lt, #d4aa55); color: var(--gold-lt, #d4aa55); }
@media (max-width: 720px) { :where(#repLeave) .btn { padding: 0.8rem 1.1rem; min-height: 44px; } }

/* ── Links in text ───────────────────────────────────────────────────────────
   A line under body-size and smaller text crowds it, so links there carry none at
   rest; hover and keyboard focus draw a thin one. A link inside running text is
   also set in bold, so a reader can find it without telling the gold from the
   body colour (the two are close in brightness, about 1.7:1). Lists of links in
   menus and footers stay at their weight. Buttons and styled links (any class)
   are left alone, and so is the Living Book page (it changes only through its own
   kit; its Dot Guide is the landmark). Large call-to-action lines keep a line
   beneath them with .cta-line. */
:where(html:not(:has(#dot-guide))) :is(p, li, dd, td, figcaption, label, small, summary, footer) a:not([class]) {
  text-decoration: none; border-bottom: 0; }
:where(html:not(:has(#dot-guide))) :is(p, li, dd, td, figcaption, summary):not(nav *, footer *, .footer-note *) a:not([class]) {
  font-weight: 700; }
:where(html:not(:has(#dot-guide))) :is(p, li, dd, td, figcaption, label, small, summary, footer) a:not([class]):is(:hover, :focus-visible) {
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }
.cta-line { font-family: 'Cinzel', serif; font-size: .78rem; letter-spacing: .12em; color: var(--gold-text);
  text-decoration: none; border-bottom: 1px solid rgba(184, 146, 58, .4); padding-bottom: .15em; }
.cta-line:hover, .cta-line:focus-visible { border-bottom-color: var(--gold); }

/* Shared readable copy keeps the chosen page theme and wraps long translations. */
html { font-size: 16px; }
body { font-size: 1rem !important; }
body :is(p,li,td,small,summary,input,select,textarea,button) { font-size: 1rem !important; overflow-wrap: anywhere; }
body :is(label,th) { font-size: .875rem !important; }
:root:not([data-theme="dark"]) { --stone: #65543e; }
.surface-paper { --stone: #65543e; }
body :is(p,li,td,small,summary,label,th) span { font-size: inherit !important; }
body { overflow-wrap: anywhere; }
body :is(input,select,textarea,button,fieldset) { box-sizing: border-box; min-inline-size: 0; max-inline-size: 100%; }
body :is(button,legend) { white-space: normal; overflow-wrap: anywhere; }
body legend { max-inline-size: 100%; }
.row-2 > *, form, .field { min-inline-size: 0; }
body nav :is(a,span) { white-space: normal !important; }
body nav a { font-size: .875rem !important; }

/* Keep the final spending figure below the balance and its held reserve. */
.money-receipt { display: grid; grid-template-columns: minmax(0, 1fr); gap: .6rem; margin-block: 1rem; }
.money-receipt > :last-child { border: 2px solid var(--forest-text); }

.report-counts { border: 1px solid var(--stone); padding: .8rem; }
.report-counts > div { display: flex; justify-content: space-between; gap: 1rem; padding-block: .35rem; }
.report-counts dt { min-width: 0; }
.report-counts dd { margin: 0; font-weight: bold; }

#repItems .held-form { display: grid; gap: .8rem; grid-template-columns: minmax(0, 1fr); }
#repItems label { display: grid; gap: .3rem; }
#repItems input:not([type="checkbox"]), #repItems select { width: 100%; min-width: 0; box-sizing: border-box; font-size: 1rem; min-height: 44px; }
#repItems button { min-height: 44px; }

/* A drawn tier or trophy mark sits where its emoji would, from the first paint. assets/js/marks.js adds the same
   rule when it runs; here it holds before then, so a page sent with its marks already drawn does not shift when that
   script arrives. */
img.mark { display: inline-block; vertical-align: middle; object-fit: contain; }

/* A fold's count stays whole so a narrow title cannot split its parentheses. */
summary .fold-count { display: inline-block; flex: 0 0 auto; white-space: nowrap; overflow-wrap: normal; word-break: normal; }
summary .fold-title { min-width: 0; overflow-wrap: anywhere; }

/* A table in a Library document keeps its words whole on screen. The rules above let text wrap anywhere so a long word
   never pushes a phone sideways, but inside a table that lets the browser crush a narrow column to a letter or two
   ("Clos" over "ed", "ye" over "s"). Here each column takes the room its longest word needs and the table's own box
   (the scrolling wrapper the document renderer puts around it) scrolls sideways when the columns do not fit. Paper
   cannot scroll (assets/css/doc-print.css shows the wrapper whole), so the print view keeps the wrapping above and
   every cell still fits the page. The selector names the renderer's markup (lib/doctrine-docs.js renderMarkdown), which no other page uses;
   lab/tests/library-tables.test.js reads both, so a change to one is caught by the other. */
@media screen {
  div[style*="overflow-x"] > table[style*="border-collapse"] th[style],
  div[style*="overflow-x"] > table[style*="border-collapse"] td[style] { overflow-wrap: normal; word-break: normal; hyphens: manual; }
}
