:root {
  --paper: #f6f3ec; --paper2: #efeae0; --ink: #1d1b18; --muted: #6b655c; --rule: #d9d2c5;
  --intact: #8a9a8b; --damaged: #d0902a; --destroyed: #a8352a; --accent: #a8352a;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.65 Inter, system-ui, sans-serif; }
a { color: var(--accent); }
h1, h2, h3 { font-family: "Source Serif 4", Georgia, serif; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: clamp(34px, 5.2vw, 60px); line-height: 1.08; margin: 0 0 20px; max-width: 900px; }
h2 { font-size: clamp(26px, 3.2vw, 36px); margin: 0 0 12px; }
h3 { font-size: 21px; margin: 32px 0 10px; }

.masthead { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center;
  padding: 12px 28px; background: rgba(246, 243, 236, 0.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--rule); }
.brand { font-family: "Source Serif 4", serif; font-weight: 700; font-size: 22px; letter-spacing: 0.02em; }
.masthead nav a { margin-left: 22px; color: var(--muted); text-decoration: none; font-size: 15px; }
.masthead nav a:hover { color: var(--ink); }

.hero { max-width: 1040px; margin: 0 auto; padding: 80px 28px 56px; }
.kicker { text-transform: uppercase; letter-spacing: 0.14em; font-size: 12.5px; color: var(--accent); font-weight: 600; margin: 0 0 14px; }
.lede { font-family: "Source Serif 4", serif; font-size: 21px; line-height: 1.55; color: #3a3631; max-width: 760px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-top: 40px; border-top: 2px solid var(--ink); }
.stat { padding: 16px 18px 6px 0; }
.stat .n { font-family: "Source Serif 4", serif; font-size: 38px; font-weight: 700; line-height: 1; }
.stat .l { font-size: 14px; color: var(--muted); margin-top: 6px; }

.band { padding: 72px 28px; border-top: 1px solid var(--rule); }
.band.alt { background: var(--paper2); }
.col { max-width: 760px; margin: 0 auto; }
.col.wide { max-width: 1100px; }
.col > p { color: #3a3631; }
.caption, .note { font-size: 14px; color: var(--muted); }

.compare { position: relative; width: 100%; max-width: 512px; aspect-ratio: 1; margin: 24px 0 8px; overflow: hidden;
  border: 1px solid var(--rule); background: #ddd; user-select: none; }
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; image-rendering: auto; }
.compare .cmp-pre { position: absolute; inset: 0; }
.compare img.fp { mix-blend-mode: screen; opacity: 0.3; pointer-events: none; }
.compare input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }
.compare .tag { position: absolute; top: 10px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em;
  background: rgba(29, 27, 24, 0.7); color: #fff; padding: 2px 8px; pointer-events: none; }
.compare .tag.left { left: 10px; } .compare .tag.right { right: 10px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; margin-top: 16px; }
.thumbs button { padding: 0; border: 2px solid transparent; background: none; cursor: pointer; position: relative; }
.thumbs button.on { border-color: var(--ink); }
.thumbs img { width: 100%; display: block; aspect-ratio: 1; object-fit: cover; }
.thumbs i { position: absolute; left: 3px; bottom: 3px; width: 10px; height: 10px; border-radius: 50%; border: 1px solid #fff; }

#mapview, #fieldmap { height: 560px; margin: 18px 0 10px; border: 1px solid var(--rule); }
.seg { display: inline-flex; flex-wrap: wrap; max-width: 100%; border: 1px solid var(--ink); }
.seg button { font: inherit; font-size: 14px; background: transparent; border: 0; padding: 6px 14px; cursor: pointer; color: var(--ink); }
.seg button.on { background: var(--ink); color: var(--paper); }
.legend { display: flex; gap: 18px; font-size: 14px; color: var(--muted); }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }

.tbl { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 15px; font-variant-numeric: tabular-nums; }
.tbl th { text-align: right; font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); border-bottom: 2px solid var(--ink); padding: 8px 6px; }
.tbl td { text-align: right; padding: 9px 6px; border-bottom: 1px solid var(--rule); }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl tr.ours td { font-weight: 600; }
.cm { display: grid; grid-template-columns: auto repeat(3, 1fr); gap: 2px; max-width: 460px; font-size: 14px; }
.cm div { padding: 10px; text-align: center; }
.cm .h { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.limits li { margin-bottom: 12px; }
.steps li { margin-bottom: 12px; color: #3a3631; }
.cmd { background: var(--ink); color: var(--paper); padding: 14px 16px; font-size: 13px; line-height: 1.5;
  overflow-x: auto; white-space: pre; }
a.brand { color: var(--ink); text-decoration: none; }
#legend { flex-wrap: wrap; gap: 0; align-items: center; }
#legend span { margin-left: 10px; }
.next { font-family: "Source Serif 4", serif; font-size: 19px; }
.foot { padding: 40px 28px 60px; border-top: 2px solid var(--ink); max-width: 1040px; margin: 0 auto; font-size: 13.5px; color: var(--muted); }
.memorial { font-family: "Source Serif 4", serif; font-style: italic; font-size: 16px; color: var(--ink); }

@media (max-width: 720px) {
  .masthead nav a:not(:last-child) { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .hero { padding: 48px 18px 36px; }
  .band { padding: 52px 18px; }
  #mapview { height: 420px; }
}

/* scenario page: charts */
:root { --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --grid: #e4ded2;
  --ds1: #dc9a72; --ds2: #cb7046; --ds3: #b04a30; --ds4: #832a20; --ds0: #d9d2c5; }
.chart { margin: 18px 0 6px; position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; font: 12px Inter, system-ui, sans-serif; }
.chart .axis text { fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .axis path, .chart .axis line { stroke: var(--grid); }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .grid path { display: none; }
.chart .lbl { fill: var(--ink); font-size: 12px; }
.chart .lbl.muted { fill: var(--muted); }
.chart-title { font-weight: 600; font-size: 15px; margin: 28px 0 2px; }
.chart-sub { font-size: 13.5px; color: var(--muted); margin: 0; }
.keys { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.keys i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.keys i.line { height: 2px; border-radius: 1px; vertical-align: 3px; width: 16px; }
.tip { position: fixed; pointer-events: none; z-index: 30; background: #fff; border: 1px solid var(--rule);
  box-shadow: 0 2px 10px rgba(0,0,0,.08); padding: 7px 10px; font-size: 12.5px; line-height: 1.45; display: none; max-width: 260px; }
.tip b { font-weight: 600; }
.multi { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.stats.five { grid-template-columns: repeat(4, 1fr); }
.stat .r { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.callout { border-left: 3px solid var(--accent); padding: 4px 0 4px 16px; margin: 22px 0; color: #3a3631; }
table.plain { border-collapse: collapse; font-size: 14.5px; width: 100%; font-variant-numeric: tabular-nums; }
table.plain td, table.plain th { padding: 7px 6px; border-bottom: 1px solid var(--rule); text-align: left; }
table.plain th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
table.plain td.n { text-align: right; }
@media (max-width: 720px) {
  .multi, .two { grid-template-columns: 1fr; }
  .stats.five { grid-template-columns: repeat(2, 1fr); }
}

/* earthquake animation */
.quake-hero { padding-bottom: 28px; }
.quake { position: relative; height: 82vh; min-height: 560px; border-top: 1px solid var(--rule); background: #0f1114; }
#quakemap { position: absolute; inset: 0; }
.qpanel { position: absolute; z-index: 5; background: rgba(18, 20, 24, 0.86); color: #ece8df; backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.08); font-size: 13px; }
.qcontrols { left: 16px; top: 16px; padding: 14px 16px; width: 330px; display: grid; gap: 10px; }
.qstats { right: 16px; top: 16px; padding: 14px 16px; width: 290px; max-height: calc(100% - 80px); overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.qrow { display: flex; align-items: center; gap: 10px; }
.qlabel { color: #a9a395; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.seg.dark { border-color: rgba(255,255,255,.35); }
.seg.dark button { color: #ece8df; padding: 5px 10px; font-size: 13px; }
.seg.dark button.on { background: #ece8df; color: #121418; }
.seg.small button { padding: 4px 8px; }
.qbtn { font: inherit; font-weight: 600; background: #b04a30; color: #fff; border: 0; padding: 7px 14px; cursor: pointer; }
.qbtn.ghost { background: transparent; border: 1px solid rgba(255,255,255,.35); color: #ece8df; padding: 6px 10px; }
.qclock { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 20px; min-width: 70px; }
#scrub { flex: 1; accent-color: #b04a30; }
.qphase { color: #d8d2c6; min-height: 2.8em; line-height: 1.4; }
.qstat .n { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.qstat .l { color: #a9a395; font-size: 12px; line-height: 1.3; }
.qseis { grid-column: 1 / -1; }
.qseis-head { font-size: 12px; color: #a9a395; margin-bottom: 4px; }
.qseis-head .muted { color: #7d786d; }
#seis { width: 100%; display: block; background: rgba(255,255,255,.03); }
.qhint { grid-column: 1 / -1; color: #7d786d; font-size: 11.5px; }
.qwide { grid-column: 1 / -1; font-size: 12px; font-weight: 500; }
.qplaces tr { cursor: pointer; } .qplaces tr:hover td { color: #fff; }
.qplaces { grid-column: 1 / -1; border-collapse: collapse; width: 100%; font-size: 12px; font-variant-numeric: tabular-nums; }
.qplaces td { padding: 3px 2px; border-top: 1px solid rgba(255,255,255,.07); }
.qplaces td.n { text-align: right; color: #a9a395; }
.qplaces .st { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: #4a4e57; }
.qplaces .st.p { background: #6da7ec; }
.qplaces .st.s { background: #e8643a; box-shadow: 0 0 6px #e8643a; }
.qplaces .st.done { background: #8d6b5c; }
.qlegend { position: absolute; z-index: 5; left: 16px; bottom: 16px; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px;
  color: #d8d2c6; background: rgba(18,20,24,.78); padding: 7px 12px; max-width: calc(100% - 32px); }
.qlegend i { display: inline-block; vertical-align: -2px; margin-right: 6px; }
.qlegend .ring { width: 12px; height: 12px; border-radius: 50%; border: 2px solid; }
.qlegend .ring.p { border-color: #6da7ec; } .qlegend .ring.s { border-color: #e8643a; }
.qlegend .bar.rup { width: 16px; height: 3px; background: #ff5a36; vertical-align: 3px; }
.qlegend .dot { width: 8px; height: 8px; border-radius: 50%; } .qlegend .dot.c { background: #ff3b2f; } .qlegend .dot.e { background: #f0a23c; }
.qlegend .sw { width: 46px; height: 8px; background: linear-gradient(90deg, #f1e6d8, #e9c9ad, #dc9a72, #b04a30, #6e2019); }
@media (max-width: 860px) {
  .quake { height: auto; min-height: 0; display: flex; flex-direction: column; background: var(--paper); }
  #quakemap { position: relative; height: 62vh; order: 1; }
  .qpanel { position: static; width: auto; max-height: none; backdrop-filter: none; }
  .qcontrols { order: 0; }
  .qstats { order: 2; grid-template-columns: 1fr 1fr; }
  .qlegend { position: static; order: 3; max-width: none; }
}

.tablewrap { overflow-x: auto; max-width: 100%; }

/* earthquake animation v2 */
.qcontrols { width: 360px; }
.qtimeline { position: relative; padding-bottom: 12px; }
.qtimeline #scrub { width: 100%; }
.qmarks { position: absolute; left: 0; right: 0; bottom: 0; height: 10px; }
.qmarks i { position: absolute; width: 2px; height: 8px; background: #a9a395; transform: translateX(-1px); cursor: help; }
.qmarks i.s { background: #e8643a; } .qmarks i.p { background: #6da7ec; } .qmarks i.r { background: #ff5a36; height: 10px; }
.qlayers { display: flex; flex-wrap: wrap; gap: 6px; }
.qlayers label { cursor: pointer; }
.qlayers input { display: none; }
.qlayers span { display: inline-block; padding: 4px 9px; border: 1px solid rgba(255,255,255,.25); color: #a9a395; font-size: 12px; }
.qlayers input:checked + span { background: rgba(236,232,223,.14); color: #fff; border-color: rgba(255,255,255,.55); }
.qstats { width: 310px; }
.qcard { grid-column: 1 / -1; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); padding: 10px; }
.qcard-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 14px; }
.qtag { font-size: 11px; padding: 2px 7px; background: #4a4e57; color: #fff; text-transform: uppercase; letter-spacing: .05em; }
.qtag.p { background: #2a5d99; } .qtag.s { background: #c24a28; } .qtag.done { background: #6b5249; }
.qcard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; margin-bottom: 6px; }
.qcard-grid span { display: block; color: #a9a395; font-size: 11px; } .qcard-grid b { font-size: 14px; font-variant-numeric: tabular-nums; }
.qcard-line { font-size: 12px; color: #d8d2c6; margin-bottom: 6px; line-height: 1.4; }
.qcard-foot { font-size: 11px; color: #7d786d; margin-top: 3px; }
.qlegend .bar.st { width: 16px; height: 4px; background: #ff3b2f; vertical-align: 2px; }
.qlegend .bar.sm { width: 16px; height: 2px; background: #f0a23c; vertical-align: 3px; }
.qlegend .sq.cut { width: 10px; height: 10px; background: #8f7cf0; opacity: .8; }
#sumStats { margin: 22px 0 8px; }
.qplaces tr.sel td { color: #fff; font-weight: 600; }
.qplaces tr.sel td:first-child { box-shadow: inset 2px 0 0 #e8643a; padding-left: 6px; }
