/* SpotGoldPrice.net — institutional market-data terminal.
   Dark neutral ground, hairline module grid, grotesk caps for structure,
   monospace for every number and label. No framework. */

:root {
  color-scheme: dark;

  /* Ground */
  --bg: #0a0b0c;
  --panel: #0f1113;
  --panel-2: #14171a;
  --raised: #191d21;

  /* Hairlines */
  --line: #22272b;
  --line-2: #2e3439;
  --line-bright: #3d454b;
  --field-line: #58616a;  /* 3.1:1 — form and control boundaries */

  /* Type */
  --fg: #e8eaec;
  --fg-2: #c3c8cc;
  --fg-3: #9aa2a9;   /* 7.6:1 on --bg */
  --fg-4: #7a8189;   /* 5.0:1 on --bg, AA for the small mono labels */

  /* Signal */
  --amber: #e0a82e;
  --amber-dim: #9a7420;
  --amber-wash: rgba(224, 168, 46, .08);
  --up: #3fb950;
  --down: #f85149;

  --sans: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --wrap: 1400px;
  --gutter: clamp(1rem, 2.5vw, 2rem);
  --bar: 2.25rem;
  --measure: 72ch;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 1.15rem;
  line-height: 1.55;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; display: block; }

a { color: var(--amber); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .2em; }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

::selection { background: rgba(224, 168, 46, .25); color: #fff; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.vh {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 200;
  background: var(--amber); color: #0a0b0c;
  font: 600 0.92rem/1 var(--mono);
  padding: .7rem 1rem;
}
.skip-link:focus { top: 1rem; text-decoration: none; }

/* Shared micro-typography */

.mono,
.lbl,
.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.lbl {
  font-size: 0.7906rem;
  font-weight: 500;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.num { font-feature-settings: "tnum" 1; }

h1, h2, h3, h4 {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: -.005em;
  margin: 0;
}

/* ---------- Top strip ---------- */

.strip {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  font-family: var(--mono);
  font-size: 0.805rem;
  letter-spacing: .06em;
  color: var(--fg-3);
}
.strip .wrap {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: var(--bar);
  justify-content: space-between;
}
.strip-l, .strip-r { display: flex; align-items: center; gap: 1.5rem; min-width: 0; }
.strip .k { color: var(--fg-4); }
.strip .v { color: var(--fg-2); }

.sig {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  text-transform: uppercase;
}
.sig .led {
  width: 6px; height: 6px;
  background: var(--fg-4);
  box-shadow: 0 0 0 0 transparent;
}
.sig[data-state="live"] .led { background: var(--up); animation: pulse 2.6s ease-out infinite; }
.sig[data-state="live"] .v { color: var(--up); }
.sig[data-state="delayed"] .led { background: var(--amber); }
.sig[data-state="delayed"] .v { color: var(--amber); }
.sig[data-state="error"] .led { background: var(--down); }
.sig[data-state="error"] .v { color: var(--down); }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(63, 185, 80, .5); }
  55% { box-shadow: 0 0 0 5px rgba(63, 185, 80, 0); }
}

/* ---------- Masthead ---------- */

.masthead {
  position: sticky; top: 0; z-index: 60;
  background: rgba(10, 11, 12, .93);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.masthead .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 2rem; height: 3.25rem;
}

.brand {
  display: inline-flex; align-items: center; gap: .6rem;
  color: var(--fg);
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1.0925rem;
  letter-spacing: .02em;
  text-transform: uppercase;
  font-stretch: 112%;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand .mark {
  width: 1.15rem; height: 1.15rem;
  border: 1.5px solid var(--amber);
  position: relative;
  flex: none;
}
.brand .mark::after {
  content: "";
  position: absolute; inset: 3px;
  background: var(--amber);
}
.brand .sep { color: var(--fg-4); font-weight: 400; }
.brand .tld { color: var(--fg-4); font-family: var(--mono); font-size: 0.805rem; letter-spacing: .1em; font-weight: 400; }

.nav {
  display: flex; gap: 1.6rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  font-family: var(--mono);
  font-size: 0.851rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--fg-3);
  white-space: nowrap;
  padding: .5rem 0;
  border-bottom: 1px solid transparent;
}
.nav a:hover { color: var(--fg); border-bottom-color: var(--amber); text-decoration: none; }

/* ---------- Module system ---------- */

.mod { border-bottom: 1px solid var(--line); }

.mod-head {
  display: flex; align-items: baseline; gap: 1.25rem;
  padding: clamp(2.25rem, 5vw, 3.5rem) 0 1.5rem;
  flex-wrap: wrap;
}
/* Section number. Fixed width so the standfirst below aligns to the
   heading rather than to the number's own text width. */
.mod-head .idx {
  font-family: var(--mono);
  font-size: 0.805rem;
  font-weight: 500;
  letter-spacing: .12em;
  color: var(--amber);
  padding-top: .4rem;
  flex: none;
  width: 1.5rem;
}
.mod-head h2 {
  font-size: clamp(1.5525rem, 2.99vw, 2.185rem);
  line-height: 1.1;
  text-transform: uppercase;
  font-stretch: 108%;
  letter-spacing: -.01em;
}
.mod-head .sub {
  flex-basis: 100%;
  margin: .35rem 0 0;
  padding-left: 2.75rem;
  max-width: 78ch;
  color: var(--fg-3);
  font-size: 1.0925rem;
}
.mod-head .sub strong { color: var(--fg-2); font-weight: 600; }

/* ---------- Hero / price desk ---------- */

.desk { border-bottom: 1px solid var(--line); }

.desk-grid {
  display: grid;
  grid-template-columns: minmax(0, 470px) minmax(0, 1fr);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.quote {
  padding: 1.75rem clamp(1.25rem, 2vw, 2rem) 1.5rem;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  background:
    linear-gradient(180deg, var(--amber-wash), transparent 45%),
    var(--panel);
  position: relative;
}
.quote::before {
  /* corner tick */
  content: "";
  position: absolute; left: 0; top: 0;
  width: 10px; height: 10px;
  border-left: 2px solid var(--amber);
  border-top: 2px solid var(--amber);
}

.quote-id {
  display: flex; align-items: baseline; gap: .6rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}
.quote-id .pair {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: .1em;
  color: var(--fg);
}
.quote-id .desc { font-family: var(--mono); font-size: 0.782rem; letter-spacing: .08em; color: var(--fg-4); text-transform: uppercase; }

.px {
  margin: 1.5rem 0 0;
  display: flex; align-items: flex-start; gap: .5rem;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 400;
  font-size: clamp(2.9rem, 7vw, 4.485rem);
  line-height: 1;
  letter-spacing: -.045em;
  color: #fff;
  transition: color .3s;
}
.px .unit {
  font-size: 0.782rem;
  letter-spacing: .12em;
  color: var(--fg-4);
  padding-top: .5rem;
}
.px.is-loading { color: var(--fg-4); }
.px.tick-up { animation: tickUp .7s ease-out; }
.px.tick-down { animation: tickDown .7s ease-out; }
@keyframes tickUp { 0% { color: var(--up); } 100% { color: #fff; } }
@keyframes tickDown { 0% { color: var(--down); } 100% { color: #fff; } }

.delta {
  margin: .85rem 0 0;
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.0925rem;
  color: var(--fg-3);
}
.delta .amt { font-weight: 500; }
.delta .pct {
  padding: .12rem .4rem;
  border: 1px solid var(--line-2);
  font-size: 0.943rem;
}
.delta[data-dir="up"] .amt, .delta[data-dir="up"] .pct { color: var(--up); }
.delta[data-dir="up"] .pct { border-color: rgba(63, 185, 80, .35); }
.delta[data-dir="down"] .amt, .delta[data-dir="down"] .pct { color: var(--down); }
.delta[data-dir="down"] .pct { border-color: rgba(248, 81, 73, .35); }
.delta .ref { font-size: 0.782rem; letter-spacing: .07em; text-transform: uppercase; color: var(--fg-4); }

.quote-rows {
  margin-top: auto;
  padding-top: 1.5rem;
  display: grid;
  gap: 0;
  font-family: var(--mono);
  font-size: 0.897rem;
}
.quote-rows .r {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .5rem 0;
  border-top: 1px solid var(--line);
}
.quote-rows .r span { color: var(--fg-4); letter-spacing: .07em; text-transform: uppercase; font-size: 0.782rem; }
.quote-rows .r b { font-weight: 500; color: var(--fg-2); font-variant-numeric: tabular-nums; }

/* Chart panel */

.viz {
  display: flex; flex-direction: column;
  background: var(--bg);
  min-width: 0;
}
.viz .chart { flex: none; }
.viz-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding: 1rem clamp(1rem, 2vw, 1.5rem);
  border-bottom: 1px solid var(--line);
}
.viz-title {
  font-family: var(--mono);
  font-size: 0.805rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-4);
  display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap;
}
.viz-title b { color: var(--fg-2); font-weight: 500; }
.viz-title .rng-delta[data-dir="up"] { color: var(--up); }
.viz-title .rng-delta[data-dir="down"] { color: var(--down); }

.tabs { display: inline-flex; border: 1px solid var(--field-line); }
.tabs button {
  appearance: none;
  border: 0;
  border-right: 1px solid var(--field-line);
  background: transparent;
  color: var(--fg-3);
  font: 500 0.805rem/1 var(--mono);
  letter-spacing: .08em;
  padding: .45rem .65rem;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.tabs button:last-child { border-right: 0; }
.tabs button:hover { color: var(--fg); background: var(--raised); }
.tabs button[aria-selected="true"] { background: var(--amber); color: #0a0b0c; }
.tabs button:focus-visible { outline-offset: -2px; }

/* Explicit height: the SVG is sized from the measured box, so an
   auto-height parent would feed back through the ResizeObserver. */
.chart {
  position: relative;
  height: 330px;
  padding: .5rem 0 0;
  touch-action: pan-y;
}
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .gridline { stroke: var(--line); stroke-width: 1; }
.chart .gridline.zero { stroke: var(--line-2); }
.chart .axis text {
  fill: var(--fg-4);
  font-family: var(--mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
}
.chart .line { fill: none; stroke: var(--amber); stroke-width: 1.35; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: url(#areaFill); }
.chart .tipdot { fill: var(--amber); }
.chart .xhair { stroke: var(--line-bright); stroke-width: 1; stroke-dasharray: 1 3; }
.chart .cdot { fill: #0a0b0c; stroke: var(--amber); stroke-width: 1.5; }
.chart .hover-layer { opacity: 0; }
.chart.is-hover .hover-layer { opacity: 1; }

.chart-tip {
  position: absolute; top: 0; left: 0;
  pointer-events: none;
  background: var(--raised);
  border: 1px solid var(--line-bright);
  padding: .4rem .55rem;
  font-family: var(--mono);
  font-size: 0.805rem;
  line-height: 1.4;
  color: var(--fg-3);
  white-space: nowrap;
  opacity: 0;
  transition: opacity .12s;
}
.chart.is-hover .chart-tip { opacity: 1; }
.chart-tip b { display: block; color: var(--fg); font-weight: 500; font-size: 0.966rem; font-variant-numeric: tabular-nums; }

.viz-foot {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .6rem clamp(1rem, 2vw, 1.5rem);
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.759rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--fg-4);
}
.viz-foot b { color: var(--fg-3); font-weight: 500; }

.chart-empty {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 0.8625rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--fg-4);
}
.chart-empty[hidden] { display: none; }

/* Metric rail */

.rail {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.rail > div {
  padding: .9rem clamp(.85rem, 1.5vw, 1.25rem) 1rem;
  border-right: 1px solid var(--line);
  min-width: 0;
}
.rail > div:last-child { border-right: 0; }
.rail dt {
  font-family: var(--mono);
  font-size: 0.736rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-4);
  margin-bottom: .35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rail dd {
  margin: 0;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.2075rem;
  color: var(--fg);
  white-space: nowrap;
}
.rail dd[data-dir="up"] { color: var(--up); }
.rail dd[data-dir="down"] { color: var(--down); }

/* Cross-metal rail */

.metals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.metals > div {
  display: flex; align-items: baseline; justify-content: space-between; gap: .75rem;
  padding: .7rem clamp(.85rem, 1.5vw, 1.25rem);
  border-right: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.92rem;
  min-width: 0;
}
.metals > div:last-child { border-right: 0; }
.metals .n { color: var(--fg-3); letter-spacing: .06em; text-transform: uppercase; font-size: 0.782rem; }
.metals .n i { font-style: normal; color: var(--fg-4); }
.metals .v { color: var(--fg); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Data table ---------- */

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
  gap: 0;
  border: 1px solid var(--line);
  margin-bottom: clamp(2.25rem, 5vw, 3.5rem);
}
.split > * { min-width: 0; }

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

.dtable {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 0.943rem;
  font-variant-numeric: tabular-nums;
}
.dtable th, .dtable td {
  padding: .6rem .9rem;
  text-align: right;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.dtable thead th {
  font-size: 0.736rem;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-4);
  background: var(--panel);
  border-bottom-color: var(--line-2);
  position: sticky; top: 0;
}
.dtable th:first-child, .dtable td:first-child { text-align: left; }
.dtable tbody td { color: var(--fg-2); }
.dtable tbody td:nth-child(2) { color: var(--fg); }
.dtable tbody tr:last-child td { border-bottom: 0; }
.dtable tbody tr:hover td { background: var(--panel-2); }
.dtable .k {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.0925rem;
  color: var(--fg);
  letter-spacing: .01em;
}
.dtable .fine { display: block; font-family: var(--mono); font-size: 0.759rem; color: var(--fg-4); letter-spacing: .04em; margin-top: .1rem; }

.tbl-note {
  padding: .6rem .9rem;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.759rem;
  letter-spacing: .05em;
  color: var(--fg-4);
}

/* Calculator */

.calc {
  border-left: 1px solid var(--line);
  background: var(--panel);
  padding: 1.25rem;
  display: flex; flex-direction: column;
}
.calc h3 {
  font-size: 0.897rem;
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--amber);
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.1rem;
}
.calc .fields { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.calc .wide { grid-column: 1 / -1; }
.calc label {
  display: block;
  font-family: var(--mono);
  font-size: 0.736rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-4);
  margin-bottom: .3rem;
}
.calc input, .calc select {
  width: 100%;
  font: 400 1.035rem/1.3 var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--field-line);
  border-radius: 0;
  padding: .5rem .55rem;
}
.calc input:hover, .calc select:hover { border-color: var(--fg-4); }
.calc output {
  display: block;
  margin-top: auto;
  padding-top: 1.25rem;
}
.calc output .rowline {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding: .45rem 0;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.851rem;
  color: var(--fg-4);
}
.calc output .rowline b { color: var(--fg-2); font-weight: 500; font-variant-numeric: tabular-nums; }
.calc output .total {
  border-top: 1px solid var(--line-2);
  margin-top: .3rem;
  padding-top: .8rem;
}
.calc output .total .lbl { display: block; margin-bottom: .2rem; }
.calc output .total .v {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 2.185rem;
  line-height: 1.1;
  letter-spacing: -.03em;
  color: var(--amber);
}

.units {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  border: 1px solid var(--line);
  margin-bottom: clamp(2.25rem, 5vw, 3.5rem);
}
.units div {
  padding: .6rem .9rem;
  border-right: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.828rem;
  color: var(--fg-4);
  letter-spacing: .04em;
}
.units div:last-child { border-right: 0; }
.units b { color: var(--fg-2); font-weight: 500; }

/* ---------- Factor grid ---------- */

.factors {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  margin-bottom: clamp(2.25rem, 5vw, 3.5rem);
}
.factor {
  padding: 1.4rem 1.5rem 1.6rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.factor:nth-child(2n) { border-right: 0; }
.factor:nth-last-child(-n+2) { border-bottom: 0; }
.factor .tag {
  font-family: var(--mono);
  font-size: 0.736rem;
  letter-spacing: .12em;
  color: var(--amber);
  display: block;
  margin-bottom: .8rem;
}
.factor h3 {
  font-size: 1.173rem;
  text-transform: uppercase;
  letter-spacing: .01em;
  font-stretch: 105%;
  margin-bottom: .5rem;
}
.factor p { margin: 0; color: var(--fg-3); font-size: 1.058rem; }

/* ---------- Reference document ---------- */

.doc-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-bottom: 0;
  background: var(--panel);
}
.doc-meta div {
  padding: .6rem .9rem;
  border-right: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.782rem;
  letter-spacing: .06em;
}
.doc-meta div:last-child { border-right: 0; }
.doc-meta span { display: block; color: var(--fg-4); text-transform: uppercase; font-size: 0.713rem; letter-spacing: .1em; margin-bottom: .15rem; }
.doc-meta b { color: var(--fg-2); font-weight: 500; overflow-wrap: anywhere; }

.doc {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  border: 1px solid var(--line);
  margin-bottom: clamp(2.25rem, 5vw, 3.5rem);
}

.toc {
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 1.25rem 0;
  position: sticky; top: 3.25rem;
  align-self: start;
  max-height: calc(100vh - 3.25rem);
  overflow-y: auto;
}
.toc .hd {
  font-family: var(--mono);
  font-size: 0.713rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--fg-4);
  padding: 0 1.1rem .75rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: .5rem;
}
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc li a {
  display: grid;
  grid-template-columns: 1.9rem 1fr;
  gap: .3rem;
  padding: .35rem 1.1rem;
  font-size: 0.92rem;
  line-height: 1.3;
  color: var(--fg-3);
  border-left: 2px solid transparent;
}
.toc li a::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 0.782rem;
  color: var(--fg-4);
}
.toc li a:hover { color: var(--fg); background: var(--panel-2); text-decoration: none; }
.toc li a.is-active { color: var(--fg); border-left-color: var(--amber); background: var(--panel-2); }
.toc li a.is-active::before { color: var(--amber); }

.prose {
  padding: 1.75rem clamp(1.25rem, 3vw, 2.5rem) 2.5rem;
  max-width: var(--measure);
  font-size: 1.1155rem;
}
.prose > p:first-child { color: var(--fg-2); font-size: 1.2075rem; }
.prose h3 {
  font-size: 1.3225rem;
  text-transform: uppercase;
  letter-spacing: .005em;
  font-stretch: 106%;
  margin: 2.5rem 0 .9rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
  counter-increment: sec;
  color: var(--fg);
}
.prose h3::before {
  content: counter(sec, decimal-leading-zero) " / ";
  font-family: var(--mono);
  font-size: 0.897rem;
  letter-spacing: .1em;
  color: var(--amber);
  font-weight: 400;
}
.prose h3:first-of-type { margin-top: 1.75rem; }
.prose h4 {
  font-family: var(--mono);
  font-size: 0.828rem;
  font-weight: 500;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--amber);
  margin: 1.6rem 0 .5rem;
}
.prose p { margin: 0 0 1.05rem; color: var(--fg-3); }
.prose p strong { color: var(--fg); font-weight: 600; }
.prose { counter-reset: sec; }

/* ---------- FAQ ---------- */

.faq { border: 1px solid var(--line); margin-bottom: clamp(2.25rem, 5vw, 3.5rem); }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:last-child { border-bottom: 0; }
.faq summary {
  list-style: none;
  cursor: pointer;
  display: flex; align-items: center; gap: 1rem;
  padding: .95rem 1.25rem;
  font-weight: 600;
  font-size: 1.0925rem;
  color: var(--fg-2);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  margin-left: auto;
  font-family: var(--mono);
  font-size: 1.15rem;
  color: var(--amber);
  transition: transform .2s;
}
.faq details[open] summary { color: var(--fg); background: var(--panel); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq summary:hover { background: var(--panel); }
.faq .answer {
  padding: 0 1.25rem 1.15rem;
  max-width: var(--measure);
  color: var(--fg-3);
  font-size: 1.058rem;
}
.faq .answer p { margin: 0; }

/* ---------- Methodology ---------- */

.specs {
  border: 1px solid var(--line);
  margin-bottom: clamp(2.25rem, 5vw, 3.5rem);
}
.specs .row {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  border-bottom: 1px solid var(--line);
}
.specs .row:last-child { border-bottom: 0; }
.specs dt {
  padding: .8rem 1.1rem;
  border-right: 1px solid var(--line);
  background: var(--panel);
  font-family: var(--mono);
  font-size: 0.782rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-4);
}
.specs dd {
  margin: 0;
  padding: .8rem 1.1rem;
  color: var(--fg-3);
  font-size: 1.035rem;
  max-width: 82ch;
}
.specs dd .mono { color: var(--fg-2); font-size: 0.966rem; }

/* ---------- Footer ---------- */

.footer { padding: 2.5rem 0 3rem; }
.footer-top {
  display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.5rem;
}
.footer nav { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.footer nav a {
  font-family: var(--mono);
  font-size: 0.805rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.footer nav a:hover { color: var(--amber); }
.footer .fine { max-width: 92ch; color: var(--fg-4); font-size: 0.92rem; }
.footer .fine p { margin: 0 0 .55rem; }
.footer .fine b { color: var(--fg-3); font-weight: 600; letter-spacing: .06em; font-family: var(--mono); font-size: 0.805rem; text-transform: uppercase; }
.footer .sig-line {
  margin-top: 1.25rem;
  font-family: var(--mono);
  font-size: 0.759rem;
  letter-spacing: .06em;
  color: var(--fg-4);
}

/* ---------- Simple page (llm-info) ---------- */

.page { padding: clamp(2rem, 5vw, 3.5rem) 0 4rem; }
.page h1 {
  overflow-wrap: break-word;
  font-size: clamp(1.55rem, 4.025vw, 2.415rem);
  text-transform: uppercase;
  font-stretch: 108%;
  line-height: 1.1;
  margin: .5rem 0 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}
.page .doc-body { max-width: 84ch; }
.page .doc-body h2 {
  font-family: var(--mono);
  font-size: 0.851rem;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--amber);
  margin: 2.25rem 0 .8rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.page .doc-body p { color: var(--fg-3); margin: 0 0 1rem; }
.page .doc-body ul { margin: 0 0 1rem; padding-left: 1.1rem; color: var(--fg-3); }
.page .doc-body li { margin-bottom: .4rem; }
.page .doc-body li::marker { color: var(--amber-dim); }
.page .doc-body strong { color: var(--fg); font-weight: 600; }

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  .fade { animation: fade .5s ease-out both; }
  .fade:nth-child(2) { animation-delay: .06s; }
  .fade:nth-child(3) { animation-delay: .12s; }
  @keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  .desk-grid { grid-template-columns: minmax(0, 380px) minmax(0, 1fr); }
  .px { font-size: 3.5rem; }
  .rail { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rail > div:nth-child(3) { border-right: 0; }
  .rail > div:nth-child(n+4) { border-top: 1px solid var(--line); }
  .doc { grid-template-columns: 250px minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .desk-grid { grid-template-columns: 1fr; }
  /* full-width column again, so the price can scale with the viewport */
  .px { font-size: clamp(2.6rem, 11vw, 4.485rem); }
  .quote { border-right: 0; border-bottom: 1px solid var(--line); }
  .split { grid-template-columns: 1fr; }
  .calc { border-left: 0; border-top: 1px solid var(--line); }
  .factors { grid-template-columns: 1fr; }
  .factor { border-right: 0; }
  .factor:nth-last-child(-n+2) { border-bottom: 1px solid var(--line); }
  .factor:last-child { border-bottom: 0; }
  .metals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metals > div:nth-child(2n) { border-right: 0; }
  .metals > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .doc { grid-template-columns: 1fr; }
  .toc { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .toc ol { columns: 2; column-gap: 0; }
  .doc-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc-meta div:nth-child(2n) { border-right: 0; }
  .doc-meta div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .specs .row { grid-template-columns: 1fr; }
  .specs dt { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 640px) {
  .strip .wrap { gap: .9rem; }
  .strip-l .hide-s, .strip-r .hide-s { display: none; }
  .rail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rail > div:nth-child(3) { border-right: 1px solid var(--line); }
  .rail > div:nth-child(2n) { border-right: 0; }
  .rail > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .metals { grid-template-columns: 1fr; }
  .metals > div { border-right: 0; border-top: 1px solid var(--line); }
  .metals > div:first-child { border-top: 0; }
  .mod-head .sub { padding-left: 0; }
  .calc .fields { grid-template-columns: 1fr; }
  .toc ol { columns: 1; }
  .chart { height: 248px; }
  /* Fit the karat table to the viewport instead of making it scroll:
     drop the two secondary unit columns and let the purity descriptor wrap,
     so no value is ever visually cut off. */
  .dtable th:nth-child(4), .dtable td:nth-child(4),
  .dtable th:nth-child(5), .dtable td:nth-child(5) { display: none; }
  .dtable th, .dtable td { padding: .6rem .55rem; }
  .dtable td:first-child, .dtable .fine { white-space: normal; }
  .units { grid-template-columns: 1fr; }
  .units div { border-right: 0; border-bottom: 1px solid var(--line); }
  .units div:last-child { border-bottom: 0; }
}

@media (max-width: 420px) {
  /* Two metadata columns leave too little room for a full domain or a
     date range at this width, so stack them. */
  .doc-meta { grid-template-columns: 1fr; }
  .doc-meta div,
  .doc-meta div:nth-child(2n) { border-right: 0; border-top: 1px solid var(--line); }
  .doc-meta div:first-child { border-top: 0; }
}
