/* Palette: maroon replaced with burnt orange (#BF5700) per brand request.
   The original format also used #BF5700 as its "amber" accent, so both
   roles now share one color — everything that was maroon or amber reads
   as burnt orange here. */
:root {
  --ink: #231f20;
  --accent: #BF5700;   /* was --maroon (#500000); merged with the original amber accent */
  --maroon: #500000;   /* used only for TOC numbers/hover, the progress bar, "Beyond the poster", and "Next" links */
  --gray: #6f6a66;
  --pale: #f6f3ef;
  --light: #e9e4de;
  --paper: #fff;
  --head: 3.1rem;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: var(--head); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "EB Garamond", Garamond, Georgia, serif;
  font-size: 1.125rem;
  line-height: 1.5;
}

main { max-width: 44rem; margin: 0 auto; }
.wrap { padding: 0 1.1rem; }

#bar { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--maroon); z-index: 20; }

h1 { font-size: 1.6rem; line-height: 1.15; font-weight: 700; margin: 1.3rem 0 0.6rem; }
.hero-static h1 { font-size: clamp(1.7rem, 6.5vw, 2.6rem); line-height: 1.1; margin: 0.4rem 0 0.7rem; }
h3 { font-size: 1.12rem; margin: 1.3rem 0 0.35rem; font-weight: 700; }
h4 { font-size: 1.02rem; margin: 1.1rem 0 0.2rem; font-weight: 700; color: var(--accent); }
p { margin: 0 0 0.85rem; }

.draft-notice { color: #E33009; font-weight: 700; font-size: clamp(0.95rem, 3.6vw, 1.45rem); line-height: 1.1; margin: 0.8rem 0 0; }

.byline { color: var(--gray); font-size: 0.98rem; margin: 0 0 0.3rem; }
.byline a { color: var(--accent); text-decoration: none; }
.byline a:hover { text-decoration: underline; }
.small, .src { font-size: 0.95rem; color: var(--gray); }

/* placeholder content marker — remove the .ph class once real copy is in */
.ph { background: #fff3e0; border: 1px dashed var(--accent); padding: 0 0.3rem; }

/* hero */
.hero-static { padding: 1.6rem 0 0.4rem; }
.eyebrow { color: var(--gray); font-size: 0.92rem; letter-spacing: 0.02em; margin: 0; }
.lede { font-size: 1.15rem; line-height: 1.45; margin: 0 0 0.6rem; }
.kicker { color: var(--gray); font-size: 0.95rem; margin: 0 0 0.6rem; }

ol.contents {
  list-style: none; padding: 0; margin: 1rem 0 1.5rem;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem;
}
@media (min-width: 26rem) { ol.contents { grid-template-columns: repeat(3, 1fr); } }
ol.contents a {
  display: flex; flex-direction: column; justify-content: center; gap: 0.15rem;
  min-height: 4.6rem; padding: 0.6rem 0.65rem; border: 1px solid var(--light); border-radius: 0.3rem;
  color: var(--ink); text-decoration: none; font-size: 1rem; line-height: 1.2; background: #fff;
}
ol.contents a:hover, ol.contents a:focus-visible { border-color: var(--maroon); outline: none; }
ol.contents .cn { color: var(--accent); font-weight: 700; font-size: 1.3rem; }

/* chapter sections */
section { padding-bottom: 1rem; }
.chead {
  position: sticky; top: 0; z-index: 10; height: var(--head);
  display: flex; align-items: center; gap: 0.6rem; padding: 0 1.1rem;
  background: var(--accent); color: #fff; margin: 0 -1.1rem;
}
.chead .cn { font-size: 1.5rem; font-weight: 400; opacity: 0.75; }
.chead .ct { font-size: 1.25rem; font-weight: 700; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chead .cof { font-size: 0.9rem; opacity: 0.75; }
.cbody { padding: 1.1rem 0 0; }

a.next { display: block; margin: 1.4rem 0 0.4rem; padding: 0.7rem 0; border-top: 1px solid var(--light); color: var(--maroon); text-decoration: none; font-weight: 700; }
a.next::after { content: " ↓"; font-weight: 400; }

figure { margin: 0.9rem 0 1.1rem; }
figure img, figure svg { width: 100%; height: auto; display: block; }
figcaption { font-size: 1.125rem; color: var(--ink); margin-top: 0.35rem; font-style: normal; line-height: 1.5; }

.beyond { background: var(--pale); padding: 0.9rem 1rem 0.6rem; margin: 1.1rem -1.1rem 0.6rem; border-left: 4px solid var(--maroon); }
@media (min-width: 44rem) { .beyond { margin-left: 0; margin-right: 0; } }
.beyond > summary { list-style: none; cursor: pointer; font-weight: 700; color: var(--maroon); font-size: 1rem; padding: 0.1rem 0 0.6rem; }
.beyond > summary::marker, .beyond > summary::-webkit-details-marker { display: none; }
.beyond > summary::before { content: "+ "; }
.beyond[open] > summary::before { content: "– "; }
.beyond h4 { margin-top: 0.4rem; }

table { border-collapse: collapse; width: 100%; font-size: 0.95rem; margin: 0.5rem 0 1rem; }
table caption { caption-side: top; text-align: center; font-size: 1.125rem; color: var(--gray); margin-bottom: 0.4rem; }
tr.total td { font-weight: 700; border-top: 2px solid var(--ink); }
#table-emissions th, #table-emissions td { text-align: center; }
th, td { text-align: left; padding: 0.38rem 0.45rem; vertical-align: top; border-bottom: 1px solid var(--light); }
th { background: var(--accent); color: #fff; font-weight: 700; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.scroll { overflow-x: auto; margin: 0 -1.1rem; padding: 0 1.1rem; }
.scroll table { min-width: 30rem; }
.ctable th, .ctable td { text-align: center; }
.ctable .src { display: block; }

/* ---------------- equations ---------------- */
.eqn { margin: 0.7rem 0; text-align: center; font-size: 1.1rem; }
.eqn .frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; margin: 0 0.3em; line-height: 1.2; }
.eqn .frac .num { padding: 0 0.35em 0.1em; border-bottom: 1px solid currentColor; }
.eqn .frac .den { padding: 0.1em 0.35em 0; }
.eqn-vars { font-size: 0.95rem; color: var(--gray); margin: 0.2rem 0 0.9rem; }
.eqn-vars span { display: block; }

/* ---------------- fault tree pathway accordions ---------------- */
.pathways { margin: 0.9rem 0 1.1rem; }
.pathway { border: 1px solid var(--light); border-radius: 0.3rem; margin-bottom: 0.6rem; padding: 0.7rem 0.9rem; }
.pathway > summary { list-style: none; cursor: pointer; font-size: 1.03rem; padding: 0.1rem 0; }
.pathway > summary::marker, .pathway > summary::-webkit-details-marker { display: none; }
.pathway > summary::before { content: "+ "; color: var(--accent); }
.pathway[open] > summary::before { content: "\2013 "; }
.pathway[open] { border-color: var(--accent); }
.pathway p, .pathway ul { margin-top: 0.7rem; margin-bottom: 0; }
.pathway p + p, .pathway ul + p, .pathway p + ul { margin-top: 0.7rem; }
.pathway ul { padding-left: 1.2rem; }
.pathway li { margin-bottom: 0.5rem; }
.pathway li:last-child { margin-bottom: 0; }

ul.refs { padding-left: 1.1rem; font-size: 0.95rem; }
ul.refs li { margin-bottom: 0.3rem; }

footer { padding: 1.5rem 1.1rem 3rem; color: var(--gray); font-size: 0.93rem; border-top: 1px solid var(--light); }

/* framework list */

/* ---------------- scrollytelling scene ---------------- */
.scene { height: calc(var(--n) * 62vh + 100vh); margin: 0.6rem -1.1rem 1rem; }
@media (min-width: 44rem) { .scene { margin-left: 0; margin-right: 0; } }
.pin { position: sticky; top: var(--head); height: calc(100svh - var(--head)); display: flex; flex-direction: column; background: #fff; }
.stage { flex: 1; min-height: 0; position: relative; padding: 1rem; overflow: hidden; transition: opacity 0.2s ease; }
.caps { position: relative; padding: 0 1.3rem calc(0.8rem + env(safe-area-inset-bottom)); }
.caps p { margin: 0; font-size: 1.08rem; line-height: 1.4; min-height: 4.5rem; transition: opacity 0.25s ease; }

html.static .scene { height: auto; }
html.static .pin { position: static; height: auto; }
html.static .stage { height: min(50vh, 22rem); }

/* process flow diagram scroll camera */
.pfd-stage { padding: 0; background: #fff; }
.imgwrap { position: absolute; left: 0; top: 0; transform-origin: 0 0; transition: transform 0.6s ease; }
.imgwrap img { display: block; max-width: none; height: auto; }
#pfd-img { width: 1427px; }
#flare-img { width: 4608px; }
#faulttree-img { width: 1527px; }
.highlight {
  position: absolute; border: 3px solid #f5ff00; background: rgba(245, 255, 0, 0.25);
  opacity: 0; transition: opacity 0.4s; pointer-events: none;
}
.highlight.on { opacity: 1; }
html.static .pfd-stage { height: min(60vh, 26rem); overflow: auto; }

.stagezoom {
  position: absolute; right: 0.6rem; top: 0.6rem; z-index: 2;
  width: 2.3rem; height: 2.3rem; border: 1px solid var(--light); background: rgba(255, 255, 255, 0.9);
  color: var(--ink); border-radius: 3px; cursor: pointer; font-size: 1.05rem;
}
.stagezoom:hover { border-color: var(--accent); color: var(--accent); }

/* ---------------- fullscreen pan/zoom lightbox ---------------- */
#lb { position: fixed; inset: 0; background: #fff; z-index: 30; display: none; flex-direction: column; }
#lb.on { display: flex; }
.lbtools { position: absolute; right: 0.6rem; top: calc(0.6rem + env(safe-area-inset-top)); z-index: 2; display: flex; gap: 0.3rem; }
.lbtools button { font: inherit; font-size: 1.1rem; width: 2.4rem; height: 2.4rem; border: 1px solid var(--light); background: #fff; color: var(--ink); border-radius: 3px; cursor: pointer; }
.lb-viewer { position: relative; flex: 1; overflow: hidden; touch-action: none; cursor: grab; user-select: none; background: #fff; }
.lb-viewer .zoom-inner { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.lb-viewer img { display: block; max-width: none; }

/* ---------------- quantification: bars & ranges ---------------- */
ul.bars { list-style: none; margin: 0.4rem 0 0.6rem; padding: 0; }
ul.bars li { padding: 0.5rem 0 0.55rem; border-bottom: 1px solid var(--light); }
.bars .brow { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.bars .id { font-weight: 700; color: var(--accent); }
.bars .desc { font-size: 0.95rem; color: var(--gray); }
.bars .pct { font-weight: 700; font-variant-numeric: tabular-nums; }
.bars .bar { height: 4px; background: var(--pale); display: block; margin-top: 0.3rem; }
.bars .bar i { display: block; height: 100%; background: var(--accent); }

ul.ranges { list-style: none; margin: 0.4rem 0; padding: 0; }
ul.ranges li { padding: 0.55rem 0; border-bottom: 1px solid var(--light); }
.ranges .rl { display: block; font-weight: 700; margin-bottom: 0.35rem; }
.ranges .rg { display: block; position: relative; height: 1.1rem; background: var(--pale); }
.ranges .rg i { position: absolute; top: 0.3rem; bottom: 0.3rem; background: var(--accent); opacity: 0.35; }
.ranges .rg b { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1.5px; background: var(--accent); }
.ranges .rv { display: flex; justify-content: space-between; font-size: 0.9rem; color: var(--gray); margin-top: 0.25rem; font-variant-numeric: tabular-nums; }

/* ---------------- feedback form ---------------- */
.feedback-form { display: flex; flex-direction: column; gap: 0.3rem; margin-top: 1rem; }
.feedback-form label { font-size: 0.95rem; font-weight: 700; margin-top: 0.6rem; }
.feedback-form .opt { font-weight: 400; color: var(--gray); }
.feedback-form input, .feedback-form select, .feedback-form textarea {
  font: inherit; font-size: 1rem; padding: 0.5rem 0.6rem; border: 1px solid var(--light);
  border-radius: 0.3rem; background: #fff; color: var(--ink);
}
.feedback-form input:focus, .feedback-form select:focus, .feedback-form textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.feedback-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.btn {
  margin-top: 1rem; align-self: flex-start; display: inline-block; padding: 0.6rem 1.1rem;
  border-radius: 0.35rem; background: var(--maroon); color: #fff; text-decoration: none;
  font-weight: 700; font-size: 1rem; border: 1px solid var(--maroon); cursor: pointer;
}
.btn:hover { opacity: 0.92; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.form-status { margin-top: 0.7rem; font-size: 0.95rem; min-height: 1.2rem; }
.form-status.ok { color: #2b6b2b; }
.form-status.err { color: #a3231d; }
