/* ============================================================
   Shared stylesheet. hub.html and books.html both load this file.
   Two pages, two designs, one brand.
   unscriptedpharmacist.com  ...  Waterline. Dark, photo forward.
   /books                    ...  Field Notebook. Paper, serif.
   ============================================================ */
* { box-sizing: border-box; }
body { margin: 0; font-family: "Source Sans 3", system-ui, sans-serif; font-size: 17px; line-height: 1.55; background: #071119; }
/* each standalone page paints its own ground behind the scroll */
body.b-hub { background: #071119; }
body.b-books { background: #F4EFE6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body.b-books { background: #0F1A22; } }
:root[data-theme="dark"] body.b-books { background: #0F1A22; }

/* ---------- the bar at the top of each page ---------- */
.topbar { position: sticky; top: 0; z-index: 40; background: var(--ground); border-bottom: 1px solid var(--rule); }
.topbar .in { display: flex; align-items: center; gap: 14px; min-height: 54px; }
.topbar a { text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 0.76rem; letter-spacing: 0.13em; text-transform: uppercase; }
.topbar .wm { color: var(--ink); }
.topbar .to { margin-left: auto; color: var(--accent); border-bottom: 2px solid var(--fill); padding-bottom: 3px; }
.topbar .to:hover { color: var(--fill); }
@media (max-width: 480px) { .topbar a { font-size: 0.66rem; letter-spacing: 0.07em; } .topbar .in { min-height: 46px; } }

.page { --gut: 24px; }
.in { max-width: 60rem; margin: 0 auto; padding-left: max(var(--gut), env(safe-area-inset-left, 0px)); padding-right: max(var(--gut), env(safe-area-inset-right, 0px)); }
.sect { padding-block: clamp(46px, 8vh, 78px); }
h1, h2, h3 { font-weight: 400; letter-spacing: -0.006em; text-wrap: balance; margin: 0; }
p { margin: 0 0 15px; }
p:last-child { margin-bottom: 0; }
a { color: var(--accent); }

/* ---------- HUB. Waterline ---------- */
#hub {
  --ground:#071119; --panel:#0E2030; --sunk:#142A3A;
  --ink:#EDE6DC; --soft:#9BAAB6; --rule:#2B4657;
  --accent:#F0913F; --fill:#E07A35; --on-fill:#140C05;
  --flag:#F08A72; --flag-bg:#2A1B18;
  --grid: var(--rule); --muted: var(--soft); --plot: var(--panel);
  --sfill: rgba(237,230,220,0.20); --sgap: rgba(224,122,53,0.46);
  --display: "Archivo Black","Arial Black",sans-serif;
  --body: "Source Sans 3", system-ui, sans-serif;
  background: var(--ground); color: var(--ink); font-family: var(--body);
}
#hub h1, #hub h2, #hub h3 { font-family: var(--display); }
#hub h1 { font-size: clamp(2.5rem, 9.4vw, 4.8rem); line-height: 0.98; margin-bottom: 14px; }
#hub h2 { font-size: clamp(1.75rem, 5.4vw, 2.7rem); margin-bottom: 12px; }
#hub h3 { font-size: 1.05rem; margin-bottom: 7px; }

/* ---------- BOOKS. Field Notebook ---------- */
#books {
  --ground:#F4EFE6; --panel:#FBF8F2; --sunk:#EAE2D4;
  --ink:#0C1B27; --soft:#55606B; --rule:#D5CBBB;
  --accent:#A8331A; --fill:#E07A35; --on-fill:#1A0F06;
  --flag:#8A3312; --flag-bg:#F2E5D7;
  --display: "Archivo", system-ui, sans-serif;
  --body: "EB Garamond", Georgia, serif;
  background: var(--ground); color: var(--ink); font-family: var(--body); font-size: 19px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #books {
    --ground:#0F1A22; --panel:#16252F; --sunk:#1C313D;
    --ink:#EFE8DE; --soft:#A1AEB7; --rule:#26404E;
    --accent:#F0A170; --flag:#F0A48C; --flag-bg:#2A1D19;
  }
}
:root[data-theme="dark"] #books {
  --ground:#0F1A22; --panel:#16252F; --sunk:#1C313D;
  --ink:#EFE8DE; --soft:#A1AEB7; --rule:#26404E;
  --accent:#F0A170; --flag:#F0A48C; --flag-bg:#2A1D19;
}
#books h1, #books h2, #books h3 { font-family: var(--display); font-weight: 700; letter-spacing: 0.01em; }
#books h2 { font-size: clamp(1.45rem, 4.2vw, 2.1rem); margin-bottom: 10px; }
#books h3 { font-size: 1.05rem; margin-bottom: 7px; }
#books .sect { border-top: 1px solid var(--rule); }

/* ---------- shared pieces ---------- */
.eyebrow { font-size: 0.76rem; font-weight: 700; letter-spacing: 0.17em; text-transform: uppercase; color: var(--accent); margin-bottom: 11px; font-family: var(--display); }
.lede { color: var(--soft); max-width: 36rem; }
.method { font-size: 0.9rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); font-weight: 700; font-family: var(--display); margin-top: 18px; }
.punch { font-size: 1.12rem; font-weight: 600; }

.btnrow { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.btn {
  display: inline-block; padding: 14px 24px; font-weight: 700; font-size: 0.98rem;
  text-decoration: none; cursor: pointer; font-family: var(--display);
  background: var(--fill); color: var(--on-fill); border: 2px solid var(--fill);
}
.btn.ghost { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* bands with footage or stills behind them */
.band { position: relative; overflow: hidden; }
.band > .bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.band > .scrim { position: absolute; inset: 0; }
.band > .body { position: relative; }
.band, .band h1, .band h2, .band h3 { color: #EDE6DC; }
.band .lede { color: #C6D0D8; }
.band .eyebrow, .band .method { color: #F0913F; }

.hero > .scrim { background: linear-gradient(to top, rgba(7,17,25,0.94) 0%, rgba(7,17,25,0.66) 44%, rgba(7,17,25,0.26) 100%); }
.hero > .body { padding-block: clamp(70px, 16vh, 150px) clamp(40px, 7vh, 70px); }
.act > .scrim { background: linear-gradient(to bottom, rgba(7,17,25,0.90), rgba(7,17,25,0.84) 50%, rgba(7,17,25,0.95)); }
.quiet > .scrim { background: linear-gradient(to bottom, rgba(7,17,25,0.90), rgba(7,17,25,0.96)); }

.playbtn {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3;
  appearance: none; border: 0; cursor: pointer; background: transparent;
  /* the whole frame is the click target. the chip sits low and right,
     clear of the headline, the lede and the byline. */
  display: flex; align-items: flex-end; justify-content: flex-end;
  padding: 0 16px 18px 0;
}
.playbtn span {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: "Archivo Black","Arial Black",sans-serif; font-size: 0.76rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; line-height: 1; padding: 14px 22px;
  background: rgba(7,17,25,0.74); color: #EDE6DC; border: 1px solid rgba(237,230,220,0.55);
}
.playbtn svg { width: 12px; height: 14px; fill: currentColor; display: block; }
.playbtn:hover span { background: #E07A35; color: #140C05; border-color: #E07A35; }
.sound {
  position: absolute; right: 16px; top: 16px; z-index: 4; appearance: none; cursor: pointer;
  font-family: "Archivo Black","Arial Black",sans-serif; font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; padding: 9px 13px; line-height: 1;
  background: rgba(7,17,25,0.76); color: #EDE6DC; border: 1px solid rgba(237,230,220,0.55);
}
.sound[aria-pressed="true"] { background: #E07A35; color: #140C05; border-color: #E07A35; }

.byline {
  font-family: "Archivo Black","Arial Black",sans-serif;
  font-size: clamp(1.2rem, 4.4vw, 2.1rem); line-height: 1.08;
  letter-spacing: 0.055em; text-transform: uppercase;
  margin-top: 28px; padding-top: 18px; max-width: 24rem;
  border-top: 1px solid rgba(237,230,220,0.3);
}
.byline .cred { display: block; font-size: 0.5em; letter-spacing: 0.16em; margin-top: 9px; color: #F0913F; }

/* the two numbers */
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: var(--rule); border: 1px solid var(--rule); margin: 24px 0 0; max-width: 34rem; }
@media (max-width: 520px) { .pair { grid-template-columns: 1fr; } }
#hub .pair { box-shadow: 0 18px 38px rgba(0,0,0,0.48); }
#books .pair { box-shadow: 6px 6px 0 var(--sunk); border-color: var(--ink); }
.pair > div { background: var(--panel); padding: 22px 18px; }
.pair .n { font-family: "Archivo Black","Arial Black",sans-serif; font-size: clamp(2.6rem, 10vw, 4rem); line-height: 1; color: var(--fill); font-variant-numeric: tabular-nums; }
.pair .lbl { font-size: 0.82rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--soft); margin-top: 9px; font-family: "Archivo Black","Arial Black",sans-serif; }
.pair .same { font-size: 0.97rem; margin: 12px 0 0; }
.mark {
  display: flex; align-items: center; gap: 9px; max-width: 34rem;
  margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--rule);
  font-family: "Archivo Black","Arial Black",sans-serif; font-size: 0.72rem;
  letter-spacing: 0.13em; text-transform: uppercase; color: var(--soft);
}
.mark .dot { width: 15px; height: 15px; flex: none; border-radius: 50%; background: var(--fill); }
.mark .site { margin-left: auto; letter-spacing: 0.04em; text-transform: none; }

.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 24px; }
@media (max-width: 700px) { .three { grid-template-columns: 1fr; } }
.step { border: 1px solid #2E4A5E; background: rgba(14,32,48,0.88); padding: 20px 17px; box-shadow: inset 0 1px 0 rgba(237,230,220,0.09); }
.step .num { font-family: "Archivo Black","Arial Black",sans-serif; color: #F0913F; font-size: 1.5rem; line-height: 1; }
.step h3 { color: #EDE6DC; margin: 11px 0 6px; }
.step p { color: #B9C2C9; font-size: 0.96rem; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 14px; margin-top: 24px; }
.card { border: 1px solid var(--rule); background: var(--panel); padding: 19px; }
#hub .card { box-shadow: 0 18px 38px rgba(0,0,0,0.42), inset 0 1px 0 rgba(237,230,220,0.08); }
#books .card { box-shadow: 5px 5px 0 var(--sunk); }
.card p { color: var(--soft); font-size: 0.97rem; }
.card .tag { display: block; font-size: 0.7rem; letter-spacing: 0.13em; text-transform: uppercase; color: var(--accent); font-weight: 700; margin-bottom: 9px; font-family: var(--display); }

.cite { color: var(--soft); font-size: 0.95rem; }

/* the shadow tool */
.pick { font-size: 0.76rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); margin: 26px 0 10px; font-family: var(--display); }
.opts { display: flex; flex-wrap: wrap; gap: 9px; }
.opt {
  appearance: none; cursor: pointer; font-family: var(--body); font-size: 1rem; font-weight: 700;
  line-height: 1.25; text-align: left; background: var(--panel); color: var(--ink);
  border: 2px solid var(--rule); padding: 11px 17px;
}
.opt:hover { border-color: var(--fill); }
.opt[aria-pressed="true"] { background: var(--fill); border-color: var(--fill); color: var(--on-fill); }
.opt .s2 { display: block; font-weight: 400; font-size: 0.92rem; color: var(--soft); }
.opt[aria-pressed="true"] .s2 { color: var(--on-fill); }
.chart { background: var(--plot); border: 2px solid var(--rule); padding: 16px 12px 10px; margin-top: 24px; box-shadow: 0 18px 38px rgba(0,0,0,0.48); }
.chart-scroll { overflow-x: auto; }
svg.plot { display: block; width: 100%; height: auto; min-width: 430px; }
.vbox { border: 1px solid var(--rule); background: var(--panel); padding: 18px 20px; margin-top: 16px; }
.vbox.hot { border: 2px solid var(--fill); }
.vlabel { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; font-family: var(--display); }
canvas { width: 100%; max-width: 380px; height: auto; border: 2px solid var(--rule); display: block; margin-top: 10px; }
.chk { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; color: var(--soft); }
.chk input { width: 20px; height: 20px; accent-color: var(--fill); cursor: pointer; }
.srow { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 16px; }

/* the counter */
.sexrow { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 18px; }
.sexrow button {
  appearance: none; cursor: pointer; font-family: var(--body); font-size: 1rem; font-weight: 700;
  padding: 11px 18px; background: var(--panel); color: var(--ink); border: 2px solid var(--rule);
}
.sexrow button[aria-pressed="true"] { background: var(--fill); border-color: var(--fill); color: var(--on-fill); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 14px; }
.field { border: 1px solid var(--rule); background: var(--panel); padding: 15px 16px 16px; }
.field label { display: block; font-weight: 700; margin-bottom: 4px; }
.field .cut { display: block; color: var(--soft); font-size: 0.95rem; margin-bottom: 10px; }
.field input { width: 100%; font-family: var(--body); font-size: 1.05rem; padding: 10px 11px; background: var(--ground); color: var(--ink); border: 1px solid var(--rule); font-variant-numeric: tabular-nums; }
.field.met { box-shadow: inset 4px 0 0 var(--fill); }
.bp { display: flex; gap: 8px; align-items: center; }
.bp span { color: var(--soft); }
.tally { border: 2px solid var(--fill); background: var(--panel); padding: 22px; margin-top: 24px; }
.tally .big { font-family: var(--display); font-size: clamp(1.3rem, 4vw, 1.9rem); line-height: 1.15; margin-bottom: 11px; }

/* the quiet safety screen */
.screen { margin-top: 26px; padding: 2px 0 2px 18px; border-left: 2px solid var(--soft); max-width: 36rem; }
.screen-h { font-family: var(--display); font-size: 1rem; margin-bottom: 12px; }
.screen .drug { font-style: italic; }

/* feedback */
.fb { margin-top: 22px; padding: 22px; background: var(--panel); border: 1px solid var(--rule); }
#books .fb { border-color: var(--ink); box-shadow: 6px 6px 0 var(--sunk); }
.fb-label { display: block; font-size: 0.97rem; color: var(--soft); margin-bottom: 9px; }
.prompts { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 7px; }
.prompts li { font-size: 0.9rem; padding: 6px 12px; background: var(--sunk); color: var(--soft); border: 1px solid var(--rule); }
.fb textarea, .fb input { width: 100%; font-family: var(--body); font-size: 1rem; line-height: 1.5; padding: 12px 13px; margin-bottom: 16px; background: var(--ground); color: var(--ink); border: 1px solid var(--rule); }
.fb textarea { resize: vertical; min-height: 7rem; }

/* the vault hero, type right */
#books .hero > .body { padding-block: clamp(50px, 10vh, 90px) clamp(34px, 6vh, 56px); }
#books .hero .wrapright { margin-left: auto; text-align: right; max-width: 44rem; }
#books .hero h1 { font-size: clamp(2.6rem, 10vw, 5rem); line-height: 0.96; margin-bottom: 12px; color: #EDE6DC; }
#books .hero .sub { font-family: var(--display); font-weight: 700; font-size: clamp(1.2rem, 3.8vw, 1.85rem); line-height: 1.12; margin-bottom: 14px; color: #EDE6DC; }
#books .hero .lede { margin-left: auto; }
@media (max-width: 560px) { #books .hero .wrapright { text-align: left; margin-left: 0; } #books .hero .lede { margin-left: 0; } }

footer { border-top: 1px solid var(--rule); padding-block: 30px 60px; color: var(--soft); font-size: 0.95rem; }
.footlinks { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-bottom: 16px; }
.footlinks a { font-weight: 700; text-decoration: none; }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .001ms !important; transition-duration: .001ms !important; } }


/* ---- safety alert. Deliberately not the site palette. ---- */
.alert { margin-top: 30px; max-width: 36rem; padding: 20px 22px 18px; border-left: 5px solid; }
.alert p { margin: 0 0 10px; }
.alert p:last-child { margin-bottom: 0; }
.alert .drug { font-style: italic; }
.alert-tag { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
             font-family: var(--display); margin-bottom: 8px !important; }
.alert-h { font-family: var(--display); font-size: 1.05rem; margin-bottom: 12px !important; }

#hub .alert { background:#1E1710; border-left-color:#C98A2E; color:#F0E0C4; }
#hub .alert-tag { color:#C98A2E; }
#hub .alert-h  { color:#F3BE72; }

#books .alert { background:#FBF0DC; border-left-color:#B8722A; color:#43301A; }
#books .alert-tag { color:#8A4F12; }
#books .alert-h  { color:#6B3B0C; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #books .alert { background:#2A1D19; border-left-color:#C98A2E; color:#F0D9BC; }
  :root:not([data-theme="light"]) #books .alert-tag { color:#C98A2E; }
  :root:not([data-theme="light"]) #books .alert-h { color:#F0B273; }
}
:root[data-theme="dark"] #books .alert { background:#2A1D19; border-left-color:#C98A2E; color:#F0D9BC; }
:root[data-theme="dark"] #books .alert-tag { color:#C98A2E; }
:root[data-theme="dark"] #books .alert-h { color:#F0B273; }

footer .in { padding-bottom: env(safe-area-inset-bottom, 0px); }

[hidden]{display:none!important}
