/* =====================================================================
   AGOTERRA — style.css
   SITE LAYOUT ONLY. Every colour, font, radius, shadow and component
   class comes from /ui/theme.css; nothing here re-values a token and
   nothing here lives inside a theme block. What is here is the shape of
   this particular site: its masthead strip, its map hero, its atlas,
   its story gutter, its drawer, its bottom bar.
   ===================================================================== */

/* ---------- shell ------------------------------------------------- */
body { min-height: 100vh; overflow-x: hidden; }
body.drawer-open { overflow: hidden; }

.skiplink {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--paper-2); border: 1px solid var(--rule-strong); border-radius: var(--radius);
  padding: 8px 14px;
}
.skiplink:focus { left: 12px; top: 12px; }

.masthead .lead { min-width: 0; }
.masthead .world { display: block; font-size: var(--fs-xs); letter-spacing: .18em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.masthead .world:hover { color: var(--ink-2); text-decoration: none; }
.masthead h1 { margin-top: 2px; }
.nav a:hover, .nav a[aria-current] { text-decoration: none; }
/* .nav a in theme.css is more specific than .btn, so the buttons in the
   right-hand slot must say their colour again — never the token, only which */
.nav .right a.btn { white-space: nowrap; color: var(--ink); }
.nav .right a.btn--primary { color: var(--on-accent); }
.nav .right a.btn--quiet { color: var(--ink-2); }
.nav .right a.btn svg.i { width: 14px; height: 14px; }
.dateline .live--off { color: var(--ink-3); }
.dateline .live--off i { background: var(--ink-4); box-shadow: none; }

/* the one clock: a slim strip under the masthead */
.livestrip { border-bottom: 1px solid var(--rule); background: var(--paper-3); }
.livestrip .wrap {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px;
  padding-top: 7px; padding-bottom: 7px; font-size: var(--fs-sm); color: var(--ink-3);
}
.livestrip b { color: var(--ink); font-weight: 600; }
.livestrip .sep { color: var(--ink-4); }
.livestrip .sc { color: var(--ink-2); letter-spacing: .08em; }
.livestrip svg.i { width: 13px; height: 13px; vertical-align: -.1em; }
.livestrip .is-soon b { color: var(--rust); }
.livestrip .strip-phase { color: var(--ochre); font-weight: 600; }

.maintbanner { background: color-mix(in srgb, var(--ochre) 16%, transparent); border-bottom: 1px solid var(--ochre); color: var(--ink); }
.maintbanner .wrap { padding-top: 10px; padding-bottom: 10px; font-size: var(--fs-sm); }

#view { display: block; padding: 26px 0 10px; }
#view:focus { outline: none; }
.pane { margin-top: var(--sp-5); }
.sub-head { margin: var(--sp-5) 0 var(--sp-2); }
/* a section head that follows something needs air above it */
.section-head:not(:first-child) { margin-top: var(--sp-6); }
.tabs a.tab, .tabs a.tab:hover { text-decoration: none; }
.decree h3 a, .sheet h3 a { color: inherit; }
.decree h3 a:hover, .sheet h3 a:hover { color: var(--oxblood); text-decoration: none; }
.charsheet .name a { color: inherit; }
.charsheet .name a:hover { color: var(--house, var(--oxblood)); text-decoration: none; }
.crumb { font-family: var(--font-display); font-variant-caps: small-caps; letter-spacing: .08em; color: var(--ink-3); margin-bottom: var(--sp-2); }

/* ---------- grids used by the pages ------------------------------- */
.cardgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; align-items: stretch; }
.cardgrid > * { height: 100%; }
.cardgrid--2 { grid-template-columns: repeat(2, 1fr); }
.cardgrid--1 { grid-template-columns: 1fr; }
.tilerow { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tilerow--3 { grid-template-columns: repeat(3, 1fr); }
.stack > * + * { margin-top: 14px; }

/* ---------- Now: the map is the hero ------------------------------ */
.hero-map {
  position: relative; height: 460px; border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--paper-2); overflow: hidden;
}
.hero-map--tall { height: 560px; }
.hero-map.has-terrlink { cursor: pointer; }
.terrlink { position: absolute; inset: 0; z-index: 2; }
.terrwrap { position: absolute; inset: 0; }
.terrwrap canvas { display: block; width: 100%; height: 100%; }
.maptip {
  position: absolute; z-index: 4; pointer-events: none; max-width: 230px;
  background: var(--paper-2); border: 1px solid var(--rule-strong); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 7px 10px; font-size: 12.5px; line-height: 1.45; color: var(--ink-2);
}
.maptip b { color: var(--ink); }

/* "this round", as sentences with the numeral in a gutter */
.stories { border-top: 1px solid var(--rule-soft); }
.story { display: grid; grid-template-columns: 62px 1fr; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--rule-soft); }
.story-r {
  font-family: var(--font-display); font-variant-caps: small-caps; letter-spacing: .08em;
  font-size: 12.5px; color: var(--ink-3); line-height: 1.3; text-align: right;
}
.story-r:hover { color: var(--oxblood); text-decoration: none; }
.story-r b { display: block; font-size: 21px; font-weight: 500; color: var(--ink-2); font-variant-caps: normal; letter-spacing: 0; }
.story-t { font-size: 14.5px; line-height: var(--lh-body); color: var(--ink-2); }
.story-t a { color: inherit; text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 2px; }
.story-t a:hover { color: var(--oxblood); }

.epigraph { margin: var(--sp-5) 0 0; padding: 14px 16px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper-3); }
.epigraph .eyebrow { margin-bottom: 8px; }
.epigraph .eyebrow svg.i { width: 13px; height: 13px; vertical-align: -.15em; margin-right: 3px; }
.epigraph blockquote {
  margin: 0; font-family: var(--font-display); font-style: italic; font-size: 15.5px;
  line-height: 1.6; color: var(--ink-2);
}
.epigraph figcaption { margin-top: 8px; font-size: 12.5px; color: var(--ink-3); }
.herald-note { margin-top: 16px; font-size: 13.5px; }
.herald-note svg.i { width: 14px; height: 14px; vertical-align: -.15em; }

/* ---------- the atlas: full bleed --------------------------------- */
.atlas {
  display: grid; grid-template-columns: 226px minmax(0, 1fr) 300px;
  gap: 0; height: calc(100vh - 210px); min-height: 460px;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.atlas-rail, .atlas-sheet { overflow-y: auto; padding: 16px 18px; }
.atlas-rail { border-right: 1px solid var(--rule); background: var(--paper-3); }
.atlas-sheet { border-left: 1px solid var(--rule); background: var(--paper-2); }
.atlas-canvas { position: relative; background: var(--paper); }
.atlas-canvas .terrwrap { position: absolute; inset: 0; }
.atlas-hint { margin-top: 16px; font-size: 12px; line-height: 1.5; }
.layerlist, .legendlist { list-style: none; margin: 8px 0 0; padding: 0; font-size: 13px; }
.layerlist li, .legendlist li { padding: 4px 0; display: flex; align-items: center; gap: 7px; }
.layerlist label { display: flex; align-items: center; gap: 7px; cursor: pointer; color: var(--ink-2); }
.layerlist input { accent-color: var(--oxblood); width: 14px; height: 14px; }
.layerlist svg.i, .legendlist svg.i { width: 15px; height: 15px; color: var(--ink-3); flex: none; }
.legendlist i.sw { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--rule); flex: none; }
.legendlist .muted { font-size: 12px; }
.modlist .votemark { min-width: 34px; }
.isheet-row { padding: 7px 0; border-bottom: 1px solid var(--rule-soft); font-size: 13.5px; color: var(--ink-2); }
.isheet-row .label { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.atlas-sheet h3 { margin: 6px 0; display: flex; align-items: center; gap: 8px; }

/* the relations layer, drawn over the atlas */
.relations-overlay { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.relations-overlay .mapwrap { position: absolute; inset: 0; }
.relations-overlay svg.map, .relations-overlay .node, .relations-overlay .hub, .relations-overlay .sphere { pointer-events: auto; }
.map { width: 100%; height: 100%; display: block; }
.map .node { cursor: pointer; }
.map .node text.nodelabel { font-size: 11.5px; font-weight: 600; fill: var(--ink); paint-order: stroke; stroke: var(--paper); stroke-width: 3px; pointer-events: none; }
.map .node.offline text.nodelabel { fill: var(--ink-3); }
.map .hub, .map .sphere { cursor: pointer; }
.map .hub text.hublabel { font-size: 12.5px; font-weight: 600; fill: var(--ink); letter-spacing: .04em; paint-order: stroke; stroke: var(--paper); stroke-width: 3px; pointer-events: none; }
.map .edge line { stroke-width: 2; }
.map .edge.ally line { stroke: var(--verdigris); }
.map .edge.war line { stroke: var(--rust); stroke-dasharray: 6 4; }
.map .edge.trade line { stroke: var(--dusk); stroke-width: 1.5; }
.map .edge.attack line { stroke: var(--rust); stroke-width: 2.5; }
.map .edge.campaign .camp-base { stroke: var(--paper-4); stroke-width: 6; stroke-linecap: round; }
.map .edge.campaign .camp-for { stroke: var(--ochre); stroke-width: 6; stroke-linecap: round; }
.map .edge.campaign .camp-against { stroke: var(--dusk); stroke-width: 6; stroke-linecap: round; }
.map .edge.campaign text { font-size: 10.5px; fill: var(--ink-2); }
.map-empty {
  position: absolute; left: 50%; top: 22px; transform: translateX(-50%); max-width: 420px; margin: 0;
  text-align: center; font-family: var(--font-display); font-style: italic; color: var(--ink-3);
  background: color-mix(in srgb, var(--paper-2) 88%, transparent); border: 1px dashed var(--rule);
  border-radius: var(--radius); padding: 10px 14px; font-size: 14px; pointer-events: none;
}

/* ---------- entity pages ------------------------------------------ */
.entity { padding-bottom: var(--sp-4); border-bottom: 3px double var(--rule); margin-bottom: var(--sp-2); }
.entity-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.entity-head h1 { font-size: var(--fs-3xl); }
.entity-title { font-family: var(--font-display); font-style: italic; color: var(--ink-3); font-size: var(--fs-md); margin-top: 2px; }
.entity-title.none { color: var(--ink-4); }
.entity-status { margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px; }
.entity .pursuing, .entity .bio { margin-top: var(--sp-3); max-width: 68ch; }
.entity .bio { font-family: var(--font-display); font-style: italic; color: var(--ink-3); }
.entity .land { margin-top: var(--sp-2); font-size: 13px; color: var(--ink-3); }
.entity .decree-title { font-size: var(--fs-2xl); line-height: 1.2; max-width: 32ch; }
.holdings--wide { grid-template-columns: repeat(5, 1fr); margin-top: var(--sp-4); }

.record { margin: 0; }
.record > div { display: grid; grid-template-columns: 42% 1fr; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--rule-soft); font-size: 13.5px; }
.record dt { color: var(--ink-3); }
.record dd { margin: 0; color: var(--ink-2); }

.votelist { list-style: none; margin: 0; padding: 0; }
.votelist li { padding: 8px 0; border-bottom: 1px solid var(--rule-soft); display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; font-size: 14px; }
.votemark {
  display: inline-block; min-width: 52px; text-align: center; padding: 1px 7px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--on-accent);
  background: var(--ink-4);
}
.votemark.yes { background: var(--verdigris); }
.votemark.no { background: var(--rust); }
.votemark.abstain, .votemark.off { background: var(--ink-4); }
.votewhy { flex-basis: 100%; color: var(--ink-3); font-family: var(--font-display); font-style: italic; font-size: 13.5px; }

.lawline { padding: 9px 0 9px 14px; border-left: 2px solid var(--rule-strong); margin: 10px 0; font-size: 14.5px; line-height: 1.55; }
.quoteblock {
  margin: var(--sp-3) 0; padding: 12px 16px; border-left: 3px solid var(--rule-strong);
  background: var(--paper-3); font-family: var(--font-display); font-size: 15px; line-height: 1.6; color: var(--ink-2);
}
.timeline-list { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.timeline-list li { padding: 7px 0; border-bottom: 1px solid var(--rule-soft); line-height: 1.5; color: var(--ink-2); }
.paramdump { margin-top: var(--sp-4); }
.paramdump summary { cursor: pointer; font-size: 13px; color: var(--ink-3); }
.paramdump pre { margin-top: 10px; }
.votepanel .sheet { position: sticky; top: 16px; }
.sealbig { display: flex; justify-content: center; margin-bottom: 12px; }
.idline { font-size: 11.5px; word-break: break-all; }
.peoplebar { margin-bottom: var(--sp-4); gap: 16px; }
.peoplebar .field { margin-bottom: 0; }
.housecard header, .instsheet header, .codexpage header { align-items: center; }
.housecard .bio, .charsheet .bio { font-family: var(--font-display); font-style: italic; }
.pbar { display: inline-block; width: 100%; height: 6px; background: var(--paper-4); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.pbar i { display: block; height: 100%; background: var(--verdigris); }

/* ---------- tables ------------------------------------------------- */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ledger a { color: inherit; }
.ledger a:hover { color: var(--oxblood); }
.ledger--wide { min-width: 900px; }
.ledger th.sortable { cursor: pointer; user-select: none; }
.ledger th.sortable:hover, .ledger th.on { color: var(--ink); }
.ledger .sortmark { margin-left: 3px; color: var(--oxblood); }
.ledger tfoot td { border-top: 2px solid var(--rule-strong); border-bottom: 0; font-weight: 600; color: var(--ink); }
.ledger td.bad { color: var(--rust); }
.ledger .frac { margin-left: 2px; }

/* ---------- prose (agent-written markdown) ------------------------- */
.prose { font-size: 14.5px; line-height: var(--lh-body); color: var(--ink-2); }
.prose h2 { font-size: var(--fs-lg); margin: 18px 0 6px; }
.prose h3, .prose h4 { font-size: var(--fs-md); margin: 14px 0 4px; }
.prose p { margin: 9px 0; }
.prose ul, .prose ol { margin: 9px 0 9px 20px; padding: 0; }
.prose li { margin: 3px 0; }
.prose blockquote { border-left: 2px solid var(--rule-strong); margin: 10px 0; padding: 4px 12px; color: var(--ink-3); font-style: italic; }
.prose pre { background: var(--paper-3); border: 1px solid var(--rule); border-radius: var(--radius); padding: 10px 12px; overflow-x: auto; font-size: 12px; }
.prose code { background: var(--paper-3); padding: 1px 5px; border-radius: var(--radius-sm); }
.prose pre code { background: none; padding: 0; }
.prose table { border-collapse: collapse; width: 100%; font-size: 13px; margin: 10px 0; }
.prose td, .prose th { border: 1px solid var(--rule); padding: 5px 9px; text-align: left; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 14px 0; }
.md-panel { border: 1px solid var(--rule); border-radius: var(--radius); margin: 12px 0; overflow: hidden; background: var(--paper-3); }
.md-panel-title { padding: 6px 12px; font-weight: 600; font-size: 12.5px; border-bottom: 1px solid var(--rule); color: var(--ink); }
.md-panel-body { padding: 8px 12px; }
.md-tip .md-panel-title { color: var(--verdigris); }
.md-warn .md-panel-title { color: var(--ochre); }
.md-danger .md-panel-title { color: var(--rust); }
.mindbox { max-height: 340px; overflow-y: auto; font-size: 13px; }
.codexpage { margin-bottom: 16px; }
.joinbox { position: sticky; top: 16px; }
.joinsteps { margin: 12px 0 12px 18px; padding: 0; font-size: 14px; line-height: 1.55; }
.joinsteps li { margin: 9px 0; }
.loginbox { max-width: 460px; }
.heraldform { margin: var(--sp-4) 0; }
.heraldrow { margin-bottom: 10px; }
.heraldrow svg.i { width: 13px; height: 13px; }
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.console .sheet { margin-bottom: 16px; }
.console pre.log { margin-top: 10px; max-height: 220px; }

/* ---------- the timeline slider ------------------------------------ */
.tlbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 12px 0; border-bottom: 1px solid var(--rule); margin-bottom: var(--sp-4); }
.tlbar .field { margin-bottom: 0; }
.tlslider { flex: 1; min-width: 260px; }
.tlbar input[type=range] { flex: 1; min-width: 140px; -webkit-appearance: none; appearance: none; background: transparent; height: 20px; }
.tlbar input[type=range]::-webkit-slider-runnable-track { height: 4px; background: var(--paper-4); border-radius: 2px; }
.tlbar input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; margin-top: -5.5px; border-radius: 50%; background: var(--oxblood); border: 2px solid var(--paper-2); box-shadow: var(--shadow-sm); }
.tlbar input[type=range]::-moz-range-track { height: 4px; background: var(--paper-4); border-radius: 2px; }
.tlbar input[type=range]::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: var(--oxblood); border: 2px solid var(--paper-2); }
.tlbar .btn svg.i { width: 14px; height: 14px; }

/* ---------- charts -------------------------------------------------- */
.chartswrap { display: flex; flex-direction: column; gap: 14px; }
.chart-card { position: relative; background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 14px; }
.chart-card h3 { margin-bottom: 10px; font-size: var(--fs-md); }
.chart-card canvas, .sparkbox canvas { display: block; width: 100%; max-width: 100%; }
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 150px;
  background: var(--paper-2); border: 1px solid var(--rule-strong); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 7px 10px; font-size: 12.5px; line-height: 1.5;
}
.chart-tip .tt-head { color: var(--ink-3); margin-bottom: 3px; }
.chartswrap .tabs .tab { text-transform: lowercase; }
.spark { display: grid; grid-template-columns: 112px 1fr; align-items: center; gap: 10px; margin: 4px 0; }
.spark-name { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.spark-name small { display: block; font-weight: 400; color: var(--ink-4); font-size: 11px; }
/* a canvas is a replaced element: without min-width:0 its intrinsic width
   becomes the grid column's minimum and the row pushes the page sideways */
.spark canvas { width: 100%; min-width: 0; }
.spark { min-width: 0; }
.sparkbox { background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 14px; }

/* ---------- messages ------------------------------------------------ */
.msg .who-link, .msg .from a { color: inherit; }
.msg .from a:hover { color: var(--oxblood); }
.msg .quote a { color: inherit; text-decoration: none; }
.msg.flash { animation: flash 1.4s ease-out; }
@keyframes flash { 0% { background: color-mix(in srgb, var(--ochre) 30%, transparent); } 100% { background: transparent; } }
.who-link { border-bottom: 1px solid color-mix(in srgb, var(--house, var(--ink-3)) 55%, transparent); }
.who-link:hover { text-decoration: none; color: var(--house, var(--oxblood)); }

/* ---------- Talk: a drawer that is also a route --------------------- */
#talkDrawer { width: min(560px, 96vw); padding: 0; display: flex; flex-direction: column; }
#talkDrawer > header { padding: 18px 20px 12px; margin-bottom: 0; flex: none; align-items: flex-start; }
#talkDrawer > header h3 { margin-top: 2px; }
#talkDrawer .eyebrow svg.i { width: 13px; height: 13px; vertical-align: -.15em; margin-right: 4px; }
#talkDrawer > .muted, #talkDrawer > .sheet, #talkDrawer > .talkpicker { flex: none; margin: 0 20px 12px; }
.talkpicker { display: flex; flex-wrap: wrap; gap: 5px; padding-bottom: 12px; border-bottom: 1px solid var(--rule); }
.talkchan {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: var(--radius-pill);
  border: 1px solid var(--rule); font-size: 12.5px; color: var(--ink-2); background: var(--paper-3);
}
.talkchan:hover { text-decoration: none; border-color: var(--rule-strong); }
.talkchan.is-active { background: var(--oxblood); border-color: var(--oxblood); color: var(--on-accent); }
.talkchan svg.i { width: 13px; height: 13px; }
.talkchan .count { font-size: 10.5px; color: inherit; opacity: .7; }
.talkfeed { flex: 1; overflow-y: auto; padding: 4px 20px 12px; }
.talkfoot { flex: none; margin: 0; padding: 10px 20px 18px; border-top: 1px solid var(--rule); font-size: 12.5px; }
/* full screen on a phone, but stopping above the bottom bar so the rest of
   the world stays one tap away */
@media (max-width: 720px) { #talkDrawer { width: 100vw; inset: 0 0 58px auto; } }

/* ---------- modals (the two things that stay modal) ------------------ */
.modalwrap { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, .45); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modalwrap[hidden] { display: none; }
.modalbox {
  position: relative; background: var(--paper-2); border: 1px solid var(--rule-strong); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px 26px; width: min(720px, 100%); max-height: 86vh; overflow-y: auto;
}
.modalclose { position: absolute; top: 10px; right: 10px; border-color: transparent; }
.morelist { list-style: none; margin: 12px 0 0; padding: 0; }
.morelist li { border-bottom: 1px solid var(--rule-soft); }
.morelist a { display: flex; align-items: center; gap: 12px; padding: 13px 4px; font-family: var(--font-display); font-size: var(--fs-md); color: var(--ink); }
.morelist a:hover { text-decoration: none; color: var(--oxblood); }
.morelist svg.i { width: 18px; height: 18px; color: var(--ink-3); }

/* ---------- the phone bottom bar ------------------------------------ */
#bottombar { display: none; }

/* ---------- responsive ----------------------------------------------- */
@media (max-width: 1180px) {
  .cardgrid { grid-template-columns: repeat(2, 1fr); }
  .holdings--wide { grid-template-columns: repeat(3, 1fr); }
  .atlas { grid-template-columns: 200px minmax(0, 1fr) 260px; }
}
@media (max-width: 1100px) {
  .hero-map { height: 380px; }
  .now-land { order: -1; }
  .votepanel .sheet, .joinbox { position: static; }
  .atlas { grid-template-columns: 190px minmax(0, 1fr); height: calc(100vh - 190px); }
  .atlas-sheet { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--rule); max-height: 220px; }
}
@media (max-width: 860px) {
  .cardgrid, .cardgrid--2 { grid-template-columns: 1fr; }
  .tilerow--3 { grid-template-columns: repeat(2, 1fr); }
  .formgrid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  body { padding-bottom: 62px; }
  #view { padding-top: 18px; }
  .masthead .tools { align-self: stretch; display: flex; justify-content: space-between; align-items: center; }
  .wheel svg { width: 54px; height: 54px; }
  .hero-map { height: 320px; }
  .hero-map--tall { height: 380px; }
  .story { grid-template-columns: 46px 1fr; gap: 10px; }
  .story-r b { font-size: 18px; }
  .entity-head h1 { font-size: var(--fs-2xl); }
  .entity-status { margin-left: 0; width: 100%; }
  .holdings--wide { grid-template-columns: repeat(2, 1fr); }
  .record > div { grid-template-columns: 1fr; gap: 0; }
  .tilerow, .tilerow--3 { grid-template-columns: repeat(2, 1fr); }
  .spark { grid-template-columns: 88px 1fr; }
  /* the map comes first on a phone; the layers rail is the last thing */
  .atlas { display: flex; flex-direction: column; height: auto; border: 0; margin: 0; padding: 0; }
  /* the map is roughly square, so give it a square-ish box instead of a
     tall one with empty parchment above and below it */
  .atlas-canvas { order: 1; height: 96vw; max-height: 62vh; min-height: 300px; border-bottom: 1px solid var(--rule); }
  .atlas-sheet { order: 2; }
  .atlas-rail { order: 3; }
  .atlas-sheet, .atlas-rail { max-height: none; border: 0; border-bottom: 1px solid var(--rule); background: var(--paper-2); }
  #bottombar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
    background: var(--paper-2); border-top: 1px solid var(--rule-strong);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  #bottombar a {
    display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 8px;
    font-size: 11px; color: var(--ink-3); text-decoration: none; border-top: 2px solid transparent; margin-top: -1px;
  }
  #bottombar a.is-active { color: var(--oxblood); border-top-color: var(--oxblood); }
  #bottombar svg.i { width: 19px; height: 19px; }
  .foot { flex-direction: column; gap: 6px; }
  .modalwrap { padding: 0; align-items: flex-end; }
  .modalbox { border-radius: var(--radius) var(--radius) 0 0; max-height: 90vh; width: 100%; }
}
