/* PewPewPost — plain, fast, readable on phone and desktop. */
* { box-sizing: border-box; }
:root {
  --ink: #1c2430;
  --muted: #5b6673;
  --line: #d9dee4;
  --bg: #f4f5f3;
  --card: #ffffff;
  --red: #b3261e;
  --red-dark: #8f1d17;
  --green: #1e6b3a;
  --blue: #1d4ed8;
  --amber-bg: #fff7e0;
}
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
a { color: var(--blue); }
h1 { font-size: 1.6rem; margin: 0.6em 0 0.4em; }
h2 { font-size: 1.15rem; margin: 0.8em 0 0.4em; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.error { color: var(--red); }
.lede { color: var(--muted); margin-top: 0; }

.site-header { background: #14202e; color: #fff; }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding: 12px 16px; }
.wordmark { color: #fff; text-decoration: none; font-weight: 800; font-size: 1.25rem; letter-spacing: 0.01em; }
.wordmark .accent { color: #ff5a4e; }
.main-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-left: auto; }
.main-nav a { color: #dbe4ee; text-decoration: none; padding: 4px 2px; }
.main-nav a.active { color: #fff; border-bottom: 2px solid #ff5a4e; }
.main-nav .who { color: #9fb0c3; font-size: 0.85rem; }
.linklike { background: none; border: none; color: #9fb0c3; cursor: pointer; text-decoration: underline; font: inherit; padding: 0; }

.site-footer { margin-top: 48px; padding: 20px 0 32px; color: var(--muted); font-size: 0.9rem; border-top: 1px solid var(--line); }
.footer-admin { font-size: 0.8rem; }
.footer-admin a { color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin: 12px 0; }
.btn, .btn-small {
  background: var(--red); color: #fff; border: none; border-radius: 6px;
  padding: 8px 14px; cursor: pointer; font: inherit; text-decoration: none; display: inline-block;
}
.btn:hover, .btn-small:hover { background: var(--red-dark); }
.btn-small { padding: 4px 10px; font-size: 0.85rem; margin: 2px; }
input, select, textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; width: 100%;
  background: #fff; color: var(--ink);
}
input[type="checkbox"], input[type="radio"] { width: auto; }
input[type="search"] { min-width: 0; }
label { display: block; margin: 10px 0; font-weight: 600; }
label input, label select, label textarea { font-weight: 400; margin-top: 4px; }
fieldset { border: 1px solid var(--line); border-radius: 6px; margin: 12px 0; padding: 10px 14px; }
fieldset label { font-weight: 400; margin: 6px 0; }
.form-msg { color: var(--red); margin-left: 8px; }

/* Show/hide password toggle: the input and its small button share one row. */
.pw-wrap { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.pw-wrap input { width: auto; flex: 1 1 auto; min-width: 0; margin-top: 0; }
.pw-toggle {
  background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 10px; cursor: pointer; font: inherit; font-size: 0.9rem; flex: 0 0 auto;
}
.pw-toggle:hover { background: var(--bg); }
/* Moderator invite link: the link and its Copy button share one row. */
.invite-row { display: flex; gap: 8px; align-items: center; }
.invite-row input { flex: 1 1 auto; min-width: 0; }
.invite-row .btn { flex: 0 0 auto; }

.board-head .picker, .board-head .search-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.board-head .picker label { margin: 0; }
.board-head .picker select { width: auto; min-width: 160px; }
.search-row input { flex: 1 1 260px; }
.search-row select { width: auto; min-width: 170px; }

.caliber-row, .manufacturer-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 12px 0; }
.cal-label { font-weight: 700; margin-right: 2px; }
.cal-chip, .mfr-chip, .area-chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 4px 10px; cursor: pointer; font: inherit; color: var(--ink);
}
.cal-chip.on, .mfr-chip.on, .area-chip.on { background: #14202e; color: #fff; border-color: #14202e; }
.cal-chip .count, .mfr-chip .count, .area-chip .count { color: var(--muted); font-size: 0.85em; }
.cal-chip.on .count, .mfr-chip.on .count { color: #cdd8e4; }
#f-caliber, #f-manufacturer { width: auto; }
/* The caliber and manufacturer filters are single dropdowns now: each
   stretches to fill its row. */
.caliber-row select, .manufacturer-row select { flex: 1; min-width: 0; }

.directory h2 { margin-top: 0; }
#dir-search { margin-bottom: 10px; }
.state-name { background: none; border: none; padding: 0; font: inherit; font-weight: 700; color: var(--blue); cursor: pointer; text-align: left; }
.state-name:hover { text-decoration: underline; }
.count { color: var(--muted); font-size: 0.9em; white-space: nowrap; }
.state-row-plain { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; border-top: 1px solid var(--line); padding: 7px 2px; }
.state-row-plain:first-child { border-top: none; }
#dir-states { columns: 2; column-gap: 28px; }
#dir-states .state-row-plain { break-inside: avoid; }
@media (max-width: 640px) { #dir-states { columns: 1; } }
.areas-panel { border: 2px solid #14202e; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; background: #fff; }
.areas-panel-head { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.areas-panel-head strong { font-size: 1.05rem; }
.areas-panel-head .linklike { color: var(--blue); }
.areas-panel-head #areas-close { margin-left: auto; }
.areas { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 0 2px 18px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.listing .thumb { display: block; aspect-ratio: 4 / 3; background: #e8ebee; border-radius: 6px 6px 0 0; overflow: hidden; }
.listing .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.no-photo { display: flex; align-items: center; justify-content: center; height: 100%; min-height: 140px; color: var(--muted); background: #e8ebee; }
.no-photo.big { min-height: 240px; border-radius: 6px; }
.listing-body { padding: 10px 12px 12px; }
.listing-title { font-weight: 700; color: var(--ink); text-decoration: none; display: block; }
.listing-title:hover { color: var(--blue); text-decoration: underline; }
.price { font-weight: 800; font-size: 1.1rem; margin: 4px 0; }
.price.big { font-size: 1.5rem; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.badge { display: inline-block; background: #eef1f4; border-radius: 4px; padding: 2px 8px; font-size: 0.85rem; }
.badge.caliber { background: #e3ecfd; color: #173a7d; font-weight: 700; }
.badge.manufacturer { background: #e9f7ee; color: #14532d; font-weight: 700; }
.badge.dealer { background: #fdeceb; color: var(--red-dark); font-weight: 700; }
.badge.founder { background: #fef3c7; color: #92400e; font-weight: 700; }
.empty { background: #fff; border: 1px dashed var(--line); border-radius: 8px; padding: 18px; }
.detail .photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.detail-photo { width: 100%; border-radius: 6px; display: block; }
.desc { white-space: pre-wrap; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.stats-panel { margin: 12px 0; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px; text-align: center; }
.stat-value { display: block; font-size: 1.7rem; font-weight: 800; line-height: 1.1; }
.stat-label { display: block; color: var(--muted); font-size: 0.85rem; }
.stat-sub { display: block; color: var(--muted); font-size: 0.8rem; }
.tabs button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 8px 14px; cursor: pointer; font: inherit; }
.tabs button.on { background: #14202e; color: #fff; border-color: #14202e; }
.tbl { width: 100%; border-collapse: collapse; background: #fff; font-size: 0.92rem; }
.tbl th, .tbl td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.tbl th { background: #eef1f4; }
.tbl tr:nth-child(even) td { background: #fafbfc; }
.form { max-width: 640px; }
@media (max-width: 640px) {
  .board-head .picker select, .search-row select { flex: 1 1 100%; }
  .header-inner { gap: 4px 12px; }
}

/* Rules agreement gate: full-screen overlay on first visit. Blocks the
   site until the visitor agrees to the site rules. */
.rules-gate {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20, 32, 46, 0.72);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; overflow-y: auto;
}
.rules-gate-card { max-width: 560px; width: 100%; margin: auto; }
.rules-gate-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.rules-gate-actions .btn-small { color: var(--ink); background: #fff; border: 1px solid var(--line); }
.rules-gate-actions .btn-small:hover { background: var(--bg); }

/* Built-in messenger: inbox thread list and thread view. */
.thread-list { background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.notify-pref { display: block; margin: 4px 0 2px; }
.thread-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 14px; text-decoration: none; color: var(--ink); border-top: 1px solid var(--line); }
.thread-row:first-child { border-top: none; }
.thread-row:hover { background: #fafbfc; }
.thread-row.unread { background: #eef4fb; }
.thread-title { font-weight: 700; }
.thread-other { color: var(--muted); font-size: 0.9rem; }
.thread-last { color: var(--muted); font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-time { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.badge.new { background: var(--red); color: #fff; font-weight: 700; }
.msg-list { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.msg { max-width: 75%; padding: 10px 12px; border-radius: 8px; background: #fff; border: 1px solid var(--line); }
.msg.mine { margin-left: auto; background: #e3ecfd; border-color: #c3d4f5; }
.msg-who { font-weight: 700; font-size: 0.85rem; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-meta { color: var(--muted); font-size: 0.8rem; margin-top: 4px; }
.msg-meta .linklike { color: var(--blue); }
.msg-report { margin-top: 8px; }
@media (max-width: 640px) { .msg { max-width: 100%; } }
