:root {
  --bg: #090b16;
  --surface: #121625;
  --surface-2: #191e31;
  --line: #2a3047;
  --text: #f4f3ee;
  --muted: #a9afc4;
  --prose: #d5d8e3;
  --orange: #ff9d5c;
  --peach: #ffc27a;
  --violet: #b99cff;
  --blue: #7ab8ff;
  --radius: 18px;
  --mono: 'Cascadia Mono', 'Segoe UI Mono', Consolas, monospace;
  --sans: Inter, 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); line-height: 1.65; }
a { color: inherit; }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; }
button, select { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.shell { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 99; top: 10px; left: 10px; padding: 10px 16px; background: var(--peach); color: #111; transform: translateY(-150%); }
.skip-link:focus { transform: none; }

.site-header { position: sticky; z-index: 20; top: 0; background: rgba(9, 11, 22, .94); backdrop-filter: blur(18px); border-bottom: 1px solid var(--line); }
.topbar { min-height: 82px; display: flex; align-items: center; gap: 32px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; letter-spacing: .1em; line-height: 1.05; white-space: nowrap; }
.brand strong { color: var(--orange); }
.brand small { display: block; margin-top: 5px; color: var(--muted); font: 400 .58rem var(--mono); letter-spacing: .16em; }
.brand-mark { width: 26px; height: 38px; border: 5px solid var(--orange); border-right: 0; border-radius: 16px 0 0 16px; }
.nav-content { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.nav-links { display: flex; gap: 5px; margin: 0; padding: 0; list-style: none; }
.nav-links a { display: flex; min-height: 44px; align-items: center; padding: 10px 13px; color: var(--muted); text-decoration: none; font-size: .86rem; font-weight: 700; border-radius: 8px; }
.nav-links a:hover, .nav-links a[aria-current='page'] { color: var(--text); background: var(--surface-2); }
.search-form { display: flex; width: min(310px, 100%); border: 1px solid var(--line); border-radius: 999px; background: var(--surface); overflow: hidden; }
.search-form:focus-within { outline: 2px solid var(--blue); outline-offset: 2px; }
.search-form input { min-width: 0; flex: 1; padding: 10px 4px 10px 16px; color: var(--text); background: transparent; border: 0; outline: 0; font-size: .8rem; }
.search-form button { margin: 4px; padding: 6px 13px; color: #10131f; background: var(--blue); border: 0; border-radius: 999px; font-size: .72rem; font-weight: 800; cursor: pointer; }
.nav-toggle { display: none; background: none; border: 0; padding: 8px; }
.nav-toggle > span:not(.sr-only) { display: block; width: 24px; height: 2px; margin: 5px; background: var(--text); }
.nav-count { display: inline-grid; min-width: 20px; height: 20px; margin-left: 5px; padding-inline: 5px; place-items: center; color: #111; background: var(--orange); border-radius: 50%; font-size: .65rem; }
.theme-control select { min-height: 44px; padding: 6px 28px 6px 10px; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; }
.lcars-stripe { height: 5px; display: grid; grid-template-columns: 18% 30% 1fr; gap: 6px; }
.lcars-stripe span:nth-child(1) { background: var(--orange); }
.lcars-stripe span:nth-child(2) { background: var(--violet); }
.lcars-stripe span:nth-child(3) { background: var(--blue); }

.page-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 42px; padding-block: 54px 90px; }
.content-column { min-width: 0; }
.eyebrow { margin: 0 0 12px; color: var(--orange); font: 700 .72rem var(--mono); letter-spacing: .16em; text-transform: uppercase; }
.hero { position: relative; padding: 50px 0 64px; border-bottom: 1px solid var(--line); }
.hero::after { content: 'NCC–1701'; position: absolute; z-index: -1; right: 0; top: 30px; color: rgba(255,255,255,.025); font: 800 clamp(4rem, 10vw, 8rem) var(--mono); }
h1, h2, h3 { line-height: 1.12; }
.hero h1, .page-heading h1 { margin: 0; max-width: 760px; font-size: clamp(2.6rem, 6vw, 5.8rem); letter-spacing: -.055em; }
.hero h1 span { color: var(--peach); }
.hero-copy { max-width: 670px; margin: 24px 0 0; color: var(--muted); font-size: 1.1rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; padding: 10px 20px; color: var(--text); background: transparent; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; font-size: .84rem; font-weight: 800; cursor: pointer; }
.button--primary { color: #15121a; background: var(--orange); border-color: var(--orange); }
.button--ghost:hover { border-color: var(--muted); background: var(--surface); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 48px 0 0; }
.stats div { padding: 18px 20px; background: linear-gradient(135deg, var(--surface), transparent); border-left: 3px solid var(--violet); }
.stats dt { font: 700 1.55rem var(--mono); }
.stats dd { margin: 3px 0 0; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 52px 0 22px; }
.section-heading h2 { margin: 0; font-size: 1.9rem; }
.section-heading a, .back-link { color: var(--blue); font-size: .82rem; font-weight: 700; text-decoration: none; }

.item-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.item-grid--list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.item-card { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform .2s, border-color .2s; }
.item-card:hover { transform: translateY(-3px); border-color: #4b536f; }
.card-image { display: grid; height: 190px; place-items: center; background: #0d101c; overflow: hidden; text-decoration: none; }
.card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.item-card:hover .card-image img { transform: scale(1.025); }
.image-placeholder { color: #596079; font: 700 .65rem var(--mono); letter-spacing: .15em; }
.card-body { padding: 18px; }
.reference { margin: 0 0 8px; color: var(--orange) !important; font: 700 .65rem var(--mono) !important; letter-spacing: .08em; }
.card-body h2, .card-body h3 { margin: 0 0 10px; font-size: 1.05rem; }
.card-body h2 a, .card-body h3 a { text-decoration: none; }
.card-body h2 a:hover, .card-body h3 a:hover { color: var(--peach); }
.card-body > p { color: var(--muted); font-size: .82rem; }
.card-actions, .detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.icon-button, .view-switcher button, .compare-dock button, .remove-compare { min-height: 44px; padding: 8px 12px; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.icon-button[aria-pressed='true'], .view-switcher button[aria-pressed='true'] { color: #111; background: var(--peach); border-color: var(--peach); }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.tag-list a { padding: 4px 9px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; font: 400 .62rem var(--mono); text-decoration: none; }
.tag-list a:hover { color: #111; background: var(--violet); border-color: var(--violet); }

.sidebar { display: flex; flex-direction: column; gap: 16px; }
.filter-panel { padding: 0 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.filter-panel h2 { margin: 0 -16px 16px; padding: 11px 16px; color: #10111a; font: 800 .72rem var(--mono); letter-spacing: .09em; text-transform: uppercase; }
.filter-panel--orange h2 { background: var(--orange); }
.filter-panel--violet h2 { background: var(--violet); }
.filter-panel--blue h2 { background: var(--blue); }
.filter-links a { display: block; padding: 7px 0; color: var(--muted); border-bottom: 1px solid var(--line); text-decoration: none; font-size: .75rem; }
.filter-links br { display: none; }
.filter-links a:hover, .tag-cloud a:hover { color: var(--text); }
.tag-cloud { color: var(--line); line-height: 2; }
.tag-cloud a { color: var(--muted); font-size: .75rem; text-decoration: none; }

.page-heading { padding: 22px 0 36px; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.page-heading h1 { font-size: clamp(2.2rem, 5vw, 4.5rem); }
.page-heading > p:last-child { color: var(--muted); }
.detail-heading .back-link { display: inline-block; margin-bottom: 28px; }
.record-section { margin-top: 20px; padding: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.record-section > h2, .record-meta h2 { margin: 0 0 18px; color: var(--peach); font: 700 .78rem var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.record-section > h2 span { color: var(--muted); }
.prose { color: var(--prose); }
.prose p:first-child { margin-top: 0; }
.prose p:last-child { margin-bottom: 0; }
.prose .lead { color: var(--text); font-size: 1.3rem; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .84rem; }
caption { padding: 10px; color: var(--muted); text-align: left; }
th { color: var(--muted); font: 700 .66rem var(--mono); letter-spacing: .08em; text-align: left; text-transform: uppercase; }
th, td { padding: 13px; border-bottom: 1px solid var(--line); }
td a, .external-link { color: var(--blue); }
.record-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.gallery { columns: 2; column-gap: 16px; }
.gallery figure { break-inside: avoid; margin: 0 0 16px; background: #0c0f1b; border-radius: 12px; overflow: hidden; }
.gallery figure img { width: 100%; }
.gallery figcaption { padding: 12px; color: var(--muted); font-size: .76rem; }
.price-chart { margin: 0 0 24px; }
.price-chart svg { display: block; width: 100%; max-height: 320px; color: var(--blue); background: var(--surface-2); border-radius: 12px; }
.chart-axis { stroke: var(--muted); stroke-width: 2; }
.chart-line { fill: none; stroke: currentColor; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.chart-point { fill: var(--orange); stroke: var(--surface); stroke-width: 3; }
.price-chart figcaption { margin-top: 8px; color: var(--muted); font-size: .78rem; }
.similar-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pagination { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-top: 34px; padding: 14px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; font: 700 .72rem var(--mono); }
.pagination a { color: var(--blue); text-decoration: none; }
.pagination > :last-child { text-align: right; }
.pagination > span:not(.page-status) { color: #555c73; }
.page-status { color: var(--muted); }
.empty-state { grid-column: 1 / -1; padding: 48px 24px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty-state strong { color: var(--text); font-size: 1.15rem; }

.advanced-search { margin-bottom: 22px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.filter-title, .results-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.filter-title h2 { margin: 0 0 18px; }
.filter-title a { color: var(--blue); }
.filter-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.filter-grid label { display: grid; gap: 5px; color: var(--muted); font: 700 .68rem var(--mono); letter-spacing: .05em; text-transform: uppercase; }
.filter-grid input, .filter-grid select { width: 100%; min-height: 44px; padding: 9px 11px; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; }
.filter-grid [aria-invalid='true'] { border-color: #ff7373; outline: 2px solid #ff7373; }
.filter-query { grid-column: span 2; }
.filter-submit { margin-top: 18px; }
.results-toolbar { margin: 20px 0; }
.active-filters { display: flex; flex-wrap: wrap; gap: 7px; color: var(--muted); font-size: .76rem; }
.active-filters a { min-height: 36px; padding: 7px 10px; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; text-decoration: none; }
.active-filters a span { color: var(--muted); }
.view-switcher { display: flex; flex-shrink: 0; gap: 5px; }
.item-grid[data-view='compact'] { grid-template-columns: 1fr; gap: 8px; }
.item-grid[data-view='compact'] .item-card { display: grid; grid-template-columns: 150px 1fr; }
.item-grid[data-view='compact'] .card-image { height: 100%; min-height: 145px; }
.compare-dock { position: fixed; z-index: 50; right: max(20px, calc((100vw - 1180px) / 2)); bottom: 20px; display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 18px; color: var(--text); background: var(--surface); border: 1px solid var(--violet); border-radius: 999px; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
.compare-dock [aria-disabled='true'] { opacity: .45; pointer-events: none; }
.compare-table th { min-width: 150px; vertical-align: top; }
.remove-compare { display: block; margin-top: 10px; font-size: 1.1rem; }
.copy-helper { position: fixed; left: -9999px; }

html[data-theme='light'] { --bg: #f4f1e9; --surface: #fffdfa; --surface-2: #e9e5dc; --line: #b3ad9f; --text: #171822; --muted: #55596a; --prose: #3f4350; --orange: #a94d00; --peach: #c45b00; --violet: #6542a4; --blue: #075b9d; }
html[data-theme='light'] .site-header { background: rgba(244,241,233,.95); }
html[data-theme='light'] .card-image, html[data-theme='light'] .gallery figure { background: #dedad2; }
html[data-theme='light'] .site-footer { background: #e9e5dc; }
@media (prefers-color-scheme: light) {
  html[data-theme='system'] { --bg: #f4f1e9; --surface: #fffdfa; --surface-2: #e9e5dc; --line: #b3ad9f; --text: #171822; --muted: #55596a; --prose: #3f4350; --orange: #a94d00; --peach: #c45b00; --violet: #6542a4; --blue: #075b9d; }
  html[data-theme='system'] .site-header { background: rgba(244,241,233,.95); }
  html[data-theme='system'] .site-footer { background: #e9e5dc; }
}

.info-panel { padding: clamp(24px, 5vw, 52px); background: var(--surface); border: 1px solid var(--line); border-left: 7px solid var(--violet); border-radius: var(--radius); }
.crew-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 0; list-style: none; }
.crew-list li { padding: 12px; background: var(--surface-2); border-radius: 8px; }
.vendor-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.vendor-grid > * { display: flex; flex-direction: column; padding: 20px; min-height: 110px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; text-decoration: none; }
.vendor-grid a:hover { border-color: var(--orange); }
.vendor-grid span { margin-top: auto; color: var(--muted); font: 400 .7rem var(--mono); }
.acknowledgement { margin-top: 30px; color: var(--muted); }
.site-footer { border-top: 1px solid var(--line); background: #070912; }
.footer-grid { display: grid; grid-template-columns: 230px 1fr; gap: 50px; padding-block: 40px; color: var(--muted); font-size: .72rem; }
.footer-grid strong { color: var(--orange); letter-spacing: .12em; }
.footer-grid p { margin: 0; }

@media (max-width: 1180px) {
  .nav-toggle { display: block; margin-left: auto; }
  .nav-content { position: absolute; display: none; top: 82px; left: 0; right: 0; padding: 20px; background: var(--bg); border-bottom: 1px solid var(--line); }
  .nav-content.is-open { display: grid; }
  .nav-links { flex-direction: column; }
  .search-form { width: 100%; }
}
@media (max-width: 980px) {
  .page-layout { grid-template-columns: 1fr; }
  .sidebar { display: grid; grid-template-columns: repeat(3, 1fr); }
  .filter-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .shell { width: min(100% - 24px, 1180px); }
  .page-layout { padding-top: 30px; }
  .hero { padding-top: 22px; }
  .stats, .item-grid, .item-grid--list, .record-meta, .vendor-grid { grid-template-columns: 1fr; }
  .sidebar { grid-template-columns: 1fr; }
  .gallery { columns: 1; }
  .pagination { border-radius: 16px; font-size: .62rem; }
  .page-status { text-align: center; }
  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
  .filter-grid { grid-template-columns: 1fr; }
  .filter-query { grid-column: auto; }
  .results-toolbar { align-items: stretch; flex-direction: column; }
  .view-switcher button { flex: 1; }
  .item-grid[data-view='compact'] .item-card { grid-template-columns: 100px 1fr; }
  .item-grid[data-view='compact'] .card-image { min-height: 120px; }
  .item-grid[data-view='compact'] .card-body { padding: 13px; }
  .compare-dock { right: 12px; bottom: 12px; left: 12px; justify-content: space-between; border-radius: 16px; }
  .similar-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
