@font-face {
  font-family: 'Bodoni Moda';
  src: url('/fonts/bodoni-moda-latin.woff2') format('woff2');
  font-weight: 400 600;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('/fonts/ibm-plex-sans-latin.woff2') format('woff2');
  font-weight: 100 700;
  font-display: swap;
}

:root {
  --ground: #0d1814;   /* bottle green, almost black */
  --raised: #13221c;
  --rule: #2a3c34;
  --text: #e4e1d5;
  --muted: #a0aba2;
  --gold: #c8a85e;     /* flat, matte gold */
  --silver: #c3c9c8;
  --serif: 'Bodoni Moda', 'Didot', 'Bodoni 72', Georgia, serif;
  --sans: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  --measure: 68ch;
  --page: 70rem;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font: 400 1.0625rem/1.6 var(--sans);
  font-variant-numeric: tabular-nums lining-nums;
}

a { color: var(--gold); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--text); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.15; margin: 0; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 1rem; top: -3rem; background: var(--gold); color: var(--ground); padding: 0.5rem 1rem; z-index: 2; }
.skip:focus { top: 1rem; }

/* ---------- masthead ---------- */

.masthead {
  max-width: var(--page);
  margin: 0 auto;
  padding: 1.75rem 1.5rem 1.25rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem 2rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--rule);
}
.wordmark {
  font-family: var(--serif);
  font-size: 1.9rem;
  letter-spacing: 0.04em;
  color: var(--gold);
  text-decoration: none;
  line-height: 1;
}
.masthead ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 1.75rem; flex-wrap: wrap; }
.masthead nav a { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.masthead nav a:hover { color: var(--text); }

main { max-width: var(--page); margin: 0 auto; padding: 0 1.5rem; }

/* ---------- live price ---------- */

.price { padding: 3.5rem 0 3rem; border-bottom: 1px solid var(--rule); }
.price-head {
  display: flex; justify-content: space-between; align-items: end;
  gap: 1.5rem 3rem; flex-wrap: wrap; margin-bottom: 2.75rem;
}
.price h1 { font-size: clamp(1.6rem, 3.2vw, 2.25rem); max-width: 30ch; text-wrap: balance; }
h1, h2, h3 { text-wrap: balance; }

.units { border: 0; margin: 0; padding: 0; display: flex; gap: 1.5rem; }
.units label, .toggle label { cursor: pointer; position: relative; }
.units input, .toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.units span {
  display: inline-block; padding: 0.3rem 0; color: var(--muted);
  border-bottom: 1px solid transparent; font-size: 0.95rem;
}
.units input:checked + span { color: var(--text); border-bottom-color: var(--gold); }
.units input:focus-visible + span, .toggle input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 3px; }

.metals { display: grid; grid-template-columns: 1fr 1fr; }
.metal { display: grid; grid-template-columns: auto 1fr; gap: 1.75rem; align-items: start; padding: 0.5rem 0; }
.metal + .metal { border-left: 1px solid var(--rule); padding-left: 3rem; }
.symbol {
  font-family: var(--serif);
  font-size: clamp(3.5rem, 7vw, 5.75rem);
  line-height: 0.8;
  font-weight: 400;
  color: transparent;
  -webkit-text-stroke: 1px var(--gold);
  letter-spacing: -0.02em;
}
.metal-silver .symbol { -webkit-text-stroke-color: var(--silver); }
@supports not (-webkit-text-stroke: 1px black) { .symbol { color: var(--gold); } .metal-silver .symbol { color: var(--silver); } }

.metal h2 { font-size: 1.25rem; color: var(--muted); margin-bottom: 0.35rem; }
.figure {
  margin: 0;
  font-weight: 300;
  font-size: clamp(2.4rem, 5.4vw, 4.25rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--gold);
}
.metal-silver .figure { color: var(--silver); }
.per { margin: 0.35rem 0 1.25rem; color: var(--muted); font-size: 0.95rem; }
.others { margin: 0; display: flex; gap: 0.5rem 2rem; flex-wrap: wrap; }
.others div { display: flex; flex-direction: column; }
.others dt { color: var(--muted); font-size: 0.85rem; }
.others dd { margin: 0; font-size: 1.05rem; }

.quote { margin-top: 2.5rem; color: var(--muted); font-size: 0.92rem; max-width: var(--measure); }
.quote p { margin: 0 0 0.4rem; }
#price-alert:empty { display: none; }
#price-alert { color: var(--text); }

/* ---------- calculators ---------- */

.calculators { padding: 3.5rem 0; border-bottom: 1px solid var(--rule); }
.calculators > h2, .guides > h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); margin-bottom: 1.75rem; }

.spot { border: 1px solid var(--rule); padding: 1.25rem 1.5rem 0.75rem; margin: 0 0 2rem; }
.spot legend { padding: 0 0.5rem; margin-left: -0.5rem; color: var(--muted); font-size: 0.92rem; }
.spot-fields { display: flex; gap: 1rem 2rem; flex-wrap: wrap; align-items: end; }
.spot-fields label { display: flex; align-items: center; gap: 0.75rem; }
.spot-fields input { width: 9rem; }

input[type="text"], select {
  font: inherit;
  color: var(--text);
  background: var(--raised);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.55rem 0.7rem;
  min-height: 2.75rem;
}
input[type="text"]:hover, select:hover { border-color: #3f544a; }
input[type="text"]:focus-visible, select:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }
select { appearance: none; padding-right: 2.25rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23a0aba2' stroke-width='1.2'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.8rem center; }

button {
  font: inherit; font-size: 0.92rem; color: var(--gold); background: none;
  border: 1px solid var(--gold); border-radius: 2px; padding: 0.55rem 0.9rem; min-height: 2.75rem; cursor: pointer;
}
button:hover { background: var(--gold); color: var(--ground); }

.hint { color: var(--muted); font-size: 0.92rem; margin: 0.6rem 0; }

.calcs { display: grid; grid-template-columns: 1fr 1fr; gap: 0 4rem; }
.calc { display: flex; flex-direction: column; gap: 1rem; }
.calc + .calc { border-left: 1px solid var(--rule); padding-left: 4rem; }
.calc h3 { font-size: 1.5rem; }
.calc .hint { margin: -0.4rem 0 0.25rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; color: var(--muted); font-size: 0.92rem; }
.field input, .field select { color: var(--text); font-size: 1.0625rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.custom { display: flex; flex-direction: column; gap: 1rem; }
.custom[hidden] { display: none; }

.toggle { border: 0; margin: 0; padding: 0; display: flex; gap: 0; }
.toggle legend { color: var(--muted); font-size: 0.92rem; margin-bottom: 0.35rem; padding: 0; }
.toggle span {
  display: inline-block; padding: 0.5rem 1.1rem; border: 1px solid var(--rule); color: var(--muted); min-height: 2.75rem; line-height: 1.6;
}
.toggle label + label span { border-left: 0; }
.toggle input:checked + span { color: var(--ground); background: var(--gold); border-color: var(--gold); }

output { display: flex; flex-direction: column; gap: 0.25rem; padding: 1.25rem 0 0.25rem; border-top: 1px solid var(--rule); margin-top: 0.5rem; }
output .result { font-size: clamp(2rem, 4vw, 2.75rem); font-weight: 300; color: var(--gold); line-height: 1.1; }
output .sub { color: var(--muted); font-size: 0.92rem; }
.caveat { font-size: 0.88rem; color: var(--muted); margin: 0; padding-left: 0.9rem; border-left: 1px solid var(--gold); }

/* ---------- guides list ---------- */

.guides { padding: 3.5rem 0 4rem; }
.guide-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.guide-list li { border-bottom: 1px solid var(--rule); }
.guide-list a {
  display: grid; grid-template-columns: minmax(0, 26rem) minmax(0, 1fr); gap: 0.25rem 3rem;
  padding: 1.35rem 0; text-decoration: none; color: var(--text);
}
.g-title { font-family: var(--serif); font-size: 1.3rem; line-height: 1.3; }
.g-desc { color: var(--muted); }
.guide-list a:hover .g-title { color: var(--gold); }

/* ---------- articles ---------- */

.article { padding: 3.5rem 0 4rem; max-width: var(--measure); }
.article .crumb { font-size: 0.92rem; margin: 0 0 1.5rem; }
.article .crumb a { color: var(--muted); }
.article h1 { font-size: clamp(2rem, 4.5vw, 2.9rem); margin-bottom: 1.25rem; }
.article .standfirst { font-size: 1.2rem; color: var(--muted); margin: 0 0 2.5rem; }
.article h2 { font-size: 1.6rem; margin: 2.75rem 0 0.9rem; }
.article h3 { font-size: 1.2rem; margin: 2rem 0 0.6rem; }
.article p, .article li { line-height: 1.7; }
.article ul, .article ol { padding-left: 1.25rem; }
.article li { margin-bottom: 0.4rem; }
.article .reviewed { color: var(--muted); font-size: 0.92rem; }
.article blockquote { margin: 1.5rem 0; padding: 0.25rem 0 0.25rem 1.25rem; border-left: 1px solid var(--gold); color: var(--text); font-family: var(--serif); font-size: 1.1rem; }
.article blockquote p { margin: 0 0 0.5rem; }
.article cite { font-family: var(--sans); font-style: normal; color: var(--muted); font-size: 0.88rem; }

.table-wrap { overflow-x: auto; margin: 1.5rem 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.97rem; }
th, td { text-align: left; padding: 0.6rem 1.25rem 0.6rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 500; color: var(--muted); font-size: 0.88rem; }
td.n { font-variant-numeric: tabular-nums; }

.sources { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); font-size: 0.95rem; }
.sources h2 { font-size: 1.25rem; margin-top: 0; }

/* ---------- footer ---------- */

.colophon {
  max-width: var(--page); margin: 0 auto; padding: 2rem 1.5rem 3rem;
  border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.9rem;
}
.colophon p { margin: 0 0 0.6rem; max-width: var(--measure); }
.colophon .notice { color: var(--text); }
.colophon a + a { margin-left: 1.25rem; }

/* ---------- small screens ---------- */

@media (max-width: 52rem) {
  .metals, .calcs { grid-template-columns: 1fr; }
  .metal + .metal { border-left: 0; padding-left: 0; border-top: 1px solid var(--rule); padding-top: 2rem; margin-top: 1.5rem; }
  .calc + .calc { border-left: 0; padding-left: 0; border-top: 1px solid var(--rule); padding-top: 2.5rem; margin-top: 2.5rem; }
  .guide-list a { grid-template-columns: 1fr; }
}
@media (max-width: 30rem) {
  .masthead, main, .colophon { padding-left: 1rem; padding-right: 1rem; }
  .masthead ul { gap: 1.1rem; }
  .price { padding-top: 2.25rem; }
  .metal { gap: 1rem; }
  .units { gap: 1.1rem; }
  .field-row { grid-template-columns: 1fr; }
  .spot-fields input { width: 7.5rem; }
}
