/* bf-theme.css
 *
 * The one stylesheet. Every page links this and defines nothing of its own.
 *
 * WHY THIS FILE EXISTS
 *
 * The site carried 358 KB of inline CSS across 38 pages, averaging 9 KB each,
 * most of it the same tokens and resets written out again. That meant a colour
 * change was 37 edits, and it is why the theme had drifted: seven font families
 * were loaded where three were intended, and 881 colour values sat outside the
 * token blocks where nothing could reach them.
 *
 * ONE FILE IS ALSO A SINGLE POINT OF FAILURE on a static site with no build
 * step. A page that forgets to link it renders unstyled rather than slightly
 * wrong, which is loud rather than quiet, and an invariant checks every page
 * references it.
 *
 * THE NAMES ARE THE OLD NAMES ON PURPOSE. --cyan no longer holds a cyan; it
 * holds the accent. Renaming it would mean touching every rule on every page in
 * the same change as repainting them, and two large changes at once is how you
 * lose the ability to say which one broke something. The rename is a separate
 * pass, later, or never: a token name is a handle, not a description.
 */

/* --------------------------------------------------------------------------
   TOKENS, light
   --------------------------------------------------------------------------
   Warm rather than cool. The previous palette was #f6f7fb, a blue white, with a
   teal accent. This is #f6f2eb, a paper white, with a vermilion accent. The
   difference is not decoration: a blue white with teal reads as a dashboard, a
   paper white with vermilion reads as something written down and thought about,
   which is what this product actually sells.
   -------------------------------------------------------------------------- */
:root {
  /* Grounds. surface sits above bg, surface-alt below it, so a card lifts and a
     well recedes without either needing a shadow to say so. */
  --bg:            #f6f2eb;
  --bg2:           #eee7de;
  --surface:       #fbf8f3;
  --card:          #fbf8f3;
  --line:          #d8cec2;
  --line2:         #e6ded3;

  /* Ink. Warm near-black rather than pure, because pure black on warm paper
     reads as a printing error. */
  --text:          #12100f;
  --dim:           #6b625b;
  --faint:         #756d68;   /* was #9a9089, which is 2.80:1 on paper and unreadable */

  /* Accents. --cyan is the primary accent and is no longer cyan; see the note
     above about names. --ember and --amber were already close to this family,
     which is part of why the warm direction sits comfortably. */
  --cyan:          #ee5b2b;
  --accent:        #ee5b2b;

  /* ACCENT FOR TEXT, and why there are two.
   *
   * #ee5b2b on paper is 3.05:1. That is fine for a large heading and it FAILS
   * for a link or a label at body size, where 4.5:1 is the bar. The Arcturus
   * palette does not carry this distinction and the failure is inherited rather
   * than introduced here.
   *
   * So the vermilion stays as the FILL, where it is doing its job as a brand
   * colour on buttons and rules, and text that happens to be accent coloured
   * uses the darker value. Same hue, enough contrast, nobody notices the
   * difference except the person who could not read it before. */
  --accent-text:   #be4922;
  --amber:         #ffb13b;
  --ember:         #c85824;
  --green:         #986d23;
  --red:           #d94621;
  --purple:        #b36e1d;

  /* Translucent surfaces, used by sticky headers and layered panels. Written as
     rgba on the light ground rather than as color-mix, because these are read
     by pages that predate color-mix support being safe to assume. */
  --topbg:         rgba(251,248,243,.86);
  --srf1:          rgba(251,248,243,.94);
  --srf2:          rgba(251,248,243,.78);
  --srf-flat:      rgba(251,248,243,.88);
  --srf-foot:      rgba(251,248,243,.62);
  --srf-deep1:     rgba(251,248,243,.96);
  --srf-deep2:     rgba(251,248,243,.86);

  /* Glows and hairlines. Tinted with the accent rather than neutral grey, which
     is what stops a warm palette looking like a cool one with the saturation
     turned down. */
  --glow-cyan:      rgba(238,91,43,.10);
  --glow-cyan-soft: rgba(238,91,43,.05);
  --glow-ember:     rgba(200,88,36,.08);
  --hair:           rgba(238,91,43,.42);

  /* Type. Three families, replacing the seven the site had accumulated: Oswald
     on three pages and IBM Plex Mono on one were strays from whenever those
     pages were built. */
  --disp:  'Space Grotesk', system-ui, sans-serif;
  --body:  'Manrope', system-ui, sans-serif;
  --mono:  'DM Mono', ui-monospace, monospace;

  /* Shadows, warm rather than blue-black, for the same reason as the ink. */
  --shadow:  0 1px 2px rgba(40,28,20,.06);
  --shadow2: 0 8px 28px rgba(40,28,20,.09);

  --radius:    12px;
  --radius-lg: 16px;
}

/* --------------------------------------------------------------------------
   TOKENS, dark
   --------------------------------------------------------------------------
   Six pages are dark today and three of those are admin only. This block exists
   so a toggle works everywhere rather than on the six, and so the admin pages
   stop carrying their own near-black.

   THE ACCENT SHIFTS BETWEEN THEMES, deliberately. #ee5b2b on paper has the
   contrast it needs; on near-black it reads muddy, so dark uses #ff6230. Two
   values for one token is not drift, it is the token doing its job.
   -------------------------------------------------------------------------- */
[data-theme="dark"] {
  --bg:            #100e0d;
  --bg2:           #171311;
  --surface:       #171311;
  --card:          #171311;
  --line:          #40342e;
  --line2:         #2b221e;

  --text:          #f7eee5;
  --dim:           #b9aaa0;
  --faint:         #8b7d74;

  --cyan:          #ff6230;
  --accent:        #ff6230;
  /* On near-black the accent is already 6.46:1, so text and fill can share it. */
  --accent-text:   #ff6230;
  --amber:         #ffb23f;
  --ember:         #ff7450;
  --green:         #ffc765;
  --red:           #ff7450;
  --purple:        #ffc16a;

  --topbg:         rgba(23,19,17,.86);
  --srf1:          rgba(23,19,17,.94);
  --srf2:          rgba(23,19,17,.78);
  --srf-flat:      rgba(23,19,17,.88);
  --srf-foot:      rgba(23,19,17,.62);
  --srf-deep1:     rgba(23,19,17,.96);
  --srf-deep2:     rgba(23,19,17,.86);

  --glow-cyan:      rgba(255,98,48,.14);
  --glow-cyan-soft: rgba(255,98,48,.07);
  --glow-ember:     rgba(255,116,80,.10);
  --hair:           rgba(255,98,48,.45);

  --shadow:  0 1px 2px rgba(0,0,0,.4);
  --shadow2: 0 8px 28px rgba(0,0,0,.5);
}

/* Follow the operating system unless the page has been told otherwise. The
   attribute wins, so a toggle can override the preference and a visitor who has
   chosen dark on their machine does not get flashed a white page first. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:#100e0d; --bg2:#171311; --surface:#171311; --card:#171311;
    --line:#40342e; --line2:#2b221e;
    --text:#f7eee5; --dim:#b9aaa0; --faint:#8b7d74;
    --cyan:#ff6230; --accent:#ff6230; --accent-text:#ff6230; --amber:#ffb23f; --ember:#ff7450;
    --green:#ffc765; --red:#ff7450; --purple:#ffc16a;
    --topbg:rgba(23,19,17,.86); --srf1:rgba(23,19,17,.94); --srf2:rgba(23,19,17,.78);
    --srf-flat:rgba(23,19,17,.88); --srf-foot:rgba(23,19,17,.62);
    --srf-deep1:rgba(23,19,17,.96); --srf-deep2:rgba(23,19,17,.86);
    --glow-cyan:rgba(255,98,48,.14); --glow-cyan-soft:rgba(255,98,48,.07);
    --glow-ember:rgba(255,116,80,.10); --hair:rgba(255,98,48,.45);
    --shadow:0 1px 2px rgba(0,0,0,.4); --shadow2:0 8px 28px rgba(0,0,0,.5);
  }
}

/* --------------------------------------------------------------------------
   BASE
   --------------------------------------------------------------------------
   These rules were written out on all 38 pages. Not identically, which was the
   problem: body appeared 38 times, .wrap 33, .eyebrow 25, and they had drifted
   apart by a pixel here and a weight there. Shared, they stay the same by
   construction rather than by anybody remembering.
   -------------------------------------------------------------------------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* The theme changes on a toggle, so the change is worth seeing rather than
     flashing. Kept short: anything longer feels like the page is thinking. */
  transition: background .18s ease, color .18s ease;
}

/* Respect a visitor who has asked their machine for less movement. The theme
   transition above is the only motion here, and for somebody with vestibular
   sensitivity a full page colour sweep is exactly the wrong thing. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body { transition: none; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

.wrap { max-width: 1160px; margin: 0 auto; padding: 0 22px; }
.wrap.narrow { max-width: 860px; }

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Visible focus, on every interactive thing, in the accent colour.
   WHY IT IS HERE AND NOT PER PAGE: the old pages mostly inherited the browser
   default, which is a blue ring that will look wrong against warm paper and
   invisible on the dark theme. A keyboard user is not an edge case. */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   TYPE
   -------------------------------------------------------------------------- */
h1, h2, h3, h4 { font-family: var(--disp); font-weight: 700; line-height: 1.12; letter-spacing: -.02em; }
h1 { font-size: clamp(30px, 5vw, 52px); }
h2 { font-size: clamp(22px, 3vw, 30px); }
h3 { font-size: 18px; }

/* The label above a heading. Monospaced and letterspaced so it reads as a
   category rather than as a first line of prose. */
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  /* 11px is small text, so this takes the darker accent. */
  color: var(--accent-text);
}

.lede { color: var(--dim); font-size: 16.5px; max-width: 78ch; }
.mut, .muted { color: var(--dim); }
code, .mono { font-family: var(--mono); font-size: .92em; }

/* --------------------------------------------------------------------------
   SURFACES
   -------------------------------------------------------------------------- */
.card, .panel, .note {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}

/* A note is a card that is saying something, so it carries an accent edge.
   The rest of the card rules are shared rather than repeated. */
.note { border-left: 3px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0; }
.note.warn { border-left-color: var(--amber); }
.note.bad  { border-left-color: var(--red); }
.note.good { border-left-color: var(--green); }

.grid { display: grid; gap: 14px; }
.grid.two   { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

hr, .rule { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

.foot {
  margin-top: 36px; padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--dim); font-size: 12.5px;
}

/* --------------------------------------------------------------------------
   CONTROLS
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--body); font-size: 14px; font-weight: 600;
  padding: 10px 18px;
  /* Fully round, which is the clearest single signal of the new direction: the
     old buttons were 8px rectangles and read as a dashboard control. */
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow2); }
/* White on #ee5b2b is 3.41:1 and fails. Two ways out: darken the fill, or put
 * dark text on it. Darkening wins, because #12100f on vermilion reads as a
 * warning label rather than as a button, and the darker fill still looks like
 * the brand colour beside it. */
.btn.primary { background: #c43f16; border-color: #c43f16; color: #fff; }
.btn.dark    { background: var(--text);   border-color: var(--text);   color: var(--bg); }
.btn.ghost   { background: transparent; }
.btn.lg      { padding: 13px 26px; font-size: 15px; }
.btn[disabled], .btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

/* --------------------------------------------------------------------------
   HEADER AND THEME TOGGLE
   -------------------------------------------------------------------------- */
.top {
  position: sticky; top: 0; z-index: 40;
  background: var(--topbg);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}

.logo { font-family: var(--disp); font-weight: 800; font-size: 18px; color: var(--text); display: inline-flex; align-items: center; gap: 9px; }
.logo:hover { text-decoration: none; }

/* The mark. Left as the hexagon on purpose: the wordmark is being redesigned
   separately, and swapping in a placeholder would mean changing it twice. */
.logo .hex {
  width: 14px; height: 16px; flex: none;
  background: var(--accent);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

.themebtn {
  font-family: var(--mono); font-size: 11.5px;
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--dim);
  cursor: pointer;
}
.themebtn:hover { color: var(--text); border-color: var(--accent); }

/* On the dark theme the darker fill disappears into the ground, so it goes back
   to the brighter accent with dark text, which is 5.57:1 and reads correctly. */
[data-theme="dark"] .btn.primary { background: var(--accent); border-color: var(--accent); color: #100e0d; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn.primary { background: #ff6230; border-color: #ff6230; color: #100e0d; }
}

/* --------------------------------------------------------------------------
   TABLES
   -------------------------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { border: 1px solid var(--line2); padding: 9px 11px; text-align: left; color: var(--dim); vertical-align: top; }
thead th { background: var(--bg2); color: var(--text); font-family: var(--disp); font-weight: 700; font-size: 12.5px; }
td b, td strong { color: var(--text); }

.hide { display: none !important; }

/* --------------------------------------------------------------------------
   IMAGES
   --------------------------------------------------------------------------
   THE BESTIARY ART CANNOT FOLLOW THE THEME. It is webp, which is raster, so no
   token reaches inside it. A CSS filter would recolour it and ruin fifty
   detailed illustrations; a second set would double a 2.8 MB payload.
   So instead the art is given a ground that works on both themes: a surface
   tile behind it, which keeps a dark illustration readable on paper and a light
   one readable on near-black, without touching the pixels.
   -------------------------------------------------------------------------- */
img { max-width: 100%; height: auto; }

.sigil, .bestiary-art {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px;
}
