/* The Ash Vault — market tracker
   High-contrast dark mode is the default (not a toggle).
   Body text meets WCAG AAA (>=7:1). UI, labels, and links meet at least 4.5:1;
   labels are also kept at AAA against the page and card backgrounds. */
:root {
  --bg: #0a0a0a;
  --bg-elev: #161616;
  --bg-inset: #1e1e1e;
  --ink: #ffffff;
  --ink-muted: #d0d0d0;
  --ink-faint: #c8c8c8;
  --line: #b0b0b0;
  --line-strong: #d0d0d0;
  --walnut: #000000;
  --walnut-2: #7EC8FF;
  --brass: #FFD84D;
  --brass-soft: #FFD56A;
  --link: #7EC8FF;
  --link-hover: #A6E3FF;
  --focus: #FFE14A;
  --verified: #0a0a0a;
  --verified-bg: #7CFFB2;
  --claimed: #0a0a0a;
  --claimed-bg: #FFD84D;
  --unverified: #0a0a0a;
  --unverified-bg: #E8E8E8;
  --empty: #FFD84D;
  --down: #FF8A80;
  --up: #6EFF9A;
  --banner-bg: #9B1C1C;
  --banner-fg: #ffffff;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
  --serif: "IBM Plex Serif", "Liberation Serif", "Noto Serif", Georgia, serif;
  --sans: "IBM Plex Sans", "Liberation Sans", "Noto Sans", ui-sans-serif, system-ui, sans-serif;
  --mono: "IBM Plex Mono", "ui-monospace", "SFMono-Regular", Menlo, Consolas, monospace;
  --wrap: 1180px;
  --radius: 10px;
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  background: var(--bg);
  color-scheme: dark;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
a:hover { color: var(--link-hover); }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
.watch-card:focus-visible,
.goods-card:focus-visible,
.segmented button:focus-visible,
.pager button:focus-visible,
.btn-quiet:focus-visible,
.section-nav a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
::placeholder {
  color: var(--ink-faint);
  opacity: 1;
}
.wrap { width: min(var(--wrap), calc(100% - 32px)); margin-inline: auto; }
.hidden { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

/* Quiet beta note (not a warning banner) */
.beta-note {
  background: var(--bg-elev);
  color: var(--ink-muted);
  text-align: center;
  font-size: 0.88rem;
  letter-spacing: 0.01em;
  text-transform: none;
  font-weight: 500;
  padding: 0.4rem 1rem;
  border-bottom: 1px solid var(--line);
}

/* Header */
.site-header {
  background: var(--walnut);
  color: var(--ink);
  padding: 1.6rem 0 1.4rem;
  border-bottom: 4px solid var(--brass);
}
.header-inner {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: flex-end;
}
.nameplate {
  margin: 0 0 0.15rem;
  font-family: var(--serif);
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brass-soft);
}
.site-header h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.header-meta { text-align: right; }
.updated { margin: 0; font-variant-numeric: tabular-nums; }
.ask-note { margin: 0.25rem 0 0; color: var(--ink-muted); font-size: 0.9rem; }

.caveat-band {
  background: #1a1500;
  color: #FFE9A8;
  font-size: 0.92rem;
  padding: 0.7rem 0;
  border-bottom: 2px solid var(--brass);
}
.section-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
}
.section-nav .wrap {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  padding: 0.35rem 0;
}
.section-nav a {
  text-decoration: none;
  color: var(--ink-muted);
  padding: 0.4rem 0.7rem;
  font-size: 0.88rem;
  white-space: nowrap;
  border-radius: 999px;
}
.section-nav a:hover { background: var(--bg-inset); color: var(--ink); }

.section { margin: 2.2rem 0 2.6rem; }
.section-head h2, .subhead {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
}
.section-head h2 { font-size: 1.7rem; }
.subhead { font-size: 1.2rem; margin-top: 1.6rem; }
.section-sub, .hint, .count-line {
  color: var(--ink-muted);
  margin: 0 0 1rem;
  font-size: 0.95rem;
}
.hint { max-width: 70ch; }

.error-banner {
  background: #3a0c0c;
  color: #FFD0C8;
  border: 1px solid #FF8A80;
  padding: 0.8rem 1rem;
  border-radius: var(--radius);
  margin: 1rem 0 0;
}

/* Stats */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.9rem;
}
.stat-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.05rem 1.05rem;
  box-shadow: var(--shadow);
  min-height: 100%;
}
.stat-card .label {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 650;
}
.stat-card .value {
  margin: 0.35rem 0 0.15rem;
  font-family: var(--serif);
  font-size: 1.85rem;
  font-weight: 600;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.stat-card .detail, .stat-card .delta {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-muted);
}
.delta.down { color: var(--down); }
.delta.up { color: var(--up); }
.stat-card ul { margin: 0.35rem 0 0; padding: 0; list-style: none; font-size: 0.88rem; }
.stat-card li { display: flex; justify-content: space-between; gap: 0.75rem; }
.stat-card .thin { color: var(--empty); font-size: 0.8rem; margin-top: 0.3rem; }

/* Ticker */
.ticker {
  background: var(--walnut);
  color: var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}
.ticker::before, .ticker::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2.4rem;
  z-index: 1;
  pointer-events: none;
}
.ticker::before { left: 0; background: linear-gradient(to right, var(--walnut), transparent); }
.ticker::after { right: 0; background: linear-gradient(to left, var(--walnut), transparent); }
.ticker-track {
  display: flex;
  width: max-content;
  animation: ticker 80s linear infinite;
  padding: 0.7rem 0;
}
.ticker:hover .ticker-track, .ticker:focus-within .ticker-track { animation-play-state: paused; }
@keyframes ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.ticker-item {
  display: inline-flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0 1.6rem;
  border-right: 1px solid #b0b0b0;
  white-space: nowrap;
  color: inherit;
  text-decoration: none;
  font-size: 0.92rem;
}
.ticker-item:hover { color: var(--brass-soft); }
.ticker-date { color: var(--brass-soft); font-variant-numeric: tabular-nums; font-size: 0.8rem; }
.ticker-source { color: var(--ink-muted); font-size: 0.8rem; }

/* Watch list */
.watch-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
}
.watch-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  box-shadow: var(--shadow);
}
.watch-card:hover { border-color: var(--brass); }
.watch-card.is-active { border-color: var(--brass); background: #1e1e1e; }
.watch-card.is-empty { opacity: 0.85; }
.watch-card h4 { margin: 0; font-family: var(--serif); font-size: 1.05rem; }
.watch-card .big {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 600;
  margin: 0.35rem 0 0.1rem;
  font-variant-numeric: tabular-nums;
}
.watch-card .meta, .watch-card .empty { margin: 0; font-size: 0.85rem; color: var(--ink-muted); }
.watch-card .empty { color: var(--empty); }

.spark-block {
  margin-top: 1.2rem;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}
.spark-block p { margin: 0 0 0.5rem; font-size: 0.92rem; color: var(--ink-muted); }
.spark-block svg { display: block; width: 100%; height: 110px; }

/* Filters + tables */
.filters {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.65rem 0.7rem;
  margin: 0.8rem 0 0.6rem;
  align-items: end;
}
.filters label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 650;
}
.filters input, .filters select {
  font: inherit;
  font-size: 0.92rem;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: var(--ink);
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0.4rem 0.5rem;
  width: 100%;
}
.btn-quiet {
  font: inherit;
  font-size: 0.88rem;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0.45rem 0.7rem;
  color: var(--ink-muted);
  cursor: pointer;
  height: 2.3rem;
}
.btn-quiet:hover { background: var(--bg-inset); color: var(--ink); }

.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-elev); }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th, .data-table td {
  padding: 0.55rem 0.7rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.data-table th {
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-faint);
  cursor: pointer;
  white-space: nowrap;
  background: var(--bg-inset);
  position: sticky;
  top: 0;
}
.data-table th.num, .data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tbody tr:hover { background: #242424; }
.data-table a.title-link { color: var(--link); font-weight: 600; }
.data-table a.title-link:hover { text-decoration: underline; }
.data-table .mute { color: var(--ink-muted); font-size: 0.82rem; }

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-verified, .badge-spec-confirmed { background: var(--verified-bg); color: var(--verified); }
.badge-claimed, .badge-title-only { background: var(--claimed-bg); color: var(--claimed); }
.badge-unverified, .badge-description-only, .badge-needs-verdict { background: var(--unverified-bg); color: var(--unverified); }

.pager { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; margin-top: 0.7rem; }
.pager button {
  font: inherit;
  font-size: 0.88rem;
  border: 1px solid var(--line-strong);
  background: var(--bg-elev);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
}
.pager button.is-active, .pager button:hover { background: var(--brass); color: #0a0a0a; border-color: var(--brass); }
.pager button:disabled, .pager button:disabled:hover {
  opacity: 1;
  cursor: not-allowed;
  background: var(--bg-inset);
  color: var(--ink-muted);
  border-color: var(--line);
}

/* Goods */
.goods-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
}
.goods-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.95rem 1rem;
  box-shadow: var(--shadow);
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  width: 100%;
}
.goods-card:hover, .goods-card.is-active { border-color: var(--brass); }
.goods-card h4 { margin: 0; font-family: var(--serif); font-size: 1.1rem; }
.goods-card .big { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; margin: 0.3rem 0; font-variant-numeric: tabular-nums; }
.goods-card p { margin: 0.15rem 0 0; font-size: 0.85rem; color: var(--ink-muted); }

/* Exports */
.export-controls { margin: 0.4rem 0 1rem; }
.segmented { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.segmented button {
  font: inherit;
  background: var(--bg-elev);
  border: 0;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  color: var(--ink-muted);
}
.segmented button.is-active { background: var(--brass); color: #0a0a0a; }
.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}
.chart-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem 0.6rem;
}
.chart-card h3 { margin: 0 0 0.2rem; font-family: var(--serif); font-size: 1.05rem; }
.chart-card .chart-note { margin: 0 0 0.6rem; font-size: 0.82rem; color: var(--ink-muted); }
.chart-card svg { width: 100%; height: auto; display: block; }
.chart-card .tick, .chart-card .bar-label { font-size: 11px; fill: var(--ink-muted); font-family: var(--sans); }
.bar-value { fill: #FFD84D; }
.bar-value.partial { fill: #FF9F1C; }
.bar-volume { fill: #3DDC97; }
.bar-volume.partial { fill: #7CFFB2; }
.bar-price { fill: #7EC8FF; }
.bar-price.partial { fill: #A6E3FF; }
.export-price-block {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}
.export-price-line-wrap { position: relative; }
.export-price-line-wrap svg { width: 100%; height: auto; display: block; }

.notes-body { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 2rem; font-size: 0.95rem; color: var(--ink-muted); }
.notes-body h3 { font-family: var(--serif); color: var(--ink); margin: 0 0 0.4rem; font-size: 1.05rem; }
.notes-body p, .notes-body ul { margin: 0 0 0.8rem; }
.notes-body ul { padding-left: 1.1rem; }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.4rem 0 2rem;
  color: var(--ink-faint);
  font-size: 0.88rem;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ticker-track { animation: none; flex-wrap: wrap; width: auto; }
  .ticker-item { white-space: normal; border-right: 0; padding: 0.35rem 1rem; }
}

@media (max-width: 960px) {
  .stat-grid, .watch-grid, .goods-grid, .chart-row, .notes-body, .filters {
    grid-template-columns: 1fr 1fr;
  }
  .export-price-block { grid-template-columns: 1fr 1fr; }
  .header-inner { flex-direction: column; align-items: flex-start; }
  .header-meta { text-align: left; }
}

@media (max-width: 640px) {
  .wrap { width: min(var(--wrap), calc(100% - 24px)); }
  .stat-grid, .watch-grid, .goods-grid, .chart-row, .notes-body, .filters {
    grid-template-columns: 1fr;
  }
  .export-price-block { grid-template-columns: 1fr; }
  .stat-card .value { font-size: 1.6rem; }
  .data-table { font-size: 0.84rem; }
  .filters { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .section-nav a { padding: 0.35rem 0.42rem; font-size: 0.8rem; }
  #dest-table .data-table { font-size: 0.78rem; }
  #dest-table .data-table th, #dest-table .data-table td { padding: 0.4rem 0.38rem; }
  #dest-table .data-table th:nth-child(3),
  #dest-table .data-table td:nth-child(3) { display: none; }
}

@media (max-width: 700px) {
  #guitar-table-wrap { overflow: visible; border: 0; background: transparent; }
  #guitar-table thead { display: none; }
  #guitar-table, #guitar-table tbody { display: block; width: 100%; }
  #guitar-table tr {
    display: block;
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin: 0 0 0.75rem;
    padding: 0.75rem 0.85rem 0.55rem;
    box-shadow: var(--shadow);
  }
  #guitar-table td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.8rem;
    border-bottom: 0;
    padding: 0.18rem 0;
    text-align: right;
    white-space: normal;
  }
  #guitar-table td::before {
    content: attr(data-label);
    flex: 0 0 7.2rem;
    text-align: left;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ink-faint);
    font-weight: 650;
  }
  #guitar-table td:first-child {
    display: block;
    text-align: left;
    padding-bottom: 0.45rem;
    margin-bottom: 0.25rem;
    border-bottom: 1px solid var(--line);
  }
  #guitar-table td:first-child::before { display: none; content: none; }
  #guitar-table td.num { text-align: right; }
  #guitar-table tr.is-empty td,
  #guitar-table tr.is-empty td::before {
    display: block;
    text-align: left;
    content: none;
  }
}

.watch-card .card-title, .goods-card .card-title, .watch-card h4, .goods-card h4 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
}


/* Stumpage history chart (inside headline; not a separate page section) */
.stumpage-history {
  margin-top: 1.6rem;
}
.stumpage-history h3 {
  margin: 0 0 0.25rem;
  font-family: var(--serif);
  font-size: 1.25rem;
  color: var(--ink);
  font-weight: 600;
}
.stumpage-history .section-sub {
  margin: 0 0 0.8rem;
  color: var(--ink-muted);
  font-size: 0.92rem;
  max-width: 62rem;
}
.stumpage-chart-card {
  position: relative;
  padding: 0.9rem 1rem 1rem;
}
.stumpage-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.15rem;
  margin: 0 0 0.7rem;
  padding: 0;
  list-style: none;
}
.stumpage-legend li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink);
  font-size: 0.88rem;
}
.stumpage-legend svg {
  width: 44px;
  height: 16px;
  flex: none;
}
.stumpage-chart-wrap {
  position: relative;
}
.stumpage-chart-wrap svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}
.stumpage-tooltip {
  position: absolute;
  z-index: 5;
  min-width: 11rem;
  max-width: 16rem;
  background: #0a0a0a;
  color: #ffffff;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  font-size: 0.82rem;
  line-height: 1.35;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.55);
}
.stumpage-tooltip[hidden] { display: none !important; }
.stumpage-point:focus,
.stumpage-point:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
.stumpage-axis, .stumpage-grid {
  stroke: #8a8a8a;
  stroke-width: 1;
}
.stumpage-tick {
  fill: #d0d0d0;
  font-size: 11px;
  font-family: var(--sans);
}
.stumpage-axis-title {
  fill: #d0d0d0;
  font-size: 11px;
  font-family: var(--sans);
}
@media (max-width: 700px) {
  .stumpage-legend { gap: 0.45rem 0.8rem; }
  .stumpage-history h3 { font-size: 1.12rem; }
}


/* Delivered log prices (inside headline, below stumpage; not a new nav section) */
.log-prices {
  margin-top: 1.8rem;
  background: var(--bg);
  overflow: hidden;
  padding-top: 0.15rem;
}
.log-prices h3 {
  margin: 0 0 0.25rem;
  font-family: var(--serif);
  font-size: 1.25rem;
  color: var(--ink);
  font-weight: 600;
}
.log-prices .section-sub {
  margin: 0 0 0.45rem;
  color: var(--ink-muted);
  font-size: 0.92rem;
  max-width: 62rem;
}
.log-sources {
  margin: 0 0 0.85rem;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.15rem;
  max-width: 62rem;
  font-size: 0.88rem;
}
.log-sources li { color: var(--ink); }
.log-grade-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.8rem;
  margin: 0 0 0.75rem;
}
.log-grade-row .log-grade-label {
  margin: 0;
  color: var(--ink);
  font-size: 0.88rem;
}
.log-grade-toggle { flex-wrap: wrap; }
.log-grade-toggle button { font-size: 0.88rem; padding: 0.35rem 0.7rem; }
.log-flag-note {
  margin: 0.55rem 0 0;
  color: #FFD84D;
  font-size: 0.86rem;
}
.log-price-point:focus,
.log-price-point:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
@media (max-width: 700px) {
  .log-prices h3 { font-size: 1.12rem; }
  .log-sources { gap: 0.2rem 0.8rem; }
}
