:root {
  --bg: #0a0c0b;
  --bg-elev: #121614;
  --olive: #6b7c3a;
  --sand: #c4b59a;
  --signal: #d4782e;
  --signal-bright: #f0a14a;
  --fog: #8a9388;
  --text: #ebe6dc;
  --text-dim: #9a9488;
  --line: rgba(196, 181, 154, 0.14);
  --danger: #c44a3a;
  --safe: #5a8a52;
  --max: 1120px;
  --font-display: "Rajdhani", "Noto Sans SC", sans-serif;
  --font-body: "Noto Sans SC", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* .nav chrome lives in nav.css */

.page-hero {
  padding: 6.5rem 1.5rem 2.5rem;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(ellipse 60% 70% at 90% 10%, rgba(212,120,46,0.1), transparent 50%),
    radial-gradient(ellipse 50% 60% at 8% 85%, rgba(107,124,58,0.08), transparent 50%),
    var(--bg);
}
@media (min-width: 860px) { .page-hero { padding: 7.25rem 2.5rem 2.75rem; } }
.wrap { max-width: var(--max); margin: 0 auto; }
.breadcrumb { font-size: 0.75rem; color: var(--fog); margin-bottom: 1rem; }
.breadcrumb a:hover { color: var(--sand); }
.page-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}
.page-desc { color: var(--text-dim); font-size: 0.92rem; max-width: 36em; }

.layout {
  display: grid;
  gap: 1.5rem;
  padding: 2rem 1.5rem 4rem;
  max-width: var(--max);
  margin: 0 auto;
}
@media (min-width: 900px) {
  .layout {
    grid-template-columns: 240px 1fr;
    gap: 2rem;
    padding: 2.5rem 2.5rem 5rem;
    align-items: start;
  }
}

/* Sidebar filters */
.filters {
  position: sticky;
  top: 4.75rem;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  padding: 1.25rem;
}
.filters-title {
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--olive);
  margin-bottom: 1rem;
}
.filter-group { margin-bottom: 1.25rem; }
.filter-group:last-of-type { margin-bottom: 0.75rem; }
.filter-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--sand);
  margin-bottom: 0.5rem;
  display: block;
}
.filter-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chip {
  font-size: 0.72rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--line);
  color: var(--text-dim);
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.chip:hover { border-color: var(--sand); color: var(--text); }
.chip.active {
  border-color: var(--signal);
  color: var(--signal-bright);
  background: rgba(212, 120, 46, 0.1);
}
.filter-search {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.filter-search:focus {
  outline: none;
  border-color: var(--signal);
}
.filter-search::placeholder { color: var(--fog); }
.filter-reset {
  width: 100%;
  padding: 0.55rem;
  font-size: 0.78rem;
  color: var(--fog);
  border: 1px dashed var(--line);
  margin-top: 0.5rem;
}
.filter-reset:hover { color: var(--sand); border-color: var(--sand); }

/* Main panel */
.results-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.results-count {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: var(--fog);
}
.results-count strong { color: var(--sand); }
.sort-select {
  padding: 0.45rem 0.65rem;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 0.78rem;
}
.sort-select:focus { outline: none; border-color: var(--signal); }

.build-list {
  border: 1px solid var(--line);
}
.build-row {
  display: grid;
  gap: 0.65rem 1rem;
  padding: 1.2rem 1.25rem;
  border-bottom: 1px solid var(--line);
  transition: background 0.2s;
}
.build-row:last-child { border-bottom: none; }
.build-row:hover { background: rgba(196, 181, 154, 0.03); }
@media (min-width: 720px) {
  .build-row {
    grid-template-columns: 5.75rem 1fr auto auto;
    align-items: center;
  }
}
.build-thumb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 5.5rem;
  height: 3.35rem;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg);
  cursor: zoom-in;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.build-thumb:hover,
.build-thumb:focus-visible {
  border-color: rgba(212, 120, 46, 0.55);
  box-shadow: 0 0 0 1px rgba(212, 120, 46, 0.2);
  outline: none;
}
.build-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  opacity: 0.95;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.2s;
}
.build-thumb:hover img,
.build-row:hover .build-thumb img {
  opacity: 1;
  transform: scale(1.06);
}
.build-thumb-hint {
  position: absolute;
  right: 0.2rem;
  bottom: 0.15rem;
  font-family: var(--font-display);
  font-size: 0.55rem;
  letter-spacing: 0.06em;
  color: var(--sand);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  opacity: 0;
  transition: opacity 0.2s;
}
.build-thumb:hover .build-thumb-hint,
.build-thumb:focus-visible .build-thumb-hint { opacity: 1; }
.build-tier {
  position: absolute;
  left: 0.25rem;
  top: 0.15rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  line-height: 1;
  color: var(--signal);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}
.build-tier.t0 { color: var(--signal-bright); }
.build-tier.t1 { color: var(--sand); }
.build-tier.t2 { color: var(--fog); }
.build-tier.budget { color: var(--olive); }
.build-name { font-weight: 700; font-size: 1.02rem; }
.build-name small {
  display: block;
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
}
.build-meta {
  font-size: 0.72rem;
  color: var(--fog);
  margin-top: 0.35rem;
}
.build-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tag {
  font-size: 0.68rem;
  padding: 0.18rem 0.45rem;
  border: 1px solid var(--line);
  color: var(--fog);
}
.build-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: flex-start;
}
@media (min-width: 720px) { .build-actions { align-items: flex-end; } }
.btn-copy {
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--sand);
  white-space: nowrap;
}
.btn-copy:hover { color: var(--signal-bright); }
.btn-map {
  font-size: 0.72rem;
  color: var(--fog);
}
.btn-map:hover { color: var(--olive); }

.empty-state {
  padding: 3rem 1.5rem;
  text-align: center;
  border: 1px dashed var(--line);
  color: var(--text-dim);
}
.empty-state p { margin-bottom: 0.75rem; }

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  z-index: 300;
  padding: 0.75rem 1.25rem;
  background: var(--bg-elev);
  border: 1px solid var(--safe);
  color: var(--sand);
  font-size: 0.85rem;
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 5, 0.82);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}
.modal-backdrop.open { opacity: 1; visibility: visible; }
.modal {
  width: min(420px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  padding: 1.75rem;
  transform: translateY(12px);
  transition: transform 0.25s;
}
.modal-backdrop.open .modal { transform: translateY(0); }
.modal h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.modal p { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 1rem; }
.code-box {
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  padding: 0.9rem;
  background: var(--bg);
  border: 1px solid var(--line);
  word-break: break-all;
  margin-bottom: 1rem;
  color: var(--sand);
}
.modal-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.btn-primary {
  display: inline-flex;
  padding: 0.75rem 1.2rem;
  background: var(--signal);
  color: #1a1008;
  font-weight: 700;
  font-size: 0.88rem;
}
.btn-primary:hover { background: var(--signal-bright); }
.btn-ghost {
  display: inline-flex;
  padding: 0.75rem 1.2rem;
  border: 1px solid var(--line);
  color: var(--sand);
  font-size: 0.88rem;
}
.btn-ghost:hover { border-color: var(--sand); }

footer {
  padding: 2rem 1.5rem 2.5rem;
  border-top: 1px solid var(--line);
}
.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
@media (min-width: 700px) {
  .footer-inner { flex-direction: row; justify-content: space-between; align-items: flex-end; }
}
.footer-brand {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.footer-copy { font-size: 0.78rem; color: var(--fog); margin-top: 0.3rem; }
.footer-links { display: flex; gap: 1.25rem; font-size: 0.85rem; color: var(--text-dim); }
.footer-links a:hover { color: var(--sand); }

/* Mobile filter toggle */
.mobile-filter-btn {
  display: flex;
  width: 100%;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--sand);
  justify-content: space-between;
  align-items: center;
}
@media (min-width: 900px) { .mobile-filter-btn { display: none; } }
.filters.collapsed { display: none; }
@media (min-width: 900px) { .filters.collapsed { display: block; } }

/* Weapon full-image lightbox */
.weapon-lightbox .weapon-lightbox-panel {
  position: relative;
  width: min(920px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  padding: 1.25rem 1.25rem 1.1rem;
  transform: translateY(12px);
  transition: transform 0.25s;
}
.weapon-lightbox.open .weapon-lightbox-panel { transform: translateY(0); }
.weapon-lightbox-close {
  position: absolute;
  top: 0.65rem;
  right: 0.85rem;
  width: 2rem;
  height: 2rem;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--fog);
}
.weapon-lightbox-close:hover { color: var(--sand); }
.weapon-lightbox-kicker {
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  color: var(--olive);
  margin-bottom: 0.25rem;
}
.weapon-lightbox-panel h3 {
  font-size: 1.25rem;
  margin-bottom: 0.2rem;
}
.weapon-lightbox-sub {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0.9rem;
}
.weapon-lightbox-frame {
  border: 1px solid var(--line);
  background:
    radial-gradient(ellipse 70% 60% at 50% 45%, rgba(107, 124, 58, 0.12), transparent 65%),
    var(--bg);
  min-height: 12rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.weapon-lightbox-frame img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(62vh, 480px);
  object-fit: contain;
}
.weapon-lightbox-note {
  margin-top: 0.65rem;
  font-size: 0.72rem;
  color: var(--fog);
}

/* Guide-first gunsmith */
.guide-banner {
  padding: 0 1.5rem 1.25rem;
}
@media (min-width: 860px) {
  .guide-banner { padding: 0 2.5rem 1.5rem; }
}
.guide-banner-grid {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  background: var(--bg-elev);
}
@media (min-width: 800px) {
  .guide-banner-grid { grid-template-columns: repeat(3, 1fr); }
}
.guide-banner-grid article {
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--line);
}
@media (min-width: 800px) {
  .guide-banner-grid article {
    border-bottom: none;
    border-right: 1px solid var(--line);
  }
  .guide-banner-grid article:last-child { border-right: none; }
}
.guide-banner-grid h2 {
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--olive);
  margin-bottom: 0.35rem;
}
.guide-banner-grid p {
  font-size: 0.84rem;
  color: var(--text-dim);
}

.guide-modal-panel {
  width: min(560px, 100%);
}
.guide-summary {
  color: var(--sand) !important;
  margin-bottom: 0.75rem !important;
}
.guide-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.1rem;
}
.guide-meta span {
  font-size: 0.7rem;
  padding: 0.2rem 0.45rem;
  border: 1px solid var(--line);
  color: var(--fog);
}
.guide-cols {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}
@media (min-width: 560px) {
  .guide-cols { grid-template-columns: 1fr 1fr; }
}
.guide-cols h4 {
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--olive);
  margin-bottom: 0.5rem;
}
.guide-order,
.guide-tips {
  list-style: none;
  font-size: 0.88rem;
  color: var(--text-dim);
}
.guide-order li,
.guide-tips li {
  position: relative;
  padding: 0.4rem 0 0.4rem 1.4rem;
  border-bottom: 1px solid var(--line);
}
.guide-order li:last-child,
.guide-tips li:last-child { border-bottom: none; }
.guide-order li em {
  position: absolute;
  left: 0;
  font-style: normal;
  font-family: var(--font-display);
  color: var(--signal);
  font-size: 0.8rem;
}
.guide-tips li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--olive);
}
.guide-note {
  font-size: 0.78rem !important;
  color: var(--fog) !important;
  margin-bottom: 1rem !important;
}
.modal-actions a.btn-primary,
.modal-actions a.btn-ghost {
  text-decoration: none;
  align-items: center;
}
