/* =============================================================
   PlinkExchange Ballistics Lab — overrides + components
   --------------------------------------------------------------
   Dev tokens, primitives, header, footer, body grain, and reset
   are loaded from /vendor/dev-base.css (mirror of the canonical
   stylesheet shared across all Plink Exchange properties).
   This file contains only the Lab-specific extensions.
   ============================================================= */

/* Numeric tabular alignment for calculator results */
.num { font-variant-numeric: tabular-nums; }

/* =============================================================
   PRIMITIVES — Lab-specific only (dev-base.css provides .eye, .section,
   .container, .lede, .btn, .chip, .card, .field — see vendor/dev-base.css)
   ============================================================= */

/* Override: dev sets .section-head margin-bottom to s-10 (64px); we use
   s-9 (48px) on this site for tighter inline-page heros. */
.section-head { margin-bottom: var(--s-9); }
.section-head__eye   { display: block; margin-bottom: var(--s-3); }
.section-head__title {
  font-family: var(--display);
  font-size: var(--t-4xl);
  font-weight: 900;
  line-height: 1.02;
  letter-spacing: -0.028em;
  margin: 0;
  color: var(--charcoal);
}
.section-head__lede {
  margin-top: var(--s-4);
  font-size: var(--t-lg);
  color: var(--charcoal-3);
  line-height: 1.55;
}
.section--ink .section-head__title { color: var(--paper); }
.section--ink .section-head__eye   { color: var(--orange); }
.section--ink .section-head__lede  { color: rgba(244,241,234,0.75); }

/* =============================================================
   PAGE HEAD (dx-page-head pattern, mirrors directory site)
   ============================================================= */

/* Tighten the page-head padding from dev's section-y default */
.dx-page-head { padding: var(--s-9) 0 var(--s-7) !important; }

.dx-page-title {
  font-size: clamp(34px, 4.4vw, 56px);
  font-weight: 900;
  letter-spacing: -.034em;
  line-height: 1.02;
  margin: var(--s-4) 0 var(--s-3);
  max-width: 18ch;
}

.dx-page-lede {
  max-width: 64ch;
  margin-bottom: var(--s-6);
}
.dx-page-lede strong {
  color: var(--charcoal);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.dx-page-meta {
  list-style: none;
  padding: 0; margin: 0;
  display: flex; flex-wrap: wrap;
  gap: var(--s-3) var(--s-6);
  font-size: var(--t-sm);
  color: var(--charcoal-3);
}
.dx-page-meta li {
  display: flex; align-items: center;
  gap: 8px;
}
.dx-page-meta .dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--orange);
  flex-shrink: 0;
}
.dx-page-meta strong {
  color: var(--charcoal);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* =============================================================
   HERO
   ============================================================= */

.hero { padding-block: var(--s-9) var(--s-7); padding-inline: var(--gutter); }
.hero--tight { padding-block: var(--s-7) var(--s-5); }
.hero .container { max-width: var(--content-max); margin: 0 auto; }
.hero__eye { margin-bottom: var(--s-5); display: block; }
.hero__title {
  font-family: var(--display);
  font-size: clamp(36px, 4.6vw, 64px);
  font-weight: 900;
  line-height: 1.02;
  letter-spacing: -0.034em;
  color: var(--charcoal);
  margin: 0;
  max-width: 18ch;
}
.hero__title em {
  font-style: normal;
  color: var(--orange);
  font-weight: 900;
}
.hero__lede {
  margin-top: var(--s-7);
  font-size: var(--t-lg);
  color: var(--charcoal-3);
  line-height: 1.55;
  max-width: 56ch;
  font-weight: 400;
}

/* =============================================================
   SHOT PROFILE BAR (sits below hero, rule-bracketed)
   ============================================================= */

.profile {
  background: linear-gradient(to bottom, var(--paper-warm) 0%, var(--paper-deep) 100%);
  border-top: 1.5px solid var(--rule-2);
  border-bottom: 1.5px solid var(--rule-2);
  padding: var(--s-4) var(--gutter);
  position: relative;
  /* Stacking-context fix for the combobox typeahead. dev-base sets every
     section to z-index:2; the .calcs-section that follows in document order
     would paint on top of the dropdown without this. Bump above 2. */
  z-index: 10;
  /* Sticks to the hero above and the calcs grid below so the three
     pieces read as one connected control surface */
  margin-top: calc(-1 * var(--s-3));
}
.profile::before {
  /* Subtle orange accent stripe along the top edge to draw the eye */
  content: '';
  position: absolute;
  top: -1.5px; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(to right, var(--orange) 0%, var(--orange) 25%, transparent 100%);
  pointer-events: none;
}
.profile-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: end;
  gap: var(--s-6);
}
.profile-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 9px;
  min-width: 0;
}
.profile-label__eye {
  display: block;
}
.profile-label__hint {
  font-family: 'DM Sans', sans-serif;
  font-size: var(--t-xs);
  font-weight: 500;
  color: var(--muted);
  letter-spacing: -0.005em;
  text-transform: none;
}
.profile-fields {
  display: grid;
  grid-template-columns: minmax(0, 3.4fr) repeat(3, minmax(76px, 0.9fr));
  gap: var(--s-3);
  align-items: end;
  min-width: 0;
}
.profile-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.profile-field label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.profile-field input,
.profile-field select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: white;
  border: 1.5px solid var(--rule-2);
  border-radius: var(--r);
  padding: 9px 12px;
  font: 600 var(--t-sm) 'DM Sans', sans-serif;
  color: var(--charcoal);
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.profile-field select {
  padding-right: 34px;
  font-size: 12.5px;
  letter-spacing: -0.005em;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M2 4l3 3 3-3' fill='none' stroke='%234A5560' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.profile-field select option { font-size: 13.5px; padding: 4px 8px; }
.profile-field select optgroup { font-style: normal; font-weight: 700; color: var(--charcoal); }
.profile-field input:focus,
.profile-field select:focus { border-color: var(--orange); box-shadow: var(--focus-ring); }

.profile-reset {
  appearance: none;
  background: transparent;
  border: 1.5px solid var(--rule-2);
  border-radius: var(--r-pill);
  padding: 8px 16px;
  font: 600 var(--t-sm) 'DM Sans', sans-serif;
  color: var(--charcoal-3);
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition: border-color 0.16s, color 0.16s;
}
.profile-reset:hover { border-color: var(--orange); color: var(--orange-deep); }

@media (max-width: 980px) {
  .profile-inner { grid-template-columns: 1fr; gap: var(--s-3); }
  .profile-label { padding-bottom: 0; }
  .profile-fields { grid-template-columns: 1fr 1fr; }
  .profile-fields .profile-field--pellet { grid-column: 1 / -1; }
  .profile-reset { justify-self: start; }
}
@media (max-width: 480px) {
  .profile-fields { grid-template-columns: 1fr; }
}

/* =============================================================
   CALCULATOR GRID — mini cards that expand inline
   ============================================================= */

.calcs-section { padding: var(--s-8) var(--gutter) var(--section-y); }
.calcs-section .container { max-width: var(--content-max); margin: 0 auto; }

.calc-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-5);
  align-items: stretch;
}
@media (max-width: 1040px) {
  .calc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .calc-grid { grid-template-columns: 1fr; }
}

.calc-grid-section-label {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: var(--s-3);
  margin: var(--s-4) 0 var(--s-1);
}
.calc-grid-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule);
}
.calc-grid-section-label .eye { color: var(--charcoal-3); }
.calc-grid-section-label:first-child { margin-top: 0; }

/* ---- The card itself ---- */

.calc-card {
  position: relative;
  background: white;
  border: 1.5px solid var(--rule);
  border-radius: var(--r-md);
  display: grid;
  grid-template-rows: auto 0fr;
  transition:
    grid-template-rows 0.5s var(--ease-soft),
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
  min-width: 0;
}
.calc-card:hover:not(.is-expanded) {
  border-color: var(--orange);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.calc-card.is-expanded {
  grid-template-rows: auto 1fr;
  grid-column: 1 / -1;
  border-color: var(--orange);
  box-shadow: var(--shadow-lg);
  transform: none;
}

/* Mini view — always visible, always usable */
.cc-mini {
  padding: var(--s-5) var(--s-5) var(--s-4);
  display: flex; flex-direction: column;
  gap: var(--s-3);
  min-width: 0;
}
.cc-mini__head { display: flex; align-items: start; justify-content: space-between; gap: var(--s-3); }
.cc-mini__eye { font-size: 10px; }
.cc-mini__title {
  font-family: 'Archivo';
  font-size: var(--t-lg);
  font-weight: 800;
  letter-spacing: -0.018em;
  color: var(--charcoal);
  margin: 0;
}
.cc-mini__lede {
  font-size: var(--t-sm);
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}

.cc-mini__form {
  display: grid;
  gap: var(--s-2);
  margin-top: auto;
}
.cc-mini__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-2);
}
.cc-mini__row--3 { grid-template-columns: repeat(3, 1fr); }
.cc-mini__field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cc-mini__field label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.cc-mini__field input,
.cc-mini__field select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--paper);
  border: 1.5px solid var(--rule-2);
  border-radius: var(--r-sm);
  padding: 7px 10px;
  font: 600 var(--t-sm) 'DM Sans';
  color: var(--charcoal);
  font-variant-numeric: tabular-nums;
  outline: none;
  width: 100%;
  min-width: 0;
  transition: border-color 0.14s;
}
.cc-mini__field select {
  padding-right: 26px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M2 4l3 3 3-3' fill='none' stroke='%234A5560' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.cc-mini__field input:focus,
.cc-mini__field select:focus { border-color: var(--orange); }

.cc-mini__result {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s-3);
  margin-top: var(--s-2);
  padding-top: var(--s-3);
  border-top: 1px dashed var(--rule);
}
.cc-mini__result-primary {
  font-family: 'Archivo';
  font-size: var(--t-2xl);
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--charcoal);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.cc-mini__result-primary .unit {
  font-size: var(--t-sm); font-weight: 600; color: var(--charcoal-3);
  margin-left: 4px;
}
.cc-mini__result-secondary {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--t-xs);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.cc-expand-btn {
  appearance: none;
  background: transparent;
  border: 0;
  font: 600 var(--t-xs) 'JetBrains Mono', monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--charcoal-3);
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  margin-top: var(--s-3);
  transition: color 0.14s;
}
.cc-expand-btn::after {
  content: '↓';
  display: inline-block;
  font-family: 'DM Sans';
  font-size: 14px;
  transform: translateY(-1px);
  transition: transform 0.3s var(--ease-soft);
}
.calc-card:hover .cc-expand-btn { color: var(--orange-deep); }
.calc-card.is-expanded .cc-expand-btn { color: var(--orange-deep); }
.calc-card.is-expanded .cc-expand-btn::after { transform: translateY(-1px) rotate(180deg); }
.calc-card.is-expanded .cc-expand-btn .label-collapsed { display: none; }
.calc-card:not(.is-expanded) .cc-expand-btn .label-expanded { display: none; }

/* Expanded view — collapsed by default via grid-rows trick */
.cc-expanded-wrap {
  overflow: hidden;
  min-height: 0;
}
.cc-expanded {
  border-top: 1px solid var(--rule);
  padding: var(--s-7) var(--s-5) var(--s-5);
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(0, 1.4fr);
  gap: var(--s-7);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.35s 0.1s ease, transform 0.4s 0.1s var(--ease-soft);
}
.calc-card.is-expanded .cc-expanded {
  opacity: 1;
  transform: none;
}
@media (max-width: 820px) {
  .cc-expanded { grid-template-columns: 1fr; gap: var(--s-5); padding: var(--s-5); }
}

.cc-expanded__inputs { display: flex; flex-direction: column; gap: var(--s-4); }
.cc-expanded__viz    { display: flex; flex-direction: column; gap: var(--s-4); min-width: 0; }

/* Expanded inputs — labeled fields with optional sliders */
.cc-input {
  display: flex; flex-direction: column;
  gap: var(--s-2);
}
.cc-input__label {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--t-eye);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--charcoal-3);
  display: flex; justify-content: space-between; align-items: baseline;
}
.cc-input__label-hint { color: var(--muted); font-weight: 500; letter-spacing: 0.06em; text-transform: none; }
.cc-input__num {
  appearance: none;
  -webkit-appearance: none;
  background: white;
  border: 1.5px solid var(--rule-2);
  border-radius: var(--r);
  padding: 10px 14px;
  font: 700 var(--t-lg) 'DM Sans';
  font-variant-numeric: tabular-nums;
  color: var(--charcoal);
  outline: none;
  width: 100%;
  transition: border-color 0.16s, box-shadow 0.16s;
}
.cc-input__num:focus { border-color: var(--orange); box-shadow: var(--focus-ring); }
.cc-input__slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--rule);
  border-radius: 4px;
  outline: none;
  margin: 4px 0;
}
.cc-input__slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--orange);
  border: 3px solid var(--paper);
  box-shadow: 0 1px 4px rgba(45,54,61,0.3);
  cursor: pointer;
}
.cc-input__slider::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--orange);
  border: 3px solid var(--paper);
  box-shadow: 0 1px 4px rgba(45,54,61,0.3);
  cursor: pointer;
}

/* Output card on the right of expanded view */
.cc-output {
  background: var(--paper-warm);
  border: 1.5px solid var(--rule);
  border-radius: var(--r-md);
  padding: var(--s-5);
}
.cc-output__primary {
  display: flex; align-items: baseline;
  gap: var(--s-3);
  font-family: 'Archivo';
  font-weight: 900;
  letter-spacing: -0.025em;
  color: var(--charcoal);
}
.cc-output__primary .value {
  font-size: clamp(36px, 4.5vw, 56px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.cc-output__primary .unit {
  font-size: var(--t-lg);
  color: var(--charcoal-3);
  font-weight: 700;
}
.cc-output__secondary {
  margin-top: var(--s-3);
  display: flex; flex-wrap: wrap; gap: var(--s-4);
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--t-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.cc-output__secondary span { display: inline-flex; gap: 6px; align-items: baseline; }
.cc-output__secondary span b { color: var(--charcoal); font-weight: 700; font-variant-numeric: tabular-nums; }

/* Use-case bar — shared visual */
.usecase-bar {
  margin-top: var(--s-5);
  display: flex; flex-direction: column; gap: var(--s-2);
}
.usecase-bar__track {
  display: grid;
  height: 28px;
  border-radius: var(--r-pill);
  overflow: hidden;
  position: relative;
  border: 1.5px solid var(--rule);
}
.usecase-bar__band { height: 100%; }
.usecase-bar__marker {
  position: absolute;
  top: -6px; bottom: -6px;
  width: 3px;
  background: var(--charcoal);
  box-shadow: 0 0 0 2px var(--paper);
  transition: left 0.35s var(--ease-soft);
  pointer-events: none;
}
.usecase-bar__marker::before {
  content: '';
  position: absolute; left: 50%; top: -8px;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--charcoal);
}
.usecase-bar__legend {
  display: grid;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.usecase-bar__legend span { padding: 0 4px; text-align: center; }
.usecase-bar__legend span.is-active { color: var(--charcoal); font-weight: 700; }

.cc-readout-line {
  display: flex; justify-content: space-between; gap: var(--s-3);
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--t-xs);
  color: var(--muted);
  letter-spacing: 0.06em;
}
.cc-readout-line strong { color: var(--charcoal); font-weight: 700; }

/* SVG chart container */
.cc-chart {
  background: white;
  border: 1.5px solid var(--rule);
  border-radius: var(--r-md);
  padding: var(--s-4);
  position: relative;
}
.cc-chart svg { display: block; width: 100%; height: auto; }
.cc-chart__caption {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: var(--s-2);
}

/* Formula reveal */
.cc-formula {
  border: 1.5px solid var(--rule);
  border-radius: var(--r);
  background: white;
  overflow: hidden;
}
.cc-formula__toggle {
  appearance: none;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: var(--s-3) var(--s-4);
  display: flex; align-items: center; justify-content: space-between;
  font: 600 var(--t-eye) 'JetBrains Mono', monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--charcoal-3);
}
.cc-formula__toggle::after {
  content: '+';
  font-family: 'DM Sans';
  font-size: 18px;
  font-weight: 700;
  transition: transform 0.3s var(--ease-soft);
}
.cc-formula__toggle[aria-expanded="true"]::after { transform: rotate(45deg); }
.cc-formula__panel {
  display: none;
  padding: 0 var(--s-4) var(--s-4);
  border-top: 1px solid var(--rule);
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--t-sm);
  color: var(--charcoal);
  line-height: 1.7;
}
.cc-formula__panel.is-open { display: block; padding-top: var(--s-3); }
.cc-formula__panel .equation { margin: 4px 0; font-variant-numeric: tabular-nums; }
.cc-formula__panel .equation strong { color: var(--orange-deep); }
.cc-formula__panel .source {
  margin-top: var(--s-3);
  font-size: var(--t-xs);
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
}

/* Reference table for converters */
.cc-ref-table {
  background: white;
  border: 1.5px solid var(--rule);
  border-radius: var(--r-md);
  overflow: hidden;
  font-size: var(--t-sm);
}
.cc-ref-table table { width: 100%; border-collapse: collapse; }
.cc-ref-table th, .cc-ref-table td {
  padding: 9px 14px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--rule);
}
.cc-ref-table th {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--t-eye);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: right;
  background: var(--paper-warm);
}
.cc-ref-table th:first-child, .cc-ref-table td:first-child { text-align: left; }
.cc-ref-table tbody tr:last-child td { border-bottom: 0; }
.cc-ref-table tbody tr.is-current { background: var(--orange-tint); }
.cc-ref-table tbody tr.is-current td { color: var(--orange-deep); font-weight: 700; }

/* Stub message for unbuilt expanded views */
.cc-stub {
  background: var(--paper-warm);
  border: 1.5px dashed var(--rule-2);
  border-radius: var(--r-md);
  padding: var(--s-5);
  font-size: var(--t-sm);
  color: var(--charcoal-3);
  line-height: 1.55;
}
.cc-stub strong { color: var(--charcoal); }

/* =============================================================
   PELLET LIBRARY SECTION
   ============================================================= */

.pellets-section {
  border-top: 1px solid var(--rule);
  background: var(--paper-warm);
}
.pellets-table-wrap {
  background: white;
  border: 1.5px solid var(--rule);
  border-radius: var(--r-md);
  overflow: hidden;
}
.pellets-table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.pellets-table th {
  background: var(--paper-warm);
  text-align: left;
  padding: 12px 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--t-eye);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
}
.pellets-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--rule);
  font-variant-numeric: tabular-nums;
  color: var(--charcoal);
}
.pellets-table tbody tr:last-child td { border-bottom: 0; }
.pellets-table tbody tr:hover { background: var(--paper); }
.pellets-table .cal {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--charcoal-3);
  font-size: var(--t-xs);
}
.pellets-table .name { font-weight: 600; }
.pellets-table .use-btn {
  appearance: none; background: transparent;
  border: 1.5px solid var(--rule-2);
  border-radius: var(--r-pill);
  padding: 4px 12px;
  font: 600 var(--t-eye) 'JetBrains Mono', monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--charcoal-3);
  transition: border-color 0.14s, color 0.14s, background 0.14s;
}
.pellets-table .use-btn:hover { border-color: var(--orange); color: var(--orange-deep); background: var(--orange-tint); }
.pellets-table .use-btn.is-active { background: var(--charcoal); border-color: var(--charcoal); color: var(--paper); }

@media (max-width: 720px) {
  .pellets-table .col-bc { display: none; }
  .pellets-table th, .pellets-table td { padding: 10px 12px; }
}

/* =============================================================
   ABOUT SECTION
   ============================================================= */

.about-section { border-top: 1px solid var(--rule); }
.about-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-5);
}
@media (max-width: 880px) { .about-grid { grid-template-columns: 1fr; } }

.about-card {
  background: white;
  border: 1.5px solid var(--rule);
  border-radius: var(--r);
  padding: var(--s-5);
  position: relative;
  transition: transform 0.16s, box-shadow 0.16s;
}
.about-card::before {
  content: '';
  position: absolute; left: 0; top: 22px; bottom: 22px;
  width: 3px;
  background: var(--orange);
  border-radius: 0 4px 4px 0;
  opacity: 0;
  transition: opacity 0.16s;
}
.about-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.about-card:hover::before { opacity: 1; }
.about-card__eye { display: block; margin-bottom: var(--s-2); }
.about-card__title {
  font-family: 'Archivo';
  font-size: var(--t-lg);
  font-weight: 800;
  letter-spacing: -0.018em;
  margin: 0 0 var(--s-2);
  color: var(--charcoal);
}
.about-card__body {
  font-size: var(--t-sm);
  color: var(--charcoal-3);
  line-height: 1.55;
  margin: 0;
}


/* =============================================================
   PRINT
   ============================================================= */

@media print {
  body::before, .hdr, .profile, .ftr { display: none !important; }
  .calc-card { break-inside: avoid; box-shadow: none; }
  .calc-card .cc-expanded-wrap { grid-row: auto; }
}

/* =============================================================
   METHODOLOGY (dark, with subtle noise)
   ============================================================= */
.methodology-section {
  padding: var(--section-y) var(--gutter);
  background: var(--charcoal);
  color: var(--paper);
  position: relative;
}
.methodology-section::before {
  content: '';
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence baseFrequency='0.85' numOctaves='2' seed='6'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.04 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  pointer-events: none;
  opacity: 0.5;
}
.methodology-inner { max-width: var(--content-max); margin: 0 auto; position: relative; }
.methodology-inner .section-head__title { color: var(--paper); }
.methodology-inner .section-head__eye   { color: var(--orange); }

.method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--s-7);
}
.method-num {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--t-eye);
  color: var(--orange);
  font-weight: 600;
  letter-spacing: 0.18em;
  margin-bottom: var(--s-2);
}
.method-h {
  font-size: var(--t-lg);
  font-weight: 800;
  letter-spacing: -0.018em;
  color: var(--paper);
  margin-bottom: var(--s-2);
}
.method-block p { font-size: var(--t-sm); color: rgba(244,241,234,0.78); line-height: 1.55; margin: 0; }

/* =============================================================
   DISCLAIMER (centered paper section)
   ============================================================= */
.disclaimer-section {
  padding: var(--section-y-tight) var(--gutter);
  background: var(--paper);
  border-top: 1px solid var(--rule);
}
.disclaimer-inner {
  max-width: 880px;
  margin: 0 auto;
  text-align: center;
}
.disclaimer-inner h2 {
  font-size: var(--t-4xl);
  font-weight: 900;
  letter-spacing: -0.025em;
  margin: var(--s-2) 0 var(--s-4);
}
.disclaimer-inner p {
  font-size: var(--t-base);
  color: var(--charcoal-3);
  line-height: 1.65;
  max-width: 720px;
  margin: 0 auto;
}
.disclaimer-inner a { border-bottom: 1px dotted currentColor; }
.disclaimer-inner a:hover { border-bottom-color: var(--orange); }

/* =============================================================
   COMBOBOX (search-as-you-type pellet picker)
   ============================================================= */
.combobox {
  position: relative;
  display: flex;
  align-items: stretch;
  background: white;
  border: 1.5px solid var(--rule-2);
  border-radius: var(--r);
  transition: border-color 0.16s, box-shadow 0.16s;
  min-width: 0;
}
.combobox:focus-within {
  border-color: var(--orange);
  box-shadow: var(--focus-ring);
}
.combobox input {
  flex: 1;
  appearance: none;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 9px 0 9px 12px;
  font: 600 13px 'DM Sans', sans-serif;
  color: var(--charcoal);
  letter-spacing: -0.005em;
  min-width: 0;
}
.combobox input::placeholder {
  color: var(--muted);
  font-weight: 500;
}
.combobox__caret {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0 12px 0 8px;
  display: flex;
  align-items: center;
  cursor: pointer;
  color: var(--charcoal-3);
  transition: color 0.14s, transform 0.16s;
}
.combobox__caret svg {
  width: 11px;
  height: 11px;
  transition: transform 0.18s;
}
.combobox__caret:hover { color: var(--orange-deep); }
.combobox[aria-expanded="true"] .combobox__caret svg { transform: rotate(180deg); }

.combobox__listbox {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: white;
  border: 1.5px solid var(--rule);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  max-height: 360px;
  overflow-y: auto;
  z-index: 40;
  padding: 4px;
}
.combobox__listbox[hidden] { display: none; }

.combobox__option {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: var(--t-sm);
  color: var(--charcoal);
  user-select: none;
  transition: background 0.1s;
}
.combobox__option:hover,
.combobox__option.is-active {
  background: var(--orange-tint);
}
.combobox__option.is-selected {
  background: var(--paper-warm);
}
.combobox__option-cal {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--orange-deep);
  background: var(--orange-tint);
  padding: 2px 8px;
  border-radius: var(--r-pill);
  text-align: center;
}
.combobox__option.is-active .combobox__option-cal,
.combobox__option:hover .combobox__option-cal {
  background: white;
}
.combobox__option-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.combobox__option-title {
  font-weight: 600;
  color: var(--charcoal);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.005em;
}
.combobox__option-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.combobox__option-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--charcoal-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}
.combobox__option mark {
  background: var(--orange-tint);
  color: var(--orange-deep);
  padding: 0 1px;
  border-radius: 2px;
}
.combobox__empty {
  padding: var(--s-5);
  text-align: center;
  color: var(--muted);
  font-size: var(--t-sm);
}
.combobox__empty strong { color: var(--charcoal); display: block; margin-bottom: 4px; }
.combobox__hint {
  padding: 6px 10px 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px dashed var(--rule);
  margin-bottom: 4px;
}

/* =============================================================
   PAGE ROUTER (show/hide pages by visibility)
   ============================================================= */
.page[hidden] { display: none !important; }
.page { animation: fadeIn 0.18s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Active nav state */
.hdr-nav a.is-active {
  color: var(--orange-deep);
}
.hdr-nav a.is-active::after {
  transform: scaleX(1);
}

/* =============================================================
   DATABASE — SEARCH ROW (large, prominent)
   ============================================================= */
.db-search-row { margin-bottom: var(--s-5); }
.db-search {
  position: relative;
  display: flex;
  align-items: center;
  background: white;
  border: 1.5px solid var(--rule-2);
  border-radius: var(--r-md);
  padding: 0 var(--s-4);
  transition: border-color 0.16s, box-shadow 0.16s;
}
.db-search:focus-within {
  border-color: var(--orange);
  box-shadow: var(--focus-ring);
}
.db-search__icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  color: var(--charcoal-3);
  margin-right: 12px;
}
.db-search input {
  flex: 1;
  border: 0; outline: 0;
  background: transparent;
  font: 500 var(--t-md) 'DM Sans', sans-serif;
  padding: 16px 0;
  color: var(--charcoal);
  letter-spacing: -0.005em;
}
.db-search input::placeholder { color: var(--muted); }
.db-search__clear {
  appearance: none;
  background: var(--paper);
  border: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--charcoal-3);
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
  flex-shrink: 0;
}
.db-search__clear:hover { background: var(--orange-tint); color: var(--orange-deep); }
.db-search__clear svg { width: 12px; height: 12px; }

/* =============================================================
   DATABASE — CALIBER VISUAL SELECTOR
   each tile shows the caliber, count, and a sized circle suggesting bore
   ============================================================= */
.db-caliber-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: var(--s-2);
  margin-bottom: var(--s-5);
}
.db-cal-tile {
  appearance: none;
  background: white;
  border: 1.5px solid var(--rule-2);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.14s;
  text-align: center;
}
.db-cal-tile:hover {
  border-color: var(--orange);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px -8px rgba(0,0,0,0.18);
}
.db-cal-tile.is-active {
  background: var(--charcoal);
  border-color: var(--charcoal);
  color: var(--paper);
}
.db-cal-tile.is-active .db-cal-tile__name { color: var(--paper); }
.db-cal-tile.is-active .db-cal-tile__count { color: var(--orange); }
.db-cal-tile.is-active .db-cal-tile__bore { background: var(--orange); border-color: var(--orange); }
.db-cal-tile__bore-wrap {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.db-cal-tile__bore {
  background: var(--orange-tint);
  border: 1.5px solid var(--orange);
  border-radius: 50%;
  display: block;
  transition: all 0.14s;
}
.db-cal-tile__name {
  font-family: 'Archivo', sans-serif;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--charcoal);
  font-variant-numeric: tabular-nums;
}
.db-cal-tile__count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.db-cal-tile--all {
  background: var(--paper-warm);
  border-style: dashed;
}
.db-cal-tile--all .db-cal-tile__bore-wrap { font-family: 'Archivo'; font-size: 22px; font-weight: 900; color: var(--charcoal-3); letter-spacing: -0.04em; }
.db-cal-tile--all.is-active .db-cal-tile__bore-wrap { color: var(--orange); }

/* =============================================================
   DATABASE — PROJECTILE TYPE GRID (icons)
   ============================================================= */
.db-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--s-3);
  margin-bottom: var(--s-5);
}
.db-type-tile {
  appearance: none;
  background: white;
  border: 1.5px solid var(--rule-2);
  border-radius: var(--r);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.14s;
}
.db-type-tile:hover { border-color: var(--orange); transform: translateY(-1px); }
.db-type-tile.is-active {
  background: var(--charcoal);
  border-color: var(--charcoal);
  color: var(--paper);
}
.db-type-tile.is-active .db-type-tile__icon { color: var(--orange); }
.db-type-tile.is-active .db-type-tile__count { color: rgba(244,241,234,0.6); }
.db-type-tile__icon {
  width: 32px; height: 32px;
  flex-shrink: 0;
  color: var(--charcoal-3);
}
.db-type-tile__icon svg { width: 100%; height: 100%; }
.db-type-tile__main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.db-type-tile__name {
  font-weight: 700;
  font-size: var(--t-sm);
  color: var(--charcoal);
  letter-spacing: -0.005em;
}
.db-type-tile.is-active .db-type-tile__name { color: var(--paper); }
.db-type-tile__count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* =============================================================
   DATABASE — REFINE ROW (game band + ranges + sort)
   ============================================================= */
.db-refine {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  padding: var(--s-4);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  margin-bottom: var(--s-5);
}
.db-refine__group { display: flex; flex-direction: column; gap: var(--s-2); }
.db-refine__label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--charcoal-3);
}
.db-refine__icon {
  width: 14px; height: 14px;
  color: var(--orange-deep);
}
.db-band-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.db-band-pill {
  appearance: none;
  background: white;
  border: 1.5px solid var(--rule-2);
  border-radius: var(--r-pill);
  padding: 6px 14px;
  font: 600 var(--t-sm) 'DM Sans', sans-serif;
  color: var(--charcoal-3);
  cursor: pointer;
  transition: all 0.14s;
  font-variant-numeric: tabular-nums;
}
.db-band-pill__count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--muted);
  margin-left: 4px;
  font-weight: 500;
}
.db-band-pill:hover { border-color: var(--orange); color: var(--orange-deep); }
.db-band-pill.is-active {
  background: var(--charcoal);
  border-color: var(--charcoal);
  color: var(--paper);
}
.db-band-pill.is-active .db-band-pill__count { color: rgba(244,241,234,0.6); }

/* Crossfilter disabled state: count is 0 given other active filters.
   Buttons stay clickable so users can clear them or pivot, but visually
   signal that toggling them on (as an addition) won't surface new rows. */
.db-cal-tile.is-disabled,
.db-type-tile.is-disabled,
.db-band-pill.is-disabled {
  opacity: 0.42;
}
.db-cal-tile.is-disabled .db-cal-tile__count,
.db-type-tile.is-disabled .db-type-tile__count,
.db-band-pill.is-disabled .db-band-pill__count {
  color: var(--muted);
}
.db-cal-tile.is-disabled .db-cal-tile__bore {
  background: var(--paper-deep);
  border-color: var(--rule-2);
}
.db-cal-tile.is-disabled:hover,
.db-type-tile.is-disabled:hover,
.db-band-pill.is-disabled:hover {
  opacity: 0.7;
}

.db-refine__row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: var(--s-4);
  align-items: end;
}
.db-range { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.db-range__inputs { display: flex; align-items: center; gap: 6px; }
.db-range__inputs input {
  flex: 1; min-width: 0;
  appearance: none;
  background: white;
  border: 1.5px solid var(--rule-2);
  border-radius: var(--r-sm);
  padding: 9px 10px;
  font: 600 var(--t-sm) 'DM Sans', sans-serif;
  color: var(--charcoal);
  font-variant-numeric: tabular-nums;
  outline: none;
  transition: border-color 0.14s;
}
.db-range__inputs input:focus { border-color: var(--orange); }
.db-range__dash { color: var(--muted); font-weight: 600; }
#db-sort {
  appearance: none; -webkit-appearance: none;
  background: white;
  border: 1.5px solid var(--rule-2);
  border-radius: var(--r-sm);
  padding: 9px 32px 9px 10px;
  font: 600 var(--t-sm) 'DM Sans', sans-serif;
  color: var(--charcoal);
  outline: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M2 4l3 3 3-3' fill='none' stroke='%234A5560' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
#db-sort:focus { border-color: var(--orange); }
#db-sort optgroup {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--orange-deep);
  background: var(--paper-warm);
}
#db-sort option {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--charcoal);
  background: white;
  padding: 4px 8px;
}
.db-clear {
  appearance: none;
  background: white;
  border: 1.5px solid var(--rule-2);
  border-radius: var(--r-pill);
  padding: 9px 18px;
  font: 600 var(--t-sm) 'DM Sans', sans-serif;
  color: var(--charcoal-3);
  cursor: pointer;
  transition: all 0.14s;
  white-space: nowrap;
  height: 38px;
}
.db-clear:hover { border-color: var(--orange-deep); color: var(--orange-deep); background: var(--orange-tint); }

@media (max-width: 720px) {
  .db-refine__row { grid-template-columns: 1fr; }
}

/* =============================================================
   DATABASE — RESULTS HEAD + CARDS
   ============================================================= */
.db-results-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-4);
  flex-wrap: wrap;
}
.db-results-head__count {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--t-sm);
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0;
}
.db-results-head__count strong {
  color: var(--charcoal);
  font-weight: 700;
  font-size: var(--t-md);
  font-variant-numeric: tabular-nums;
}
.db-results-head__visible {
  display: inline-block;
  margin-left: var(--s-2);
  font-size: var(--t-xs);
  color: var(--muted);
}
.db-results-head__hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: var(--t-xs);
  color: var(--muted);
  font-style: italic;
}
.db-results-head__hint svg {
  width: 13px; height: 13px;
  color: var(--orange-deep);
}

.db-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-3);
}

.db-card {
  appearance: none;
  background: white;
  border: 1.5px solid var(--rule);
  border-radius: var(--r-md);
  padding: var(--s-4);
  text-align: left;
  cursor: pointer;
  transition: all 0.16s;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  position: relative;
}
.db-card:hover {
  border-color: var(--orange);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px -10px rgba(0,0,0,0.16);
}
.db-card.is-in-use {
  border-color: var(--charcoal);
  background: var(--paper-warm);
}
.db-card.is-in-use::before {
  content: 'IN USE';
  position: absolute;
  top: 10px; right: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--paper);
  background: var(--charcoal);
  padding: 3px 8px;
  border-radius: var(--r-pill);
}

.db-card__head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.db-card__cal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--orange-deep);
  background: var(--orange-tint);
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-variant-numeric: tabular-nums;
}
.db-card__cal--slug { background: var(--paper-deep); color: var(--charcoal); }
.db-card__cal--bigbore { background: var(--charcoal); color: var(--orange); }
.db-card__shape-icon {
  width: 26px; height: 26px;
  flex-shrink: 0;
  color: var(--charcoal-3);
}
.db-card__shape-icon svg { width: 100%; height: 100%; }
.db-card__type {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-left: auto;
}

.db-card__mfr {
  font-size: var(--t-xs);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--orange-deep);
}
.db-card__name {
  font-family: 'Archivo', sans-serif;
  font-size: var(--t-md);
  font-weight: 700;
  color: var(--charcoal);
  letter-spacing: -0.012em;
  line-height: 1.25;
  margin: 0;
}

.db-card__specs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  border-top: 1px dashed var(--rule);
  padding-top: 10px;
  margin-top: auto;
}
.db-card__spec {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-right: 6px;
}
.db-card__spec + .db-card__spec { border-left: 1px dashed var(--rule); padding-left: 10px; }
.db-card__spec-val {
  font-family: 'Archivo', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--charcoal);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.db-card__spec-val--muted { color: var(--muted); }
.db-card__spec-lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.db-card__band {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--charcoal-3);
  letter-spacing: -0.005em;
  margin-top: 4px;
}
.db-card__band-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.db-card__band-dot--t1 { background: var(--tier-1); }
.db-card__band-dot--t2 { background: var(--tier-2); }
.db-card__band-dot--t3 { background: var(--tier-3); }
.db-card__band-dot--t4 { background: var(--tier-4); }
.db-card__band-dot--rank-2 { background: var(--rank-2); }
.db-card__band-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Empty state */
.db-empty {
  padding: var(--s-9) var(--s-5);
  text-align: center;
  background: var(--paper-warm);
  border: 1px dashed var(--rule);
  border-radius: var(--r-md);
}
.db-empty p { margin: var(--s-3) auto var(--s-4); max-width: 460px; line-height: 1.5; color: var(--charcoal-3); }

/* Truncated notice */
.db-truncated {
  margin-top: var(--s-5);
  padding: var(--s-4);
  background: var(--paper-deep);
  border: 1px solid var(--rule-2);
  border-radius: var(--r-md);
}
.db-truncated__inner {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  max-width: 720px;
  margin: 0 auto;
}
.db-truncated svg {
  width: 22px; height: 22px;
  flex-shrink: 0;
  color: var(--orange-deep);
}
.db-truncated p {
  margin: 0;
  font-size: var(--t-sm);
  color: var(--charcoal-3);
  line-height: 1.5;
}
.db-truncated strong { color: var(--charcoal); font-weight: 700; }

/* =============================================================
   DATABASE — DETAIL MODAL
   ============================================================= */
.db-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-4);
  animation: modalIn 0.18s ease-out;
}
.db-modal[hidden] { display: none; }
@keyframes modalIn { from { opacity: 0; } to { opacity: 1; } }
.db-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 37, 40, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.db-modal__panel {
  position: relative;
  overscroll-behavior: contain;
  background: var(--paper);
  border-radius: var(--r-md);
  max-width: 720px;
  width: 100%;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-shadow: 0 24px 64px -8px rgba(0,0,0,0.4);
  animation: modalSlide 0.22s ease-out;
}
@keyframes modalSlide { from { transform: translateY(12px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
.db-modal__close {
  position: absolute;
  top: 14px; right: 14px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: white;
  border: 1.5px solid var(--rule);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--charcoal-3);
  z-index: 2;
  transition: all 0.14s;
}
.db-modal__close:hover { background: var(--orange-tint); border-color: var(--orange); color: var(--orange-deep); }
.db-modal__close svg { width: 14px; height: 14px; }
.db-modal__body { padding: var(--s-7); }

/* Modal content blocks */
.dbm-head { margin-bottom: var(--s-5); padding-right: 40px; }
.dbm-cal-row { display: flex; align-items: center; gap: 10px; margin-bottom: var(--s-3); flex-wrap: wrap; }
.dbm-cal {
  display: inline-flex;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--orange-deep);
  background: var(--orange-tint);
  padding: 5px 12px;
  border-radius: var(--r-pill);
}
.dbm-cal--slug { background: var(--paper-deep); color: var(--charcoal); }
.dbm-cal--bigbore { background: var(--charcoal); color: var(--orange); }
.dbm-type-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--charcoal-3);
  background: white;
  border: 1px solid var(--rule);
  padding: 4px 10px;
  border-radius: var(--r-pill);
}
.dbm-mfr {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--orange-deep);
  margin-bottom: 4px;
}
.dbm-name {
  font-family: 'Archivo', sans-serif;
  font-size: clamp(22px, 2.8vw, 28px);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--charcoal);
  line-height: 1.15;
  margin: 0;
}

.dbm-specs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-3);
  background: white;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: var(--s-4);
  margin-bottom: var(--s-5);
}
.dbm-spec { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dbm-spec__val {
  font-family: 'Archivo', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--charcoal);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dbm-spec__val--muted { color: var(--muted); }
.dbm-spec__lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
@media (max-width: 560px) {
  .dbm-specs { grid-template-columns: repeat(2, 1fr); }
}

.dbm-section {
  margin-bottom: var(--s-5);
}
.dbm-section__title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--orange-deep);
  margin-bottom: var(--s-2);
  display: flex;
  align-items: center;
  gap: 8px;
}
.dbm-section__title svg { width: 13px; height: 13px; }

.dbm-fpe-table {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  background: var(--paper-warm);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.dbm-fpe-cell {
  padding: 10px 12px;
  text-align: center;
  border-right: 1px solid var(--rule);
}
.dbm-fpe-cell:last-child { border-right: 0; }
.dbm-fpe-cell__lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
}
.dbm-fpe-cell__val {
  font-family: 'Archivo', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--charcoal);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
  display: block;
}

.dbm-band {
  background: var(--paper-warm);
  border-left: 3px solid var(--orange);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.dbm-band__name {
  font-family: 'Archivo', sans-serif;
  font-size: var(--t-md);
  font-weight: 700;
  color: var(--charcoal);
  letter-spacing: -0.01em;
}
.dbm-band__min {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--t-xs);
  color: var(--charcoal-3);
}
.dbm-band__min strong { color: var(--orange-deep); font-size: 13px; font-weight: 700; }

.dbm-list {
  margin: 0; padding: 0; list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
  font-size: var(--t-sm);
}
.dbm-list li {
  color: var(--charcoal-3);
  padding-left: 14px;
  position: relative;
}
.dbm-list li::before {
  content: '';
  position: absolute;
  left: 0; top: 9px;
  width: 6px; height: 1.5px;
  background: var(--orange);
}
@media (max-width: 480px) {
  .dbm-list { grid-template-columns: 1fr; }
}

.dbm-prose {
  font-size: var(--t-sm);
  color: var(--charcoal-3);
  line-height: 1.55;
}

.dbm-actions {
  display: flex;
  gap: var(--s-3);
  margin-top: var(--s-5);
  padding-top: var(--s-5);
  border-top: 1px solid var(--rule);
}
.dbm-action {
  appearance: none;
  flex: 1;
  background: var(--charcoal);
  border: 1.5px solid var(--charcoal);
  border-radius: var(--r);
  padding: 13px 18px;
  font: 700 var(--t-sm) 'DM Sans', sans-serif;
  letter-spacing: -0.005em;
  color: var(--paper);
  cursor: pointer;
  transition: all 0.14s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.dbm-action:hover { background: var(--orange-deep); border-color: var(--orange-deep); }
.dbm-action svg { width: 14px; height: 14px; }
.dbm-action--secondary {
  background: white;
  border-color: var(--rule-2);
  color: var(--charcoal);
}
.dbm-action--secondary:hover { background: var(--paper-warm); border-color: var(--orange-deep); color: var(--orange-deep); }

/* =============================================================
   WHERE TO BUY (modal section)
   ============================================================= */
.dbm-section--wtb { /* uses common dbm-section spacing */ }
.dbm-section__sub {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: -0.005em;
  color: var(--muted);
  margin-left: 6px;
}

.wtb-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wtb-card {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: white;
  border: 1.5px solid var(--rule);
  border-radius: var(--r);
  text-decoration: none;
  color: var(--charcoal);
  transition: all 0.16s;
  cursor: pointer;
}
.wtb-card:hover {
  border-color: var(--orange);
  background: var(--paper-warm);
  transform: translateX(2px);
}
.wtb-card:hover .wtb-card__cta {
  color: var(--orange-deep);
}
.wtb-card:hover .wtb-card__cta svg {
  transform: translateX(2px);
}
.wtb-card--best {
  border-color: var(--orange);
  background: var(--orange-tint);
}
.wtb-card--best:hover {
  background: white;
}

.wtb-card__logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: white;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  flex-shrink: 0;
  overflow: hidden;
}
.wtb-card__logo {
  width: 100%;
  height: auto;
  max-height: 32px;
  object-fit: contain;
  padding: 4px 6px;
}
.wtb-card__logo--placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--charcoal-3);
  background: var(--paper-warm);
  letter-spacing: 0.04em;
  padding: 0;
}

.wtb-card__main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.wtb-card__retailer {
  font-family: 'Archivo', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--charcoal);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.wtb-card__badge {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: white;
  background: var(--orange-deep);
  padding: 2px 7px;
  border-radius: var(--r-pill);
}
.wtb-card__meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
  display: flex;
  gap: 10px;
}
.wtb-card__pack,
.wtb-card__cpr {
  text-transform: uppercase;
}

.wtb-card__price-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}
.wtb-card__price {
  font-family: 'Archivo', sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: var(--charcoal);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.wtb-card__price--unknown {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  letter-spacing: -0.005em;
}
.wtb-card__cta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--charcoal-3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.14s;
}
.wtb-card__cta svg {
  width: 11px;
  height: 11px;
  transition: transform 0.14s;
}

.wtb-disclaimer {
  margin: 12px 0 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  font-style: italic;
}

@media (max-width: 480px) {
  .wtb-card {
    grid-template-columns: 36px 1fr auto;
    gap: 10px;
    padding: 10px 12px;
  }
  .wtb-card__logo-wrap { width: 36px; height: 36px; }
  .wtb-card__logo { max-height: 26px; }
  .wtb-card__price { font-size: 16px; }
  .wtb-card__retailer { font-size: 13px; }
}

/* =============================================================
   RANGE MODE ENTRY BUTTON
   --------------------------------------------------------------
   Always-visible floating affordance. Glass-effect surface that
   hints at the Range Mode aesthetic. Pinned bottom-right with
   safe-area inset on phones with notches. Click opens the overlay.
   ============================================================= */

.range-mode-btn {
  position: fixed;
  right: calc(env(safe-area-inset-right, 0px) + 16px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  z-index: 25;             /* below header (30) and tooltip (1000), above content */
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 12px;
  border: 1px solid rgba(45, 54, 61, 0.14);
  border-radius: var(--r-pill);
  /* The glass surface — translucent background + backdrop blur,
     soft inner highlight to suggest a glass edge */
  background:
    linear-gradient(135deg, rgba(255,255,255,0.78), rgba(255,255,255,0.55));
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.7),         /* top edge highlight */
    0 1px 3px rgba(45,54,61,0.08),               /* tight ground shadow */
    0 12px 32px -10px rgba(45,54,61,0.20);       /* soft floating shadow */
  color: var(--charcoal);
  cursor: pointer;
  font-family: var(--body);
  text-align: left;
  transition: transform 0.18s var(--ease-out),
              box-shadow 0.18s var(--ease-out),
              background 0.18s var(--ease-out);
}
.range-mode-btn:hover,
.range-mode-btn:focus-visible {
  outline: none;
  transform: translateY(-1px);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.92), rgba(255,255,255,0.72));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.85),
    0 2px 4px rgba(45,54,61,0.10),
    0 18px 40px -10px rgba(242,92,31,0.30);
}
.range-mode-btn:active {
  transform: translateY(0);
}

.range-mode-btn__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,0.9), rgba(252,234,217,0.6) 60%, rgba(242,92,31,0.18) 100%);
  color: var(--orange-deep);
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}
.range-mode-btn__icon svg {
  width: 18px;
  height: 18px;
}
.range-mode-btn__label {
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.range-mode-btn__title {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--charcoal);
}
.range-mode-btn__sub {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 3px;
}

/* On narrow screens the label disappears, leaving just the icon orb */
@media (max-width: 480px) {
  .range-mode-btn { padding: 10px; gap: 0; }
  .range-mode-btn__label { display: none; }
}

/* Hidden once Range Mode is open (the overlay covers it anyway, but
   this stops it from picking up keyboard focus) */
body[data-range-open] .range-mode-btn { display: none; }


/* lock page scroll while the detail modal is open */
body.db-modal-open { overflow: hidden; }
.db-modal__backdrop { overscroll-behavior: contain; }
