/* Which Way It Blows - a weather-station almanac: pale sky paper, iron ink, copper and verdigris in light mode; a
 * night sky with lit copper in dark mode. The vane keeps its own drawn colours per theme. */
:root { --bg: #eef2f0; --panel: #fbfaf6; --ink: #1f2629; --muted: #4e5b5f; --line: #c9d3d1; --rule: #2f3b3f; --acc: #a4521f; --acc-ink: #ffffff; --acc-soft: #f6e5d8;
  --verd: #2b7468; --verd-soft: #dcefea; --free-bg: #dcefea; --free-ink: #1c5149;
  --warn-bg: #f8e1d6; --warn-ink: #7a2d0e; --info-bg: #e3e9f1; --info-ink: #283c5a;
  --v-enhances: #dcefea; --v-enhances-ink: #1c5149; --v-obsolesces: #ebe4d6; --v-obsolesces-ink: #4d3d1c; --v-retrieves: #e3e9f1; --v-retrieves-ink: #283c5a;
  --v-reverses: #f6e5d8; --v-reverses-ink: #7a2d0e; --v-declined: #ece6ee; --v-declined-ink: #4e2f58; --v-tie: #e8eaea; --v-tie-ink: #384346;
  --t-prev: #a4521f; --t-prev-ink: #ffffff; --vane-bg: #dce7ec; color-scheme: light; }
:root[data-theme="dark"] { --bg: #0f181d; --panel: #16232a; --ink: #eef1ee; --muted: #b3c0c2; --line: #2c3d44; --rule: #c9d2d3; --acc: #e58e54; --acc-ink: #1a0d05; --acc-soft: #3a2618;
  --verd: #6cc4b3; --verd-soft: #173a35; --free-bg: #173a35; --free-ink: #b6eee2;
  --warn-bg: #43221a; --warn-ink: #ffcdb9; --info-bg: #1d2a3d; --info-ink: #cfdcf2;
  --v-enhances: #173a35; --v-enhances-ink: #b6eee2; --v-obsolesces: #352d1d; --v-obsolesces-ink: #eedfbf; --v-retrieves: #1d2a3d; --v-retrieves-ink: #cfdcf2;
  --v-reverses: #43271a; --v-reverses-ink: #ffcdb0; --v-declined: #33233a; --v-declined-ink: #ebd2f3; --v-tie: #263338; --v-tie-ink: #d7dfe0;
  --t-prev: #e58e54; --t-prev-ink: #1a0d05; --vane-bg: #132028; color-scheme: dark; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow-x: hidden; }
a { color: var(--acc); }
h1, h2, h3, h4 { line-height: 1.2; overflow-wrap: anywhere; font-family: Georgia, "Times New Roman", serif; font-weight: 700; }
.hidden { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.small { font-size: 0.88rem; } .muted { color: var(--muted); } .mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.center { text-align: center; justify-content: center; }
.none { color: var(--muted); font-style: italic; }

/* Header */
.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--panel); border-bottom: 1px solid var(--rule); box-shadow: 0 3px 0 -1px var(--line); flex-wrap: wrap; }
.back { text-decoration: none; font-weight: 700; white-space: nowrap; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 1.06rem; min-width: 0; font-family: Georgia, "Times New Roman", serif; }
.brand strong { white-space: nowrap; }
.logo { width: 28px; height: 28px; flex: none; }
.lg-arm { fill: none; stroke: var(--rule); stroke-width: 1.6; stroke-linecap: round; } .lg-arrow { fill: var(--acc); } .lg-hub { fill: var(--rule); }
.session { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.pill { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 6px 14px; border-radius: 6px; border: 1px solid var(--rule); background: var(--panel); color: var(--ink); font: 600 0.9rem/1 inherit; font-family: inherit; cursor: pointer; text-decoration: none; white-space: nowrap; }
.pill:hover:not(:disabled) { background: var(--verd-soft); }
.pill.solid { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); }
.pill.solid:hover:not(:disabled) { filter: brightness(1.07); background: var(--acc); }
.pill.ghost { border-color: var(--line); cursor: default; }
.pill.tiny { min-height: 30px; padding: 4px 10px; font-size: 0.8rem; }
.pill.big { min-height: 48px; padding: 10px 22px; font-size: 1.02rem; }
.pill:disabled { opacity: 0.5; cursor: not-allowed; }
.pill:focus-visible, .chip:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--verd); outline-offset: 2px; }

main { max-width: 1040px; margin: 0 auto; padding: 0 16px 40px; }
.hero { padding: 26px 0 8px; }
.kicker { margin: 0 0 10px; padding: 0 0 0 12px; border-left: 4px solid var(--acc); color: var(--muted); font-size: 0.92rem; max-width: 70ch; }
.hero h1 { font-size: clamp(2.1rem, 8vw, 3.4rem); margin: 6px 0 10px; letter-spacing: -0.01em; }
.h1b { display: block; font-size: clamp(1.02rem, 3.6vw, 1.3rem); font-weight: 400; font-style: italic; color: var(--muted); margin-top: 6px; }
.lede { max-width: 68ch; font-size: 1.04rem; }
.samples { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.chip { min-height: 36px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: 600 0.88rem inherit; font-family: inherit; cursor: pointer; }
.chip.on { border-color: var(--verd); background: var(--verd-soft); color: var(--free-ink); }

.panel { background: var(--panel); border: 1px solid var(--rule); outline: 1px solid var(--line); outline-offset: 3px; border-radius: 4px; padding: 16px 18px; margin: 22px 4px; }
.ph { margin: 0 0 10px; font-size: 1.32rem; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.step-no { display: inline-flex; width: 30px; height: 30px; border-radius: 50%; align-items: center; justify-content: center; background: var(--rule); color: var(--panel); font: 700 0.96rem/1 system-ui, sans-serif; flex: none; }
.free { font: 700 0.72rem/1.3 system-ui, sans-serif; letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 8px; border-radius: 4px; background: var(--free-bg); color: var(--free-ink); }
.lbl { display: block; font-weight: 700; margin: 12px 0 4px; }
.lbl .muted { font-weight: 500; font-size: 0.86rem; }
.count { font-weight: 700; font-size: 0.82rem; color: var(--verd); }
.two { display: grid; grid-template-columns: 2fr 1fr; gap: 0 16px; }
input[type=text], textarea, select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-bottom: 2px solid var(--rule); border-radius: 4px; background: var(--bg); color: var(--ink); font: 1rem/1.45 inherit; font-family: inherit; }
select { min-height: 44px; }
textarea { resize: vertical; min-height: 110px; }
textarea.drop { border-color: var(--acc); border-style: dashed; }
.filerow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.note { margin: 10px 0 0; padding: 8px 12px; background: var(--warn-bg); color: var(--warn-ink); border-radius: 4px; }
.sub { font-size: 1.06rem; margin: 18px 0 8px; }
.cardrow { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }

/* The vane and your own reading */
.vanegrid { display: grid; grid-template-columns: minmax(0, 460px) minmax(0, 1fr); gap: 22px; align-items: start; }
.vanewrap { max-width: 460px; margin: 0 auto; background: var(--vane-bg); border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; }
.vanewrap svg { display: block; width: 100%; height: auto; }
.vanecol .cardrow { margin-top: 6px; }
.owngrid { display: grid; gap: 4px; }
.ownrow { display: grid; grid-template-columns: 7.5em minmax(0, 1fr) 4.6em; gap: 8px; align-items: center; }
.ownrow .lbl { margin: 0; font-size: 0.9rem; }
.ownrow input[type=text], .ownrow select { padding: 8px 10px; min-height: 40px; font-size: 0.94rem; }
.freelist { margin: 0; padding-left: 20px; }
.freelist li { margin: 4px 0; }

/* Ask */
.runrow { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 10px; }
.gate { margin: 12px 0 0; padding: 10px 12px; background: var(--info-bg); color: var(--info-ink); border-radius: 4px; }
.gate .pill { margin-left: 4px; }
.progress h3 { margin: 0 0 8px; }
.steps { list-style: none; padding: 0; margin: 0; }
.step { padding: 3px 0; color: var(--muted); }
.step.done { color: var(--ink); } .step.active { color: var(--acc); font-weight: 700; }
.step-ic { display: inline-block; width: 1.2em; font-family: ui-monospace, Menlo, monospace; }
.raw { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg); padding: 10px; border-radius: 4px; max-height: 320px; overflow: auto; font-size: 0.82rem; }

/* The reading */
.res-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.res-kick { margin: 0; color: var(--muted); font-weight: 600; }
.badge { display: inline-flex; padding: 6px 12px; border-radius: 4px; border: 1px solid var(--rule); font: 700 0.82rem/1.3 system-ui, sans-serif; letter-spacing: 0.06em; background: var(--bg); color: var(--ink); }
.badge.v-enhances { background: var(--v-enhances); color: var(--v-enhances-ink); }
.badge.v-obsolesces { background: var(--v-obsolesces); color: var(--v-obsolesces-ink); }
.badge.v-retrieves { background: var(--v-retrieves); color: var(--v-retrieves-ink); }
.badge.v-reverses { background: var(--v-reverses); color: var(--v-reverses-ink); }
.badge.v-declined { background: var(--v-declined); color: var(--v-declined-ink); }
.badge.v-tie { background: var(--v-tie); color: var(--v-tie-ink); }
.rlabel { font-size: 1.6rem; margin: 10px 0 6px; }
.reason { font-size: 1.04rem; padding: 10px 12px; background: var(--v-declined); color: var(--v-declined-ink); border-radius: 4px; }
.winds { list-style: none; padding: 0; margin: 12px 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.winds li.none { grid-column: 1 / -1; }
.wind { padding: 12px 14px; border: 1px solid var(--line); border-top: 4px solid var(--line); border-radius: 4px; background: var(--bg); min-width: 0; overflow-wrap: anywhere; }
.wind.w-enhances { border-top-color: var(--verd); } .wind.w-obsolesces { border-top-color: #8a7444; } .wind.w-retrieves { border-top-color: #4f6f9a; } .wind.w-reverses { border-top-color: var(--acc); }
.wind.prevailing { border-color: var(--acc); border-top-width: 6px; }
.whead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wlaw { font: 700 0.78rem/1.3 system-ui, sans-serif; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.pips { display: inline-flex; gap: 3px; }
.pip { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.pip.on { background: var(--verd); }
.wind.prevailing .pip.on { background: var(--acc); }
.wwhat { display: block; font-family: Georgia, "Times New Roman", serif; font-size: 1.2rem; margin: 6px 0 2px; }
.whl { margin: 0 0 4px; font-style: italic; color: var(--muted); }
.wread { margin: 4px 0; }
.wq { margin: 6px 0 0; }
.qlabel { font-weight: 700; color: var(--muted); }
.tag { font: 700 0.68rem/1.3 system-ui, sans-serif; text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 6px; border-radius: 4px; }
.t-prev { background: var(--t-prev); color: var(--t-prev-ink); }
.prev { margin: 14px 0 0; padding: 10px 12px; background: var(--acc-soft); color: var(--ink); border-left: 4px solid var(--acc); border-radius: 2px; font-weight: 600; }
.closing { font-style: italic; }
.fliprow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0; }
.recon { margin: 6px 0; padding-left: 0; list-style: none; }
.recon li { margin: 4px 0; padding: 6px 10px; border-radius: 4px; background: var(--free-bg); color: var(--free-ink); }
.recon li.warn { background: var(--warn-bg); color: var(--warn-ink); }
.recon li.info { background: var(--info-bg); color: var(--info-ink); }
.recon li.none { font-style: normal; }
.exports { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.result.empty .exports, .result.empty .fliprow { display: none; }

/* Saved */
.saved { list-style: none; padding: 0; margin: 12px 0 0; }
.hrow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.hrow.none { color: var(--muted); font-style: italic; }
.hdot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--line); border: 1px solid var(--rule); }
.hdot.v-enhances { background: var(--verd); } .hdot.v-obsolesces { background: #8a7444; } .hdot.v-retrieves { background: #4f6f9a; } .hdot.v-reverses { background: var(--acc); } .hdot.v-declined { background: #8e6a9a; }
.hinfo { display: flex; flex-direction: column; min-width: 0; flex: 1; overflow-wrap: anywhere; }
.hbtns { display: flex; gap: 6px; flex: none; }

.foot { max-width: 1040px; margin: 0 auto; padding: 8px 16px 40px; color: var(--muted); font-size: 0.86rem; }
.foot p { color: var(--muted); }
.toasts { position: fixed; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 8px; z-index: 20; max-width: min(380px, calc(100vw - 24px)); }
.toast { padding: 10px 14px; border-radius: 4px; border: 1px solid var(--rule); transition: opacity .5s; }
.toast.ok { background: var(--free-bg); color: var(--free-ink); }
.toast.err { background: var(--warn-bg); color: var(--warn-ink); }
.toast a { color: inherit; font-weight: 700; }
.toast.gone { opacity: 0; }

@media (max-width: 820px) {
  .vanegrid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .winds { grid-template-columns: minmax(0, 1fr); }
  .two { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 460px) {
  .bar { padding: 6px 10px; gap: 6px; }
  .back-t { display: none; }
  .brand { font-size: 0.98rem; }
  .pill { padding: 6px 10px; }
  .panel { padding: 14px 12px; margin: 18px 3px; }
  .ownrow { grid-template-columns: minmax(0, 1fr) 4.4em; }
  .ownrow .lbl { grid-column: 1 / -1; margin-top: 6px; }
}
@media print {
  .bar, .samples, .askbox, .histbox, .aboutbox, .exports, .cardrow, .owncol, .toasts, #progressPanel, .fliprow { display: none !important; }
  .panel { outline: none; }
}
