/* Static directory detail pages (models + brands).

   Adopts the range directory's listing-page treatment so these pages read as
   part of the same site: paper background, big Archivo title, an editorial
   header with a prominently framed manufacturer logo, meta chips, and a
   2fr / 1fr body with a sidebar of white cards. Component bits (dx-kv,
   dx-wtb-*, dx-price-*, grade badges) come from directory/styles.css. */

.dx-detail { background: var(--paper, #F4F1EA); }
.dx-detail .listing-inner { max-width: 1140px; margin: 0 auto; }
.dx-detail .listing-section { padding: var(--s-6, 28px) var(--gutter, 24px) var(--s-9, 72px); }

/* ---------- breadcrumb + back ---------- */
.dx-detail .listing-breadcrumb {
  font: 600 11px var(--mono, 'JetBrains Mono', monospace);
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted, #6E7178); margin-bottom: 10px;
}
.dx-detail .listing-breadcrumb a { color: var(--orange-deep, #C84711); text-decoration: none; }
.dx-detail .listing-breadcrumb a:hover { text-decoration: underline; }
.dx-detail .listing-breadcrumb .sep { margin: 0 6px; color: var(--range-tan-deep, #C9B68A); }
.dx-detail .listing-breadcrumb .current { color: var(--charcoal, #1F2528); }
.dx-back-link {
  display: inline-flex; align-items: center; gap: 5px;
  font: 700 13px var(--body, 'DM Sans', sans-serif);
  color: var(--orange-deep, #C84711); text-decoration: none;
  margin-bottom: var(--s-6, 26px); transition: gap 0.16s ease;
}
.dx-back-link:hover { gap: 9px; }

/* ============ HEADER (site-consistent, editorial) ============ */
.dx-model-header, .dx-brand-header {
  display: flex; align-items: center; gap: clamp(16px, 2.4vw, 28px);
  margin-bottom: var(--s-7, 40px);
  padding-bottom: var(--s-6, 28px);
  border-bottom: 2px solid var(--rule, #E2DBC9);
  position: relative;
}
/* warm wash + faint topo grain behind the header for visual interest */
.dx-model-header::after, .dx-brand-header::after {
  content: ""; position: absolute; inset: -24px -24px 0; z-index: -1;
  background:
    radial-gradient(720px 220px at 88% 20%, rgba(242, 92, 31, 0.06), transparent 70%),
    radial-gradient(520px 200px at 4% 90%, rgba(90, 143, 58, 0.05), transparent 72%);
  pointer-events: none;
}
.dx-model-header-logo, .dx-brand-header-logo { flex-shrink: 0; }
.dx-bighero-logo {
  width: clamp(84px, 11vw, 124px); height: clamp(84px, 11vw, 124px);
  border-radius: 22px; background: #fff;
  border: 1px solid var(--rule, #E2DBC9);
  box-shadow: 0 14px 34px -16px rgba(31, 37, 40, 0.34);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.dx-bighero-logo img { width: 76%; height: 76%; object-fit: contain; }
.dx-bighero-logo.is-fallback { background: linear-gradient(135deg, var(--orange, #F25C1F), var(--orange-deep, #C84711)); border: none; }
.dx-bighero-logo .dx-logo-ini { font: 900 clamp(30px, 4vw, 44px) var(--display, 'Archivo', sans-serif); color: #fff; }

.dx-model-header-text, .dx-brand-header-text { min-width: 0; }
.dx-model-eyebrow {
  display: block; font: 700 12px var(--mono, 'JetBrains Mono', monospace);
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--orange-deep, #C84711); margin-bottom: 6px;
}
.dx-model-title, .dx-brand-title {
  font: 900 clamp(28px, 4.4vw, 50px)/1.03 var(--display, 'Archivo', sans-serif);
  letter-spacing: -0.03em; color: var(--charcoal, #1F2528); margin: 0;
}
.dx-brand-header-row { margin-top: 12px; }

/* website pill in the brand header */
.dx-brand-site {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--charcoal, #1F2528); color: #fff;
  font: 700 13px var(--mono, 'JetBrains Mono', monospace); letter-spacing: 0.02em;
  border-radius: 999px; padding: 9px 17px; text-decoration: none;
  transition: transform 0.16s ease, background 0.16s ease;
}
.dx-brand-site:hover { background: var(--orange-deep, #C84711); transform: translateY(-2px); }
.dx-brand-site .dx-outbound-arrow { opacity: 0.7; }

/* meta chips (caliber / powerplant / type / production / catalog count) */
.dx-meta-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.dx-meta-chip {
  display: inline-flex; flex-direction: column; gap: 1px;
  background: #fff; border: 1px solid var(--rule, #E2DBC9);
  border-radius: 10px; padding: 7px 13px; min-width: 0;
}
.dx-meta-chip.is-accent { border-color: rgba(242, 92, 31, 0.45); background: rgba(242, 92, 31, 0.05); }
.dx-meta-chip-k { font: 700 9px var(--mono, 'JetBrains Mono', monospace); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted, #6E7178); }
.dx-meta-chip-v { font: 800 14px var(--display, 'Archivo', sans-serif); color: var(--charcoal, #1F2528); }
.dx-meta-chip.is-accent .dx-meta-chip-v { color: var(--orange-deep, #C84711); }

/* ============ BODY: 2fr / 1fr ============ */
.dx-detail-body { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--s-8, 56px); margin-bottom: var(--s-9, 72px); }
.dx-detail-main { display: flex; flex-direction: column; gap: var(--s-7, 40px); min-width: 0; }
.dx-detail-side { display: flex; flex-direction: column; gap: var(--s-4, 18px); }
@media (min-width: 981px) { .dx-detail-side { position: sticky; top: 18px; align-self: start; } }
.dx-detail-main > section { padding: 0; }

/* section eyebrows */
.dx-detail .listing-block-eye {
  font: 600 var(--t-eye, 11px) var(--mono, 'JetBrains Mono', monospace);
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--orange-deep, #C84711); margin: 0 0 var(--s-4, 18px);
}

/* framed spec table */
.dx-kv--framed {
  background: #fff; border: 1.5px solid var(--rule, #E2DBC9);
  border-radius: var(--r-lg, 14px); padding: 4px var(--s-5, 22px);
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.06));
  display: grid; grid-template-columns: minmax(120px, 0.7fr) 1.3fr; margin: 0;
}
.dx-kv--framed dt {
  font: 600 10px var(--mono, 'JetBrains Mono', monospace); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted, #6E7178); padding: 13px 0; border-bottom: 1px dashed var(--rule, #E2DBC9);
  display: flex; align-items: center;
}
.dx-kv--framed dd {
  font: 600 14px var(--body, 'DM Sans', sans-serif); color: var(--charcoal, #1F2528);
  padding: 13px 0; margin: 0; border-bottom: 1px dashed var(--rule, #E2DBC9);
  display: flex; align-items: center;
}
.dx-kv--framed dt:nth-last-of-type(1), .dx-kv--framed dd:nth-last-of-type(1) { border-bottom: none; }

/* prose blocks */
.dx-prose-block .lead { font: 500 18px/1.5 var(--body, 'DM Sans', sans-serif); color: var(--charcoal, #1F2528); margin: 0; }
.dx-prose-block p { font: 400 15px/1.62 var(--body, 'DM Sans', sans-serif); color: #3f474d; margin: 0; }
.dx-prose-block p.dim { color: var(--muted, #6E7178); }
.dx-alias-row { display: flex; flex-wrap: wrap; gap: 6px; }
.dx-alias-row .dx-mini-chip {
  font: 600 12px var(--body, 'DM Sans', sans-serif); color: #5a6168;
  background: #fff; border: 1px solid var(--rule, #E2DBC9); border-radius: 999px; padding: 5px 12px;
}
.dx-source-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.dx-source-list li { display: flex; gap: 8px; font: 400 12.5px var(--body, 'DM Sans', sans-serif); }
.dx-source-list .num { color: var(--muted, #6E7178); font-family: var(--mono, monospace); flex-shrink: 0; }
.dx-source-list a { color: var(--orange-deep, #C84711); word-break: break-all; text-decoration: none; }
.dx-source-list a:hover { text-decoration: underline; }
.dx-outbound-link {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; border: 1.5px solid var(--rule, #E2DBC9); border-radius: 10px;
  padding: 11px 16px; font: 700 13.5px var(--body, 'DM Sans', sans-serif);
  color: var(--charcoal, #1F2528); text-decoration: none; transition: border-color 0.16s ease, transform 0.16s ease;
}
.dx-outbound-link:hover { border-color: var(--orange, #F25C1F); transform: translateY(-2px); }
.dx-outbound-arrow { color: var(--orange, #F25C1F); }

/* image gallery */
.dx-image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.dx-image-tile { aspect-ratio: 4/3; background: #fff; border: 1px solid var(--rule, #E2DBC9); border-radius: 12px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.dx-image-tile img { width: 100%; height: 100%; object-fit: contain; }
.dx-image-tile.is-broken { display: none; }

/* ============ SIDEBAR CARDS ============ */
.dx-detail-side .listing-side-card {
  background: #fff; border: 1.5px solid var(--rule, #E2DBC9);
  border-radius: var(--r-lg, 14px); padding: var(--s-5, 22px);
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.06));
}
.dx-detail-side .listing-side-card h3 {
  font: 600 var(--t-eye, 11px) var(--mono, 'JetBrains Mono', monospace);
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--orange-deep, #C84711);
  margin: 0 0 var(--s-4, 18px);
}

/* manufacturer card on model pages */
.dx-mfr-card { border-left: 5px solid var(--orange, #F25C1F) !important; }
.dx-mfr-card-link { display: grid; grid-template-columns: 52px 1fr; grid-template-rows: auto auto; column-gap: 13px; align-items: center; text-decoration: none; margin-bottom: 12px; }
.dx-mfr-card-logo { grid-row: 1 / 3; width: 52px; height: 52px; border-radius: 12px; background: var(--paper, #F4F1EA); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.dx-mfr-card-logo img { width: 80%; height: 80%; object-fit: contain; }
.dx-mfr-card-logo.is-fallback { background: linear-gradient(135deg, var(--orange, #F25C1F), var(--orange-deep, #C84711)); }
.dx-mfr-card-logo .dx-logo-ini { font: 900 19px var(--display, 'Archivo', sans-serif); color: #fff; }
.dx-mfr-card-name { font: 800 17px var(--display, 'Archivo', sans-serif); color: var(--charcoal, #1F2528); align-self: end; }
.dx-mfr-card-meta { font: 500 11.5px var(--body, 'DM Sans', sans-serif); color: var(--muted, #6E7178); align-self: start; }
.dx-mini-line { font: 400 13px/1.5 var(--body, 'DM Sans', sans-serif); color: #4a5258; margin: 0 0 12px; }
.dx-mini-grades { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.dx-mini-grade { display: inline-flex; align-items: center; gap: 5px; font: 600 11px var(--body, 'DM Sans', sans-serif); color: var(--muted, #6E7178); }
.dx-mini-grade-badge { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; font: 800 11px var(--display, 'Archivo', sans-serif); border: 1px solid transparent; }
.dx-mfr-card-cta { display: flex; align-items: center; gap: 6px; font: 700 13px var(--body, 'DM Sans', sans-serif); color: var(--orange-deep, #C84711); text-decoration: none; }
.dx-mfr-card-cta:hover .dx-related-arrow { transform: translateX(3px); }
.dx-related-arrow { transition: transform 0.16s ease; }

/* ratings card on brand pages */
.dx-ratings-card { border-top: 4px solid var(--orange, #F25C1F); }
.dx-grade-row { display: flex; align-items: center; gap: 13px; padding: 11px 0; border-bottom: 1px dashed var(--rule, #E2DBC9); }
.dx-grade-row:last-of-type { border-bottom: none; }
.dx-grade-badge-large { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 11px; font: 800 20px var(--display, 'Archivo', sans-serif); border: 1.5px solid transparent; flex-shrink: 0; }
.dx-grade-row-name { font: 800 14px var(--display, 'Archivo', sans-serif); color: var(--charcoal, #1F2528); }
.dx-grade-row-sub { font: 500 11px var(--body, 'DM Sans', sans-serif); color: var(--muted, #6E7178); }
.dx-grade-rationale { font: 400 12px/1.5 var(--body, 'DM Sans', sans-serif); color: var(--muted, #6E7178); margin: 12px 0 0; padding-top: 12px; border-top: 1px dashed var(--rule, #E2DBC9); }

/* grade badge palette */
.grade-a { background: rgba(90,143,58,.16); color: var(--topo-sage-deep, #3A6225); border-color: rgba(90,143,58,.5) !important; }
.grade-b { background: rgba(168,166,80,.20); color: #6a6420; border-color: rgba(168,166,80,.55) !important; }
.grade-c { background: rgba(229,165,60,.22); color: #a87121; border-color: rgba(229,165,60,.55) !important; }
.grade-d { background: rgba(224,112,36,.18); color: #b8531a; border-color: rgba(224,112,36,.5) !important; }
.grade-f { background: rgba(178,58,26,.16); color: #9c3015; border-color: rgba(178,58,26,.5) !important; }
.grade-na { background: #ece8dd; color: #9aa0a6; border-color: #ddd6c6 !important; }

/* at-a-glance facts */
.listing-fact { display: flex; flex-direction: column; gap: 3px; padding: 11px 0; border-bottom: 1px dashed var(--rule, #E2DBC9); }
.listing-fact:last-child { border-bottom: none; padding-bottom: 0; }
.listing-fact:first-of-type { padding-top: 0; }
.listing-fact-label { font: 600 10px var(--mono, 'JetBrains Mono', monospace); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted, #6E7178); }
.listing-fact-value { font: 600 13.5px var(--body, 'DM Sans', sans-serif); color: var(--charcoal, #1F2528); }

/* official-site card */
.dx-sitecard-link { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.dx-sitecard-logo { width: 40px; height: 40px; border-radius: 9px; background: var(--paper, #F4F1EA); display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.dx-sitecard-logo img { width: 80%; height: 80%; object-fit: contain; }
.dx-sitecard-logo.is-fallback { background: linear-gradient(135deg, var(--orange, #F25C1F), var(--orange-deep, #C84711)); }
.dx-sitecard-logo .dx-logo-ini { font: 800 15px var(--display, 'Archivo', sans-serif); color: #fff; }
.dx-sitecard-dom { font: 700 13.5px var(--mono, 'JetBrains Mono', monospace); color: var(--charcoal, #1F2528); flex: 1; word-break: break-all; }

/* where-to-buy + price band sit inside sidebar cards: strip their inner section chrome */
.dx-side-wtb .dx-drawer-section, .dx-side-price .dx-drawer-section { background: none; border: none; padding: 0; }
.dx-side-wtb .dx-drawer-section--wtb h3, .dx-side-price h3 { color: var(--orange-deep, #C84711); }
.dx-side-wtb .dx-wtb-row { flex-wrap: wrap; gap: 8px; }
.dx-side-wtb .dx-wtb-main { width: 100%; }
.dx-side-wtb .dx-wtb-right { width: 100%; justify-content: space-between; }

/* ============ CATALOG GRID (brand pages) ============ */
.dx-cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 10px; }
.dx-cat-item {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border: 1px solid var(--rule, #E2DBC9); border-radius: 11px;
  padding: 11px 13px; text-decoration: none;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}
.dx-cat-item:hover { transform: translateY(-2px); border-color: var(--orange, #F25C1F); box-shadow: 0 10px 22px -12px rgba(200, 71, 17, 0.35); }
.dx-cat-logo { width: 40px; height: 40px; border-radius: 9px; background: var(--paper, #F4F1EA); display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.dx-cat-logo img { width: 80%; height: 80%; object-fit: contain; }
.dx-cat-logo.is-fallback { background: linear-gradient(135deg, var(--orange, #F25C1F), var(--orange-deep, #C84711)); }
.dx-cat-logo .dx-logo-ini { font: 800 15px var(--display, 'Archivo', sans-serif); color: #fff; }
.dx-cat-text { min-width: 0; flex: 1; }
.dx-cat-name { display: block; font: 800 14px var(--display, 'Archivo', sans-serif); color: var(--charcoal, #1F2528); }
.dx-cat-meta { display: block; font: 500 11.5px var(--body, 'DM Sans', sans-serif); color: var(--muted, #6E7178); margin-top: 1px; }
.dx-cat-item .dx-related-arrow { margin-left: auto; color: var(--orange, #F25C1F); flex-shrink: 0; }

/* logo helper shared shape */
.dx-logo { position: relative; }
.dx-logo.is-fallback img { display: none; }

/* ============ RESPONSIVE ============ */
@media (max-width: 980px) {
  .dx-cat-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

  /* On mobile the primary content must follow the header, not sit beneath the
     sidebar cards. We flatten the main/side wrappers (display:contents) so all
     cards become orderable siblings, then set an explicit reading order per
     page type. */
  .dx-detail-body { display: flex; flex-direction: column; gap: var(--s-5, 22px); }
  .dx-detail-main, .dx-detail-side { display: contents; }
  .dx-detail-main { gap: 0; }

  /* MODEL (gun) page: specs are the key info, so they lead; manufacturer
     context and where-to-buy follow. */
  .dx-model-body .dx-gallery-block   { order: 1; }
  .dx-model-body .dx-spec-block      { order: 2; }
  .dx-model-body .dx-mfr-card        { order: 3; }
  .dx-model-body .dx-side-wtb        { order: 4; }
  .dx-model-body .dx-side-price      { order: 5; }
  .dx-model-body .dx-outbound-block  { order: 6; }

  /* BRAND (manufacturer) page: lead with what the brand is, then the grades
     and quick facts (the key reference info), then the longer prose, catalog,
     and sources. */
  .dx-brand-body .dx-sec-oneline     { order: 1; }
  .dx-brand-body .dx-sec-inwords     { order: 2; }
  .dx-brand-body .dx-ratings-card    { order: 3; }
  .dx-brand-body .dx-facts-card      { order: 4; }
  .dx-brand-body .dx-sec-commentary  { order: 5; }
  .dx-brand-body .dx-sec-support     { order: 6; }
  .dx-brand-body .dx-sec-alias       { order: 7; }
  .dx-brand-body .dx-catalog-block   { order: 8; }
  .dx-brand-body .dx-sec-sources     { order: 9; }
  .dx-brand-body .dx-sitecard        { order: 10; }

  /* sidebar cards lose their sticky positioning when flattened */
  .dx-detail-side .listing-side-card { position: static; }
}
@media (max-width: 680px) {
  .dx-model-header, .dx-brand-header { flex-direction: column; align-items: flex-start; gap: 16px; }
  .dx-kv--framed { grid-template-columns: 1fr; }
  .dx-kv--framed dt { padding-bottom: 2px; border-bottom: none; }
  .dx-kv--framed dd { padding-top: 2px; }
}


/* Brand summary line (replaces the old "In one line" section header).
   Scoped to beat `.dx-prose-block p`'s font shorthand. */
.dx-prose-block p.dx-brand-summary {
  font: 600 19px/1.55 var(--body, 'DM Sans', sans-serif);
  color: var(--charcoal, #1F2528);
  margin: 0;
}

/* Sources — clean host display instead of raw truncated URLs */
.dx-source-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.dx-source-list li { margin: 0; }
.dx-source-list a {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #fff; border: 1px solid var(--rule, #E2DBC9); border-radius: 9px;
  padding: 10px 13px; text-decoration: none;
  font: 600 12.5px var(--mono, 'JetBrains Mono', monospace); color: var(--charcoal, #1F2528);
  transition: border-color 0.14s ease, transform 0.14s ease;
}
.dx-source-list a:hover { border-color: var(--orange, #F25C1F); transform: translateY(-1px); }
.dx-source-host { word-break: break-all; }
.dx-source-list .dx-outbound-arrow { color: var(--orange, #F25C1F); flex-shrink: 0; }
