/* =============================================================================
   SBC 350 — Interactive Engine Study
   Editorial / technical-manual aesthetic: warm off-black, brass accents,
   serif display paired with precise monospace for callouts.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --e-bg: #160607;
  --e-bg-elev: #111114;
  --ink: #F8F5EF;
  --ink-dim: #d8d3cf;
  --ink-faint: #F8F5EF;
  --accent: #D45A10;           /* warm orange — primary accent */
  --accent-dim: rgba(212,90,16,0.40);  /* subdued version for borders/rules */
  --rule: #1f1d19;
  --fw-regular:  400;
  --fw-medium:   500;
  --fw-semibold: 600;
  --fw-bold: 800;
  --nav-h3d: 46px;
  /* Borders & Radii */
  --radius-sm: 2px;
  --radius-md: 5px;
  --radius-lg: 10px;
  --radius-xl: 15px;

  --border-w-sm: 1px;
  --border-w-md: 1.5px;
  --border-w-lg: 2px;
  --border-w-xl: 3px;
  --border-w-2xl: 4px;

  /* Visuals */
  --blur-md: 16px;

  /* Transitions */
  --trans-fast: 0.2s ease;
  --trans-base: 0.3s ease;
  --trans-slow: 0.65s ease;

  /* Z-Index Scale */
  --z-base: 1;
  --z-sticky: 900;
  --z-nav-mobile: 999;
  --z-nav: 1000;
  --z-overlay: 9999;
  /* keep legacy names so any un-touched CSS still resolves */
  --brass:     #D45A10;
  --brass-dim: rgba(212,90,16,0.40);
  /* Letter Spacing (Tracking) */
  --track-logo: -0.1em;
  --track-tight: -0.025em;
  --track-base:  0em;
  --track-wide:  0.06em;
  --track-wider: 0.15em;
  --track-widest:0.22em;

  /* Spacing Scale */
  --space-xs:  clamp(0.5rem, 1vw, 0.75rem);
  --space-sm:  clamp(0.75rem, 1.5vw, 1.1rem);
  --space-md:  clamp(1.1rem, 2vw, 1.6rem);
  --space-lg:  clamp(1.6rem, 3vw, 2.6rem);
  --space-xl:  clamp(2.6rem, 5vw, 5rem);
  --space-2xl: clamp(4.5rem, 9vw, 9rem);

  --font-display: 'Fraunces', 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  --max-width: 1440px;
}
/* DARK MODE OVERRIDES */
@media (prefers-color-scheme: dark) {
  :root {
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--e-bg);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body {
  background-image:
    radial-gradient(ellipse at top, rgba(212,90,16, 0.05), transparent 60%),
    radial-gradient(ellipse at bottom, rgba(212,90,16, 0.02), transparent 70%);
}
/* ============================================================
   3D NAVIGATION
   ============================================================ */
#navbar3d { background: color-mix(in srgb, var(--bg) 94%, #cb0000c7); backdrop-filter: blur(var(--blur-md)); -webkit-backdrop-filter: blur(var(--blur-md)); border-bottom-color: var(--border); position: fixed; inset: 0 0 auto 0; height: var(--nav-h3d); z-index: var(--z-nav); transition: background var(--trans-base), border-color var(--trans-base); border-bottom: var(--border-w-sm) solid transparent; display: flex; align-items: center; }

.nav-inner3d { display: flex; align-items: center; justify-content: space-between; height: 100%; width: 100%; }
.nav-logo-text3d { font-family: var(--serif); font-size: 1.1rem; font-weight: var(--fw-semibold); color: var(--black); line-height: 1; }
.nav-logo-name3d { letter-spacing: var(--track-logo); font-size: 1.5rem; }
.nav-logo-sub3d { padding-left: 4px; font-size: 1.4rem; }
.nav-links3d { display: flex; align-items: center; gap: clamp(1rem, 2.2vw, 2rem); height: 100%; }
.nav-links3d a { font-size: 1rem; color: var(--text-body); opacity: 1; transition: opacity var(--trans-fast); display: flex; align-items: center; height: 100%; }
.nav-links3d a:hover { opacity: 1; }

/* Mobile Nav */
.nav-hamburger3d { display: none; flex-direction: column; gap: var(--radius-md); cursor: pointer; background: none; border: none; padding: 4px; }
.nav-hamburger3d span { display: block; width: 24px; height: var(--border-w-md); background: var(--black); transition: transform var(--trans-base), opacity var(--trans-base); }

.nav-mobile3d { display: none; position: fixed; inset: var(--nav-h3d) 0 auto 0; background: color-mix(in srgb, var(--bg) 97%, transparent); backdrop-filter: blur(var(--blur-md)); border-bottom: var(--border-w-sm) solid var(--border); padding: var(--space-lg) var(--space-md); flex-direction: column; z-index: var(--z-nav-mobile); }
.nav-mobile3d.open { display: flex; }
.nav-mobile3d a { font-size: 0.88rem; color: var(--text-body); padding-block: 0.75rem; border-bottom: var(--border-w-sm) solid var(--border); display: block; }
.nav-mobile3d .nav-cta-btn { margin-top: var(--space-sm); padding: 0.9rem !important; text-align: center; }

@media(max-width: 900px) { .nav-links3d { display: none; } .nav-hamburger3d { display: flex; } }

	.components-grid, .sgallery {
  		filter: brightness(1.05) drop-shadow(0 0 60px var(--red-glow));
	}

/* =============================================================================
   HEADER
   ========================================================================== */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  padding: 24px 40px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  background: linear-gradient(to bottom, rgba(10,10,12,0.85), transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
}

.site-header > * { pointer-events: auto; }


/* ============================================================
   PAGE TITLE BAR — absolute inside .stage, above the canvas
   ============================================================ */
.page-titlebar {
  position: absolute;
  top: var(--nav-h3d);
  left: 0;
  right: 0;
  z-index: 10;
  padding: 14px clamp(1.4rem, 5.5vw, 4.5rem) 16px;
  background: linear-gradient(to bottom, rgba(10,8,6,0.68) 0%, transparent 100%);
  pointer-events: none;
  max-height: 95px;
  
  /* Grid layout */
  display: grid;
  grid-template-columns: 1fr auto; 
  grid-template-rows: auto auto;   
  column-gap: 20px; 
  backdrop-filter: blur(15px) brightness(.3);
  
  /* NEW: Ensures the grid content stays centered if it doesn't fill the 95px */
  align-content: center; 
}

.page-titlebar__title {
  grid-column: 1; 
  grid-row: 1;    
  
  font-family: var(--serif);
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  font-weight: var(--fw-medium);
  color: white;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0;
}

.page-titlebar__subtitle {
  grid-column: 1; 
  grid-row: 2;    

  font-family: var(--sans);
  font-size: clamp(0.7rem, 1vw, 0.82rem);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--track-wider);
  text-transform: uppercase;
  color: var(--orange);
  margin-top: 4px;
  margin-bottom: 0;
}

.page-titlebar__status {
  grid-column: 2; 
  grid-row: 1 / 3; 
  
  display: flex;
  align-items: center; 
  
  font-family: var(--serif);
  /* FIX: Lowered max clamp size from 5rem to 3.5rem so it fits within the 65px available height */
  font-size: clamp(1.4rem, 3.4vw, 3.5rem);
  font-weight: var(--fw-md);
  color: white;
  text-align: right;
  
  /* FIX: Keeps the text's bounding box tight so align-items: center works perfectly */
  line-height: 1; 
}

@media(max-width: 600px) {
  .page-titlebar {
    padding: 10px 1.2rem 12px;
    max-height: 96px;
    backdrop-filter: blur(15px) brightness(.3);
  }
  .page-titlebar__title {
    font-size: 1.65rem;
    line-height: 1.05;
    white-space: nowrap;
  }
  .page-titlebar__subtitle {
    font-size: 0.66rem;
    line-height: 1.02;
    margin-top: 4px;
    letter-spacing: var(--track-wide);
  }
  /* Coming Soon: forced onto two lines via min-content width so the block
     reads at a confident size and visually matches the title+subtitle stack.
     The grid cell spans both rows and centers content, keeping it aligned
     beside the title block. */
  .page-titlebar__status {
    font-size: 1.7rem;
    line-height: 1.02;
    text-align: right;
    white-space: normal;
    width: min-content;
    margin-left: auto;
  }
}

/* On wider screens (above mobile), keep Coming Soon on one line */
@media(min-width: 601px) {
  .page-titlebar__status {
    white-space: nowrap;
  }
}

.meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  display: flex;
  gap: 32px;
}
.meta span { display: inline-block; }
.meta .label { color: var(--ink-faint); margin-right: 6px; }

/* =============================================================================
   STICKY STAGE — holds the 3D canvas and the orbiting labels
   ========================================================================== */
.stage-wrapper {
  position: relative;
  width: 100%;
  height: 100vh;
}

.stage {
  position: sticky;
  top: 0;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

#canvas-3d {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* SVG overlay — lives inside .stage (and BEFORE the labels layer in the DOM,
   so connector lines render behind the labels). */
.overlay-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Label container — individual labels are placed by JS */
.labels-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* =============================================================================
   ORBITING LABEL — one per component.
   JS sets transform (position) and opacity every frame. The numbering + rule
   hug the alignment side (set per-label from rotation position); the title and
   description are ALWAYS left-aligned and never uppercased.
   ========================================================================== */
.label {
  position: absolute;
  top: 0; left: 0;
  width: 260px;
  opacity: 0;                  /* JS drives this */
  will-change: transform, opacity;
  pointer-events: none;        /* decorative; must not block scroll/rotate */
}

.label__index {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.25em;
  text-transform: uppercase;   /* the "01 / 06" counter only */
  margin-bottom: 6px;
  text-align: left;
}

.label__rule {
  width: 24px;
  height: 1px;
  background: var(--accent-dim);
  margin-bottom: 10px;
}

.label__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink);           /* #F8F5EF warm off-white */
  text-align: left;            /* always left-aligned */
  text-transform: none;
  text-shadow: 0 1px 8px rgba(0,0,0,0.55);   /* legibility over the 3D scene */
}

/* The description is positioned ABSOLUTELY just below the title block, so it
   never contributes to the label's offsetHeight — revealing it can never push
   the title upward. JS drives both opacity (fade) and clip-path (curtain-down
   reveal from top → bottom).                                                  */
.label__description {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  margin-top: 8px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-dim);
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
  font-variant: normal;
  opacity: 0;                  /* JS drives this */
  pointer-events: none;
  text-shadow: 0 1px 8px rgba(0,0,0,0.55);
}

/* Numbering, rule, title and description all hug the alignment side
   (JS toggles .align-right / .align-left, only while the label is at 0 opacity). */
.label.align-right .label__index       { text-align: right; }
.label.align-right .label__rule        { margin-left: auto; }
.label.align-right .label__title       { text-align: right; }
.label.align-right .label__description { left: auto; right: 0; text-align: right; }

.label.align-left  .label__index       { text-align: left; }
.label.align-left  .label__rule        { margin-right: auto; }
.label.align-left  .label__title       { text-align: left; }
.label.align-left  .label__description { left: 0; right: auto; text-align: left; }

/* =============================================================================
   SCROLL HINT
   ========================================================================== */
.scroll-hint {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-faint);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 16px;
  pointer-events: none;
  backdrop-filter: blur(10px) brightness(.2) invert(.05);
  padding:7px;
  animation: fadeOutScroll linear both;
  animation-timeline: scroll(root);
  
    border-radius: 4px;

}

.scroll-hint__key {
  display: inline-block;
  padding: 3px 8px;
  border: 1px solid var(--ink-faint);
  color: var(--ink-dim);
  border-radius: 2px;
  font-size: 9px;
}

@media (max-width: 600px) {
  .scroll-hint { display: none; }
}

@keyframes fadeOutScroll {
  0% {
    opacity: 1;
  }
  13% {
    opacity: 0.35;
  }
  16%, 100% {
    opacity: 0;
  }
}
/* =============================================================================
   LOGO PLACEHOLDER — shown while model loads, sits inside the stage
   ========================================================================== */
.logo-placeholder {
  position: absolute;
  transform: translateY(-7%);
  inset: 0px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
  transition: opacity 600ms ease;
}

.logo-placeholder img {
  max-width: 65vw; 
  max-height: 55vh;
  width: auto;
  height: auto;
  opacity: 0.85;
}

.logo-placeholder.is-hidden {
  opacity: 0;
}

/* =============================================================================
   DEBUG READOUT
   ========================================================================== */
.debug-readout {
  position: fixed;
  bottom: 16px;
  right: 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-dim);
  background: rgba(0,0,0,0.5);
  padding: 6px 10px;
  border: 1px solid var(--rule);
  z-index: 45;
}

/* =============================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 768px) {
  .site-header { padding: 16px 20px; }
  .meta { display: none; }
  .body-columns { grid-template-columns: 1fr; gap: 30px; }
  .spec-table .row { grid-template-columns: 140px 1fr; }
  .label { width: 200px; }
  .label__title { font-size: 18px; }
  .label__description { font-size: 12.5px; }
}

/* =============================================================================
   COMPONENT CARD — active highlight (synced with 3D label visibility)
   Uses the inverse-card treatment: dark rose background, white text,
   solid orange top accent. Border is left alone so the normal hover
   behavior (orange border) still applies on top of the active state.
   ========================================================================== */
.component-card.is-active {
  background: var(--dark-rose-bg);
  color: var(--white);
}
.component-card.is-active::before {
  background: var(--orange);
  opacity: 1;
}
.component-card.is-active .component-name {
  color: var(--white);
}
.component-card.is-active .component-num {
  color: var(--white-op-90);
}
.component-card.is-active .component-label {
  color: var(--white-op-70);
}
.component-card.is-active p {
  color: var(--white-op-70);
}
.component-card p {
font-size: clamp(0.95rem, 1rem, 2rem);
}
/* =============================================================================
   SPLIT GALLERY (sgallery)
   Two-pane gallery with stacked, cross-fading images.
   Left/right click zones step through; hold = auto-advance.
   ========================================================================== */
.sgallery {
  display: flex;
  gap: clamp(12px, 1.5vw, 20px);
  width: 100%;
  padding: 0 clamp(1.4rem, 5.5vw, 4.5rem);
  align-items: stretch;
}

.sgallery-pane {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: clamp(280px, 32vw, 420px);
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--e-bg-elev);
  user-select: none;
  -webkit-user-select: none;
}

/* Stacked images — all absolute, only .is-active is opaque */
.sgallery-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-lg);
  opacity: 0;
  transition: opacity 0.55s ease;
  pointer-events: none;
  will-change: opacity;
}
.sgallery-img.is-active { opacity: 1; }

/* Invisible click/hold zones — left half and right half */
.sgallery-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
  margin: 0;
  z-index: 2;
  -webkit-tap-highlight-color: transparent;
}
.sgallery-zone--prev { left: 0; }
.sgallery-zone--next { right: 0; }
.sgallery-zone:disabled { cursor: default; }

/* Arrow overlay — full-height vertical strip with blur+darken */
.sgallery-overlay {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 22%;
  max-width: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  backdrop-filter: blur(5px) brightness(0.8);
  -webkit-backdrop-filter: blur(5px) brightness(0.8);
  transition:
    backdrop-filter var(--trans-base),
    -webkit-backdrop-filter var(--trans-base),
    opacity var(--trans-base),
    visibility var(--trans-base);
  pointer-events: none;
  z-index: 3;
}
.sgallery-overlay--prev { left: 0; }
.sgallery-overlay--next { right: 0; }

/* Hover: drop the blur/darken, leave only the arrow */
.sgallery-pane:hover .sgallery-overlay {
  backdrop-filter: blur(0) brightness(1);
  -webkit-backdrop-filter: blur(0) brightness(1);
}

/* Hidden when navigation in that direction is not possible */
.sgallery-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
}

/* CSS triangle arrow */
.sgallery-arrow {
  display: block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 7px 0 7px 10px;
  border-color: transparent transparent transparent var(--ink);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
  transition: border-color var(--trans-fast);
}
.sgallery-arrow--left {
  transform: rotate(180deg);
  margin-right: 3px; /* visually center after rotate */
}
.sgallery-arrow--right {
  margin-left: 3px;
}

/* Subtle accent tint on hover of the active side */
.sgallery-zone:hover ~ .sgallery-overlay--next .sgallery-arrow,
.sgallery-zone:hover ~ .sgallery-overlay--prev .sgallery-arrow {
  border-left-color: var(--accent);
}

/* Mobile: stack the two panes into a column */
@media (max-width: 768px) {
  .sgallery {
    flex-direction: column;
    padding: 0 clamp(1rem, 4vw, 1.6rem);
  }
  .sgallery-pane {
    flex: 0 0 auto;
    width: 100%;
    height: 62vw;
    max-height: 420px;
  }
}

/* =============================================================================
   COMPONENT GRID — ev8.html
   1 col on mobile, 2 cols on tablet, 3 cols on desktop (max).
   Scoped via #component-details to override ev8motors.css.
   ========================================================================== */
#component-details .components-grid {
  grid-template-columns: 1fr;
}
@media (min-width: 600px) {
  #component-details .components-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1100px) {
  #component-details .components-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* =============================================================================
   NAVBAR 3D — hide-on-scroll
   Matches the .nav-hidden treatment on #navbar in ev8motors.css.
   ========================================================================== */
#navbar3d {
  transition: transform var(--trans-base), background var(--trans-base), border-color var(--trans-base);
  will-change: transform;
}
#navbar3d.nav-hidden {
  transform: translateY(-100%);
}
