/* The MetroField Dispatch: a broadsheet printed in the DesignGuide's greens.
   Paper and ink are the newspaper; forest (#2c5f4e) and moss (#3a6b5a) from the DesignGuide's
   sidebar are the spot colours; mint (#7bdc93) appears once, as the stop-press highlighter; the
   guide's signal colours (#22c55e, #f59e0b, #ef4444) appear only where a value is a status. */

:root {
  --paper: #e8e5d8;
  --paper-deep: #dedbcc;
  --ink: #1f231f;
  --ink-soft: #4a4f47;
  --rule: #1f231f;
  --forest: #2c5f4e;
  --moss: #3a6b5a;
  --mint: #7bdc93;
  --good: #22c55e;
  --attention: #f59e0b;
  --trouble: #ef4444;
  --closed: #8c8f84;
  --display: "Libre Caslon Display", "Libre Caslon Text", Georgia, serif;
  --text: "Libre Caslon Text", Georgia, "Times New Roman", serif;
  --blackletter: "UnifrakturMaguntia", "Old English Text MT", serif;
  --index-w: 14.5rem;
  --wire-w: 20rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0; background: var(--paper); color: var(--ink); font-family: var(--text);
  font-variant-numeric: oldstyle-nums proportional-nums; line-height: 1.55;
  /* faint newsprint grain */
  background-image:
    radial-gradient(rgba(31, 35, 31, .035) 1px, transparent 1px),
    radial-gradient(rgba(31, 35, 31, .025) 1px, transparent 1px);
  background-size: 3px 3px, 7px 7px;
  background-position: 0 0, 1px 2px;
}
a { color: inherit; text-decoration-color: var(--forest); text-underline-offset: 2px; }
a:hover { color: var(--forest); }
:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; }
h1, h2, h3 { margin: 0; font-weight: 400; }
p { margin: 0; }
.icon { flex-shrink: 0; }

/* ── page frame ── */
.paper { display: grid; grid-template-columns: var(--index-w) minmax(0, 1fr); min-height: 100vh; max-width: 1500px; margin: 0 auto; }
.sheet { padding: 1.5rem 2.5rem 3rem 2rem; min-width: 0; }

/* ── section index (left) ── */
.index {
  position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto;
  padding: 2rem 1.25rem 2rem 1.5rem; border-right: 3px double var(--rule);
}
.index-title { font-family: var(--display); font-size: 1.15rem; border-bottom: 1px solid var(--rule); padding-bottom: .4rem; margin-bottom: .5rem; }
.index-list { list-style: none; margin: 0; padding: 0; }
.index-link {
  display: grid; grid-template-columns: 1.4rem 1.1rem 1fr auto; align-items: center; gap: .5rem;
  padding: .55rem .2rem; text-decoration: none; border-bottom: 1px dotted rgba(31, 35, 31, .45);
}
.index-letter { font-family: var(--display); font-size: 1.2rem; color: var(--forest); line-height: 1; }
.index-icon { color: var(--moss); }
.index-name { font-size: .95rem; white-space: nowrap; }
.index-count { font-size: .8rem; color: var(--ink-soft); font-variant-numeric: lining-nums tabular-nums; }
.index-link.is-current { background: var(--forest); color: var(--paper); padding-left: .45rem; padding-right: .45rem; }
.index-link.is-current .index-letter, .index-link.is-current .index-icon, .index-link.is-current .index-count { color: var(--mint); }
.index-note { margin-top: 1.25rem; font-size: .78rem; font-style: italic; color: var(--ink-soft); line-height: 1.45; }

/* ── masthead ── */
.masthead {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 1.5rem;
  padding-bottom: .5rem; border-bottom: 1px solid var(--rule);
}
.nameplate {
  font-family: var(--blackletter); color: var(--forest); text-decoration: none; text-align: center;
  font-size: clamp(2.6rem, 5.4vw, 5.2rem); line-height: 1; letter-spacing: .01em; padding: 0 .5rem;
}
.nameplate:hover { color: var(--forest); }
.ear { font-size: .8rem; line-height: 1.35; border: 1px solid var(--rule); padding: .45rem .6rem; max-width: 13rem; }
.ear-left { justify-self: start; display: flex; gap: .5rem; align-items: center; }
.ear-right { justify-self: end; text-align: right; }
.ear-small { font-style: italic; color: var(--ink-soft); }
.wire-dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--closed); flex-shrink: 0; }
.wire-dot.is-live { background: var(--good); box-shadow: 0 0 0 2px rgba(34, 197, 94, .25); }
.edition-line {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; padding: .3rem 0;
  border-bottom: 3px double var(--rule); font-size: .82rem; font-variant-numeric: lining-nums;
}
.edition-line > span:nth-child(2) { text-align: center; font-weight: 700; }
.edition-line > span:last-child { text-align: right; }
.edition-line .printing { color: var(--forest); font-style: italic; }
.reprint { color: var(--ink-soft); font-style: italic; }

/* ── section flag ── */
.section-flag { display: flex; align-items: center; gap: .75rem; padding: 1rem 0 .25rem; border-bottom: 1px solid var(--rule); color: var(--forest); }
.section-letter {
  font-family: var(--display); font-size: 1.6rem; width: 2.3rem; height: 2.3rem; display: grid; place-items: center;
  background: var(--forest); color: var(--paper); line-height: 1;
}
.section-name { font-family: var(--display); font-size: 2rem; color: var(--ink); }

/* ── stories in ruled columns ── */
.content { padding-top: 1.25rem; }
.page-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.story { container-type: inline-size; padding: 0 1.25rem 1.5rem; border-left: 1px solid var(--rule); border-bottom: 1px solid rgba(31, 35, 31, .35); margin-bottom: 1.25rem; min-width: 0; }
/* every page opens with a lead (2 columns) and a side story, so children 3, 6, 9 start a row */
.page-grid > .story:nth-child(3n), .story-lead, .story-wide { border-left: 0; padding-left: 0; }
.story-lead { grid-column: span 2; padding-right: 1.5rem; }
.story-side { grid-column: span 1; border-left: 1px solid var(--rule) !important; padding-left: 1.25rem !important; }
.story-wide { grid-column: 1 / -1; padding-right: 0; }
.story-span2 { grid-column: span 2; }
.hed { font-family: var(--display); font-size: 1.55rem; line-height: 1.15; margin-bottom: .45rem; text-wrap: balance; }
.story-lead .hed { font-size: clamp(2rem, 3.2vw, 2.9rem); line-height: 1.05; letter-spacing: -.01em; }
.dek { font-style: italic; font-size: 1.02rem; color: var(--ink-soft); margin-bottom: .9rem; max-width: 62ch; line-height: 1.5; }
.source { font-size: .74rem; font-style: italic; color: var(--ink-soft); margin-top: .75rem; padding-top: .35rem; border-top: 1px solid rgba(31, 35, 31, .25); }
.correction { font-size: .9rem; border: 1px solid var(--trouble); padding: .6rem .75rem; background: rgba(239, 68, 68, .06); }
.press-wait { font-style: italic; color: var(--ink-soft); font-size: .92rem; padding: 1.5rem 0; }
.jump { margin-top: .6rem; font-size: .85rem; font-style: italic; }
.lead-body { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.75rem; align-items: start; }
.ink { animation: inked .9s ease-out; }
@keyframes inked { from { opacity: .35; filter: blur(.4px); } to { opacity: 1; filter: none; } }

/* ── box score ── */
.figures { margin: 0; display: flex; flex-direction: column; gap: .15rem; font-variant-numeric: lining-nums tabular-nums; }
.figure-row { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: .4rem; padding: .3rem 0; border-bottom: 1px solid rgba(31, 35, 31, .2); }
.figures dt { overflow: hidden; white-space: nowrap; }
.figures dt span { background: var(--paper); padding-right: .3rem; }
.figures dt::after { content: " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ."; color: rgba(31, 35, 31, .45); }
.figures dd { margin: 0; font-weight: 700; font-size: 1.05rem; }
.figure-note { grid-column: 1 / -1; font-weight: 400 !important; font-size: .78rem !important; font-style: italic; color: var(--ink-soft); }

/* ── chart inks: hatched fills in the guide's greens ── */
.ink-1 { background: var(--forest); fill: var(--forest); }
.ink-2 { background: repeating-linear-gradient(45deg, var(--moss) 0 2px, var(--paper) 2px 5px); fill: var(--moss); }
.ink-3 { background: repeating-linear-gradient(-45deg, var(--forest) 0 1.5px, transparent 1.5px 4px), repeating-linear-gradient(45deg, var(--forest) 0 1.5px, var(--paper) 1.5px 4px); fill: #6f8f7f; }
.ink-4 { background: var(--mint); fill: var(--mint); }
.ink-5 { background: radial-gradient(var(--moss) 1.1px, var(--paper) 1.3px) 0 0 / 4px 4px; fill: var(--moss); }
.ink-6 { background: var(--paper-deep); box-shadow: inset 0 0 0 1.5px var(--ink); fill: var(--paper-deep); }
.tone-good { background: var(--good); fill: var(--good); }
.tone-steady { background: repeating-linear-gradient(45deg, var(--forest) 0 2px, var(--paper) 2px 5px); fill: var(--moss); }
.tone-attention { background: var(--attention); fill: var(--attention); }
.tone-trouble { background: var(--trouble); fill: var(--trouble); }
.tone-closed { background: var(--closed); fill: var(--closed); }

/* horizontal bars */
.hbars { margin: 0; }
.axis-cat { font-size: .75rem; font-style: italic; color: var(--ink-soft); margin-bottom: .3rem; }
.axis-val { font-size: .75rem; font-style: italic; color: var(--ink-soft); text-align: center; margin-top: .25rem; }
.hbar-row { display: grid; grid-template-columns: minmax(6rem, 34%) 1fr 4.5rem; align-items: center; gap: .65rem; padding: .22rem 0; font-size: .9rem; }
.hbar-label { overflow-wrap: anywhere; line-height: 1.2; }
.hbar-track {
  position: relative; height: 1.05rem;
  background: repeating-linear-gradient(to right, transparent 0 calc(25% - 1px), rgba(31, 35, 31, .22) calc(25% - 1px) 25%);
  border-left: 1.5px solid var(--ink);
}
.hbar-fill { position: absolute; inset: 1px auto 1px 0; min-width: 2px; outline: 1px solid var(--ink); outline-offset: -1px; transition: width .6s ease; }
.hbar-value { text-align: right; font-weight: 700; font-variant-numeric: lining-nums tabular-nums; }
.hbar-scale { padding-top: 0; }
.scale { position: relative; height: 1rem; font-size: .7rem; color: var(--ink-soft); border-top: 1px solid var(--ink); font-variant-numeric: lining-nums; }
.scale span { position: absolute; top: .1rem; transform: translateX(-50%); white-space: nowrap; }
.scale span:first-child { transform: none; }
.scale span:last-child { transform: translateX(-100%); }

/* columns */
.columns { margin: 0; display: grid; grid-template-columns: auto 1fr; grid-template-rows: 1fr auto; gap: .2rem .5rem; }
.axis-val-v { writing-mode: vertical-rl; transform: rotate(180deg); font-size: .75rem; font-style: italic; color: var(--ink-soft); text-align: center; }
.axis-cat-b { grid-column: 2; font-size: .75rem; font-style: italic; color: var(--ink-soft); text-align: center; }
.col-plot {
  display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: .9rem; align-items: end; height: 13rem;
  border-bottom: 1.5px solid var(--ink); padding: 0 .25rem;
  background: repeating-linear-gradient(to top, transparent 0 calc(25% - 1px), rgba(31, 35, 31, .18) calc(25% - 1px) 25%);
}
.col { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.col-bar { width: 100%; max-width: 3.5rem; min-height: 2px; outline: 1px solid var(--ink); outline-offset: -1px; transition: height .6s ease; }
.col-value { font-weight: 700; font-size: .9rem; margin-bottom: .2rem; font-variant-numeric: lining-nums; }
.col-label { position: absolute; top: calc(100% + .3rem); font-size: .78rem; line-height: 1.15; text-align: center; width: 150%; overflow-wrap: normal; hyphens: manual; }
.columns figcaption { margin-top: 2.6rem; }

/* pie and its key */
.pie-fig { margin: 0; display: grid; grid-template-columns: minmax(8rem, 11rem) 1fr; gap: 1.25rem; align-items: center; }
.pie { width: 100%; height: auto; }
.slice { stroke: var(--ink); stroke-width: .012; }
.pie-hatch-bg { fill: var(--paper); }
.pie-hatch-line { stroke: var(--moss); stroke-width: .035; }
.pie-dots-bg { fill: var(--paper); }
.pie-dots-dot { fill: var(--moss); }
.key { width: 100%; border-collapse: collapse; font-size: .88rem; font-variant-numeric: lining-nums tabular-nums; }
.key td { padding: .22rem 0; vertical-align: middle; }
.key td:first-child { width: 1.4rem; }
.swatch { display: inline-block; width: .85rem; height: .85rem; outline: 1px solid var(--ink); outline-offset: -1px; vertical-align: -2px; }
.key-label { overflow: hidden; white-space: nowrap; max-width: 0; width: 100%; padding-left: .45rem !important; }
.key-label span { background: var(--paper); padding-right: .3rem; position: relative; z-index: 1; }
.key-label::after { content: " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ."; color: rgba(31, 35, 31, .45); }
.key-fig { text-align: right; font-weight: 700; padding-left: .5rem !important; white-space: nowrap; }
.key-share { padding-left: .75rem !important; }
.key-share { text-align: right; color: var(--ink-soft); width: 3.2rem; white-space: nowrap; }
.key tfoot td { border-top: 1px solid var(--ink); padding-top: .35rem; font-style: italic; }

/* a pie in a narrow column: key under the pie */
@container (max-width: 25rem) {
  .pie-fig { grid-template-columns: 1fr; }
  .pie { max-width: 9.5rem; justify-self: center; }
}

/* front-page directory */
.directory { width: 100%; border-collapse: collapse; font-variant-numeric: lining-nums tabular-nums; }
.directory td { padding: .45rem .25rem; border-bottom: 1px dotted rgba(31, 35, 31, .45); white-space: nowrap; }
.directory a { display: inline-flex; gap: .45rem; align-items: center; text-decoration: none; }
.dir-letter { font-family: var(--display); color: var(--forest); width: 2rem; font-size: 1.1rem; }
.dir-leader { width: 100%; }
.dir-fig { text-align: right; font-weight: 700; font-size: 1.15rem; }
.dir-unit { color: var(--ink-soft); font-style: italic; width: 6rem; }

/* ── stop press: a right-hand column, or a tab on the edge when shut ── */
.paper.has-wire { grid-template-columns: var(--index-w) minmax(0, 1fr) var(--wire-w); max-width: calc(1500px + var(--wire-w)); }
.wire {
  position: sticky; top: 0; align-self: start; height: 100vh; display: flex; flex-direction: column;
  border-left: 3px double var(--rule); padding: 2rem 1rem 1rem 1.1rem; min-width: 0;
}
.wire-head { display: flex; align-items: center; gap: .5rem; background: var(--forest); color: var(--paper); padding: .4rem .5rem .4rem .7rem; }
.wire-title { flex: 1; font-family: var(--display); font-size: 1.15rem; line-height: 1.2; }
.wire-close, .wire-clear { border: 0; background: none; color: inherit; cursor: pointer; font: inherit; padding: .15rem; display: grid; place-items: center; }
.wire-close:hover { color: var(--mint); }
.wire-sub { display: flex; align-items: baseline; gap: .5rem; padding: .35rem 0; border-bottom: 1px solid var(--rule); font-size: .78rem; font-style: italic; color: var(--ink-soft); }
.wire-sub span { flex: 1; }
.wire-clear { font-style: normal; text-decoration: underline; text-decoration-color: var(--forest); text-underline-offset: 2px; }
.wire-clear:hover { color: var(--forest); }
.wire-empty { padding: .75rem 0; font-size: .85rem; font-style: italic; color: var(--ink-soft); }
.wire .bulletin-list { flex: 1; min-height: 0; margin-right: -.6rem; padding-right: .6rem; }
.wire .bulletin { padding: .6rem .3rem; }
.wire .bulletin.is-hot { animation: highlighter 6s ease-out; }
.wire-tab {
  position: fixed; right: 0; top: 50%; transform: translateY(-50%); z-index: 50;
  display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: .8rem .45rem;
  border: 1.5px solid var(--ink); border-right: 0; background: var(--forest); color: var(--paper);
  box-shadow: -3px 3px 0 var(--ink); cursor: pointer; font-family: var(--display); font-size: 1rem;
}
.wire-tab:hover { background: var(--moss); }
.wire-tab-label { writing-mode: vertical-rl; transform: rotate(180deg); }
.wire-tab-count { font-family: var(--text); font-size: .72rem; font-weight: 700; background: var(--mint); color: var(--forest); padding: .05rem .3rem; min-width: 1.4rem; text-align: center; }
.bulletin { padding: .65rem .75rem; font-size: .88rem; }
@keyframes highlighter { 0% { background: rgba(123, 220, 147, .55); } 100% { background: transparent; } }
.bulletin-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.bulletin-list .bulletin { border-bottom: 1px dotted rgba(31, 35, 31, .45); }
.bulletin-hed { display: flex; align-items: center; gap: .4rem; font-weight: 700; }
.bulletin-hed .icon { color: var(--forest); }
.bulletin-hed time { margin-left: auto; font-weight: 400; font-size: .75rem; color: var(--ink-soft); font-variant-numeric: lining-nums; }
.bulletin-title { font-family: var(--display); font-size: 1.05rem; line-height: 1.25; margin-top: .15rem; }
.bulletin-changes { font-style: italic; color: var(--ink-soft); font-size: .82rem; margin-top: .1rem; }

.colophon { margin-top: 2rem; padding-top: .6rem; border-top: 3px double var(--rule); font-size: .76rem; font-style: italic; color: var(--ink-soft); max-width: 80ch; }

#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 100; padding: .7rem 1.25rem; background: var(--paper); border-top: 2px solid var(--trouble); }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 1rem; top: .5rem; }

/* ── narrower screens ── */
@media (max-width: 1150px) {
  /* Too narrow for three columns: the open column slides over the page from the right. */
  .paper.has-wire { grid-template-columns: var(--index-w) minmax(0, 1fr); }
  .wire { position: fixed; right: 0; top: 0; bottom: 0; z-index: 60; width: min(var(--wire-w), 100vw); background: var(--paper); box-shadow: -4px 0 0 var(--forest); }
  .page-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .story-lead, .story-wide { grid-column: 1 / -1; padding-right: 0; }
  .story-span2 { grid-column: 1 / -1; }
  .page-grid > .story { border-left: 0 !important; padding-left: 0 !important; padding-right: 1.25rem; }
  .lead-body { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .paper, .paper.has-wire { grid-template-columns: 1fr; }
  .index { position: static; height: auto; border-right: 0; border-bottom: 3px double var(--rule); padding: 1rem; }
  .index-list { display: flex; flex-wrap: wrap; gap: 0 1rem; }
  .index-link { grid-template-columns: 1.2rem 1rem auto; border-bottom: 0; }
  .index-count, .index-note { display: none; }
  .sheet { padding: 1rem; }
  .masthead { grid-template-columns: 1fr; text-align: center; }
  .ear { display: none; }
  .edition-line { grid-template-columns: 1fr; text-align: center; }
  .edition-line > span { text-align: center !important; }
  .page-grid { grid-template-columns: 1fr; }
  .story { padding-right: 0 !important; }
  .pie-fig { grid-template-columns: 1fr; }
  .pie { max-width: 12rem; justify-self: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── certificate notices: a column of small notices, the standing in signal colour ── */
.notices { width: 100%; border-collapse: collapse; font-size: .9rem; }
.notices th { text-align: left; font-weight: 400; font-style: italic; font-size: .78rem; color: var(--ink-soft); border-bottom: 1px solid var(--rule); padding: .2rem .5rem .3rem 0; }
.notices td { padding: .45rem .5rem .45rem 0; border-bottom: 1px dotted rgba(31, 35, 31, .45); vertical-align: baseline; }
.notice-date { white-space: nowrap; font-variant-numeric: lining-nums tabular-nums; font-weight: 700; width: 7.5rem; }
.notice-name { font-family: var(--display); font-size: 1.02rem; }
.notice-type { font-style: italic; color: var(--ink-soft); font-size: .8rem; margin-left: .3rem; }
.notice-where { color: var(--ink-soft); }
.notice-standing { white-space: nowrap; width: 11rem; }
.notice-mark { display: inline-block; width: .6rem; height: .6rem; margin-right: .45rem; vertical-align: baseline; background: repeating-linear-gradient(45deg, var(--forest) 0 1.5px, var(--paper) 1.5px 3.5px); box-shadow: inset 0 0 0 1px var(--forest); }
.notice-lapsed .notice-mark { background: var(--trouble); box-shadow: none; }
.notice-due .notice-mark { background: var(--attention); box-shadow: none; }
.notice-lapsed .notice-standing { font-weight: 700; }
@media (max-width: 820px) {
  .notice-where { display: none; }
  .notice-standing { width: auto; }
}
