/* Pearl Monetary — the central-bank desk. Mint/engraving aesthetic:
   deep ink, engraved gold, parchment type. Pearl brand family (dark, luminous). */
:root {
  --ink: #12100a;
  --ink-2: #1a1710;
  --panel: #1c1811;
  --gold: #d4af37;
  --gold-dim: #ab9348;
  --parch: #ece2c8;
  --parch-dim: #b3a67f;
  --teal: #5fd4c4;
  --red: #e0685c;
  --line: #3a3220;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--ink); color: var(--parch);
  font-family: var(--sans); line-height: 1.55;
  background-image:
    repeating-linear-gradient(45deg, rgba(212,175,55,.015) 0 2px, transparent 2px 8px);
}
h1, h2, h3 { font-family: var(--serif); color: var(--gold); letter-spacing: .02em; }
code { font-family: var(--mono); font-size: .92em; color: var(--gold); }
.mono { font-family: var(--mono); }
.hint { color: var(--parch-dim); font-size: .88rem; }
.dim { color: var(--parch-dim); }
.spacer { flex: 1; }

/* ---------- hero ---------- */
.hero {
  border-bottom: 3px double var(--gold-dim);
  padding: 2.2rem 1.2rem 1.2rem;
  background:
    radial-gradient(ellipse 60% 90% at 50% -20%, rgba(212,175,55,.10), transparent),
    var(--ink-2);
  text-align: center;
}
.seal {
  font-size: 2.6rem; color: var(--gold); line-height: 1;
  text-shadow: 0 0 18px rgba(212,175,55,.5);
}
.kicker { color: var(--gold-dim); text-transform: uppercase; letter-spacing: .28em; font-size: .78rem; margin: .6rem 0 .2rem; }
.hero h1 { font-size: 2.6rem; margin: .1rem 0 .6rem; font-weight: 600; }
.hero .sub { max-width: 62rem; margin: 0 auto 1.2rem; color: var(--parch); }
.hero-inner { max-width: 72rem; margin: 0 auto; }
.tabs { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }
.tabs button {
  font-family: var(--serif); font-size: 1rem;
  background: transparent; color: var(--parch-dim);
  border: 1px solid var(--line); border-radius: 2px;
  padding: .55rem 1.1rem; cursor: pointer;
}
.tabs button:hover { border-color: var(--gold-dim); color: var(--parch); }
.tabs button.active {
  color: var(--ink); background: var(--gold); border-color: var(--gold);
  font-weight: 700;
}

/* ---------- honest limits ---------- */
.limits {
  border-bottom: 1px solid var(--line);
  background: rgba(212,175,55,.05);
  padding: .9rem 1.2rem; font-size: .88rem;
}
.limits > div { max-width: 72rem; margin: 0 auto; }
.limits strong { color: var(--gold); }
.limits ul { margin: .4rem 0 0; padding-left: 1.2rem; color: var(--parch-dim); }
.limits li { margin: .15rem 0; }

/* ---------- panels ---------- */
main { max-width: 72rem; margin: 0 auto; padding: 1.4rem 1.2rem 3rem; }
.panel { display: none; }
.panel.active { display: block; }
.panel > h2:first-child { margin-top: .2rem; }
.bar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: 1rem 0; }
.badge {
  font-family: var(--mono); font-size: .78rem; padding: .25rem .7rem;
  border-radius: 999px; border: 1px solid;
}
.badge.live { color: #7fe6a8; border-color: #2c6b44; background: rgba(80,200,120,.08); }
.badge.stale { color: var(--gold); border-color: var(--gold-dim); background: rgba(212,175,55,.10); }
.badge.manual { color: var(--teal); border-color: #2c6b63; background: rgba(95,212,196,.08); }
label.inline { display: inline-flex; align-items: center; gap: .4rem; color: var(--parch-dim); font-size: .9rem; }
input, button, select { font-size: .95rem; }
input {
  background: var(--ink-2); color: var(--parch);
  border: 1px solid var(--line); border-radius: 2px; padding: .5rem .6rem;
}
input:focus { outline: 1px solid var(--gold-dim); border-color: var(--gold-dim); }
button {
  background: var(--gold); color: var(--ink); border: 1px solid var(--gold);
  border-radius: 2px; padding: .5rem 1rem; cursor: pointer; font-weight: 600;
}
button:hover { filter: brightness(1.08); }
button.ghost { background: transparent; color: var(--gold); border-color: var(--gold-dim); }
button.ghost:hover { border-color: var(--gold); }

/* ---------- stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr)); gap: .8rem; margin: 1rem 0 1.6rem; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 3px;
  padding: .9rem 1rem; position: relative; overflow: hidden;
}
.stat::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}
.stat .k { font-size: .74rem; text-transform: uppercase; letter-spacing: .14em; color: var(--parch-dim); }
.stat .v { font-family: var(--serif); font-size: 1.35rem; color: var(--parch); margin: .2rem 0; overflow-wrap: anywhere; }
.stat .v.gold { color: var(--gold); }
.stat .n { font-size: .78rem; color: var(--parch-dim); }
.prog { height: 1.1rem; background: var(--ink-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin: .5rem 0; }
.prog > div { height: 100%; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); }
.prog-labels { display: flex; justify-content: space-between; font-size: .8rem; color: var(--parch-dim); font-family: var(--mono); }

/* ---------- chart ---------- */
.chart-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 3px; padding: .6rem; overflow-x: auto; }
.chart-wrap svg { display: block; min-width: 640px; width: 100%; height: auto; }
.legend { display: flex; gap: 1.4rem; margin: .7rem 0; font-size: .88rem; color: var(--parch-dim); }
.sw { display: inline-block; width: 1.6rem; height: .55rem; border-radius: 2px; margin-right: .4rem; vertical-align: middle; }
.sw.gold { background: var(--gold); }
.sw.teal { background: var(--teal); }
.sw.marker { background: var(--red); }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 3px; }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th, table.data td { padding: .6rem .8rem; text-align: right; border-bottom: 1px solid var(--line); }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data thead th {
  font-family: var(--serif); color: var(--gold); background: var(--ink-2);
  white-space: nowrap;
}
table.data tbody tr:hover { background: rgba(212,175,55,.05); }
table.data td { font-family: var(--mono); }

/* ---------- tools ---------- */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: 1rem; }
.tool {
  background: var(--panel); border: 1px solid var(--line); border-radius: 3px;
  padding: 1rem 1.1rem;
}
.tool h3 { margin-top: 0; }
.tool label { display: block; margin: .5rem 0; font-size: .88rem; color: var(--parch-dim); }
.tool input { width: 100%; margin-top: .25rem; }
.tool .out { margin-top: .7rem; font-size: .92rem; }
.out table { width: 100%; border-collapse: collapse; }
.out td { padding: .22rem 0; border-bottom: 1px dotted var(--line); }
.out td:first-child { color: var(--parch-dim); width: 46%; }
.out td:last-child { font-family: var(--mono); text-align: right; }
.out .big { font-family: var(--serif); font-size: 1.35rem; color: var(--gold); }

/* ---------- methodology ---------- */
.formula {
  background: var(--ink-2); border: 1px solid var(--line); border-left: 3px solid var(--gold);
  padding: 1rem 1.2rem; overflow-x: auto; font-size: .92rem;
}
.sources li { margin: .45rem 0; }

/* ---------- footer ---------- */
footer {
  border-top: 3px double var(--gold-dim); text-align: center;
  padding: 1.6rem 1rem 2.2rem; color: var(--parch-dim); font-size: .9rem;
}
footer a { color: var(--gold); }
.foot-brand { font-family: var(--serif); color: var(--parch); }
.donate code { color: var(--gold); word-break: break-all; }

@media (max-width: 560px) {
  .hero h1 { font-size: 2rem; }
  .stat .v { font-size: 1.25rem; }
}

/* Keyboard focus: a visible ring in this app's accent on every interactive element (fleet focus-visible pass). */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Skip link: the first Tab stop on the page — parked off-screen until keyboard focus reveals it (fleet skip-link pass). */
.skip-link { position: absolute; left: 12px; top: -64px; z-index: 1000; padding: 10px 16px; border: 2px solid var(--gold); border-radius: 8px; background: #0b0e14; color: var(--gold); font-weight: 700; text-decoration: none; transition: top .15s ease; }
.skip-link:focus-visible { top: 12px; }
main:focus { outline: none; }

/* Reduced motion: when the OS asks for reduced motion, animations and transitions finish near-instantly and scrolling is not smoothed (fleet reduced-motion pass). Near-zero durations — not animation: none — so fade-ins still land on their end state and no content can be stranded invisible. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
