/* =========================================================================
 * SaltCrate — style.css
 * Dark, responsive, "precious metals" aesthetic. Zero dependencies.
 * ========================================================================= */

:root {
  --bg:            #0b0e13;
  --bg-soft:       #10141b;
  --card:          #141a23;
  --card-2:        #1a212c;
  --border:        #26303e;
  --border-soft:   #1c2430;
  --text:          #e6edf3;
  --text-muted:    #8b98a8;
  --text-dim:      #5c6878;

  --gold:          #e6c15a;
  --gold-dim:      #a8892f;
  --silver:        #aeb6bf;
  --platinum:      #8fd0c8;
  --palladium:     #b8a4d0;

  --accent:        var(--gold);
  --accent-2:      #c9a24b;
  --danger:        #e57373;
  --ok:            #81c784;

  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 8px 30px rgba(0, 0, 0, 0.45);
  --font-mono:     ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(230, 193, 90, 0.07), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(143, 208, 200, 0.05), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5rem; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 1.35rem; }

.hint { color: var(--text-muted); font-size: 0.875rem; margin: 0.25rem 0 1rem; }
.muted { color: var(--text-dim); }

/* ------------------------------------------------------------------ header */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem 2rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-soft);
  background: linear-gradient(180deg, rgba(20, 26, 35, 0.9), rgba(11, 14, 19, 0.4));
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(8px);
}

.brand { display: flex; align-items: center; gap: 0.65rem; }
.brand-mark {
  font-size: 1.7rem;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(230, 193, 90, 0.5);
}
.brand-text h1 {
  margin: 0;
  font-size: 1.3rem;
  background: linear-gradient(100deg, #f4e3b0, var(--gold) 55%, #a8892f);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.tagline { font-size: 0.72rem; color: var(--text-muted); letter-spacing: 0.04em; text-transform: uppercase; }

.spot-ticker { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.spot-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-2);
  min-width: 92px;
}
.spot-name { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.spot-price { font-size: 0.95rem; font-weight: 650; font-variant-numeric: tabular-nums; }

.spot-meta { margin-left: auto; text-align: right; display: flex; align-items: center; gap: 0.6rem; }
.spot-updated { font-size: 0.72rem; color: var(--text-dim); max-width: 220px; }
#spot-status { font-size: 0.8rem; color: var(--accent); }

/* ------------------------------------------------------------------ nav */
.site-nav {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 1.5rem;
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 62px;
  z-index: 19;
  background: rgba(11, 14, 19, 0.92);
  backdrop-filter: blur(8px);
}
.site-nav a {
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
}
.site-nav a:hover { color: var(--text); background: var(--card-2); text-decoration: none; }

/* ------------------------------------------------------------------ layout */
main {
  max-width: 980px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

/* ------------------------------------------------------------------ forms */
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field > span { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.span-full { grid-column: 1 / -1; }

select, input[type="number"], input[type="text"] {
  width: 100%;
  padding: 0.55rem 0.7rem;
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
}
select:focus, input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(230, 193, 90, 0.15);
}

/* ------------------------------------------------------------------ buttons */
.btn {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text);
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { border-color: var(--accent); }
.btn-primary {
  background: linear-gradient(120deg, var(--gold), var(--accent-2));
  color: #171307;
  border-color: transparent;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

/* ------------------------------------------------------------------ mode toggle */
.mode-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 1rem;
}
.mode-option { cursor: pointer; }
.mode-option input { position: absolute; opacity: 0; pointer-events: none; }
.mode-option span {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.mode-option input:checked + span {
  background: var(--accent);
  color: #171307;
}

/* ------------------------------------------------------------------ result */
.result {
  margin-top: 1.25rem;
  padding: 1.25rem;
  background: linear-gradient(140deg, var(--card-2), var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
}
.result-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.result-value {
  font-size: 2.6rem;
  font-weight: 750;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 24px rgba(230, 193, 90, 0.25);
}

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; margin: 1rem 0; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.data-table th, .data-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
}
.data-table th {
  color: var(--text-muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.data-table tbody tr:hover { background: var(--card-2); }
.data-table tr.highlight td { background: rgba(230, 193, 90, 0.06); font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table th.num { text-align: right; }

/* ------------------------------------------------------------------ stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin: 1rem 0; }
.stat-card {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
}
.stat-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.stat-value { font-size: 1.4rem; font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 0.82rem; color: var(--text-muted); }

/* ------------------------------------------------------------------ buyback */
.buyback {
  margin: 1rem 0;
  padding: 1rem 1.25rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: rgba(143, 208, 200, 0.04);
}
.bb-row { display: flex; justify-content: space-between; padding: 0.25rem 0; }
.bb-row strong { color: var(--platinum); font-variant-numeric: tabular-nums; }
.bb-note { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.5rem; }

.empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-dim);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

.metal-badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #0b0e13;
  background: var(--m, var(--silver));
}

/* ------------------------------------------------------------------ footer */
.site-footer {
  margin-top: 2rem;
  border-top: 1px solid var(--border-soft);
  padding: 2rem 1.5rem 2.5rem;
  background: var(--bg-soft);
}
.affiliates { max-width: 980px; margin: 0 auto 1.5rem; }
.affiliates-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 0.6rem;
}
.affiliates-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.affiliate {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.7rem 1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text-muted);
  transition: border-color 0.15s;
}
.affiliate:hover { border-color: var(--accent); text-decoration: none; }
.affiliate[aria-disabled="true"] { opacity: 0.6; cursor: default; }
.aff-name { font-weight: 650; color: var(--text); }
.aff-note { font-size: 0.72rem; color: var(--text-dim); }

.disclaimer {
  max-width: 980px;
  margin: 0 auto 1.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  border-left: 3px solid var(--gold-dim);
  padding-left: 1rem;
}
.disclaimer p { margin: 0.3rem 0; }
.brand-footer { text-align: center; font-size: 0.78rem; color: var(--text-dim); }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 760px) {
  .site-header { padding: 1rem; gap: 1rem; }
  .spot-meta { margin-left: 0; text-align: left; width: 100%; }
  .spot-updated { max-width: none; }
  .site-nav { top: 0; position: static; padding: 0.5rem 1rem; overflow-x: auto; }
  main { padding: 1rem; }
  .card { padding: 1.1rem; }
  .result-value { font-size: 2rem; }
  .field-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 460px) {
  .field-grid { grid-template-columns: 1fr; }
  .spot-chip { min-width: 76px; padding: 0.3rem 0.6rem; }
  .spot-price { font-size: 0.85rem; }
}
