/* Layout: the printed flip book, opened flat. A sticky stack of colored tabs on the left
   (one bar per procedure, in book order), and the selected sheet on the right. On phones the stack
   folds into a sticky "Procedures" bar above the sheet. */
:root {
  --ground: #EEF1F5;
  --paper: #FFFFFF;
  --ink: #141A22;
  --muted: #4E5866;
  --rule: #D3D9E2;
  --tint: #F4F6F9;
  --navy: #033479;
  --navy-ink: #033479;
  /* tab fills, deepened from the print swatches so white text passes contrast */
  --blue: #2F5597;
  --red: #B00000;
  --purple: #6A2C99;
  --green: #00703A;
  --orange: #B04A0A;
  --secure: #005BB5;
  /* SRP action text on paper */
  --t-red: #B00000;
  --t-purple: #6A2C99;
  --t-green: #00703A;
  --t-orange: #A64508;
  --t-secure: #005BB5;
  --focus: #F2B705;

  --f-sign: "Barlow Semi Condensed", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  --f-body: "Public Sans", "Segoe UI", system-ui, -apple-system, sans-serif;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --radius: 6px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0F141B; --paper: #18202B; --ink: #E7EBF1; --muted: #A3AEBD; --rule: #2C3746; --tint: #1F2835;
    --navy: #A9C2F2; --navy-ink: #A9C2F2;
    --t-red: #FF8A80; --t-purple: #CFA6F2; --t-green: #6FD49B; --t-orange: #FFAA6E; --t-secure: #8CC2FF;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #0F141B; --paper: #18202B; --ink: #E7EBF1; --muted: #A3AEBD; --rule: #2C3746; --tint: #1F2835;
  --navy: #A9C2F2; --navy-ink: #A9C2F2;
  --t-red: #FF8A80; --t-purple: #CFA6F2; --t-green: #6FD49B; --t-orange: #FFAA6E; --t-secure: #8CC2FF;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: var(--f-body); font-size: 1.0625rem; line-height: 1.55;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
img { max-width: 100%; height: auto; }
a { color: var(--navy-ink); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: var(--s2) var(--s3); z-index: 20; }
.skip:focus { left: max(16px, env(safe-area-inset-left, 0px)); }

/* ---------- masthead ---------- */
.masthead { padding-block: var(--s4); }
.mast-inner { max-width: 1240px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: var(--s4); text-decoration: none; color: var(--ink); min-width: 0; }
.brand img { width: 142px; background: #FFFFFF; border-radius: 4px; padding: 4px 6px; }
.brand span { font-family: var(--f-sign); font-weight: 700; font-size: 1.25rem; letter-spacing: .02em; text-transform: uppercase; line-height: 1.1; }
.actions { display: flex; gap: var(--s3); flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: var(--s2); min-height: 44px; padding: 0 var(--s4); border-radius: var(--radius);
  font-family: var(--f-sign); font-weight: 700; font-size: 1.05rem; letter-spacing: .03em; text-transform: uppercase; text-decoration: none; }
.btn-pdf { background: var(--navy); color: var(--paper); }
.btn-pdf .meta { font-family: var(--f-body); font-weight: 400; font-size: .8rem; text-transform: none; letter-spacing: 0; opacity: .85; }
.btn-call { background: var(--red); color: #FFFFFF; }
.btn-tips { background: var(--paper); color: var(--navy-ink); border: 2px solid var(--navy); }
.btn:hover { filter: brightness(1.08); }

/* ---------- book ---------- */
.book { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 0; align-items: start; padding-block: 0 var(--s7); }
.stack { position: sticky; top: var(--s4); padding-right: 0; }
.stack-toggle { display: none; }
.tabs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.tab { display: flex; align-items: center; min-height: 44px; padding: 6px var(--s4); color: #FFFFFF; text-decoration: none;
  font-family: var(--f-sign); font-weight: 700; font-size: .98rem; letter-spacing: .04em; text-transform: uppercase; line-height: 1.15;
  border-radius: var(--radius) 0 0 var(--radius); margin-right: 14px; transition: margin-right .18s ease, filter .18s ease; }
.tab:hover { filter: brightness(1.12); }
.tab[aria-current="true"] { margin-right: 0; border-radius: var(--radius) 0 0 var(--radius); }
.t-blue { background: var(--blue); } .t-red { background: var(--red); } .t-purple { background: var(--purple); }
.t-green { background: var(--green); } .t-orange { background: var(--orange); }

/* ---------- sheets ---------- */
.sheets { min-width: 0; }
.sheet { background: var(--paper); border: 1px solid var(--rule); border-radius: 0 var(--radius) var(--radius) var(--radius); overflow: hidden; }
.js .sheet { display: none; }
.js .sheet.is-open { display: block; }
.no-js .sheet + .sheet, html:not(.js) .sheet + .sheet { margin-top: var(--s5); }
.sheet:focus { outline: none; }
.sheet-head { padding: var(--s4) var(--s5); }
.sheet-head h2 { margin: 0; color: #FFFFFF; font-family: var(--f-sign); font-weight: 800; font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.2rem);
  letter-spacing: .03em; text-transform: uppercase; line-height: 1.05; text-wrap: balance; }
.sheet-body { padding: var(--s5); display: flex; flex-direction: column; gap: var(--s5); }

.srp { display: flex; align-items: center; gap: var(--s4); padding-bottom: var(--s4); border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.srp-icons { display: flex; gap: var(--s2); }
.srp-icons img { width: 56px; height: 56px; }
.srp-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.srp-label { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.srp-acts { font-family: var(--f-sign); font-weight: 800; font-size: 1.9rem; text-transform: uppercase; letter-spacing: .03em; line-height: 1.1; }
.srp-acts .or { font-family: var(--f-body); font-weight: 400; font-size: 1rem; text-transform: none; color: var(--muted); }
.srp-acts .qual { font-family: var(--f-body); font-weight: 400; font-style: italic; font-size: 1rem; text-transform: none; letter-spacing: 0; color: var(--muted); }
.srp-directed { font-weight: 700; font-size: 1.15rem; }
.c-red { color: var(--t-red); } .c-purple { color: var(--t-purple); } .c-green { color: var(--t-green); }
.c-orange { color: var(--t-orange); } .c-secure { color: var(--t-secure); }

.blocks { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: var(--s5) var(--s6); }
.block { min-width: 0; }
.block h3, .sub-h { margin: 0 0 var(--s2); font-family: var(--f-sign); font-weight: 700; font-size: 1.3rem; letter-spacing: .02em; color: var(--navy-ink); text-wrap: balance; }
.block ul, .block ol { margin: 0; padding-left: 1.25em; display: flex; flex-direction: column; gap: 6px; }
.block li::marker { color: var(--muted); }
.block ol li::marker { font-weight: 700; color: var(--navy-ink); }
.block .sub { margin-top: 6px; padding-left: 1.1em; list-style: "\2013\00a0\00a0"; }
.intro { margin: 0 0 6px; font-style: italic; color: var(--muted); }
.when-safe { margin: 0; padding: var(--s4) var(--s5); background: var(--tint); border-radius: var(--radius); font-weight: 700; }

/* SRP sheet */
.lede { margin: 0; max-width: 68ch; }
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); }
.srp-table { width: 100%; border-collapse: collapse; min-width: 520px; }
.srp-table thead th { background: var(--blue); color: #FFFFFF; text-align: left; font-family: var(--f-sign); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; font-size: .95rem; padding: var(--s3) var(--s4); }
.srp-table td, .srp-table tbody th { padding: var(--s3) var(--s4); border-top: 1px solid var(--rule); vertical-align: middle; text-align: left; }
.srp-table tbody th { width: 150px; }
.srp-table tbody th img { display: block; width: 44px; height: 44px; margin-bottom: 4px; }
.srp-table tbody th span { font-family: var(--f-sign); font-weight: 800; font-size: 1.15rem; text-transform: uppercase; letter-spacing: .03em; }
.scripts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border: 1px solid var(--rule); border-radius: var(--radius); }
.script { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: var(--s4); padding: var(--s4); align-items: center; }
.script + .script { border-top: 1px solid var(--rule); }
.who { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.who img { width: 44px; height: 44px; }
.who span { font-family: var(--f-sign); font-weight: 800; text-transform: uppercase; letter-spacing: .03em; }
.what p { margin: 0; }
.what .say { font-weight: 700; font-size: 1.2rem; line-height: 1.35; }
.what .note { color: var(--muted); margin-top: 4px; }

.contacts { display: flex; flex-direction: column; gap: var(--s3); border-top: 1px solid var(--rule); padding-top: var(--s5); }
.hint { margin: 0; color: var(--muted); font-size: .95rem; }
.contact-form h4 { margin: var(--s4) 0 var(--s2); font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; color: var(--navy-ink); }
.contact-form h4:first-child { margin-top: 0; }
.fields { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: var(--s2) var(--s4); align-items: center; }
.fields label { font-weight: 600; font-size: .95rem; }
.fields input, .fields textarea { width: 100%; min-height: 44px; padding: var(--s2) var(--s3); font: inherit; color: var(--ink); background: var(--paper);
  border: 1px solid var(--rule); border-bottom: 2px solid var(--muted); border-radius: 4px 4px 0 0; }
.fields textarea { grid-column: 1 / -1; min-height: 120px; resize: vertical; }

/* cover */
.cover { border-radius: 0 var(--radius) var(--radius) var(--radius); }
.cover-inner { padding: var(--s7) var(--s6); display: flex; flex-direction: column; gap: var(--s5); align-items: flex-start; }
.cover .logo { width: 330px; background: #FFFFFF; border-radius: 6px; padding: 8px 12px; }
.cover h2 { margin: 0; font-family: var(--f-sign); font-weight: 800; font-size: clamp(2.2rem, 1.5rem + 3vw, 3.6rem); line-height: 1; text-transform: uppercase; letter-spacing: .02em; color: var(--navy-ink); text-wrap: balance; }
.cover h2 em { display: block; font-style: normal; font-weight: 600; color: var(--muted); font-size: .55em; letter-spacing: .08em; margin-top: 6px; }
.in-emergency { width: 100%; border-top: 3px solid var(--ink); padding-top: var(--s4); }
.kicker { margin: 0 0 var(--s3); font-size: .85rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.musts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s2); }
.musts li { font-family: var(--f-sign); font-weight: 700; font-size: clamp(1.3rem, 1rem + 1.2vw, 1.75rem); line-height: 1.15; text-wrap: balance; }
.musts .call { font-weight: 800; font-size: clamp(2.4rem, 1.6rem + 3vw, 3.6rem); color: var(--t-red); line-height: 1; }
.pick { margin: 0; color: var(--muted); }
.partner { display: flex; align-items: center; gap: var(--s4); padding-top: var(--s4); border-top: 1px solid var(--rule); width: 100%; }
.partner img { width: 64px; height: 64px; background: #FFFFFF; border-radius: 50%; flex: none; }
.partner p { margin: 0; font-style: italic; font-size: .92rem; color: var(--muted); }

.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); padding: 0 var(--s5) var(--s5); }
.pn { display: flex; flex-direction: column; gap: 2px; padding: var(--s3) var(--s4); border: 1px solid var(--rule); border-radius: var(--radius); text-decoration: none; color: var(--ink); font-weight: 700; min-height: 44px; }
.pn span { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pn.next { text-align: right; }
.pn:hover { background: var(--tint); }

.foot { max-width: 1240px; margin: 0 auto; padding-block: 0 var(--s6); color: var(--muted); font-size: .88rem; }

/* ---------- phones / tablets ---------- */
@media (max-width: 900px) {
  .book { grid-template-columns: minmax(0, 1fr); gap: var(--s3); }
  .js .stack { top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--ground); padding-block: var(--s2); }
  .js .stack-toggle { display: flex; width: 100%; min-height: 48px; align-items: center; justify-content: space-between; gap: var(--s3);
    padding: 0 var(--s4); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); color: var(--ink); font: inherit; cursor: pointer; }
  .stack-toggle .label { font-size: .78rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
  .stack-toggle .current { font-family: var(--f-sign); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; text-align: right; }
  .stack-toggle .current::after { content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 10px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-3px) rotate(45deg); }
  .stack-toggle[aria-expanded="true"] .current::after { transform: translateY(1px) rotate(-135deg); }
  .js .tabs { display: none; margin-top: var(--s2); max-height: calc(100vh - 140px); overflow-y: auto; }
  .js .stack.is-open .tabs { display: flex; }
  .tab, .tab[aria-current="true"] { margin-right: 0; border-radius: var(--radius); }
  .tab[aria-current="true"] { box-shadow: inset 6px 0 0 rgba(255,255,255,.85); }
  .sheet, .cover { border-radius: var(--radius); }
  .sheet { scroll-margin-top: 76px; }
  .cover-inner { padding: var(--s6) var(--s5); }
  .script { grid-template-columns: 84px minmax(0, 1fr); }
  .fields { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .fields input { margin-bottom: var(--s2); }
}
@media (max-width: 520px) {
  .brand span { font-size: 1.05rem; }
  .brand img { width: 112px; }
  .btn-pdf .meta { display: none; }
  .actions { width: 100%; }
  .actions .btn { flex: 1 1 auto; justify-content: center; text-align: center; }
  .actions .btn-call { flex-basis: 100%; }
  .sheet-body { padding: var(--s4); }
  .sheet-head { padding: var(--s3) var(--s4); }
  .prevnext { padding: 0 var(--s4) var(--s4); }
  .srp-acts { font-size: 1.6rem; }
}
@media (prefers-reduced-motion: reduce) { .tab { transition: none; } }

/* ---------- print: every sheet, in book order ---------- */
@media print {
  body { background: #FFFFFF; color: #000000; padding: 0; }
  .masthead .actions, .stack, .prevnext, .skip, .hint { display: none !important; }
  .book { display: block; }
  .js .sheet { display: block; }
  .sheet { border: 0; break-before: page; }
  .sheet:first-child { break-before: auto; }
  .sheet-head, .tab, .srp-table thead th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
