/* Shared shell for every free tool page under /tools/.
   Kept out of the app's styles.css on purpose: these pages are public,
   crawlable and must not depend on anything the logged-in app needs. */

  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  :root {
    --ink:#09090f; --deep:#0e0d1a; --surface:#13121f; --card:#1a1929;
    --rim:#2a2940; --rim-hover:#3a3856;
    --text:#e8e4d9; --tertiary:#8a8fd6;
    --muted:color-mix(in srgb, var(--tertiary) 28%, #a5a0ab);
    --subtle:color-mix(in srgb, var(--tertiary) 20%, #6e6a78);
    --gold:#c9a84c; --gold-dim:rgba(201,168,76,0.13);
    --ember:#d4664a; --green:#63b98a;
    --radius:10px;
  }
  html { -webkit-text-size-adjust:100%; scroll-behavior:smooth; }
  body {
    background:var(--ink); color:var(--text);
    font-family:'Inter',system-ui,-apple-system,sans-serif;
    line-height:1.6; font-size:16px;
    padding:0 20px 90px;
  }
  .wrap { max-width:820px; margin:0 auto; }

  /* ── header ── */
  .top { padding:26px 0; display:flex; align-items:center; justify-content:space-between; gap:16px; }
  .brand { display:flex; align-items:center; gap:11px; text-decoration:none; }
  .mark { width:26px; height:26px; border-radius:6px; background:var(--gold);
          display:flex; align-items:center; justify-content:center;
          font-family:'Cinzel',serif; font-weight:900; font-size:15px; color:var(--ink); }
  .word { font-family:'Cinzel',serif; font-weight:700; font-size:0.95rem;
          letter-spacing:0.28em; color:var(--text); }
  .top-cta { font-size:0.8rem; color:var(--gold); text-decoration:none; }
  .top-cta:hover { text-decoration:underline; }

  h1 { font-family:'Cinzel',serif; font-size:2.1rem; line-height:1.15; font-weight:700;
       margin:22px 0 12px; text-wrap:balance; }
  .standfirst { font-size:1.02rem; color:var(--muted); max-width:62ch; }
  .standfirst strong { color:var(--text); font-weight:600; }

  h2 { font-family:'Cinzel',serif; font-size:1.15rem; font-weight:700; margin:0 0 4px; }
  .section { margin-top:40px; }
  .section-note { font-size:0.86rem; color:var(--muted); margin-bottom:14px; max-width:62ch; }

  /* ── the form ── */
  .adder { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:14px; }
  input[type=text], select {
    background:var(--surface); border:1px solid var(--rim); border-radius:8px;
    color:var(--text); font-family:inherit; font-size:0.9rem; padding:10px 12px;
  }
  input[type=text] { flex:1; min-width:220px; }
  input[type=text]:focus, select:focus { outline:none; border-color:var(--gold); }
  select { cursor:pointer; }
  select option { background:var(--card); }

  .btn {
    background:var(--gold); color:var(--ink); border:none; border-radius:8px;
    padding:10px 18px; font-family:inherit; font-size:0.88rem; font-weight:600;
    cursor:pointer; white-space:nowrap;
  }
  .btn:hover { filter:brightness(1.08); }
  .btn-ghost { background:none; color:var(--muted); border:1px solid var(--rim); }
  .btn-ghost:hover { border-color:var(--rim-hover); color:var(--text); }
  .btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
  button:focus-visible { outline:2px solid var(--gold); outline-offset:2px; }

  /* ── rows ── */
  .rows { display:flex; flex-direction:column; gap:1px; background:var(--rim);
          border:1px solid var(--rim); border-radius:var(--radius); overflow:hidden; }
  .row { background:var(--deep); padding:11px 14px; display:flex; align-items:center;
         gap:12px; flex-wrap:wrap; }
  .row-type {
    font-size:0.6rem; letter-spacing:0.1em; text-transform:uppercase; font-weight:600;
    color:var(--tertiary); border:1px solid var(--rim-hover); border-radius:3px;
    padding:2px 7px; flex-shrink:0; min-width:88px; text-align:center;
  }
  .row-name { flex:1; min-width:150px; font-size:0.92rem; }
  .row.used   .row-name { color:var(--text); }
  .row.unused .row-name { color:var(--subtle); text-decoration:line-through;
                          text-decoration-color:var(--rim-hover); }
  .verdicts { display:flex; gap:4px; flex-shrink:0; }
  .vbtn {
    background:none; border:1px solid var(--rim); border-radius:6px;
    color:var(--subtle); font-family:inherit; font-size:0.72rem; font-weight:600;
    padding:5px 10px; cursor:pointer;
  }
  .vbtn:hover { border-color:var(--rim-hover); color:var(--text); }
  .vbtn.on[data-v="used"]   { border-color:var(--green); color:var(--green); background:rgba(99,185,138,0.1); }
  .vbtn.on[data-v="partly"] { border-color:var(--gold);  color:var(--gold);  background:var(--gold-dim); }
  .vbtn.on[data-v="no"]     { border-color:var(--ember); color:var(--ember); background:rgba(212,102,74,0.1); }
  .row-x { background:none; border:none; color:var(--subtle); cursor:pointer;
           font-size:0.9rem; padding:4px 6px; flex-shrink:0; }
  .row-x:hover { color:var(--ember); }
  .empty { color:var(--subtle); font-size:0.88rem; padding:22px 14px; text-align:center;
           background:var(--deep); }

  /* ── results ── */
  .score { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr));
           gap:1px; background:var(--rim); border:1px solid var(--rim);
           border-radius:var(--radius); overflow:hidden; margin-bottom:18px; }
  .score-cell { background:var(--deep); padding:16px 18px; }
  .score-n { font-family:'Cinzel',serif; font-size:1.8rem; font-weight:700; line-height:1.1;
             font-variant-numeric:tabular-nums; display:block; }
  .score-l { font-size:0.66rem; letter-spacing:0.1em; text-transform:uppercase;
             color:var(--subtle); margin-top:4px; display:block; }

  .bars { display:flex; flex-direction:column; gap:11px; }
  .bar-row { display:grid; grid-template-columns:104px 1fr 58px; gap:12px; align-items:center; }
  .bar-l { font-size:0.76rem; color:var(--muted); }
  .bar-track { height:6px; background:var(--rim); border-radius:3px; overflow:hidden; }
  /* display:block is load-bearing — these are spans, and width/height do not
     apply to an inline box, so every bar rendered at zero width. */
  .bar-fill { display:block; height:100%; border-radius:3px; background:var(--tertiary); }
  .bar-fill.good { background:var(--green); }
  .bar-fill.bad  { background:var(--ember); }
  .bar-n { font-size:0.76rem; color:var(--muted); text-align:right;
           font-variant-numeric:tabular-nums; }

  .verdict {
    margin-top:20px; padding:16px 18px; border-radius:var(--radius);
    background:var(--gold-dim); border:1px solid var(--gold);
    font-size:0.94rem; color:var(--text);
  }
  .verdict strong { color:var(--gold); }

  /* ── prose ── */
  .prose { margin-top:44px; padding-top:30px; border-top:1px solid var(--rim); }
  .prose h2 { margin-bottom:10px; }
  .prose h3 { font-family:'Cinzel',serif; font-size:0.98rem; margin:26px 0 7px; }
  .prose p { color:var(--muted); font-size:0.94rem; margin-bottom:12px; max-width:64ch; }
  .prose ul { color:var(--muted); font-size:0.94rem; margin:0 0 12px 20px; max-width:64ch; }
  .prose li { margin-bottom:6px; }
  .prose strong { color:var(--text); }

  .plug {
    margin-top:34px; padding:20px 22px; border-radius:var(--radius);
    background:var(--surface); border:1px solid var(--rim);
  }
  .plug h3 { font-family:'Cinzel',serif; font-size:1rem; margin-bottom:7px; }
  .plug p { color:var(--muted); font-size:0.9rem; margin-bottom:14px; max-width:60ch; }
  .plug a { display:inline-block; background:var(--gold); color:var(--ink);
            text-decoration:none; padding:9px 18px; border-radius:8px;
            font-size:0.86rem; font-weight:600; }

  footer { margin-top:44px; padding-top:20px; border-top:1px solid var(--rim);
           font-size:0.8rem; color:var(--subtle); display:flex; gap:16px; flex-wrap:wrap; }
  footer a { color:var(--muted); text-decoration:none; }
  footer a:hover { color:var(--text); }

  @media (max-width:560px) {
    h1 { font-size:1.7rem; }
    .bar-row { grid-template-columns:88px 1fr 48px; gap:9px; }
    .row-type { min-width:0; }
  }

/* ── prep checklist ── */
.picker { display:flex; flex-direction:column; gap:18px; }
.pick-group { display:flex; flex-direction:column; gap:8px; }
.pick-label { font-size:0.66rem; letter-spacing:0.11em; text-transform:uppercase;
              color:var(--subtle); font-weight:600; }
.chips { display:flex; gap:7px; flex-wrap:wrap; }
.chip {
  background:none; border:1px solid var(--rim); border-radius:20px;
  color:var(--muted); font-family:inherit; font-size:0.8rem; font-weight:500;
  padding:6px 14px; cursor:pointer;
}
.chip:hover { border-color:var(--rim-hover); color:var(--text); }
.chip.on { border-color:var(--gold); color:var(--gold); background:var(--gold-dim); }

.list-head { display:flex; align-items:baseline; justify-content:space-between;
             gap:12px; flex-wrap:wrap; margin-bottom:12px; }
.list-meta { font-size:0.74rem; color:var(--subtle); font-variant-numeric:tabular-nums; }

/* A label, not a div — the whole row is the hit area for the checkbox, which
   matters most on a phone at a table. */
label.row { cursor:pointer; align-items:flex-start; }
label.row input[type=checkbox] {
  appearance:none; -webkit-appearance:none;
  width:17px; height:17px; margin-top:3px; flex-shrink:0;
  border:1px solid var(--rim-hover); border-radius:4px; background:var(--surface);
  cursor:pointer; position:relative;
}
label.row input[type=checkbox]:checked { border-color:var(--gold); background:var(--gold); }
label.row input[type=checkbox]:checked::after {
  content:''; position:absolute; left:5px; top:1px; width:4px; height:9px;
  border:solid var(--ink); border-width:0 2px 2px 0; transform:rotate(45deg);
}
label.row input[type=checkbox]:focus-visible { outline:2px solid var(--gold); outline-offset:2px; }
.row-body { flex:1; min-width:0; display:flex; flex-direction:column; gap:2px; }
.row-s { font-size:0.92rem; color:var(--text); }
.row-d { font-size:0.8rem; color:var(--muted); }
label.row.done .row-s { color:var(--subtle); text-decoration:line-through;
                        text-decoration-color:var(--rim-hover); }
label.row.done .row-d { color:var(--subtle); opacity:0.6; }
.row-m { font-size:0.74rem; color:var(--subtle); flex-shrink:0;
         font-variant-numeric:tabular-nums; padding-top:2px; }

/* Shown rather than hidden: knowing what was cut, and that it was cut because
   it matters least, is the reassurance that makes a short list usable. */
.cut { background:var(--deep); padding:14px; border-top:1px solid var(--rim); }
.cut-h { font-size:0.64rem; letter-spacing:0.1em; text-transform:uppercase;
         color:var(--subtle); margin-bottom:9px; font-weight:600; }
.cut-i { font-size:0.84rem; color:var(--subtle); padding:3px 0;
         display:flex; justify-content:space-between; gap:10px; }
.cut-i span { font-variant-numeric:tabular-nums; }

.prose a { color:var(--gold); }

/* ── tools index ── */
.tool-row {
  background:var(--deep); padding:18px 20px; display:flex; align-items:center;
  gap:16px; text-decoration:none; color:inherit;
}
.tool-row:hover { background:var(--card); }
.tool-body { flex:1; min-width:0; display:flex; flex-direction:column; gap:4px; }
.tool-t { font-family:'Cinzel',serif; font-size:1.02rem; font-weight:700; color:var(--text); }
.tool-d { font-size:0.88rem; color:var(--muted); }
.tool-go { color:var(--gold); font-size:1.1rem; flex-shrink:0; }

/* ══════════════════════════════════════════════════════════
   ARTICLES
   Narrower than the tool pages: a tool is scanned, an article is read, and
   65 characters a line is where reading stops being work.
   ══════════════════════════════════════════════════════════ */
/* 560px, not 660. Measured in the actual font rather than guessed: 660 was
   putting 75 characters on a line, and reading comfort falls off past about 65.
   This lands at ~64. */
.article { max-width: 560px; }
.article-meta {
  font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--subtle); margin-bottom: 14px;
}
.article h1 { font-size: 2.15rem; margin-bottom: 16px; }
.article .standfirst { font-size: 1.08rem; line-height: 1.55; }

.article-body { margin-top: 34px; }
.article-body p { color: var(--muted); margin-bottom: 17px; font-size: 1rem; }
.article-body h2 {
  font-family: 'Cinzel', serif; font-size: 1.3rem; font-weight: 700;
  color: var(--text); margin: 40px 0 12px; text-wrap: balance;
}
.article-body h3 {
  font-family: 'Cinzel', serif; font-size: 1.02rem; font-weight: 700;
  color: var(--text); margin: 28px 0 8px;
}
.article-body ul, .article-body ol { color: var(--muted); margin: 0 0 17px 22px; }
.article-body li { margin-bottom: 8px; }
.article-body strong { color: var(--text); font-weight: 600; }
.article-body em { color: var(--text); font-style: italic; }
.article-body a { color: var(--gold); }

/* The answer, pulled out of the prose so a reader — or a model — can find it
   without reading the whole page. */
.answer {
  background: var(--surface); border: 1px solid var(--rim);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 18px 20px; margin: 26px 0;
}
.answer p { margin: 0; color: var(--text); font-size: 0.98rem; }
.answer p + p { margin-top: 10px; }

.pull {
  font-family: 'Cinzel', serif; font-size: 1.15rem; line-height: 1.45;
  color: var(--text); border-top: 1px solid var(--rim);
  border-bottom: 1px solid var(--rim); padding: 20px 0; margin: 30px 0;
  text-wrap: balance;
}

.tool-inline {
  display: flex; align-items: center; gap: 14px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--rim);
  border-radius: var(--radius); padding: 15px 18px; margin: 26px 0;
}
.tool-inline:hover { border-color: var(--gold); }
.tool-inline-body { flex: 1; min-width: 0; }
.tool-inline-t { display: block; font-weight: 600; color: var(--text); font-size: 0.94rem; }
.tool-inline-d { display: block; color: var(--muted); font-size: 0.84rem; margin-top: 2px; }
.tool-inline-go { color: var(--gold); font-size: 1.1rem; flex-shrink: 0; }

.article-table { width: 100%; border-collapse: collapse; margin: 22px 0; }
.article-table th, .article-table td {
  padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--rim);
  font-size: 0.9rem;
}
.article-table th {
  font-size: 0.65rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--subtle); font-weight: 600;
}
.article-table td { color: var(--muted); }
.article-table td:first-child { color: var(--text); }
.article-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── blog index ── */
.post-row {
  background: var(--deep); padding: 20px; display: block;
  text-decoration: none; color: inherit;
}
.post-row:hover { background: var(--card); }
.post-date {
  font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--subtle); display: block; margin-bottom: 6px;
}
.post-t {
  font-family: 'Cinzel', serif; font-size: 1.08rem; font-weight: 700;
  color: var(--text); display: block; margin-bottom: 5px;
}
.post-d { font-size: 0.89rem; color: var(--muted); display: block; }

/* ── encounter calculator ── */
.thresholds {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1px; background: var(--rim); border: 1px solid var(--rim);
  border-radius: var(--radius); overflow: hidden; margin-top: 14px;
}
.thr { background: var(--deep); padding: 12px 14px; }
.thr-l {
  display: block; font-size: 0.64rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--subtle); margin-bottom: 3px;
}
.thr-n { display: block; font-size: 0.95rem; color: var(--text); font-variant-numeric: tabular-nums; }

input[type=number] {
  background: var(--surface); border: 1px solid var(--rim); border-radius: 8px;
  color: var(--text); font-family: inherit; font-size: 0.9rem; padding: 10px 12px;
}
input[type=number]:focus { outline: none; border-color: var(--gold); }

/* The pacing note is separate from the verdict on purpose — it answers a
   different question (how long will this take) and should not read as part of
   the difficulty result. */
.pacing {
  margin-top: 14px; padding: 14px 16px; border-radius: var(--radius);
  font-size: 0.9rem; color: var(--text); line-height: 1.55;
}
.pacing.warm { background: var(--gold-dim); border: 1px solid var(--gold); }
.pacing.hot  { background: rgba(212,102,74,0.12); border: 1px solid var(--ember); }

/* ══════════════════════════════════════════════════════════
   FIGURES
   Inline SVG, no external requests, and every colour comes from the same
   tokens as the page so both themes work without a second drawing.
   These are explanatory, not decoration: each one carries an argument the
   surrounding paragraphs are making.
   ══════════════════════════════════════════════════════════ */
figure {
  margin: 30px 0;
  background: var(--surface);
  border: 1px solid var(--rim);
  border-radius: var(--radius);
  padding: 20px 20px 14px;
}
figure svg { display: block; width: 100%; height: auto; }
figcaption {
  margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--rim);
  font-size: 0.8rem; color: var(--muted); line-height: 1.5;
}
figcaption strong { color: var(--text); }

/* SVG text has to be styled here rather than with attributes, so it follows
   the theme like everything else. */
.fig-t   { fill: var(--text);     font-family: 'Inter', sans-serif; font-size: 12px; }
.fig-m   { fill: var(--muted);    font-family: 'Inter', sans-serif; font-size: 11px; }
.fig-s   { fill: var(--subtle);   font-family: 'Inter', sans-serif; font-size: 10px;
           letter-spacing: 0.08em; text-transform: uppercase; }
.fig-hi  { fill: var(--gold);     font-family: 'Inter', sans-serif; font-size: 12px; font-weight: 600; }
.fig-bad { fill: var(--ember);    font-family: 'Inter', sans-serif; font-size: 12px; font-weight: 600; }
.fig-bar      { fill: var(--tertiary); }
.fig-bar-good { fill: var(--green); }
.fig-bar-warn { fill: var(--gold); }
.fig-bar-bad  { fill: var(--ember); }
.fig-track    { fill: var(--rim); }
.fig-line     { stroke: var(--rim); stroke-width: 1; }
.fig-box      { fill: var(--deep); stroke: var(--rim); stroke-width: 1; }
.fig-box-hi   { fill: var(--gold-dim); stroke: var(--gold); stroke-width: 1; }
