/* ── MILITARY FIREARMS TIMELINE ──────────────────────────────────────── */

body.military-page {
  background: var(--bg);
}

/* ── PAGE HEADER ─────────────────────────────────────────────────────── */
.calibers-header {
  padding: 96px 0 32px;
  border-bottom: 0.5px solid var(--border);
}

.calibers-title {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.calibers-sub {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.5px;
}

.breadcrumb {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}
.breadcrumb:hover { color: var(--text); }

/* ── VIEW SWITCHER (sticky) ──────────────────────────────────────────── */
.view-switcher {
  position: sticky;
  top: 60px;
  z-index: 51;
  background: rgba(7,7,26,0.97);
  backdrop-filter: blur(12px);
  border-bottom: 0.5px solid var(--border);
}

.view-switcher-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 48px;
}

.view-tabs {
  display: flex;
  height: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.view-tabs::-webkit-scrollbar { display: none; }

.view-tab {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--dim);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0 16px;
  cursor: pointer;
  height: 100%;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
  text-transform: uppercase;
}
.view-tab:hover { color: var(--muted); }
.view-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.db-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.db-sep { color: var(--dim); font-size: 10px; }

.db-action-btn {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--dim);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
  transition: color 0.15s;
}
.db-action-btn:hover { color: var(--muted); }

/* ══════════════════════════════════════════════
   VIEW 1: COUNTRY SWIMLANES
══════════════════════════════════════════════ */

/* ── ROLE LEGEND ─────────────────────────────────────────────────────── */
.sl-legend {
  border-bottom: 0.5px solid var(--border);
  padding: 10px 0;
}

.sl-legend-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

.sl-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
}

.sl-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── CHART WRAPPER ───────────────────────────────────────────────────── */
.sl-wrap {
  overflow: hidden; /* no horizontal scroll — chart fills viewport */
}

.sl-inner {
  /* fluid width, fills available space */
}

/* ── YEAR RULER ──────────────────────────────────────────────────────── */
.sl-ruler {
  display: flex;
  height: 30px;
  border-bottom: 0.5px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 108px; /* 60px nav + 48px view-switcher */
  z-index: 10;
}

.sl-ruler-spacer {
  width: 180px;
  flex-shrink: 0;
  border-right: 0.5px solid var(--border);
  background: var(--bg);
}

.sl-ruler-ticks {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.sl-tick {
  position: absolute;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 8px;
  color: var(--dim);
  top: 50%;
  margin-top: -6px;
  letter-spacing: 0.3px;
  pointer-events: none;
  user-select: none;
}

/* ── ROLE GROUP HEADERS ──────────────────────────────────────────────── */
.sl-role-header {
  display: flex;
  align-items: center;
  padding: 20px 0 6px;
}

.sl-role-spacer {
  width: 180px;
  flex-shrink: 0;
}

.sl-role-divider {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 8px;
}

.sl-role-label {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 2px;
  white-space: nowrap;
}

.sl-role-line {
  flex: 1;
  border-top: 0.5px solid;
}

/* ── WEAPON ROWS ─────────────────────────────────────────────────────── */
.sl-row {
  display: flex;
  align-items: center;
  height: 24px;
  cursor: pointer;
  transition: background 0.08s;
}

.sl-row:hover { background: rgba(255,255,255,0.025); }
.sl-row-active { background: rgba(255,212,59,0.05); }

.sl-row-label {
  width: 180px;
  flex-shrink: 0;
  padding: 0 10px 0 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 0.5px solid rgba(255,255,255,0.06);
  overflow: hidden;
}

.sl-row-name {
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.2px;
  line-height: 1.2;
}

.sl-row-years {
  font-family: var(--mono);
  font-size: 7px;
  color: var(--dim);
  letter-spacing: 0.2px;
  margin-top: 1px;
}

.sl-row-bars {
  flex: 1;
  position: relative;
  height: 100%;
  overflow: hidden;
  background-image: repeating-linear-gradient(
    90deg,
    rgba(255,255,255,0.05) 0,
    rgba(255,255,255,0.05) 0.5px,
    transparent 0.5px,
    transparent 6.0976%  /* 10yr / 164yr span */
  );
}

/* ── BARS ────────────────────────────────────────────────────────────── */
.sl-bar {
  position: absolute;
  top: 3px;
  height: 18px;
  border-radius: 2px;
  border: none;
  cursor: pointer;
  min-width: 2px;
  z-index: 1;
  opacity: 0.9;
  transition: opacity 0.1s, filter 0.1s;
}

.sl-row:hover .sl-bar { opacity: 1; }

.sl-bar-ongoing {
  /* gradient applied inline via JS; bar ends before right edge */
}

.sl-bar-selected {
  outline: 2px solid rgba(255,255,255,0.8);
  outline-offset: 1px;
  opacity: 1;
  z-index: 3;
}

.sl-note {
  padding: 12px 0 24px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--dim);
  border-top: 0.5px solid var(--border);
}

.sl-browse-cta {
  background: none;
  border: none;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: color 0.15s;
}
.sl-browse-cta:hover { color: var(--text); }

/* ══════════════════════════════════════════════
   VIEW 2: YEAR SNAPSHOT
══════════════════════════════════════════════ */

.snap-controls-wrap {
  border-bottom: 0.5px solid var(--border);
  padding: 20px 0 16px;
  position: sticky;
  top: 108px;
  z-index: 20;
  backdrop-filter: blur(12px);
  background: rgba(7,7,26,0.96);
}

.snap-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.snap-year-label {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 2px;
  color: var(--dim);
  margin-bottom: 4px;
}

.snap-year-display {
  font-family: var(--mono);
  font-size: 40px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -1px;
}

.snap-jumps {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.chip-label {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 1px;
  color: var(--dim);
  margin-right: 2px;
  white-space: nowrap;
}

.snap-jump {
  font-family: var(--mono);
  font-size: 9px;
  padding: 4px 10px;
  background: transparent;
  border: 0.5px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  white-space: nowrap;
}
.snap-jump:hover,
.snap-jump.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 700;
}

/* Range slider */
#snap-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  background: var(--surface);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  margin: 0;
}
#snap-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 2px rgba(255,212,59,0.3);
}
#snap-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 2px rgba(255,212,59,0.3);
}

.snap-range-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 8px;
  color: var(--dim);
}

.snap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  padding: 20px 0 40px;
}

.snap-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}

.snap-card-country {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 0.5px solid var(--border);
}

.snap-weapon {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  border-radius: 4px;
  padding: 4px;
  margin-left: -4px;
  transition: background 0.1s;
}
.snap-weapon:hover { background: rgba(255,255,255,0.04); }
.snap-weapon:last-child { margin-bottom: 0; }

.snap-weapon-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}

.snap-weapon-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.snap-weapon-role {
  font-family: var(--mono);
  font-size: 8px;
  margin-top: 2px;
  letter-spacing: 0.3px;
}

.snap-empty {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--dim);
  padding: 8px 0;
}

.snap-note {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--dim);
  padding-bottom: 40px;
  text-align: center;
}

.snap-browse-cta {
  background: none;
  border: none;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: color 0.15s;
}
.snap-browse-cta:hover { color: var(--text); }

/* ══════════════════════════════════════════════
   VIEW 3: BROWSE ALL
══════════════════════════════════════════════ */

.browse-bar {
  position: sticky;
  top: 108px;
  z-index: 50;
  background: rgba(7,7,26,0.97);
  backdrop-filter: blur(12px);
  border-bottom: 0.5px solid var(--border);
  padding: 12px 0;
}

.filter-row-1 {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.search-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--dim);
  pointer-events: none;
}

#browse-search {
  width: 100%;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 8px;
  padding: 9px 36px 9px 34px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
#browse-search:focus { border-color: rgba(255,212,59,0.35); }
#browse-search::placeholder { color: var(--dim); }

.search-clear {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
}

.filter-row-2 {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.chip-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.chip-group::-webkit-scrollbar { display: none; }

.chip {
  font-family: var(--mono);
  font-size: 9px;
  background: transparent;
  border: 0.5px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  color: var(--muted);
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.chip.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 700;
}

.result-count {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
  letter-spacing: 0.5px;
  white-space: nowrap;
  margin-left: auto;
}

/* ── VERTICAL TIMELINE (Browse view) ────────────────────────────────── */
.tl-body {
  padding: 0 0 80px;
}

.table-empty {
  padding: 60px 24px;
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--dim);
}

.timeline-wrap {
  position: relative;
  padding-top: 8px;
}

.timeline-wrap::before {
  content: '';
  position: absolute;
  left: 56px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
}

.tl-era {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 36px 0 16px 76px;
}

.tl-era-label {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  white-space: nowrap;
}

.tl-era-line {
  flex: 1;
  height: 0.5px;
  background: var(--border);
}

.tl-entry {
  display: flex;
  align-items: flex-start;
  cursor: pointer;
  position: relative;
  margin-bottom: 2px;
}

.tl-year-col {
  width: 48px;
  flex-shrink: 0;
  text-align: right;
  padding-top: 13px;
}

.tl-year {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--dim);
  letter-spacing: 0.3px;
}

.tl-dot-col {
  width: 17px;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  padding-top: 17px;
}

.tl-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--bg);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition: transform 0.15s;
}

.tl-entry:hover .tl-dot,
.tl-entry.active .tl-dot { transform: scale(1.3); }

.tl-card {
  flex: 1;
  padding: 10px 12px 10px 14px;
  border-radius: 6px;
  transition: background 0.1s;
  min-width: 0;
}

.tl-entry:hover .tl-card { background: rgba(255,255,255,0.03); }
.tl-entry.active .tl-card { background: rgba(255,212,59,0.06); }

.tl-cat-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 3px;
  margin-bottom: 5px;
  opacity: 0.85;
}

.tl-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.3;
}

.tl-meta {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--dim);
}

/* ── DETAIL DRAWER ───────────────────────────────────────────────────── */
.detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(0,0,0,0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}
.detail-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 58%;
  max-width: 760px;
  min-width: 360px;
  z-index: 100;
  background: var(--bg);
  border-left: 0.5px solid var(--border);
  box-shadow: -24px 0 60px rgba(0,0,0,0.45);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.detail-panel.open { transform: translateX(0); }

.detail-overlay-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(7,7,26,0.97);
  backdrop-filter: blur(12px);
  border-bottom: 0.5px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
}

.detail-back {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  transition: color 0.15s;
}
.detail-back:hover { color: var(--text); }

.detail-inner {
  padding: 28px 24px 80px;
}

.detail-name {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.2;
}

.detail-meta-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
}

.detail-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 4px;
}

.detail-badge-outline {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  background: rgba(255,255,255,0.04);
  border: 0.5px solid rgba(255,255,255,0.1);
  padding: 3px 8px;
  border-radius: 4px;
}

.detail-body {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.85;
}

.detail-spec-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}

.spec-item {
  background: rgba(255,255,255,0.02);
  border: 0.5px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
}

.spec-label {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--dim);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.spec-value {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.spec-value.accent { color: var(--accent); }

/* ── FORM MODALS ─────────────────────────────────────────────────────── */
.form-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.form-modal-inner {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  overflow: hidden;
}

.form-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 0.5px solid var(--border);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--muted);
}

.form-modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

.form-modal-body {
  padding: 20px 20px 24px;
}

.form-modal-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 20px;
}

.form-field {
  margin-bottom: 16px;
}

.form-field label {
  display: block;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.8px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 0.5px solid var(--border);
  border-radius: 6px;
  padding: 9px 12px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus { border-color: rgba(255,212,59,0.4); }
.form-field input::placeholder,
.form-field textarea::placeholder { color: var(--dim); }

.form-field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23666' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}
.form-field select option { background: var(--surface); color: var(--text); }
.form-field textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

.req { color: var(--accent); }

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.form-cancel {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 12px;
}
.form-cancel:hover { color: var(--text); }

.form-success {
  text-align: center;
  padding: 32px 20px;
}

.form-success-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(46,204,113,0.15);
  border: 0.5px solid rgba(46,204,113,0.3);
  color: #2ecc71;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.form-success p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  max-width: 300px;
  margin: 0 auto;
}

/* ── RESPONSIVE ──────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .snap-grid { grid-template-columns: repeat(2, 1fr); }
  .snap-top-row { flex-direction: column; gap: 12px; }
}

@media (max-width: 700px) {
  .detail-panel { width: 100%; min-width: unset; max-width: unset; border-left: none; box-shadow: none; }
  .form-modal { align-items: flex-end; padding: 0; }
  .form-modal-inner { border-radius: 16px 16px 0 0; max-width: 100%; }
  .timeline-wrap::before { left: 44px; }
  .tl-era { padding-left: 60px; }
  .tl-year-col { width: 36px; }
  .db-sep { display: none; }
}

@media (max-width: 600px) {
  .snap-grid { grid-template-columns: 1fr; }
  .view-tab { font-size: 9px; padding: 0 10px; }
}

@media (max-width: 420px) {
  .result-count { display: none; }
}
