/* Green and gold: deep green carries the brand (header, buttons, headline), gold is
   the accent (highlights, selection, the cheapest result). The page itself stays a
   calm warm white so prices are easy to read. */
:root {
  --bg: #f4f3ea;
  --surface: #fffefa;
  --ink: #15241d;
  --muted: #5c675f;
  --line: #dcdccb;
  --brand: #0d4a35;
  --header-bg: #0d4a35;
  --header-ink: #f6f1df;
  --header-muted: #b5c8bc;
  --accent: #86660a;
  --accent-soft: #f5eabf;
  --button: #0d4a35;
  --button-ink: #fffdf3;
  --good: #17683c;
  --warn: #8a4b10;
  --warn-soft: #fbeedd;
  --gold: #d4a91c;
  --gold-bright: #e9c349;
  --silver: #98a1ab;
  --platinum: #6f8fa3;
  --radius: 14px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1410;
    --surface: #121e19;
    --ink: #edf0e6;
    --muted: #9aa69e;
    --line: #23342c;
    --brand: #edf0e6;
    --header-bg: #0e3023;
    --header-ink: #f3eedb;
    --header-muted: #a9bdb1;
    --accent: #e3bd4f;
    --accent-soft: #2b2912;
    --button: #e3bd4f;
    --button-ink: #10201a;
    --good: #74cf95;
    --warn: #e7a968;
    --warn-soft: #2c2114;
  }
}

* { box-sizing: border-box; }

/* The hidden attribute must win over any display rule below. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Top bar: brand, spot prices, countdown */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 8px clamp(16px, 4vw, 40px);
  background: var(--header-bg);
  color: var(--header-ink);
  border-bottom: 2px solid var(--gold);
}

/* Logo: Australia cut into five gold bars, with the name stacked beside it */
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  white-space: nowrap;
}
.brand-mark { width: 41px; height: 38px; flex: none; }
.mark-gold { fill: var(--gold-bright); }
.brand-name {
  display: flex;
  flex-direction: column;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.17em;
  line-height: 1.22;
  text-transform: uppercase;
}
.brand-name span { color: var(--gold-bright); }

.spot {
  display: flex;
  flex: 1;
  justify-content: center;
  gap: clamp(12px, 3vw, 32px);
  margin: 0;
  min-width: 0;
}
.spot-item { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.spot-item dt {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--header-muted);
}
.spot-item dd { margin: 0; font-weight: 600; }
/* Movement over the last 24 hours */
.spot-change { margin-left: 7px; font-size: 0.76rem; font-weight: 600; white-space: nowrap; }
.spot-up { color: #8fe3a9; }
.spot-down { color: #ffa392; }
.spot-flat { color: var(--header-muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-gold { background: var(--gold); }
.dot-silver { background: var(--silver); }
.dot-platinum { background: var(--platinum); }

.countdown { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; white-space: nowrap; }
.countdown-label { font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--header-muted); }
.countdown-time { font-size: 1.15rem; font-weight: 700; color: var(--gold-bright); }

/* Anything else that sits in the green header (admin page) */
.topbar .admin-user { color: var(--header-muted); }
.topbar .dialog-close { color: var(--ink); }

main {
  max-width: 980px;
  margin: 0 auto;
  padding: clamp(20px, 4vw, 44px) clamp(16px, 4vw, 40px) 40px;
}

.intro h1 {
  margin: 0 0 6px;
  color: var(--brand);
  font-family: var(--serif);
  font-size: clamp(1.7rem, 4.5vw, 2.6rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.intro p { margin: 0; color: var(--muted); }

/* Picker */
.picker {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 28px;
  margin-top: 28px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.picker-group { display: flex; flex-direction: column; gap: 8px; }
.picker-group-wide { flex: 1; min-width: 240px; }
/* Starts a new line, so the weights sit on their own row. */
.picker-break { flex-basis: 100%; height: 0; }
.picker-label { font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

button { font: inherit; color: inherit; cursor: pointer; }

.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--bg); }
.segmented button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
}
.segmented button[aria-pressed="true"] { background: var(--button); color: var(--button-ink); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
}
.chips button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.chips button:disabled { border-style: dashed; color: var(--muted); opacity: 0.55; cursor: not-allowed; }
.chips button:disabled:hover { background: var(--bg); }

.segmented button:hover, .chips button:hover { background-color: color-mix(in srgb, var(--ink) 8%, transparent); }
.segmented button[aria-pressed="true"]:hover { background: var(--button); }

.notice {
  margin: 16px 0 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.92rem;
}

/* Cheapest seller */
.best {
  margin-top: 20px;
  padding: clamp(18px, 3vw, 28px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--gold);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 24px;
  align-items: end;
}
.best[data-metal="silver"] { border-left-color: var(--silver); }
.best[data-metal="platinum"] { border-left-color: var(--platinum); }
.best:empty { display: none; }
.best-eyebrow { font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); font-weight: 700; margin: 0; }
.best-seller { margin: 2px 0 0; font-family: var(--serif); font-size: clamp(1.4rem, 3.5vw, 2rem); line-height: 1.15; letter-spacing: -0.01em; }
.best-product { margin: 4px 0 0; color: var(--muted); }
.best-saving { margin: 10px 0 0; color: var(--good); font-weight: 600; }
.best-side { text-align: right; }
.best-price { font-size: clamp(1.8rem, 5vw, 2.7rem); font-weight: 700; line-height: 1.05; letter-spacing: -0.02em; }
.best-meta { color: var(--muted); font-size: 0.92rem; margin-top: 4px; }
.best-link {
  display: inline-block;
  margin-top: 12px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--button);
  color: var(--button-ink);
  font-weight: 600;
  text-decoration: none;
}
.best-link:hover { opacity: 0.88; }

/* Ranking */
.ranking { margin-top: 28px; }
.ranking-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ranking h2 { margin: 0; font-family: var(--serif); font-size: 1.3rem; }
.checked { margin: 0; color: var(--muted); font-size: 0.88rem; }

.rows { list-style: none; margin: 12px 0 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 4px 14px;
  align-items: center;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}
.row:first-child { border-top: 0; }
.row-rank { color: var(--muted); font-weight: 600; text-align: center; }
.row-seller { font-weight: 600; }
.row-product { color: var(--muted); font-size: 0.92rem; overflow-wrap: anywhere; }
.row-product a { text-decoration-color: color-mix(in srgb, var(--muted) 50%, transparent); text-underline-offset: 3px; }
.row-product a:hover { color: var(--ink); }
.row-price { text-align: right; white-space: nowrap; }
.row-each { font-weight: 700; font-size: 1.08rem; }
.row-sub { color: var(--muted); font-size: 0.86rem; }
.row-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag { font-size: 0.74rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.tag-warn { border-color: transparent; background: var(--warn-soft); color: var(--warn); }
.tag-good { border-color: transparent; background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
.row-best { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
.row-muted .row-seller, .row-muted .row-each { color: var(--muted); font-weight: 500; }

.skeleton { padding: 28px 18px; color: var(--muted); }

.footer {
  max-width: 980px;
  margin: 0 auto;
  padding: 8px clamp(16px, 4vw, 40px) 48px;
  color: var(--muted);
  font-size: 0.85rem;
}
.footer p { margin: 0 0 8px; max-width: 72ch; }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 8px 16px; }
  /* Brand stays first; anything else in the header follows it */
  .brand { order: 0; }
  .countdown { order: 1; margin-left: auto; }
  .spot { order: 3; flex-basis: 100%; justify-content: space-between; gap: 8px; }
  /* Phone: label, price and 24-hour movement stacked in three short lines per metal */
  .spot-item { flex-direction: column; gap: 0; align-items: flex-start; }
  .spot-item dd { display: flex; flex-direction: column; }
  .spot-change { margin-left: 0; }
  .best { grid-template-columns: 1fr; }
  .best-side { text-align: left; }
  .row { grid-template-columns: 24px minmax(0, 1fr); padding: 14px; }
  .row-price { grid-column: 2; text-align: left; white-space: normal; }
}

@media (prefers-reduced-motion: no-preference) {
  .segmented button, .chips button, .best-link { transition: background-color 0.15s ease, opacity 0.15s ease; }
}

/* Seller name, rating and trust in a row */
.row-seller { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.seller-button {
  padding: 0;
  border: 0;
  background: none;
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--ink) 25%, transparent);
  text-underline-offset: 3px;
}
.seller-button:hover { text-decoration-color: var(--accent); }
.seller-meta { color: var(--muted); font-size: 0.82rem; font-weight: 500; white-space: nowrap; }
.row-muted .seller-button { color: var(--muted); font-weight: 500; }

/* Seller profile panel */
.profile {
  width: min(640px, calc(100vw - 24px));
  max-height: min(86vh, 900px);
  padding: clamp(18px, 4vw, 28px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  overflow-y: auto;
}
.profile::backdrop { background: rgb(0 0 0 / 0.5); }
.profile-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.profile-header h2 { margin: 0; font-family: var(--serif); font-size: 1.6rem; line-height: 1.15; }
.profile-site { color: var(--muted); font-size: 0.9rem; }
.dialog-close {
  flex: none;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
}
.trust-line { margin: 14px 0 0; }
.profile-description { margin: 14px 0 0; }
.profile-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.profile-section h3 { margin: 0 0 10px; font-family: var(--serif); font-size: 1.1rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 14px 0 0; }
.profile-section .facts { margin-top: 0; }
.facts dt { color: var(--muted); font-size: 0.9rem; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.profile-section p { margin: 10px 0 0; }

.stars { color: var(--gold); letter-spacing: 1px; }
.review-overall { font-weight: 600; }
.review-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 14px; }
.review-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.review-name { font-weight: 600; }
.review-text { margin: 4px 0 0; white-space: pre-line; overflow-wrap: anywhere; }

.review-form { display: grid; gap: 14px; }
.rating { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; border: 0; }
.rating legend { padding: 0; margin-bottom: 6px; font-size: 0.9rem; color: var(--muted); }
.rating label { display: inline-flex; align-items: center; cursor: pointer; }
.rating input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rating span { display: inline-block; min-height: 38px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); }
.rating input:checked + span { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.rating input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 0.9rem; color: var(--muted); }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}
.field textarea { resize: vertical; }
.primary {
  justify-self: start;
  min-height: 42px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--button);
  color: var(--button-ink);
  font-weight: 600;
}
.primary:disabled { opacity: 0.6; cursor: default; }
.form-message { margin: 0; color: var(--warn); min-height: 1.2em; }
.form-thanks { margin: 0; color: var(--good); font-weight: 600; }
.visually-hidden { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

@media (max-width: 720px) {
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dd { margin-bottom: 8px; }
}

/* Sponsored banners: visibly separate from the comparison results */
.ad { margin-top: 20px; }
.ad-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border: 1px dashed color-mix(in srgb, var(--muted) 55%, transparent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  text-decoration: none;
}
.ad-link:hover { border-style: solid; border-color: var(--accent); }
.ad-label {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ad-text { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; min-width: 0; flex: 1; }
.ad-name { font-family: var(--serif); font-size: 1.15rem; font-weight: 700; overflow-wrap: anywhere; }
.ad-tagline { color: var(--muted); font-size: 0.92rem; overflow-wrap: anywhere; }
.ad-host { flex: none; color: var(--muted); font-size: 0.82rem; }
.ad-empty .ad-name { color: var(--muted); }

@media (max-width: 720px) {
  .ad-link { flex-wrap: wrap; gap: 6px 12px; }
  .ad-text { flex-basis: 100%; order: 3; }
  .ad-host { margin-left: auto; }
}

/* Community section and feature request page */
.community {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 28px;
  margin-top: 32px;
  padding: clamp(18px, 3vw, 26px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius);
}
.community > div { flex: 1; min-width: 260px; }
.community h2 { margin: 0 0 6px; font-family: var(--serif); font-size: 1.3rem; color: var(--brand); }
.community p { margin: 0; color: var(--muted); max-width: 68ch; }
.button-link {
  display: inline-block;
  flex: none;
  padding: 11px 20px;
  border-radius: 999px;
  background: var(--button);
  color: var(--button-ink);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.button-link:hover { opacity: 0.88; }

.topbar-link { margin-left: auto; color: var(--header-ink); font-size: 0.92rem; text-underline-offset: 3px; }
main.narrow { max-width: 680px; }
.request-form {
  margin-top: 24px;
  padding: clamp(18px, 4vw, 28px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.name-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.request-thanks {
  margin-top: 24px;
  padding: clamp(18px, 4vw, 28px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius);
}
.request-thanks h2 { margin: 0 0 6px; font-family: var(--serif); color: var(--brand); }
.request-thanks p { margin: 0 0 16px; color: var(--muted); }

/* About section: what the site does, in plain text */
.about { margin-top: 36px; max-width: 76ch; }
.about h2 { margin: 0 0 8px; font-family: var(--serif); font-size: 1.35rem; color: var(--brand); }
.about h3 { margin: 22px 0 8px; font-family: var(--serif); font-size: 1.08rem; }
.about p { margin: 0; color: var(--muted); }
.about ul { margin: 0; padding-left: 20px; color: var(--muted); display: grid; gap: 4px; }
.about strong { color: var(--ink); font-weight: 600; }
.about details { border-top: 1px solid var(--line); padding: 10px 0; }
.about details:last-of-type { border-bottom: 1px solid var(--line); }
.about summary { cursor: pointer; font-weight: 600; }
.about details p { margin-top: 8px; }

/* Privacy policy page */
.policy { margin-top: 20px; }
.policy h2 { margin-top: 30px; }
.policy h3 { margin: 18px 0 6px; }
.policy p + p, .policy ul + p, .policy p + ul { margin-top: 10px; }
.policy a { text-underline-offset: 3px; }
.policy code { font-size: 0.92em; }
