/* ================================================================
   SELANAR INSTRUMENTS — Stylesheet

   Nasalization font: download from dafont.com/nasalization.font
   Place nasalization.woff2 + nasalization.woff in /fonts/
   Orbitron (Google Fonts) is used as the web-available fallback.
================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;700;900&family=Share+Tech+Mono&display=swap');

@font-face {
    font-family: 'Nasalization';
    src: url('../fonts/nasalization.woff2') format('woff2'),
         url('../fonts/nasalization.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

/* ── Variables ── */
:root {
    --bg:          #080808;
    --bg-surface:  #101010;
    --bg-card:     #0d0d0d;
    --border:      #1e1e1e;
    --border-hi:   #333333;
    --text:        #f0f0f0;
    --text-dim:    #888888;
    --text-faint:  #444444;
    --red:         #cc1122;
    --blue:        #1e3a6e;
    --white:       #ffffff;

    --font-head: 'Nasalization', 'Orbitron', monospace;
    --font-mono: 'Share Tech Mono', 'Courier New', monospace;

    --nav-h:   64px;
    --max-w:   1200px;
    --pad:     clamp(16px, 5vw, 80px);
    --ease:    0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --nav-bg:  rgba(8, 8, 8, 0.96);
}

/* ── Light Theme ──
   Palette drawn from the packaging: white field, black text, same red/blue accents.
── */
[data-theme="light"] {
    --bg:         #f5f5f5;
    --bg-surface: #ebebeb;
    --bg-card:    #f0f0f0;
    --border:     #d0d0d0;
    --border-hi:  #b0b0b0;
    --text:       #0a0a0a;
    --text-dim:   #555555;
    --text-faint: #aaaaaa;
    --white:      #0a0a0a;
    --nav-bg:     rgba(245, 245, 245, 0.96);
}

/* Transitions applied only during a theme switch (added/removed by JS) */
.theme-transition * {
    transition: background-color 0.3s ease, color 0.3s ease,
                border-color 0.3s ease !important;
}

/* ── Base ── */
body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-head);
    font-size: 16px;
    line-height: 1.6;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ── Utilities ── */
.container {
    width: 100%;
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 var(--pad);
}

.mono { font-family: var(--font-mono); }

.divider     { height: 1px; background: var(--border); }
.divider-red { height: 2px; background: linear-gradient(90deg, var(--red), transparent); }

/* Corner bracket decoration */
.bracket { position: relative; }
.bracket::before, .bracket::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
}
.bracket::before { top: 0; left: 0; border-top: 1px solid var(--border-hi); border-left: 1px solid var(--border-hi); }
.bracket::after  { bottom: 0; right: 0; border-bottom: 1px solid var(--border-hi); border-right: 1px solid var(--border-hi); }

/* Layout helpers */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: center;
}

.sidebar-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 80px;
}

/* ── Navigation ── */
.nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    height: var(--nav-h);
    background: var(--nav-bg);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    transition: border-color var(--ease);
}

.nav.scrolled { border-bottom-color: var(--red); }

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 var(--pad);
}

.nav-logo      { display: flex; flex-direction: row; align-items: center; gap: 10px; }
.nav-logo-img  { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.nav-logo-text { display: flex; flex-direction: column; gap: 3px; line-height: 1; }
.nav-logo-main { font-size: 20px; font-weight: 700; letter-spacing: 0.15em; color: var(--white); }
.nav-logo-sub  { font-size: 8px; letter-spacing: 0.4em; color: var(--text-dim); }

.nav-links { display: flex; gap: 32px; list-style: none; }
.nav-links a {
    font-size: 11px;
    letter-spacing: 0.25em;
    color: var(--text-dim);
    transition: color var(--ease);
    position: relative;
    padding-bottom: 4px;
}
.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 1px;
    background: var(--red);
    transform: scaleX(0);
    transition: transform var(--ease);
}
.nav-links a:hover, .nav-links a.active { color: var(--white); }
.nav-links a:hover::after, .nav-links a.active::after { transform: scaleX(1); }

.nav-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-faint);
}
.nav-status-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--red);
    animation: blink 2s infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* ── Hero ── */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    padding-top: var(--nav-h);
}

.hero-grid {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 60px 60px;
    opacity: 0.5;
}

.hero-scanline {
    position: absolute; inset: 0;
    background: repeating-linear-gradient(
        0deg, transparent, transparent 3px,
        rgba(0,0,0,0.08) 3px, rgba(0,0,0,0.08) 4px
    );
    pointer-events: none;
}

.hero-crosshair {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 500px; height: 500px;
    opacity: 0.03;
    border-radius: 50%;
    border: 1px solid var(--white);
}
.hero-crosshair::before {
    content: ''; position: absolute;
    top: 50%; left: 0; right: 0;
    height: 1px; background: var(--white);
}
.hero-crosshair::after {
    content: ''; position: absolute;
    left: 50%; top: 0; bottom: 0;
    width: 1px; background: var(--white);
}

.hero-sketch {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.hero-inner {
    position: relative;
    width: 100%;
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 var(--pad);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 48px;
    align-items: center;
}

.hero-eyebrow {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.3em;
    color: var(--red);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.hero-eyebrow::before { content: ''; width: 32px; height: 1px; background: var(--red); }

.hero-title {
    font-size: clamp(56px, 11vw, 110px);
    font-weight: 700;
    line-height: 0.9;
    letter-spacing: 0.08em;
    color: var(--white);
    margin-bottom: 6px;
    cursor: default;
}

.hero-subtitle {
    font-size: clamp(14px, 2vw, 20px);
    letter-spacing: 0.5em;
    color: var(--text-dim);
    margin-bottom: 32px;
}

.hero-desc {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-dim);
    max-width: 480px;
    line-height: 1.9;
    margin-bottom: 48px;
    border-left: 2px solid var(--border-hi);
    padding-left: 16px;
}

.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; }

.hero-data { display: flex; flex-direction: column; gap: 20px; }

/* Data block */
.data-block {
    border: 1px solid var(--border);
    padding: 20px 24px;
    min-width: 200px;
    position: relative;
    font-family: var(--font-mono);
}
.data-block::before {
    content: attr(data-label);
    position: absolute;
    top: -7px; left: 12px;
    background: var(--bg);
    padding: 0 6px;
    font-size: 9px;
    letter-spacing: 0.2em;
    color: var(--text-faint);
}
.data-value { color: var(--white); font-size: 15px; display: block; margin-bottom: 4px; }
.data-unit  { color: var(--text-faint); font-size: 10px; letter-spacing: 0.1em; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    font-family: var(--font-head);
    font-size: 11px;
    letter-spacing: 0.2em;
    border: none;
    cursor: pointer;
    transition: all var(--ease);
}
.btn-primary { background: var(--red); color: #ffffff; }
.btn-primary:hover { background: #e01224; transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border-hi); }
.btn-ghost:hover { border-color: var(--text-dim); color: var(--white); }

/* ── Section ── */
.section { padding: clamp(60px, 8vw, 120px) 0; }

.section-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.4em;
    color: var(--red);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.section-label::after { content: ''; flex: 1; height: 1px; background: var(--border); max-width: 100px; }

.section-header { margin-bottom: 60px; }
.section-title  { font-size: clamp(28px, 4vw, 48px); letter-spacing: 0.06em; line-height: 1.1; color: var(--white); }
.section-desc   { font-family: var(--font-mono); font-size: 13px; color: var(--text-dim); max-width: 600px; margin-top: 16px; line-height: 1.9; }

/* ── Feature Grid ── */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
}
.feature-item {
    background: var(--bg);
    padding: 40px 32px;
    position: relative;
    transition: background var(--ease);
}
.feature-item:hover { background: var(--bg-surface); }
.feature-item::before {
    content: attr(data-num);
    font-family: var(--font-mono);
    font-size: 10px; color: var(--text-faint);
    letter-spacing: 0.1em;
    display: block; margin-bottom: 24px;
}
.feature-icon {
    width: 40px; height: 40px;
    border: 1px solid var(--border-hi);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 20px; font-size: 18px;
    color: var(--text-dim);
}
.feature-title { font-size: 13px; letter-spacing: 0.15em; color: var(--white); margin-bottom: 12px; }
.feature-desc  { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); line-height: 1.9; }

/* ── Stats Bar ── */
.stats-bar {
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 48px 0;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1px;
    background: var(--border);
}
.stat-item {
    background: var(--bg-surface);
    padding: 32px 24px;
    text-align: center;
}
.stat-num {
    font-size: 40px; font-weight: 700;
    color: var(--white); display: block;
    line-height: 1; margin-bottom: 8px;
}
.stat-num small { font-size: 0.5em; color: var(--text-dim); }
.stat-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.3em; color: var(--text-dim); }

/* ── Product Cards ── */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1px;
    background: var(--border);
    box-shadow: 0 0 0 1px var(--border);
}
.product-card {
    background: var(--bg-card);
    display: flex; flex-direction: column;
    transition: background var(--ease);
}
.product-card:hover { background: var(--bg-surface); }

.card-stripe { height: 2px; background: linear-gradient(90deg, var(--red) 0%, var(--red) 40%, var(--border) 40%); }

.card-head {
    padding: 20px 24px 16px;
    display: flex; justify-content: space-between; align-items: flex-start;
    border-bottom: 1px solid var(--border);
}
.card-model { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em; color: var(--text-dim); }

.card-dots { display: flex; gap: 5px; flex-wrap: wrap; max-width: 80px; justify-content: flex-end; }
.dot { width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--text-faint); }
.dot.on  { background: var(--text-dim); border-color: var(--text-dim); }
.dot.red { background: var(--red); border-color: var(--red); }

.card-drawing {
    aspect-ratio: 4/3;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden;
    background: var(--bg);
}
.drawing-placeholder {
    width: 75%; height: 75%;
    border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    position: relative;
}
.drawing-placeholder::before { content: ''; position: absolute; width: 100%; height: 1px; background: var(--border-hi); }
.drawing-placeholder::after  { content: ''; position: absolute; width: 1px; height: 100%; background: var(--border-hi); }
.circle-marker {
    width: 56px; height: 56px;
    border-radius: 50%;
    border: 1px solid var(--border-hi);
    position: absolute;
}

.card-body { padding: 24px; flex: 1; }
.card-name { font-size: 15px; letter-spacing: 0.1em; color: var(--white); margin-bottom: 8px; }
.card-tagline { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); margin-bottom: 20px; line-height: 1.7; }

.spec-table { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--border); padding-top: 16px; }
.spec-row { display: flex; justify-content: space-between; align-items: center; font-family: var(--font-mono); font-size: 11px; }
.spec-key { color: var(--text-faint); }
.spec-val { color: var(--text-dim); }

.card-foot { padding: 16px 24px; border-top: 1px solid var(--border); }
.card-link {
    font-size: 11px; letter-spacing: 0.2em;
    color: var(--text-dim);
    display: inline-flex; align-items: center; gap: 8px;
    transition: color var(--ease);
}
.card-link::after { content: '→'; transition: transform var(--ease); }
.card-link:hover { color: var(--red); }
.card-link:hover::after { transform: translateX(4px); }

/* ── Timeline ── */
.timeline { position: relative; padding-left: 48px; }
.timeline::before {
    content: ''; position: absolute;
    left: 12px; top: 0; bottom: 0;
    width: 1px; background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 64px; }
.timeline-item:last-child { padding-bottom: 0; }

.timeline-marker {
    position: absolute;
    left: -42px; top: 5px;
    width: 13px; height: 13px;
    border-radius: 50%;
    border: 1px solid var(--border-hi);
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
}
.timeline-marker.active { border-color: var(--red); }
.timeline-marker.active::after { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--red); }

.timeline-date   { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.3em; color: var(--red); margin-bottom: 10px; }
.timeline-title  { font-size: 20px; letter-spacing: 0.08em; color: var(--white); margin-bottom: 12px; }
.timeline-body   { font-family: var(--font-mono); font-size: 13px; color: var(--text-dim); line-height: 1.9; max-width: 620px; }
.timeline-tag    { display: inline-block; margin-top: 14px; padding: 4px 10px; border: 1px solid var(--border); font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.2em; color: var(--text-faint); }

/* ── Page Header ── */
.page-header {
    padding: calc(var(--nav-h) + 64px) 0 64px;
    border-bottom: 1px solid var(--border);
    position: relative; overflow: hidden;
}
.page-header-grid {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 40px 40px;
    opacity: 0.35;
}
.page-header-content { position: relative; }
.page-title    { font-size: clamp(36px, 7vw, 80px); letter-spacing: 0.08em; color: var(--white); line-height: 0.95; }
.page-subtitle { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); margin-top: 20px; letter-spacing: 0.15em; }

/* ── Filter Bar ── */
.filter-bar { border-bottom: 1px solid var(--border); padding: 16px 0; }
.filter-inner { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em; color: var(--text-faint); margin-right: 8px; }
.filter-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-family: var(--font-head);
    font-size: 10px; letter-spacing: 0.15em;
    padding: 6px 14px; cursor: pointer;
    transition: all var(--ease);
}
.filter-btn:hover, .filter-btn.active { border-color: var(--red); color: var(--white); }

/* ── Footer ── */
.footer { background: var(--bg-surface); border-top: 1px solid var(--border); }
.footer-stripe {
    height: 4px;
    background: linear-gradient(90deg, var(--red) 0%, var(--red) 33%, var(--blue) 33%, var(--blue) 66%, var(--border-hi) 66%);
}
.footer-main { padding: 56px 0; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 48px; }

.footer-brand-name { font-size: 24px; font-weight: 700; letter-spacing: 0.15em; color: var(--white); margin-bottom: 4px; }
.footer-brand-sub  { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.3em; color: var(--text-dim); margin-bottom: 20px; }
.footer-tagline    { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); line-height: 1.9; max-width: 280px; }

.footer-heading { font-size: 10px; letter-spacing: 0.3em; color: var(--text-dim); margin-bottom: 20px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.footer-links   { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.footer-links a { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); transition: color var(--ease); }
.footer-links a:hover { color: var(--white); }

.footer-bottom { border-top: 1px solid var(--border); padding: 20px 0; }
.footer-bottom-inner {
    display: flex; justify-content: space-between; align-items: center;
    font-family: var(--font-mono); font-size: 10px;
    color: var(--text-faint); letter-spacing: 0.1em;
}

/* ── Theme Toggle ── */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--border-hi);
    color: var(--text-dim);
    font-family: var(--font-head);
    font-size: 9px;
    letter-spacing: 0.18em;
    padding: 5px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
    transition: border-color var(--ease), color var(--ease);
}
.theme-toggle:hover { border-color: var(--text-dim); color: var(--text); }

/* Half-circle icon: left half filled in dark mode, right half in light mode */
.toggle-icon {
    width: 12px; height: 12px;
    border-radius: 50%;
    border: 1.5px solid currentColor;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}
.toggle-icon::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 50%; height: 100%;
    background: currentColor;
    border-radius: 50% 0 0 50%;
}
[data-theme="light"] .toggle-icon::before {
    left: 50%;
    border-radius: 0 50% 50% 0;
}

/* ── Responsive ── */
@media (max-width: 960px) {
    .hero-inner { grid-template-columns: 1fr; }
    .hero-data  { display: none; }
    .two-col, .sidebar-layout { grid-template-columns: 1fr; gap: 40px; }
    .footer-grid { grid-template-columns: 1fr; gap: 32px; }
}

@media (max-width: 640px) {
    .nav-status { display: none; }
    .nav-links  { gap: 16px; }
    .product-grid { grid-template-columns: 1fr; }
    .stats-grid   { grid-template-columns: repeat(2, 1fr); }
    .toggle-label { display: none; }
}

/* ── Hero Logo ── */
.hero-logo {
    width: 90px; height: 90px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 28px;
    display: block;
    box-shadow: 0 0 40px rgba(204,17,34,0.2);
}

/* ── Horizontal Product Cards ── */
.product-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: var(--border);
    box-shadow: 0 0 0 1px var(--border);
}

.phcard {
    background: var(--bg-card);
    display: grid;
    grid-template-columns: 320px 1fr;
    cursor: pointer;
    transition: background var(--ease);
    position: relative;
    overflow: hidden;
}
.phcard:hover { background: var(--bg-surface); }
.phcard:hover .phcard-link { color: var(--red); }
.phcard:hover .phcard-link::after { transform: translateX(4px); }

.phcard-top-stripe {
    position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, var(--red) 0%, var(--red) 30%, var(--border) 30%);
}

.phcard-drawing {
    border-right: 1px solid var(--border);
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    padding: 28px;
    position: relative;
    min-height: 240px;
}
.phcard-drawing::before {
    content: '';
    position: absolute; inset: 0;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 18px 18px;
    opacity: 0.9;
}

.phcard-info {
    padding: 28px 36px;
    display: flex; flex-direction: column; justify-content: space-between;
}
.phcard-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 12px;
}
.phcard-name    { font-size: 18px; letter-spacing: 0.1em; color: var(--white); margin-bottom: 8px; }
.phcard-tagline { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); line-height: 1.8; margin-bottom: 20px; max-width: 560px; }

.phcard-specs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1px; background: var(--border); border: 1px solid var(--border);
    margin-bottom: 24px;
}
.phcard-spec { background: var(--bg-card); padding: 10px 14px; font-family: var(--font-mono); font-size: 11px; }
.phcard-spec-key { color: var(--text-faint); font-size: 9px; letter-spacing: 0.1em; display: block; margin-bottom: 3px; }
.phcard-spec-val { color: var(--text-dim); }

.phcard-footer { display: flex; align-items: center; }
.phcard-link {
    font-size: 11px; letter-spacing: 0.2em;
    color: var(--text-dim);
    display: inline-flex; align-items: center; gap: 8px;
    transition: color var(--ease);
}
.phcard-link::after { content: '→'; transition: transform var(--ease); }

@media (max-width: 760px) {
    .phcard { grid-template-columns: 1fr; }
    .phcard-drawing { min-height: 200px; border-right: none; border-bottom: 1px solid var(--border); }
}

/* ── Modal Overlay ── */
.modal {
    position: fixed; inset: 0; z-index: 200;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.modal[hidden] { display: none; }

.modal-bg {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.78);
    cursor: pointer;
}
[data-theme="light"] .modal-bg { background: rgba(0,0,0,0.5); }

.modal-panel {
    position: relative; z-index: 1;
    width: 100%; max-width: 960px;
    max-height: 92vh; overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-hi);
    display: flex; flex-direction: column;
}

.modal-top-stripe {
    height: 3px; flex-shrink: 0;
    background: linear-gradient(90deg, var(--red) 0%, var(--red) 40%, var(--blue) 40%, var(--blue) 70%, var(--border-hi) 70%);
}

.modal-head {
    padding: 20px 28px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 20px;
    flex-shrink: 0;
}
.modal-head-main { flex: 1; }
.modal-head-model {
    font-family: var(--font-mono); font-size: 10px;
    letter-spacing: 0.25em; color: var(--red); margin-bottom: 4px;
}
.modal-head-title { font-size: 20px; letter-spacing: 0.1em; color: var(--white); }

.modal-head-meta {
    display: flex; gap: 24px;
    font-family: var(--font-mono); font-size: 10px;
    border-left: 1px solid var(--border); padding-left: 20px;
}
.modal-meta-col { display: flex; flex-direction: column; gap: 4px; }
.modal-meta-key { color: var(--text-faint); letter-spacing: 0.1em; }
.modal-meta-val { color: var(--text-dim); }

.modal-close {
    width: 30px; height: 30px;
    background: transparent; border: 1px solid var(--border-hi);
    color: var(--text-dim); font-size: 16px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--ease); flex-shrink: 0; line-height: 1;
}
.modal-close:hover { border-color: var(--red); color: var(--red); }

/* Blueprint drawing area */
.modal-drawing {
    position: relative; min-height: 300px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; flex-shrink: 0;
}
.modal-bp-grid {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 24px 24px;
    opacity: 0.9;
}

.bp-views {
    position: relative; z-index: 1;
    display: flex; gap: 80px; align-items: flex-start;
    padding: 40px 60px;
}
.bp-view {
    display: flex; flex-direction: column;
    align-items: center; gap: 18px;
}
.bp-label {
    font-family: var(--font-mono); font-size: 9px;
    letter-spacing: 0.2em; color: var(--text-faint);
}

/* Drawing frame — data-w / data-h attributes render as dimension labels */
.bp-frame {
    border: 1px solid var(--border-hi);
    position: relative;
}
.bp-frame::before {
    content: attr(data-w);
    position: absolute; top: -22px; left: 0; right: 0;
    text-align: center;
    font-family: var(--font-mono); font-size: 9px; color: var(--text-dim);
    border-bottom: 1px solid var(--border-hi);
    padding-bottom: 4px;
}
.bp-frame::after {
    content: attr(data-h);
    position: absolute; right: -38px; top: 0; bottom: 0;
    writing-mode: vertical-rl; text-align: center;
    font-family: var(--font-mono); font-size: 9px; color: var(--text-dim);
    border-left: 1px solid var(--border-hi);
    padding-left: 4px;
}

/* Elements inside frames */
.bp-aperture {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%; border: 1px solid var(--border-hi);
}
.bp-hole {
    position: absolute; width: 7px; height: 7px;
    border-radius: 50%; border: 1px solid var(--border-hi);
}
.bp-hole.tl { top: 8px; left: 8px; }
.bp-hole.tr { top: 8px; right: 8px; }
.bp-hole.bl { bottom: 8px; left: 8px; }
.bp-hole.br { bottom: 8px; right: 8px; }

.bp-crosshair { position: relative; }
.bp-crosshair::before {
    content: ''; position: absolute;
    top: 50%; left: 0; right: 0; height: 1px; background: var(--border-hi);
}
.bp-crosshair::after {
    content: ''; position: absolute;
    top: 0; bottom: 0; left: 50%; width: 1px; background: var(--border-hi);
}

.bp-notes {
    display: flex; flex-direction: column; gap: 6px;
    padding: 14px; border: 1px solid var(--border);
    font-family: var(--font-mono); font-size: 10px;
    color: var(--text-dim); align-self: center;
    position: relative; z-index: 1;
}
.bp-notes-title { color: var(--text-faint); font-size: 9px; letter-spacing: 0.15em; margin-bottom: 4px; }

/* Modal spec table */
.modal-specs { padding: 24px 28px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-spec-heading {
    font-family: var(--font-mono); font-size: 10px;
    letter-spacing: 0.3em; color: var(--red); margin-bottom: 12px;
}
.modal-spec-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 1px; background: var(--border); border: 1px solid var(--border);
}
.msc {
    background: var(--bg-card); padding: 12px 16px;
    font-family: var(--font-mono); font-size: 11px;
}
.msc-key { color: var(--text-faint); font-size: 9px; letter-spacing: 0.1em; display: block; margin-bottom: 4px; }
.msc-val { color: var(--text); }

/* Modal footer */
.modal-foot {
    padding: 18px 28px;
    display: flex; justify-content: space-between; align-items: center;
    font-family: var(--font-mono); font-size: 9px;
    color: var(--text-faint); letter-spacing: 0.1em;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .modal-head-meta { display: none; }
    .bp-views { gap: 40px; padding: 28px; flex-wrap: wrap; }
}

/* ── Nav: 5-link spacing fix ── */
.nav-links { gap: 16px; }
@media (max-width: 1050px) { .nav-status { display: none; } }
@media (max-width: 820px)  { .nav-links a { font-size: 10px; letter-spacing: 0.12em; } }

/* ── Image Gallery Modal ── */
.gallery-intro {
    padding: 20px 28px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--border);
    padding: 24px 28px;
    gap: 1px;
}
.gallery-item {
    background: var(--bg);
    aspect-ratio: 4/3;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    cursor: pointer;
    transition: filter var(--ease);
}
.gallery-item:hover { filter: brightness(1.15); }
.gallery-item::before {
    content: '';
    position: absolute; inset: 0;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.8;
}
/* Centre crosshair in each placeholder */
.gallery-item::after {
    content: '';
    position: absolute;
    top: 50%; left: 10%; right: 10%;
    height: 1px; background: var(--border-hi);
}
.gallery-vert {
    position: absolute;
    top: 10%; bottom: 10%; left: 50%;
    width: 1px; background: var(--border-hi);
}
.gallery-caption {
    position: relative; z-index: 1;
    font-family: var(--font-mono);
    font-size: 9px; letter-spacing: 0.2em;
    color: var(--text-dim);
    padding: 8px 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.6));
    width: 100%;
}
[data-theme="light"] .gallery-caption { background: linear-gradient(transparent, rgba(255,255,255,0.8)); }
@media (max-width: 600px) { .gallery-grid { grid-template-columns: repeat(2, 1fr); } }

/* ── Explore Page ── */
.explore-section {
    min-height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    overflow: hidden;
    padding: 120px 0 80px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.explore-section:first-child { padding-top: calc(var(--nav-h) + 80px); }

.explore-bg { position: absolute; inset: 0; }

/* Planet/body atmospheres */
.bg-sol     { background: radial-gradient(ellipse at 78% 28%, #ff8800 0%, #cc3300 32%, #5a0800 68%, #000 100%); }
.bg-mercury { background: radial-gradient(ellipse at 22% 62%, #b0a898 0%, #706858 40%, #2a2620 80%, #000 100%); }
.bg-venus   { background: radial-gradient(ellipse at 64% 36%, #e2aa22 0%, #9a6800 44%, #3c2204 76%, #000 100%); }
.bg-earth   { background: radial-gradient(ellipse at 38% 52%, #1a72b8 0%, #0d3c6a 44%, #041526 78%, #000 100%); }
.bg-mars    { background: radial-gradient(ellipse at 68% 38%, #cc4c22 0%, #8c2c10 44%, #2c0c06 76%, #000 100%); }
.bg-jupiter { background: radial-gradient(ellipse at 50% 50%, #c89260 0%, #9c6234 44%, #3c2212 76%, #000 100%); }
.bg-saturn  { background: radial-gradient(ellipse at 56% 42%, #d6b462 0%, #9c7a2a 44%, #3c2c0a 76%, #000 100%); }
.bg-uranus  { background: radial-gradient(ellipse at 44% 56%, #72e2e2 0%, #2c7a7a 44%, #0a2626 76%, #000 100%); }
.bg-neptune { background: radial-gradient(ellipse at 30% 44%, #2a58ec 0%, #121a72 44%, #040822 76%, #000 100%); }
.bg-deep     { background: radial-gradient(ellipse at 50% 50%, #0c0c26 0%, #040412 58%, #000 100%); }
.bg-asteroid { background: radial-gradient(ellipse at 45% 55%, #2e2418 0%, #181210 44%, #080604 76%, #000 100%); }
.bg-kuiper   { background: radial-gradient(ellipse at 55% 45%, #0a1828 0%, #040a12 54%, #000 100%); }

.asteroid-particles,
.kuiper-particles {
    position: absolute; inset: 0;
    pointer-events: none;
}

/* Decorative overlay elements */
.jupiter-bands {
    position: absolute; inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px, transparent 28px,
        rgba(160,90,40,0.07) 28px, rgba(160,90,40,0.07) 56px
    );
    pointer-events: none;
}
.saturn-ring {
    position: absolute;
    width: min(580px, 55vw); height: min(116px, 11vw);
    border-radius: 50%;
    border: 14px solid rgba(210,185,105,0.18);
    box-shadow: 0 0 0 5px rgba(200,175,95,0.09), 0 0 0 12px rgba(180,155,75,0.05);
    top: 50%; right: 4%;
    transform: translateY(-50%) rotateX(72deg);
    pointer-events: none;
}
.deep-stars {
    position: absolute; inset: 0;
    pointer-events: none;
}

.explore-content {
    position: relative; z-index: 1;
    width: 100%; max-width: var(--max-w);
    margin: 0 auto; padding: 0 var(--pad);
}
.explore-index {
    font-family: var(--font-mono); font-size: 10px;
    letter-spacing: 0.4em; color: rgba(255,255,255,0.35);
    margin-bottom: 16px;
}
.explore-name {
    font-size: clamp(60px, 13vw, 150px);
    font-weight: 700; letter-spacing: 0.06em;
    line-height: 0.88; color: rgba(255,255,255,0.9);
    margin-bottom: 8px;
}
.explore-subname {
    font-size: clamp(12px, 1.8vw, 18px);
    letter-spacing: 0.5em; color: rgba(255,255,255,0.45);
    margin-bottom: 28px;
}
.explore-desc {
    font-family: var(--font-mono); font-size: 13px;
    color: rgba(255,255,255,0.55);
    max-width: 460px; line-height: 1.9; margin-bottom: 36px;
    border-left: 2px solid rgba(255,255,255,0.18);
    padding-left: 16px;
}
.explore-stats {
    display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 32px;
}
.explore-stat {
    padding: 14px 18px;
    border: 1px solid rgba(255,255,255,0.14);
    min-width: 110px;
}
.explore-stat-label {
    font-family: var(--font-mono); font-size: 9px;
    letter-spacing: 0.2em; color: rgba(255,255,255,0.3);
    display: block; margin-bottom: 4px;
}
.explore-stat-value {
    font-family: var(--font-mono); font-size: 14px;
    color: rgba(255,255,255,0.8);
}
.explore-instruments {
    font-family: var(--font-mono); font-size: 10px;
    color: rgba(255,255,255,0.35); letter-spacing: 0.1em;
    display: flex; align-items: center; gap: 10px;
}
.explore-instruments strong { color: var(--red); letter-spacing: 0.2em; }

/* ── Requisitions / Store ── */
.tab-bar {
    display: flex;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}
.tab-btn {
    background: transparent;
    border: none; border-bottom: 2px solid transparent;
    color: var(--text-dim);
    font-family: var(--font-head);
    font-size: 11px; letter-spacing: 0.2em;
    padding: 16px 28px;
    cursor: pointer; white-space: nowrap;
    transition: color var(--ease), border-color var(--ease);
    margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--white); border-bottom-color: var(--red); }

.tab-panel { display: none; padding: clamp(32px,5vw,80px) 0; }
.tab-panel.active { display: block; }

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
    font-family: var(--font-mono); font-size: 10px;
    letter-spacing: 0.2em; color: var(--text-faint);
}
.field-input, .field-select {
    background: var(--bg);
    border: 1px solid var(--border-hi);
    color: var(--text);
    font-family: var(--font-mono); font-size: 13px;
    padding: 10px 14px; outline: none; width: 100%;
    transition: border-color var(--ease);
    appearance: none;
}
.field-input:focus, .field-select:focus { border-color: var(--red); }
.field-input::placeholder { color: var(--text-faint); }
.field-textarea { resize: vertical; min-height: 110px; line-height: 1.6; }

.form-actions { display: flex; gap: 12px; margin-top: 8px; flex-wrap: wrap; }

.form-panel {
    border: 1px solid var(--border);
    padding: 32px;
}
.form-panel-title {
    font-size: 14px; letter-spacing: 0.15em;
    color: var(--white); margin-bottom: 24px;
    padding-bottom: 16px; border-bottom: 1px solid var(--border);
}

/* Vendor map */
.vendor-map {
    border: 1px solid var(--border);
    background: var(--bg);
    position: relative;
    height: 340px;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; margin-bottom: 24px;
}
.vendor-map::before {
    content: '';
    position: absolute; inset: 0;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 40px 40px;
    opacity: 0.6;
}
.vendor-map-label {
    position: relative; z-index: 1;
    font-family: var(--font-mono); font-size: 11px;
    letter-spacing: 0.2em; color: var(--text-faint);
    text-align: center;
}
.vendor-marker {
    position: absolute; z-index: 1;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--red);
    box-shadow: 0 0 0 4px rgba(204,17,34,0.2), 0 0 0 8px rgba(204,17,34,0.08);
}
.vendor-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1px; background: var(--border); border: 1px solid var(--border);
    margin-top: 24px;
}
.vendor-item {
    background: var(--bg-card); padding: 20px 24px;
    font-family: var(--font-mono); font-size: 11px;
}
.vendor-name { color: var(--white); margin-bottom: 6px; font-size: 13px; }
.vendor-detail { color: var(--text-dim); line-height: 1.7; }
.vendor-tag {
    display: inline-block; margin-top: 8px;
    padding: 3px 8px; border: 1px solid var(--border);
    font-size: 9px; letter-spacing: 0.15em; color: var(--text-faint);
}

/* Requisitions table */
.req-table {
    width: 100%; border-collapse: collapse;
    font-family: var(--font-mono); font-size: 12px;
}
.req-table th {
    text-align: left; padding: 12px 16px;
    font-size: 9px; letter-spacing: 0.2em;
    color: var(--text-faint);
    border-bottom: 1px solid var(--border);
    font-weight: normal;
}
.req-table td {
    padding: 16px; color: var(--text-dim);
    border-bottom: 1px solid var(--border);
}
.req-table tr:hover td { background: var(--bg-surface); }
.req-table td:first-child { color: var(--white); }

.status-badge {
    display: inline-block; padding: 3px 10px;
    font-size: 9px; letter-spacing: 0.2em;
    border: 1px solid;
}
.status-badge.shipped  { color: #4caf78; border-color: #4caf78; }
.status-badge.transit  { color: #f0a020; border-color: #f0a020; }
.status-badge.pending  { color: var(--text-dim); border-color: var(--border-hi); }
.status-badge.complete { color: var(--red); border-color: var(--red); }

/* Storefront product tiles */
.store-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1px; background: var(--border); border: 1px solid var(--border);
}
.store-tile {
    background: var(--bg-card); padding: 28px 24px;
    display: flex; flex-direction: column; gap: 16px;
    transition: background var(--ease); cursor: pointer;
}
.store-tile:hover { background: var(--bg-surface); }
.store-tile-model { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em; color: var(--red); }
.store-tile-name { font-size: 15px; letter-spacing: 0.08em; color: var(--white); }
.store-tile-price { font-family: var(--font-mono); font-size: 18px; color: var(--text); margin-top: auto; }
.store-tile-price small { font-size: 10px; color: var(--text-dim); letter-spacing: 0.1em; }

/* ── Page Transition ── */
.page-transition {
    position: fixed; inset: 0;
    z-index: 900;
    pointer-events: none;
}
.trans-panel {
    position: absolute; left: 0; right: 0;
    height: 50%;
    background: var(--bg);
}
.trans-panel-top    { top: 0;    transform: translateY(-100%); }
.trans-panel-bottom { bottom: 0; transform: translateY(100%); }

.trans-center {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    display: flex; align-items: center; gap: 16px;
    opacity: 0; z-index: 1; pointer-events: none;
    white-space: nowrap;
}
.trans-logo       { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; }
.trans-brand-main { font-family: var(--font-head); font-size: 22px; letter-spacing: 0.2em; color: var(--white); }
.trans-brand-sub  { font-family: var(--font-head); font-size: 8px;  letter-spacing: 0.45em; color: var(--text-dim); margin-top: 4px; }

/* covering — panels wipe in from top & bottom */
.pt-covering { pointer-events: all; }
.pt-covering .trans-panel-top,
.pt-covering .trans-panel-bottom { transform: translateY(0); transition: transform 0.52s cubic-bezier(0.76, 0, 0.24, 1); }
.pt-covering .trans-center       { opacity: 1; transition: opacity 0.22s ease 0.32s; }

/* covered — instant state applied via [data-pt] on <html> before first paint */
[data-pt="covered"] .page-transition            { pointer-events: all; }
[data-pt="covered"] .trans-panel-top,
[data-pt="covered"] .trans-panel-bottom         { transform: translateY(0); }
[data-pt="covered"] .trans-center               { opacity: 1; }

/* uncovering — panels wipe back out */
.pt-uncovering .trans-panel-top    { transform: translateY(-100%); transition: transform 0.52s cubic-bezier(0.76, 0, 0.24, 1) 0.1s; }
.pt-uncovering .trans-panel-bottom { transform: translateY(100%);  transition: transform 0.52s cubic-bezier(0.76, 0, 0.24, 1) 0.1s; }
.pt-uncovering .trans-center       { opacity: 0; transition: opacity 0.18s ease; }

/* ── Nav Auth ── */
.nav-auth { display: flex; align-items: center; gap: 8px; }
.nav-login, .nav-operators {
    font-family: var(--font-head);
    font-size: 11px;
    letter-spacing: 0.15em;
    padding: 6px 14px;
    border: 1px solid var(--red);
    color: var(--red);
    background: transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--ease), color var(--ease);
    white-space: nowrap;
}
.nav-login:hover { background: var(--red); color: #fff; }
.nav-operators { border-color: var(--border-hi); color: var(--text-dim); }
.nav-operators:hover { color: var(--white); border-color: var(--white); }
.nav-logout {
    font-family: var(--font-head);
    font-size: 10px;
    letter-spacing: 0.12em;
    padding: 5px 10px;
    border: 1px solid var(--border-hi);
    color: var(--text-faint);
    background: transparent;
    cursor: pointer;
    transition: color var(--ease), border-color var(--ease);
}
.nav-logout:hover { color: var(--text-dim); border-color: var(--text-dim); }

/* ── Auth Modal ── */
.auth-tab-bar { display: flex; border-bottom: 1px solid var(--border); }
.auth-tab {
    flex: 1;
    padding: 12px;
    font-family: var(--font-head);
    font-size: 10px;
    letter-spacing: 0.2em;
    border: none;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color var(--ease), border-color var(--ease);
}
.auth-tab:hover { color: var(--white); }
.auth-tab.active { color: var(--white); border-bottom-color: var(--red); }
.auth-panel { display: none; }
.auth-panel.active { display: block; }
.auth-error {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--red);
    min-height: 14px;
    margin: 0;
}

/* ── Operators Pages ── */
.operators-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 32px;
}
.operators-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 28px;
    transition: border-color var(--ease);
}
.operators-card:hover { border-color: var(--border-hi); }
.operators-card-label { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.3em; color: var(--text-faint); margin-bottom: 8px; }
.operators-card-title { font-size: 16px; letter-spacing: 0.1em; color: var(--white); margin-bottom: 12px; }
.operators-card-desc { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); line-height: 1.7; margin-bottom: 20px; }

.forum-post {
    border: 1px solid var(--border);
    padding: 20px 24px;
    margin-bottom: 1px;
    transition: background var(--ease);
}
.forum-post:hover { background: var(--bg-surface); }
.forum-post-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; gap: 16px; }
.forum-post-title { font-size: 13px; letter-spacing: 0.08em; color: var(--white); }
.forum-post-meta { font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); white-space: nowrap; }
.forum-post-excerpt { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); line-height: 1.7; }
.forum-post-tag { font-size: 9px; letter-spacing: 0.2em; color: var(--red); border: 1px solid var(--red); padding: 2px 8px; display: inline-block; margin-top: 10px; }
