/* page.css — the document side of the site: legal, methodology, about, city
 * pages and the shared footer.
 *
 * Loads after app.css and reuses its tokens, so these pages inherit the same
 * palette and the same light-phone / dark-desktop swap as the ticker. Nothing
 * here depends on JavaScript.
 */

/* ── content shell ──────────────────────────────────────────────────────── */
.page-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px 64px;
}
@media (min-width: 1024px) { .page-wrap { padding: 0 28px 80px; } }

.page-topbar { border-bottom: 1px solid var(--line-soft); }
.page-nav {
  display: flex; align-items: center; gap: 14px 18px; flex-wrap: wrap;
  max-width: 760px; margin: 0 auto; padding: 18px 20px;
}
@media (min-width: 1024px) { .page-nav { padding: 20px 28px; } }
.page-nav a {
  font: 400 13px var(--sans); color: var(--fg-2); text-decoration: none;
}
/* Seven destinations and a brand do not fit one phone line, and at the desktop
 * size they took three — a third of the first screen spent on navigation
 * before the reader reached a price. Tighter type and gaps bring it back to
 * two, which is the most a header should cost above the fold. */
@media (max-width: 700px) {
  .page-nav { gap: 9px 14px; padding: 14px 20px; }
  .page-nav a { font-size: 12px; }
  .page-nav .page-brand { font-size: 15px; width: 100%; margin-right: 0; }
}
.page-nav a:hover { color: var(--fg); }
.page-nav .page-brand {
  display: flex; align-items: center; gap: 9px;
  font: 700 17px var(--sans); color: var(--fg); margin-right: auto;
}
.page-brand-mark {
  width: 28px; height: 28px; border-radius: 7px; background: var(--gold); color: #0D1013;
  display: flex; align-items: center; justify-content: center; font: 700 11px var(--mono);
}

.breadcrumb { margin: 22px 0 0; font: 400 12px var(--mono); color: var(--fg-3); }
.breadcrumb a { color: var(--fg-3); text-decoration: none; }
.breadcrumb a:hover { color: var(--gold-text); }
.breadcrumb span { margin: 0 6px; }

/* ── prose ──────────────────────────────────────────────────────────────── */
.prose h1 {
  font: 700 30px/1.2 var(--sans); letter-spacing: -.015em;
  margin: 18px 0 0;
}
@media (min-width: 1024px) { .prose h1 { font-size: 38px; } }

.page-lede {
  margin: 14px 0 0; font: 400 16px/1.65 var(--sans); color: var(--fg-2); max-width: 62ch;
}

.page-meta {
  margin: 18px 0 0; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--panel-2); border: 1px solid var(--line-soft);
  font: 400 12px var(--mono); color: var(--fg-2);
}

.prose h2 {
  font: 600 21px/1.3 var(--sans); margin: 44px 0 0; letter-spacing: -.01em;
  scroll-margin-top: 20px;
}
.prose h3 { font: 600 16px/1.4 var(--sans); margin: 28px 0 0; }
.prose p, .prose li { font: 400 15px/1.7 var(--sans); color: var(--fg); }
.prose p { margin: 14px 0 0; max-width: 68ch; }
.prose ul, .prose ol { margin: 14px 0 0; padding-left: 22px; max-width: 68ch; }
.prose li { margin-top: 8px; }
.prose li::marker { color: var(--fg-3); }
.prose a { color: var(--gold-text); text-decoration: underline; text-underline-offset: 2px; }
.prose a:hover { text-decoration-thickness: 2px; }

/* A button inside prose is still a button. `.prose a` (0,1,1) outranks
 * `.btn-gold` (0,1,0), so the "Open the full live board" link on every city
 * page was drawing gold text on a gold background — a control at 1:1 contrast,
 * invisible but still clickable. Restated here at a specificity that wins. */
.prose a.btn { text-decoration: none; }
.prose a.btn-gold { color: #14171A; }
.prose strong { font-weight: 600; }
.prose code {
  font: 400 13.5px var(--mono); background: var(--panel-2);
  border: 1px solid var(--line-soft); border-radius: 5px; padding: 1px 5px;
}
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0 0; }
.prose small { font-size: 12.5px; color: var(--fg-2); }

/* ── formula block ──────────────────────────────────────────────────────── */
.formula {
  margin: 18px 0 0; padding: 18px 20px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line);
  font: 400 13px/2 var(--mono); overflow-x: auto;
}
.formula .op { color: var(--gold-text); }
.formula .cmt { color: var(--fg-3); }

/* ── tables ─────────────────────────────────────────────────────────────── */
.table-scroll { overflow-x: auto; margin: 18px 0 0; }
.data-table {
  width: 100%; min-width: 520px; border-collapse: collapse;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.data-table th {
  text-align: left; padding: 11px 14px; background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  font: 500 10.5px var(--mono); color: var(--fg-3); letter-spacing: .08em; text-transform: uppercase;
}
.data-table td {
  padding: 12px 14px; border-bottom: 1px solid var(--line-soft);
  font: 400 13px/1.55 var(--sans); vertical-align: top;
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table td a { color: var(--gold-text); text-decoration: none; }
.data-table td a:hover { text-decoration: underline; }
.data-table .num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
/* Captions carry the "as of" stamp on the price tables, so they read as a note
 * above the table rather than as a centred title inside it. */
.data-table caption {
  caption-side: top; text-align: left; padding: 0 0 10px;
  font: 400 12.5px/1.6 var(--sans); color: var(--fg-2);
}
.data-table caption time { font-family: var(--mono); font-size: 12px; }

/* The rate tables, on a phone.
 *
 * `min-width: 520px` is right for a prose table with sentences in its cells —
 * it stops "Coins, bars, investment metal" wrapping to one word per line. It
 * was wrong for the number tables, where every cell is a short rupee figure
 * and the 520px floor forced a sideways scroll on a 390px screen for a table
 * that would otherwise have fitted. These four carry data attributes already,
 * so no markup changes to select them: tighter padding, slightly smaller
 * figures, and no artificial floor. */
@media (max-width: 700px) {
  .data-table[data-weights],
  .data-table[data-city-table],
  .data-table[data-rate-table],
  .seo-board { min-width: 0; }
  .seo-board th, .seo-board td { padding: 9px 8px; font-size: 12px; }
  .seo-board .num { font-size: 11.5px; }
  .data-table[data-weights] th, .data-table[data-weights] td,
  .data-table[data-city-table] th, .data-table[data-city-table] td,
  .data-table[data-rate-table] th, .data-table[data-rate-table] td {
    padding: 9px 8px;
  }
  .data-table[data-weights] td,
  .data-table[data-city-table] td,
  .data-table[data-rate-table] td { font-size: 12.5px; }
  .data-table[data-weights] .num,
  .data-table[data-city-table] .num,
  .data-table[data-rate-table] .num { font-size: 11.5px; }
  .data-table[data-weights] th, .data-table[data-city-table] th,
  .data-table[data-rate-table] th { font-size: 9.5px; letter-spacing: .05em; }
  .data-table[data-weights] th[scope="row"] {
    font: 500 12px var(--sans); letter-spacing: 0; text-transform: none;
    background: none; color: var(--fg);
  }
}

/* ── callouts ───────────────────────────────────────────────────────────── */
.callout {
  margin: 20px 0 0; padding: 16px 18px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel);
  border-left: 3px solid var(--gold);
}
.callout p { margin: 0; font-size: 14px; }
.callout p + p { margin-top: 10px; }
.callout-warn { border-left-color: var(--down); }
.callout-title {
  font: 600 12px var(--mono); letter-spacing: .07em; text-transform: uppercase;
  color: var(--fg-2); margin-bottom: 8px;
}

/* An unfilled {{TOKEN}} from lib/config.js — must be loud. */
mark.todo {
  background: var(--down-bg); color: var(--down);
  font: 500 12px var(--mono); padding: 1px 6px; border-radius: 4px;
}

/* ── FAQ ────────────────────────────────────────────────────────────────── */
.faq { margin: 18px 0 0; }
.faq details {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel); margin-top: 10px;
}
.faq summary {
  cursor: pointer; padding: 15px 18px; list-style: none;
  font: 600 14.5px/1.45 var(--sans); display: flex; gap: 12px; align-items: flex-start;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '+'; margin-left: auto; color: var(--gold-text);
  font: 400 18px var(--mono); line-height: 1; flex: none;
}
.faq details[open] summary::after { content: '−'; }
.faq details[open] summary { border-bottom: 1px solid var(--line-soft); }
.faq .faq-body { padding: 4px 18px 16px; }
.faq .faq-body p { font-size: 14px; }
.faq .faq-body p:first-child { margin-top: 12px; }

/* ── live rate widget on city pages ─────────────────────────────────────── */
.rate-widget { margin: 24px 0 0; padding: 20px; }
.rate-widget-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.rate-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px;
}
/* Grid tracks default to min-width:auto, so the widest unbreakable figure in a
 * cell — a per-kilogram dollar price, a six-figure rupee rate — sets the track
 * floor, and two of those plus the gap spilled out of the card on a phone. It
 * is the same failure the calculator columns hit (see .calc-cols in app.css)
 * and takes the same fix, plus a smaller figure at that width: letting the
 * track shrink without shrinking the number only moves the overflow inside the
 * cell. Below 360px not even that is enough, so the grid falls back to one
 * column. */
.rate-grid > * { min-width: 0; }
@media (max-width: 359px) { .rate-grid { grid-template-columns: 1fr; } }
@media (min-width: 640px) { .rate-grid { grid-template-columns: repeat(3, 1fr); } }
.rate-cell {
  padding: 14px; border-radius: var(--radius-sm);
  background: var(--panel-2); border: 1px solid var(--line-soft);
}
.rate-cell-k { font: 400 11.5px var(--sans); color: var(--fg-2); }
.rate-cell-v {
  font: 600 22px var(--mono); font-variant-numeric: tabular-nums; margin-top: 5px;
  letter-spacing: -.01em;
}
/* Two prices in a cell sized for one. At 22px "$68.96 / $69.04" wraps and
 * strands the slash on its own line, which reads as a rendering fault rather
 * than as a spread. */
.rate-cell-v.pair-value { font-size: 15px; letter-spacing: 0; }
.rate-cell-u { font: 400 10.5px var(--mono); color: var(--fg-3); margin-top: 3px; }

/* Phone sizing for the grid above. The figures step down so a per-kilogram
 * price fits its track, and the bid/ask cell takes the full row: at two
 * columns a four-digit pair cannot fit on one line at any size still worth
 * reading, and this keeps the slash where it belongs instead of stranding it. */
@media (max-width: 460px) {
  .rate-cell { padding: 12px; }
  .rate-cell-v { font-size: 16px; }
  .rate-cell-wide { grid-column: 1 / -1; }
}
.rate-foot {
  margin-top: 14px; font: 400 11.5px var(--mono); color: var(--fg-3);
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.rate-widget .btn { margin-top: 16px; }

/* ── city index links ───────────────────────────────────────────────────── */
/* The calculator, sitting directly under the price card.
 *
 * A rate board answers "what is gold worth"; nearly everyone arriving at one
 * is really asking "what will this piece cost me" — which needs making charges
 * and tax, neither of which a rate contains. Putting the answer four screens
 * down, as a sentence, was the same as not having it. */
.calc-cta { margin: 18px 0 0; padding: 18px 20px; }
.calc-cta-head { font: 600 14px var(--sans); }
.calc-cta-note {
  margin: 10px 0 0 !important; font-size: 13.5px !important; color: var(--fg-2) !important;
  max-width: 68ch;
}
.calc-cta-note a { color: var(--gold-text); }
.calc-cta-figures {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px; margin-top: 14px;
}
.calc-cta .btn { margin-top: 16px; }

.city-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
/* The city list, high on the page and big enough to be a destination rather
 * than a footnote. The plain .city-links row stays for the "more on this site"
 * strips further down. */
.city-links-lead { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.city-links-lead a {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--panel); font-weight: 600;
}
.city-links-lead a span {
  font: 400 11.5px var(--mono); color: var(--fg-3); font-weight: 400;
}
.city-links-lead a:hover span { color: var(--fg-2); }
.city-links a {
  display: inline-flex; align-items: center; height: 36px; padding: 0 14px;
  border-radius: 999px; background: var(--panel); border: 1px solid var(--line);
  font: 500 13px var(--sans); color: var(--fg); text-decoration: none;
}
.city-links a:hover { border-color: var(--gold-text); color: var(--gold-text); }

/* ── historical price pages ────────────────────────────────────────────── */
.history-hero {
  margin-top: 24px; padding: 20px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line);
  display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap;
}
.history-eyebrow, .history-stat-k {
  font: 500 10.5px var(--mono); color: var(--fg-3);
  letter-spacing: .08em; text-transform: uppercase;
}
.history-current {
  margin-top: 7px; font: 600 34px/1 var(--mono); letter-spacing: -.025em;
  font-variant-numeric: tabular-nums;
}
.history-current-kind { margin-top: 7px; font: 400 12px var(--mono); color: var(--fg-2); }
.history-source-note { font: 400 11.5px/1.6 var(--mono); color: var(--fg-3); }

.history-stats {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px; margin-top: 18px;
}
@media (min-width: 680px) { .history-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.history-stat {
  min-width: 0; padding: 15px; border-radius: var(--radius-sm);
  background: var(--panel); border: 1px solid var(--line);
}
.history-stat-v {
  margin-top: 7px; font: 600 17px/1.25 var(--mono); letter-spacing: -.01em;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.history-stat-u { margin-top: 5px; font: 400 10.5px/1.45 var(--mono); color: var(--fg-3); }
.history-stat-v.up, .history-table .up { color: var(--up); }
.history-stat-v.down, .history-table .down { color: var(--down); }

.history-chart-card {
  margin: 18px 0 0; padding: 14px 14px 10px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line); overflow: hidden;
}
.history-chart { display: block; width: 100%; height: auto; color: var(--gold-text); }
.history-chart-grid line { stroke: var(--line-soft); stroke-width: 1; vector-effect: non-scaling-stroke; }
.history-chart-line {
  fill: none; stroke: currentColor; stroke-width: 2; vector-effect: non-scaling-stroke;
  stroke-linecap: round; stroke-linejoin: round;
}
.history-chart-dot { fill: var(--gold); stroke: var(--panel); stroke-width: 2; vector-effect: non-scaling-stroke; }
.history-chart-card figcaption {
  display: flex; justify-content: space-between; gap: 12px; margin-top: 2px;
  font: 400 10.5px var(--mono); color: var(--fg-3);
}
.history-chart-empty {
  margin-top: 18px; padding: 28px 18px; border: 1px dashed var(--line);
  border-radius: var(--radius); color: var(--fg-3); font: 400 13px var(--mono); text-align: center;
}
.history-caption { color: var(--fg-2) !important; font-size: 13px !important; }
.history-table th[scope="row"] { font: 500 13px var(--mono); }
.history-table th[scope="row"] a { color: var(--gold-text); text-decoration: none; }
.history-table th[scope="row"] a:hover { text-decoration: underline; }
.history-download { margin-top: 18px; }
.history-download p { color: var(--fg-2); font-size: 13px; }
.history-neighbours {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 30px;
}
.history-neighbours a {
  padding: 13px 15px; border-radius: var(--radius-sm); background: var(--panel);
  border: 1px solid var(--line); text-decoration: none; font: 500 13px var(--sans);
}
.history-neighbours a:last-child { text-align: right; }
.history-neighbours a:hover { border-color: var(--gold-text); }

/* ── footer ─────────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--panel-2);
  margin-top: 56px;
}
/* Only the app shell has a fixed tab bar to clear. */
body.app-shell .site-footer { padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 1024px) { body.app-shell .site-footer { padding-bottom: 0; } }

.foot-inner { max-width: 1160px; margin: 0 auto; padding: 32px 20px 36px; }
@media (min-width: 1024px) { .foot-inner { padding: 40px 28px 44px; } }

.foot-disclaimer {
  padding: 16px 18px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--gold);
  font: 400 13px/1.65 var(--sans); color: var(--fg-2); max-width: 78ch;
}
.foot-disclaimer strong { color: var(--fg); font-weight: 600; }
.foot-disclaimer a { color: var(--gold-text); }

.foot-cols {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 26px 20px; margin-top: 32px;
}
/* Five columns once there is room for five. Below that they wrap in threes
 * rather than being squeezed — a footer column narrower than its own link text
 * is a column that has stopped being a column. */
@media (min-width: 760px) { .foot-cols { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1040px) { .foot-cols { grid-template-columns: repeat(5, 1fr); } }
.foot-col h2 {
  font: 500 10.5px var(--mono); letter-spacing: .09em; text-transform: uppercase;
  color: var(--fg-3); margin: 0 0 12px;
}
.foot-col ul { list-style: none; margin: 0; padding: 0; }
.foot-col li + li { margin-top: 9px; }
.foot-col a {
  font: 400 13.5px var(--sans); color: var(--fg-2); text-decoration: none;
}
.foot-col a:hover { color: var(--gold-text); }

.foot-legal { margin-top: 32px; padding-top: 22px; border-top: 1px solid var(--line); }
.foot-legal p {
  margin: 0; font: 400 12px/1.7 var(--mono); color: var(--fg-3); max-width: 90ch;
}
.foot-legal a { color: var(--fg-2); }
.foot-fine { margin-top: 10px !important; font-family: var(--sans) !important; font-size: 12.5px !important; }

/* ── SEO content block on the app shell ─────────────────────────────────── */
.seo-block {
  border-top: 1px solid var(--line-soft);
  margin-top: 40px; padding-top: 32px;
}
.seo-block h1 { font: 700 21px/1.3 var(--sans); margin: 0; letter-spacing: -.01em; }
/* The subheads under that h1 are h2s, not h3s: there is no intermediate level
 * for them to sit under, and skipping one is a heading-order error even when it
 * looks right. The level is structural; the 15px is what makes them read as
 * subordinate to the block title. */
.seo-block h2 { font: 600 15px var(--sans); margin: 24px 0 0; }
.seo-block p {
  margin: 12px 0 0; font: 400 14px/1.7 var(--sans); color: var(--fg-2); max-width: 68ch;
}
.seo-block a { color: var(--gold-text); }

/* The server-rendered price line and board. This is the only price on the page
 * before JavaScript runs, so it is styled to read as data rather than as prose
 * — but quieter than the live board above it, which is the real instrument. */
.seo-glance {
  font-family: var(--mono) !important; font-size: 13px !important;
  color: var(--fg) !important; margin-top: 14px !important;
}
.seo-glance time { color: var(--fg-2); }
/* Where the figure above came from, and when. On the static pages this is the
 * only attribution a reader with JavaScript off will ever see. */
.seo-source {
  margin-top: 8px !important;
  font-family: var(--mono) !important; font-size: 11.5px !important; line-height: 1.65 !important;
  color: var(--fg-3) !important;
}
.seo-source a { color: var(--gold-text); }
.seo-block .metal-card { max-width: 68ch; }
.seo-block .metal-card p { margin-top: 10px; font-size: 12.5px; }
/* Held to the measure of the prose around it. Left to itself the table fills
 * a 1440px board and strands the rate column half a screen from its label. */
.seo-block .table-scroll { max-width: 68ch; margin-top: 6px; }
.seo-board { margin-top: 0; }
.seo-board th[scope="row"] { font: 500 13px var(--sans); white-space: nowrap; }
.seo-board .fine { font: 400 11px var(--mono); color: var(--fg-3); }
.seo-note:empty { display: none; }
.seo-note { font-size: 12.5px !important; color: var(--fg-3) !important; }
/* The static block belongs to one view — the one this document is about, which
 * is the board on "/", the calculator on /calculator/ and the alerts page on
 * /alerts/. app.js adds .seo-off to <body> whenever the view on screen is not
 * that one. This used to key off data-view="rates", which was correct while
 * every view lived at "/" and wrong the moment two of them got addresses of
 * their own.
 *
 * The heading is the exception: it is this document's <h1>, and a page with no
 * h1 at all is worse than one whose h1 is off-screen. Hidden from the layout,
 * kept in the accessibility tree. */
body.seo-off .seo-block > :not(h1) { display: none; }
body.seo-off .seo-block {
  border-top: 0; margin-top: 0; padding-top: 0;
}
body.seo-off .seo-block h1 {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ── 404 ────────────────────────────────────────────────────────────────── */
.notfound { text-align: center; padding: 72px 0 0; }
.notfound .code { font: 600 64px var(--mono); color: var(--gold-text); letter-spacing: -.02em; }
.notfound h1 { margin-top: 8px; }
.notfound .page-lede { margin-left: auto; margin-right: auto; }
.notfound .city-links { justify-content: center; }
