/* =====================================================
   2027 Raider ICE Data Book – Site Styles
   Battle Motors dark/light theme
   ===================================================== */

/*
   SPEC IMAGE STANDARD
   -------------------
   All spec/product images: 200×250px source (height × width).
   Display: 160px width, height auto.
   - .spec-photos-row: flex row for multiple images (e.g., closed/open)
   Use these classes when adding new spec images.
*/

/* ---- Theme Variables (Dark default) ---- */
:root {
  --bg-body: #111;
  --bg-header: #000;
  --bg-sidebar: #0a0a0a;
  --bg-main: transparent;
  --bg-card: #181818;
  --bg-spec-item: #181818;
  --bg-search: #1a1a1a;
  --bg-search-focus: #222;
  --bg-search-results: #1a1a1a;
  --bg-table-even: #1a1a1a;
  --bg-table-odd: #141414;
  --bg-table-hover: #222;
  --bg-hero: #000;
  --bg-meta: #0a0a0a;
  --bg-hero-placeholder: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
  --bg-card-placeholder: linear-gradient(135deg, #1c1c1c 0%, #262626 100%);
  --bg-section-hero-placeholder: linear-gradient(135deg, #1a1a1a 0%, #222 100%);
  --color-text: #e8e8e8;
  --color-text-muted: #888;
  --color-text-dim: #bbb;
  --color-heading: #fff;
  --color-heading-muted: #ccc;
  --color-border: #222;
  --color-border-light: #333;
  --color-accent: #cc0000;
  --color-accent-hover: #ff3333;
  --color-footer: #555;
  --color-footer-link: #888;
  --color-note-bg: #1a1a00;
  --color-note-border: #aa8800;
  --color-note-text: #ccaa44;
  --shadow-card: 0 8px 24px rgba(0,0,0,.5);
}

[data-theme="light"] {
  --bg-body: #fff;
  --bg-header: #fff;
  --bg-sidebar: #fafafa;
  --bg-main: transparent;
  --bg-card: #fff;
  --bg-spec-item: #fff;
  --bg-search: #fff;
  --bg-search-focus: #fff;
  --bg-search-results: #fff;
  --bg-table-even: #f9f9f9;
  --bg-table-odd: #fff;
  --bg-table-hover: #f0f0f0;
  --bg-hero: #fff;
  --bg-meta: #f8f8f8;
  --bg-hero-placeholder: linear-gradient(135deg, #e8e8e8 0%, #f0f0f0 100%);
  --bg-card-placeholder: linear-gradient(135deg, #e8e8e8 0%, #f0f0f0 100%);
  --bg-section-hero-placeholder: linear-gradient(135deg, #e8e8e8 0%, #f0f0f0 100%);
  --color-text: #222;
  --color-text-muted: #555;
  --color-text-dim: #444;
  --color-heading: #111;
  --color-heading-muted: #333;
  --color-border: #ddd;
  --color-border-light: #e0e0e0;
  --color-accent: #cc0000;
  --color-accent-hover: #b30000;
  --color-footer: #555;
  --color-footer-link: #666;
  --color-note-bg: #fffde7;
  --color-note-border: #f0c040;
  --color-note-text: #7a6000;
  --shadow-card: 0 8px 24px rgba(0,0,0,.12);
}

/* ---- Reset / Base ---- */
* { box-sizing: border-box; }

body {
  background-color: var(--bg-body);
  color: var(--color-text);
  font-family: 'Lato', sans-serif;
  font-size: 15px;
  line-height: 1.65;
  margin: 0;
  padding: 0;
}

a { color: var(--color-accent); }
a:hover { color: var(--color-accent-hover); text-decoration: none; }

.config-ref {
  color: var(--color-accent);
  font-style: italic;
  font-weight: 400;
  font-size: 11px;
  white-space: nowrap;
  text-transform: none;
  letter-spacing: 0;
}

/* Configurator topic locations (red italic additions from markup PDF) */
.config-xref-list {
  color: var(--color-accent);
  font-style: italic;
  font-weight: 400;
  font-size: 12px;
  line-height: 1.45;
  margin: 6px 0 18px;
  white-space: normal;
  text-transform: none;
  letter-spacing: 0;
}

.config-xref-inline {
  color: var(--color-accent);
  font-style: italic;
  font-weight: 400;
  font-size: 12px;
  line-height: 1.35;
  text-transform: none;
  letter-spacing: 0;
}

/* Configurator ref on its own row under an item heading (matches PDF blocks) */
.spec-item-title + .config-xref-inline {
  display: block;
  margin: -2px 0 10px;
}

/* Stack duplicate xref lines tightly (PDF sometimes repeats the same tag) */
.spec-item-title + .config-xref-inline + .config-xref-inline {
  margin-top: -6px;
}

/* Keep main section title distinct from configurator tag */
.spec-section-title {
  flex-wrap: wrap;
}
.spec-title-text {
  white-space: nowrap;
}

/* Screen-reader only (kept in DOM for copy parity) */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
}

/* ---- Topbar Header ---- */
#site-header {
  background: var(--bg-header);
  padding: 0 24px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 3px solid var(--color-accent);
}

#site-header .logo-area {
  display: flex;
  align-items: center;
  gap: 16px;
}

#site-header .logo-area a {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

#site-header .logo-area a:hover {
  opacity: 0.9;
}

#site-header .logo-area img {
  height: 36px;
  width: auto;
}

#site-header .book-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-heading-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  line-height: 1.2;
  border-left: 2px solid var(--color-accent);
  padding-left: 14px;
}

#site-header .book-title span {
  display: block;
  color: var(--color-heading);
  font-size: 15px;
}

/* Header search – centered between logo and actions */
.header-search {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 0 24px;
  position: relative;
  max-width: 420px;
  margin: 0 auto;
}

.search-input-wrap {
  position: relative;
  width: 100%;
  max-width: 320px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: var(--color-text-muted);
  pointer-events: none;
}

#site-search {
  width: 100%;
  padding: 8px 14px 8px 40px;
  font-size: 13px;
  font-family: 'Lato', sans-serif;
  color: var(--color-heading);
  background: var(--bg-search);
  border: 1px solid var(--color-border-light);
  border-radius: 4px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

#site-search::placeholder {
  color: var(--color-text-muted);
}

#site-search:hover {
  border-color: var(--color-border);
}

#site-search:focus {
  border-color: var(--color-accent);
  background: var(--bg-search-focus);
}

/* Search results dropdown */
.search-results {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 6px;
  width: 100%;
  max-width: 480px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg-search-results);
  border: 1px solid var(--color-border-light);
  border-radius: 4px;
  box-shadow: var(--shadow-card);
  z-index: 1001;
}

.search-result-item {
  display: block;
  padding: 12px 16px;
  color: var(--color-text-dim);
  text-decoration: none;
  border-bottom: 1px solid var(--color-border);
  transition: background 0.15s;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: var(--bg-table-hover);
  color: var(--color-heading);
}

.search-result-title {
  display: block;
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-heading);
  margin-bottom: 4px;
}

.search-result-snippet {
  display: block;
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.search-result-empty {
  padding: 16px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.search-result-empty strong {
  color: var(--color-accent);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-dl-full,
.btn-dl-section,
.btn-theme-toggle {
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 9px 18px;
  border: 2px solid var(--color-accent);
  border-radius: 3px;
  cursor: pointer;
  text-decoration: none !important;
  white-space: nowrap;
  background: transparent;
  color: var(--color-accent) !important;
  box-sizing: border-box;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-dl-full:hover,
.btn-dl-section:hover,
.btn-theme-toggle:hover {
  background: var(--color-accent);
  color: #fff !important;
}

/* ---- Download dropdown ---- */
.dl-menu {
  position: relative;
  display: inline-flex;
}
.btn-dl-trigger {
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 9px 18px;
  border: 2px solid var(--color-accent);
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
  background: transparent;
  color: var(--color-accent);
  box-sizing: border-box;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-dl-trigger:hover,
.dl-menu.open .btn-dl-trigger {
  background: var(--color-accent);
  color: #fff;
}
.dl-caret {
  font-size: 10px;
  line-height: 1;
  transition: transform .15s ease;
}
.dl-menu.open .dl-caret { transform: rotate(180deg); }
.dl-menu-list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  display: none;
  flex-direction: column;
  gap: 6px;
  min-width: 100%;
  padding: 8px;
  background: var(--bg-card);
  border: 1px solid var(--color-accent);
  border-radius: 4px;
  box-shadow: var(--shadow-card);
  z-index: 1000;
}
.dl-menu.open .dl-menu-list { display: flex; }
.dl-menu-list .btn-dl-section,
.dl-menu-list .btn-dl-full {
  width: 100%;
}

/* ---- Layout Wrapper ---- */
#page-wrap {
  display: flex;
  min-height: calc(100vh - 72px);
}

/* ---- Sidebar ---- */
#sidebar {
  width: 270px;
  min-width: 270px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--color-border);
  padding: 24px 0;
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
  overflow-y: auto;
}

#sidebar h5 {
  color: var(--color-text-muted);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 0 20px 8px;
  margin: 16px 0 4px;
  border-bottom: 1px solid var(--color-border);
}

#sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

#sidebar ul li a {
  display: block;
  padding: 8px 20px;
  color: var(--color-text-dim);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}

#sidebar ul li a:hover,
#sidebar ul li a.active {
  color: var(--color-heading);
  background: var(--bg-table-hover);
  border-left-color: var(--color-accent);
}

#sidebar ul li a.nav-home {
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--color-accent);
}

#sidebar ul li a.nav-home:hover {
  background: var(--bg-table-hover);
  border-left-color: var(--color-accent);
  color: var(--color-accent-hover);
}

#sidebar .sub-links {
  padding-left: 16px;
}

#sidebar .sub-links li a {
  font-size: 12px;
  color: var(--color-text-muted);
  padding: 5px 20px 5px 12px;
}

#sidebar .sub-links li a:hover,
#sidebar .sub-links li a.active {
  color: var(--color-text-dim);
  background: var(--bg-spec-item);
  border-left-color: var(--color-accent);
}

/* ---- Main Content ---- */
#main-content {
  flex: 1;
  min-width: 0; /* allow the flex column to shrink below its content's intrinsic width */
  padding: 40px 48px;
  max-width: 1100px;
}

/* ---- Section Page Hero ---- */
.section-hero {
  background: var(--bg-hero);
  border-radius: 4px;
  margin-bottom: 36px;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  border: 1px solid var(--color-border);
}

.section-hero-img {
  width: 340px;
  min-height: 200px;
  background: var(--bg-search);
  object-fit: cover;
  display: block;
}

.section-hero-img-placeholder {
  width: 340px;
  min-height: 200px;
  background: var(--bg-section-hero-placeholder);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.section-hero-img-placeholder span {
  font-size: 48px;
  opacity: .35;
}

.section-hero-body {
  padding: 28px 32px;
}

.section-hero-body .section-badge {
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 8px;
}

.section-hero-body h1 {
  font-size: 28px;
  margin: 0 0 12px;
  color: var(--color-heading);
}

.section-hero-body p {
  color: var(--color-text-dim);
  font-size: 14px;
  margin: 0;
}

/* ---- Spec Sections ---- */
.spec-section {
  margin-bottom: 48px;
}

.spec-section-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--color-heading);
  padding-bottom: 10px;
  border-bottom: 2px solid var(--color-accent);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.spec-section-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 20px;
  background: var(--color-accent);
  border-radius: 2px;
}

.spec-subsection {
  margin-bottom: 28px;
}

.spec-subsection-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 10px;
  padding-left: 8px;
  border-left: 3px solid var(--color-accent);
}

.spec-item {
  margin-bottom: 18px;
  padding: 14px 18px;
  background: var(--bg-spec-item);
  border-radius: 4px;
  border-left: 3px solid var(--color-border-light);
}

.spec-item.is-standard { border-left-color: #2a7a2a; }
.spec-item.is-optional { border-left-color: var(--color-border); }

.spec-item-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-heading);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-std {
  font-size: 10px;
  font-weight: 700;
  background: #1a4d1a;
  color: #5dba5d;
  padding: 2px 7px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

[data-theme="light"] .badge-std {
  background: #e8f5e8;
  color: #2a7a2a;
}

.badge-opt {
  font-size: 10px;
  font-weight: 700;
  background: #2a2a2a;
  color: var(--color-text-muted);
  padding: 2px 7px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

[data-theme="light"] .badge-opt {
  background: #f0f0f0;
  color: #555;
}

.spec-item p {
  margin: 0;
  color: var(--color-text-dim);
  font-size: 13.5px;
  line-height: 1.6;
}

.spec-item ul {
  margin: 6px 0 0;
  padding-left: 18px;
  color: var(--color-text-dim);
  font-size: 13.5px;
}

/* ---- Spec with Image (two-column: text left, image right) ---- */
.spec-with-image {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.spec-with-image .spec-text {
  flex: 1;
  min-width: 0;
}

.spec-with-image .spec-image-col {
  flex-shrink: 0;
  width: 55%;
  max-width: 480px;
}

.spec-with-image .spec-image-col img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

.spec-with-image .spec-image-col img.spec-photo {
  width: 160px;
  height: auto;
  max-width: 100%;
}

/* Image fills vertical space to match text column */
.spec-with-image--fill-height {
  align-items: stretch;
}
.spec-with-image--fill-height .spec-image-col {
  display: flex;
  align-items: stretch;
}
.spec-with-image--fill-height .spec-image-col img {
  width: auto;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Standard spec photo: 160px width, height auto */
.spec-photo {
  width: 160px;
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

.spec-photos-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.spec-photos-row .spec-photo {
  flex-shrink: 0;
}

/* Connector images: two side-by-side above copy, captions below each */
.connector-images-block {
  margin-bottom: 24px;
}

.connector-images-row {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.connector-figure {
  margin: 0;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

.connector-figure .connector-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
  border: 1px solid var(--color-border-light);
}

.connector-figure figcaption {
  margin-top: 10px;
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.5;
}

@media (max-width: 900px) {
  .spec-with-image {
    flex-direction: column;
  }
  .spec-with-image .spec-image-col {
    width: 100%;
    max-width: none;
  }
  .spec-photo {
    width: 100%;
    max-width: 160px;
    height: auto;
  }
}

/* ---- Spec Tables ---- */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 20px;
  font-size: 13px;
}

.spec-table th {
  background: var(--color-accent);
  color: #fff;
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 9px 12px;
  text-align: left;
  white-space: nowrap;
}

.spec-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-dim);
  vertical-align: top;
}

.spec-table tr:nth-child(even) td { background: var(--bg-table-even); }
.spec-table tr:nth-child(odd) td { background: var(--bg-table-odd); }
.spec-table tr:hover td { background: var(--bg-table-hover); }

.spec-table .td-std {
  color: #5dba5d;
  font-weight: 600;
}

.spec-table .td-opt { color: var(--color-text-muted); }

/* ---- Note Callouts ---- */
.spec-note {
  background: var(--color-note-bg);
  border-left: 4px solid var(--color-note-border);
  color: var(--color-note-text);
  padding: 10px 16px;
  border-radius: 0 4px 4px 0;
  font-size: 13px;
  margin: 10px 0;
}

.spec-note strong { color: var(--color-note-text); }

/* ---- Index Page Cards ---- */
#index-body { padding: 40px 32px; max-width: 1400px; margin: 0 auto; }

.index-intro {
  margin-bottom: 40px;
}

.index-intro h1 {
  font-size: 32px;
  color: var(--color-heading);
  margin-bottom: 8px;
}

.index-intro p { color: var(--color-text-muted); font-size: 15px; }

.section-group-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin: 36px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 8px;
}

/* Feature row (e.g., single Overview card) */
.cards-grid--feature{
  grid-template-columns: 1fr;
}
.cards-grid--feature .spec-card{
  flex-direction: row;
  align-items: stretch;
  height: 160px;
}
.cards-grid--feature .spec-card-img{
  width: min(44%, 520px);
  height: 160px;
  object-fit: cover;
}
.cards-grid--feature .spec-card-body{
  padding: 14px 16px;
  justify-content: center;
}
.cards-grid--feature .spec-card-body h3{
  font-size: 16px;
  margin-bottom: 6px;
}
.cards-grid--feature .spec-card-body p{
  font-size: 13.5px;
  line-height: 1.6;
}

@media (max-width: 1200px) { .cards-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px) { .cards-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .cards-grid { grid-template-columns: 1fr; } }

@media (max-width: 900px) {
  .cards-grid--feature .spec-card{
    flex-direction: column;
    height: auto;
  }
  .cards-grid--feature .spec-card-img{
    width: 100%;
    min-height: 160px;
    height: 120px;
  }
}

.spec-card {
  background: var(--bg-card);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color .2s, transform .2s;
  text-decoration: none !important;
  color: inherit !important;
}

.spec-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.spec-card-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--color-border);
  display: block;
}

.spec-card-img-placeholder {
  width: 100%;
  height: 160px;
  background: var(--bg-card-placeholder);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  flex-shrink: 0;
}

.spec-card-body {
  padding: 16px 18px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.spec-card-body h3 {
  font-size: 15px;
  color: var(--color-heading);
  margin: 0 0 6px;
  font-weight: 700;
}

.spec-card-body p {
  font-size: 12.5px;
  color: var(--color-text-muted);
  margin: 0 0 12px;
  flex: 1;
  line-height: 1.5;
}

.spec-card-body .card-arrow {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-accent);
  font-family: 'Montserrat', sans-serif;
  letter-spacing: .5px;
  text-transform: uppercase;
}

/* ---- Footer ---- */
#site-footer {
  background: var(--bg-header);
  border-top: 1px solid var(--color-border);
  padding: 24px 48px;
  color: var(--color-footer);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

#site-footer a { color: var(--color-footer-link); }

/* ---- Index Hero & Meta (theme-aware) ---- */
body { overflow-x: hidden; }
.hero-banner {
  background: var(--bg-hero);
  border-bottom: 1px solid var(--color-border);
  padding: 64px 32px 56px;
}
.hero-inner{
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
  gap: 32px;
}
.hero-text { max-width: 700px; flex: 1 1 560px; min-width: 320px; }
.hero-text .eyebrow {
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 12px;
}
.hero-text h1 {
  font-size: 40px;
  color: var(--color-heading);
  margin: 0 0 16px;
  line-height: 1.1;
}
.hero-text p { color: var(--color-text-muted); font-size: 15px; max-width: 580px; margin: 0; }

/* Hero spec grid – quick reference specs below intro (image 3 style) */
.hero-spec-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px 32px;
  margin-top: 28px;
  padding: 24px 0 0;
  border-top: 1px solid var(--color-border);
}
.hero-spec-item {
  font-size: 12px;
}
.hero-spec-item .label {
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 10px;
  margin-bottom: 4px;
  font-family: 'Montserrat', sans-serif;
}
.hero-spec-item .value {
  color: var(--color-heading-muted);
  font-weight: 700;
}
.hero-spec-item .unit {
  font-weight: 500;
  color: var(--color-text-dim);
  font-size: 11px;
}
.hero-img-placeholder {
  width: clamp(360px, 38vw, 560px);
  min-width: 320px;
  height: 420px;
  background: transparent;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  border: 1px solid var(--color-border);
  flex-shrink: 0;
  overflow: hidden;
  margin-top: 56px;
}
.hero-img-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: 4px;
}
.meta-strip {
  background: var(--bg-meta);
  border-bottom: 1px solid var(--color-border);
}
.meta-inner{
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 32px;
  display: flex;
  gap: 40px;
  flex-wrap: wrap;
  justify-content: center;
}
.meta-item { font-size: 12px; }
.meta-item .label { color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 1px; font-size: 10px; margin-bottom: 2px; font-family: 'Montserrat', sans-serif; }
.meta-item .value { color: var(--color-heading-muted); font-weight: 700; }

@media (max-width: 1200px) {
  .hero-img-placeholder {
    width: clamp(320px, 44vw, 520px);
    min-width: 300px;
    height: 320px;
    margin-top: 44px;
  }
}
@media (max-width: 900px) {
  .hero-banner {
    padding: 48px 24px 40px;
  }
  .hero-inner{
    flex-direction: column;
    align-items: stretch;
    gap: 24px;
  }
  .hero-text {
    max-width: none;
  }
  .hero-text h1 {
    font-size: 32px;
  }
  .hero-text p {
    max-width: none;
  }
  .hero-spec-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px 24px;
    margin-top: 20px;
    padding-top: 20px;
  }
  .hero-img-placeholder {
    width: 100%;
    min-width: 0;
    height: 280px;
    max-width: 500px;
    margin: 0 auto;
  }
  .meta-strip {
    /* background stays full-width; padding lives on .meta-inner */
  }
  .meta-inner{
    padding: 14px 24px;
    gap: 28px;
  }
  #index-body {
    padding: 32px 24px;
  }
}
@media (max-width: 600px) {
  .hero-banner {
    padding: 32px 16px 28px;
  }
  .hero-inner{
    gap: 20px;
  }
  .hero-text h1 {
    font-size: 26px;
  }
  .hero-text p {
    font-size: 14px;
  }
  .hero-spec-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
  }
  .hero-img-placeholder {
    height: 220px;
    max-width: none;
  }
  .meta-strip {
    /* background stays full-width; padding lives on .meta-inner */
  }
  .meta-inner{
    padding: 12px 16px;
    gap: 20px;
    flex-direction: column;
  }
  .meta-item {
    font-size: 11px;
  }
  #index-body {
    padding: 24px 16px;
  }
  #site-header {
    padding: 0 16px;
  }
}

/* ---- PDF capture: reduce whitespace when downloading section ---- */
body.pdf-capture .section-hero {
  align-items: flex-start;
  margin-bottom: 16px;
}
body.pdf-capture .section-hero-img,
body.pdf-capture .section-hero-img-placeholder {
  min-height: 0;
  max-height: 180px;
}
body.pdf-capture .section-hero-img {
  height: auto;
  object-fit: contain;
}
body.pdf-capture .section-hero-body {
  padding: 16px 24px;
}
body.pdf-capture .spec-section {
  margin-bottom: 20px;
}
body.pdf-capture .spec-subsection {
  margin-bottom: 14px;
}
body.pdf-capture .spec-item {
  margin-bottom: 12px;
  padding: 10px 14px;
}
body.pdf-capture .spec-section-title {
  margin-bottom: 12px;
  padding-bottom: 6px;
}
body.pdf-capture .spec-with-image,
body.pdf-capture .spec-with-image--fill-height {
  align-items: flex-start;
  margin-bottom: 12px;
}
body.pdf-capture .spec-with-image--fill-height .spec-image-col {
  align-items: flex-start;
}
body.pdf-capture #main-content {
  padding: 24px 32px;
}
body.pdf-capture .spec-note {
  margin: 6px 0;
  padding: 8px 12px;
}
body.pdf-capture .spec-section,
body.pdf-capture .spec-subsection {
  break-inside: auto;
  page-break-inside: auto;
}
body.pdf-capture .spec-item {
  break-inside: avoid;
  page-break-inside: avoid;
}
body.pdf-capture .spec-with-image,
body.pdf-capture .spec-with-image--fill-height {
  break-inside: auto;
  page-break-inside: auto;
}
body.pdf-capture .full-book-section {
  page-break-before: auto;
}

/* ---- Print / PDF Styles ---- */
@media print {
  #site-header .header-search,
  #site-header,
  #sidebar,
  .header-actions,
  .btn-dl-full,
  .btn-dl-section,
  #site-footer,
  .no-print {
    display: none !important;
  }

  body { background: #fff; color: #000; }
  #page-wrap { display: block; }
  #main-content { padding: 20px; max-width: 100%; }

  .connector-images-block { break-inside: avoid; }
  .connector-figure figcaption { color: #555; }
  .spec-with-image { break-inside: avoid; }
  .spec-with-image .spec-image-col img,
  .spec-photo { max-width: 160px; height: auto; }
  .spec-item { background: #f9f9f9; border: 1px solid #ddd; break-inside: avoid; }
  /* Let sections flow across pages to avoid big blank gaps. Keep individual spec items unbroken. */
  .spec-section { break-inside: auto; page-break-inside: auto; }
  .spec-section-title { color: #000; border-color: #cc0000; }
  .spec-subsection-title { color: #cc0000; }
  .badge-std { background: #e8f5e8; color: #2a7a2a; }
  .badge-opt { background: #f0f0f0; color: #666; }
  .spec-table th { background: #cc0000; -webkit-print-color-adjust: exact; }
  .spec-table tr:nth-child(even) td { background: #f9f9f9; }
  .spec-table tr:nth-child(odd) td { background: #fff; }

  .section-hero { border: 1px solid #ddd; }
  .section-hero-img-placeholder { background: #f5f5f5; }
  .section-hero-body h1 { color: #000; }
  .section-hero-body p { color: #555; }
  .spec-note { background: #fffde7; color: #7a6000; border-color: #f0c040; }

  h1, h2, h3 { color: #000; }
  .spec-item p, .spec-item ul { color: #333; }

  @page {
    margin: 1.5cm 1.5cm 2cm;
    size: letter;
  }

  .print-header {
    display: block !important;
    font-family: 'Montserrat', Arial, sans-serif;
    font-size: 20px;
    font-weight: 700;
    border-bottom: 3px solid #cc0000;
    padding-bottom: 8px;
    margin-bottom: 20px;
    color: #000;
  }
}

.print-header { display: none; }

/* ---- Mobile nav toggle (hamburger) – hidden on desktop, injected by spec.js ---- */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-left: 8px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--color-border-light);
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
}
.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--color-accent);
  transition: transform .2s ease, opacity .2s ease, background .2s ease;
}
.nav-toggle span { position: relative; }
.nav-toggle span::before,
.nav-toggle span::after {
  content: '';
  position: absolute;
  left: 0;
}
.nav-toggle span::before { top: -6px; }
.nav-toggle span::after { top: 6px; }
body.nav-open .nav-toggle span { background: transparent; }
body.nav-open .nav-toggle span::before { top: 0; transform: rotate(45deg); }
body.nav-open .nav-toggle span::after { top: 0; transform: rotate(-45deg); }

/* Backdrop behind the open drawer */
.nav-backdrop {
  display: none;
  position: fixed;
  inset: 72px 0 0 0;
  background: rgba(0,0,0,.5);
  z-index: 1040;
}
body.nav-open .nav-backdrop { display: block; }

/* Theme toggle as a square icon button (sun / moon); label hidden in header */
.btn-theme-toggle {
  width: 40px;
  padding: 0;
  gap: 8px;
}
.btn-theme-toggle svg { display: block; }
.btn-theme-toggle .theme-label { display: none; }

/* ---- Horizontal scroll container for wide spec tables on small screens ---- */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 12px 0 20px;
}
.table-scroll .spec-table { margin: 0; }

/* Drawer-only nav (injected on pages without an in-layout sidebar, e.g. index) */
.drawer-only { display: none; }

/* Tools area at the top of the drawer (search + print + theme) – mobile only */
.drawer-tools {
  display: none;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}
.drawer-tools .header-search {
  display: block;
  width: 100%;
  max-width: none;
  padding: 0;
  margin: 0 0 12px;
}
.drawer-tools .search-input-wrap { max-width: none; width: 100%; }
.drawer-tools .search-results {
  left: 0;
  transform: none;
  width: 100%;
  max-width: none;
}

/* Secondary actions (print + theme), stacked full-width at the bottom of the drawer */
.drawer-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 20px 24px;
  margin-top: 12px;
  border-top: 1px solid var(--color-border);
}
.drawer-actions:empty { display: none; }
.drawer-actions .btn-dl-section,
.drawer-actions .btn-dl-full,
.drawer-actions .btn-theme-toggle {
  width: 100%;
  height: 42px;
  font-size: 12px;
  letter-spacing: .5px;
  padding: 0 14px;
}
.drawer-actions .btn-theme-toggle .theme-label { display: inline; }
/* In the drawer there's no room for a popover, so drop the trigger and show
   the two options directly as full, self-explanatory "Download …" buttons. */
.drawer-actions .dl-menu { display: flex; flex-direction: column; width: 100%; }
.drawer-actions .dl-menu .btn-dl-trigger { display: none; }
.drawer-actions .dl-menu-list {
  position: static;
  display: flex;
  margin-top: 0;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
}
.drawer-actions .dl-menu-list .btn-dl-section::before,
.drawer-actions .dl-menu-list .btn-dl-full::before {
  content: "Download\00a0";
}

/* ---- Responsive header de-crowding (before the full hamburger collapse) ---- */
@media (max-width: 1024px) {
  /* Logo already identifies the book; drop the wrapping title text */
  #site-header .book-title { display: none; }
  .btn-dl-section,
  .btn-dl-full,
  .btn-dl-trigger {
    padding: 8px 12px;
    font-size: 11px;
    letter-spacing: .3px;
  }
}

/* ---- Hamburger + off-canvas drawer ---- */
@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }

  /* Sidebar becomes an off-canvas drawer (slides in from the right) */
  #sidebar {
    position: fixed;
    top: 72px;
    right: 0;
    left: auto;
    bottom: 0;
    height: auto;
    width: min(320px, 88vw);
    min-width: 0;
    z-index: 1050;
    transform: translateX(100%);
    transition: transform .25s ease;
    box-shadow: -4px 0 24px rgba(0,0,0,.4);
  }
  #sidebar.drawer-only { display: block; }
  body.nav-open #sidebar { transform: translateX(0); }
  body.nav-open { overflow: hidden; }

  .drawer-tools { display: block; }

  #main-content { padding: 24px 20px; }

  /* Search, print options and theme toggle relocate into the drawer on mobile */
  #site-header .header-search { display: none; }
  .header-actions .btn-dl-section,
  .header-actions .btn-dl-full,
  .header-actions .dl-menu,
  .header-actions .btn-theme-toggle { display: none; }

  /* Fallback table scroll for pages without spec.js (print-all, full-book) */
  .spec-table:not(.table-scroll *) {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
}

@media (max-width: 600px) {
  #site-header { padding: 0 12px; }
  .header-actions { gap: 8px; }
}

/* ---- Prevent content cut-off on small screens ---- */
@media (max-width: 700px) {
  /* Section hero: stack the image above the text instead of side-by-side */
  .section-hero { flex-direction: column; }
  .section-hero-img,
  .section-hero-img-placeholder {
    width: 100%;
    min-height: 160px;
    max-height: 240px;
  }
  .section-hero-body { padding: 20px 22px; }
  .section-hero-body h1 { font-size: 22px; }
}

@media (max-width: 900px) {
  /* Let long headings, refs and inline cross-refs wrap instead of overflowing */
  .spec-title-text { white-space: normal; }
  .config-ref { white-space: normal; }
  .config-xref-inline { white-space: normal; }
}

/* Wide tables: render each row as a labeled card on phones (no horizontal scroll) */
@media (max-width: 700px) {
  .table-scroll--stacked { overflow-x: visible; }

  /* Force pure block layout so the table can't keep its intrinsic width */
  .spec-table--stack,
  .spec-table--stack tbody,
  .spec-table--stack tr,
  .spec-table--stack td {
    display: block;
    width: 100%;
    max-width: 100%;
  }
  .spec-table--stack thead { display: none; }

  .spec-table--stack tr {
    margin-bottom: 14px;
    border: 1px solid var(--color-border-light);
    border-radius: 4px;
    overflow: hidden;
  }

  .spec-table--stack td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 14px;
    padding: 9px 14px;
    border-bottom: 1px solid var(--color-border);
    white-space: normal;
  }
  .spec-table--stack td:last-child { border-bottom: none; }
  .spec-table--stack td.cell-empty { display: none; }

  .spec-table--stack td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    max-width: 45%;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 10px;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--color-text-muted);
    text-align: left;
  }

  /* The value: allowed to shrink and wrap (min-width:0 defeats flex min-content) */
  .spec-table--stack .cell-value {
    flex: 1 1 auto;
    min-width: 0;
    text-align: right;
    overflow-wrap: anywhere;
  }

  /* Full-width separator rows keep their own styling, no label */
  .spec-table--stack td.row-full {
    display: block;
    text-align: left;
  }
  .spec-table--stack td.row-full::before { content: none; }
}

@media (max-width: 600px) {
  .spec-table th { white-space: normal; }
}

/* ---- Scrollbar ---- */
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: var(--bg-sidebar); }
#sidebar::-webkit-scrollbar-thumb { background: var(--color-border-light); border-radius: 2px; }
