:root {
  --stone-0: #14110c;
  --stone-1: #1c1810;
  --stone-2: #241f16;
  --stone-3: #2f2819;
  --brass: #c9a15e;
  --brass-dim: #a2854e;
  --brass-deep: #6f5a34;
  --ivory: #ece1c8;
  --muted: #9a8d71;
  --patina: #4f9c8f;
  --rust: #b3603f;
  --line: #3a3120;
  --shadow: rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@font-face {
  font-family: 'Balgruf';
  src: url('/fonts/balgruf.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Balgruf';
  src: url('/fonts/balgruf-italic.woff2') format('woff2');
  font-weight: normal;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'DwemerRunes';
  src: url('/fonts/Dwemer.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

body {
  margin: 0;
  background: #0f0d08;
  color: var(--ivory);
  font-family: "Spectral", Georgia, serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Animated pipe background */
#pipesCanvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Site content sits above the pipes */
.masthead, .shops-bar, nav.tabs, main, footer {
  position: relative;
  z-index: 1;
}

/* Darken content areas for readability over pipes */
.masthead .plate {
  background: radial-gradient(ellipse at 50% 0%, rgba(30, 24, 16, 0.95) 0%, rgba(16, 12, 6, 0.95) 100%);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(201, 161, 94, 0.15);
}
.shops-bar {
  background: rgba(20, 16, 10, 0.92);
  backdrop-filter: blur(4px);
}
nav.tabs {
  background: rgba(16, 12, 6, 0.9);
  backdrop-filter: blur(3px);
  border-bottom: 1px solid rgba(201, 161, 94, 0.12);
}
main {
  background: rgba(16, 12, 6, 0.6);
}
footer {
  background: rgba(16, 12, 6, 0.85);
  backdrop-filter: blur(2px);
}

/* faint machined texture over everything */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.012) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}

header, nav, main, footer { position: relative; z-index: 1; }

/* ---------- masthead: a riveted brass nameplate ---------- */
.masthead {
  max-width: 980px; margin: 0 auto; padding: 40px 24px 8px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
.plate {
  position: relative; flex: 1 1 520px;
  border: 1px solid var(--brass-deep);
  border-radius: 4px;
  padding: 22px 30px;
  background:
    linear-gradient(180deg, rgba(201,161,94,0.10), rgba(0,0,0,0.14)),
    var(--stone-2);
  box-shadow: inset 0 1px 0 rgba(201,161,94,0.25), 0 10px 30px var(--shadow);
}
.rivet { position: absolute; width: 7px; height: 7px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--brass), var(--brass-deep));
  box-shadow: 0 0 2px rgba(0,0,0,0.6); }
.rivet.tl { top: 8px; left: 8px; } .rivet.tr { top: 8px; right: 8px; }
.rivet.bl { bottom: 8px; left: 8px; } .rivet.br { bottom: 8px; right: 8px; }

.eyebrow {
  margin: 0 0 6px; font-family: "Balgruf", "Cinzel", serif; font-weight: 500;
  letter-spacing: 0.22em; text-transform: uppercase; font-size: 11px; color: var(--brass-dim);
}
h1 {
  margin: 0; font-family: "Balgruf", "Cinzel", serif; font-weight: 700;
  font-size: clamp(28px, 5vw, 46px); letter-spacing: 0.04em; color: var(--ivory);
  text-shadow: 0 1px 0 #000, 0 0 22px rgba(201,161,94,0.12);
}
.sub { margin: 10px 0 0; color: var(--muted); font-size: 15px; max-width: 60ch; }

.ratechip {
  border: 1px solid var(--brass-deep); border-radius: 4px; padding: 12px 18px; text-align: center;
  background: var(--stone-1); box-shadow: inset 0 1px 0 rgba(201,161,94,0.2);
}
.ratechip-label { display: block; font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.ratechip-value { display: block; font-family: "JetBrains Mono", monospace; font-size: 26px; font-weight: 700; color: var(--brass); }

/* ---------- tabs + search ---------- */
.tabs {
  max-width: 980px; margin: 26px auto 0; padding: 0 24px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}
.tab {
  appearance: none; background: none; border: 0; cursor: pointer;
  font-family: "Balgruf", "Cinzel", serif; font-size: 14px; letter-spacing: 0.08em;
  color: var(--muted); padding: 12px 6px; margin-right: 14px; position: relative;
}
.tab:hover { color: var(--ivory); }
.tab.active { color: var(--brass); }
.tab.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--brass), transparent);
}
.search { margin-left: auto; padding: 8px 0; }
.search input {
  background: var(--stone-1); border: 1px solid var(--line); color: var(--ivory);
  border-radius: 3px; padding: 8px 12px; font-family: "Spectral", serif; font-size: 15px; min-width: 220px;
}
.search input:focus { outline: 2px solid var(--brass-deep); outline-offset: 1px; border-color: var(--brass-dim); }

main { max-width: 980px; margin: 0 auto; padding: 18px 24px 40px; }
.asof { color: var(--muted); font-size: 12px; letter-spacing: 0.04em; margin: 8px 2px 20px; font-family: "JetBrains Mono", monospace; }

/* ---------- signature: the assay plate row ---------- */
.plate-row {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 18px; align-items: center;
  border: 1px solid var(--line); border-left: 3px solid var(--brass-deep);
  background: linear-gradient(180deg, rgba(201,161,94,0.04), rgba(0,0,0,0.10)), var(--stone-1);
  padding: 16px 20px; margin-bottom: 10px; border-radius: 3px;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
  animation: rise 320ms ease both;
}
.plate-row:hover { transform: translateY(-2px); border-left-color: var(--brass); box-shadow: 0 8px 22px var(--shadow); }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .plate-row { animation: none; } .plate-row:hover { transform: none; } }

.bezel {
  width: 56px; height: 56px; border-radius: 6px; display: grid; place-items: center;
  background: radial-gradient(circle at 40% 30%, #2b2417, #17130c);
  border: 1px solid var(--brass-deep); box-shadow: inset 0 0 0 2px rgba(0,0,0,0.4);
}
.bezel img { width: 40px; height: 40px; object-fit: contain; image-rendering: auto; }

.rowmain .name { font-family: "Balgruf", "Cinzel", serif; font-size: 19px; letter-spacing: 0.02em; }
.rowmain .meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.rowmain .meta b { color: var(--ivory); font-weight: 600; }
.tag { display: inline-block; font-size: 11px; letter-spacing: 0.06em; color: var(--patina);
  border: 1px solid #2c4a45; border-radius: 999px; padding: 1px 8px; margin-left: 6px; }
.tag.rust { color: var(--rust); border-color: #4a2f24; }

.readout { text-align: right; font-family: "JetBrains Mono", monospace; min-width: 120px; }
.readout .price { font-size: 26px; font-weight: 700; color: var(--brass); line-height: 1; }
.readout .price .unit { font-size: 12px; color: var(--muted); font-weight: 500; }
.readout .ask { font-size: 12px; color: var(--muted); margin-top: 6px; }
.readout .ask b { color: var(--ivory); }
.readout .noprice { font-size: 13px; color: var(--muted); }

/* ---------- listings table ---------- */
.listing-row {
  display: grid; grid-template-columns: 48px 1fr auto auto; gap: 16px; align-items: center;
  border: 1px solid var(--line); background: var(--stone-1); border-radius: 3px;
  padding: 12px 18px; margin-bottom: 8px; animation: rise 300ms ease both;
}
.listing-row .bezel { width: 40px; height: 40px; }
.listing-row .bezel img { width: 28px; height: 28px; }
.listing-row .li-name { font-family: "Balgruf", "Cinzel", serif; font-size: 16px; }
.listing-row .li-meta { color: var(--muted); font-size: 13px; }
.listing-row .li-price { font-family: "JetBrains Mono", monospace; color: var(--brass); font-weight: 700; text-align: right; }
.listing-row .li-price small { color: var(--muted); font-weight: 500; }
.ticket { font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--muted); }

.empty {
  border: 1px dashed var(--brass-deep); border-radius: 4px; padding: 40px 24px; text-align: center;
  color: var(--muted); background: var(--stone-1);
}
.empty strong { color: var(--ivory); font-family: "Balgruf", "Cinzel", serif; display: block; margin-bottom: 6px; letter-spacing: 0.04em; }

footer { max-width: 980px; margin: 0 auto; padding: 0 24px 48px; }
footer p { color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); padding-top: 18px; }
.dwemer-motto {
  font-family: 'DwemerRunes', serif; font-size: 22px;
  color: var(--brass); letter-spacing: 0.15em;
  border-top: none !important; padding-top: 8px !important;
  text-align: center;
}

/* shop status bar */
.shops-bar {
  max-width: 980px; margin: 0 auto 12px; padding: 10px 24px;
  background: var(--stone-2); border: 1px solid var(--line);
  border-radius: 6px; display: flex; align-items: center; gap: 12px;
}
.shops-label {
  font-family: "Balgruf", "Cinzel", serif; font-size: 13px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.shop-chip {
  display: inline-block; padding: 3px 14px; border-radius: 4px;
  font-family: "JetBrains Mono", monospace; font-size: 13px; font-weight: 700;
  margin-right: 8px;
}
.shop-chip.open { background: #1a3a2a; color: #5fcf8a; border: 1px solid #2d6b40; }
.shop-chip.closed { background: #3a1a1a; color: #cf5f5f; border: 1px solid #6b2d2d; }

/* site toast */
.toast-bar {
  max-width: 980px; margin: 0 auto 12px; padding: 12px 24px;
  background: linear-gradient(135deg, rgba(180, 130, 50, 0.18), rgba(201, 161, 94, 0.08));
  border: 1px solid rgba(201, 161, 94, 0.22);
  border-radius: 6px; text-align: center;
  font-family: "Balgruf", "Cinzel", serif; font-size: 16px;
  color: var(--brass); letter-spacing: 0.03em;
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.toast-icon {
  width: 28px; height: 28px; object-fit: contain; flex-shrink: 0;
}

@media (max-width: 560px) {
  .plate-row { grid-template-columns: 48px 1fr; grid-template-areas: "b m" "r r"; }
  .plate-row .bezel { grid-area: b; } .plate-row .rowmain { grid-area: m; } .plate-row .readout { grid-area: r; text-align: left; }
  .readout { min-width: 0; }
  .listing-row { grid-template-columns: 40px 1fr; }
  .listing-row .li-price, .listing-row .ticket { grid-column: 2; text-align: left; }
}
