/* ==========================================================
   THE HANGAR — vessel selector (replaces the old Vessel Bay list)
   A full-screen instrument screen: one photographic plate of the craft
   on the left, its readouts on the right, the whole fleet as a filmstrip
   beneath, and every cruising speed on one shared log ladder.
   Palette: the app's gold readout accent (--readout-gold family) on
   near-black, with a per-craft glow on the plate only.
   ========================================================== */
.vessel-scrim { position: fixed; inset: 0; z-index: 46; background: rgba(1, 3, 9, 0.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; pointer-events: none; transition: opacity 0.6s ease; }
.vessel-scrim.open { opacity: 1; pointer-events: auto; }

.hangar {
  --hg-gold: #f2cd84; --hg-hot: #ff9a3c; --hg-line: rgba(158, 178, 255, 0.16); --hg-glow: rgba(130, 160, 255, 0.3);
  position: fixed; inset: 0; z-index: 47; display: flex; flex-direction: column;
  background: radial-gradient(130% 100% at 50% 0%, #070a14 0%, #04060d 50%, #010207 100%);
  opacity: 0; pointer-events: none; transform: scale(1.012); transition: opacity 0.6s ease, transform 0.8s cubic-bezier(0.22, 0.8, 0.32, 1);
}
.hangar.open { opacity: 1; pointer-events: auto; transform: none; }
.hangar[data-vessel="fusion"] { --hg-glow: rgba(255, 150, 70, 0.34); }
.hangar[data-vessel="antimatter"] { --hg-glow: rgba(168, 130, 255, 0.34); }
.hangar[data-vessel="starship"] { --hg-glow: rgba(150, 190, 255, 0.28); }

/* hangar atmosphere: two slow drifting hazes + a floor of light */
.hangar-smoke { position: absolute; inset: -12%; pointer-events: none; opacity: 0.75; background: radial-gradient(42% 48% at 22% 78%, rgba(120, 150, 255, 0.1), transparent 70%), radial-gradient(46% 42% at 82% 24%, rgba(255, 170, 90, 0.075), transparent 70%); filter: blur(28px); animation: hg-drift 38s ease-in-out infinite alternate; }
.hangar-floor { position: absolute; inset: auto 0 0 0; height: 34%; pointer-events: none; background: linear-gradient(0deg, rgba(120, 145, 235, 0.07), transparent 70%); }
@keyframes hg-drift { 0% { transform: translate3d(-2%, 1%, 0) scale(1); } 100% { transform: translate3d(3%, -2%, 0) scale(1.08); } }

.hangar-inner { position: relative; z-index: 1; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: clamp(13px, 1.9vh, 24px); padding: clamp(16px, 2.6vh, 30px) clamp(20px, 3.4vw, 54px) clamp(14px, 2.2vh, 26px); overflow: auto; }

/* ---- top rail ---- */
.hangar-top { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.hangar-eyebrow { font-family: var(--sans); font-size: 10.5px; font-weight: 500; letter-spacing: 0.34em; text-transform: uppercase; color: var(--hg-gold); white-space: nowrap; flex-shrink: 0; }
.hangar-rule { flex: 1; height: 1px; background: linear-gradient(90deg, rgba(242, 205, 132, 0.32), rgba(158, 178, 255, 0.1)); }
.hangar-close { background: none; border: none; color: var(--text-faint); font-size: 26px; line-height: 1; padding: 6px 10px; cursor: pointer; transition: color 0.3s ease; min-width: 44px; min-height: 44px; }
.hangar-close:hover { color: var(--text); }
.hangar.gate .hangar-close { display: none; }

/* ---- main: plate + readouts ---- */
.hangar-main { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.92fr); gap: clamp(20px, 3vw, 46px); align-items: start; flex-shrink: 0; }
.hangar-stage { display: flex; justify-content: center; }
.hangar-plate { position: relative; aspect-ratio: 16 / 9; width: min(100%, 88vh); overflow: hidden; background: #04060d; border: 1px solid var(--hg-line); box-shadow: 0 30px 90px rgba(0, 0, 0, 0.72), 0 0 70px -26px var(--hg-glow); transition: box-shadow 0.9s ease; }
.hplate-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.045); transition: opacity 0.75s ease, transform 1.6s cubic-bezier(0.2, 0.7, 0.3, 1); filter: saturate(0.88) contrast(1.06) brightness(0.9); }
.hplate-img.is-live { opacity: 1; transform: scale(1); }
/* one grade over every plate so a daylight photograph and a deep-space render
   read as the same hangar, lit the same way */
.hangar-grade { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(122% 104% at 50% 44%, transparent 38%, rgba(2, 4, 10, 0.62) 100%), linear-gradient(180deg, rgba(2, 4, 10, 0.4), transparent 26%, transparent 58%, rgba(2, 4, 10, 0.66)); }
.hangar-scan { position: absolute; inset: 0; pointer-events: none; opacity: 0.16; background: repeating-linear-gradient(180deg, rgba(190, 205, 255, 0.14) 0 1px, transparent 1px 3px); }
.hangar-sweep { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: linear-gradient(105deg, transparent 34%, rgba(255, 232, 190, 0.16) 50%, transparent 66%); }
.hangar-plate.sweep .hangar-sweep { animation: hg-sweep 1s ease-out; }
@keyframes hg-sweep { 0% { opacity: 0; transform: translateX(-55%); } 16% { opacity: 1; } 100% { opacity: 0; transform: translateX(55%); } }
.hg-bracket { position: absolute; width: 22px; height: 22px; pointer-events: none; border: 0 solid var(--hg-gold); opacity: 0.7; }
.hg-bracket.tl { top: 10px; left: 10px; border-top-width: 1px; border-left-width: 1px; }
.hg-bracket.tr { top: 10px; right: 10px; border-top-width: 1px; border-right-width: 1px; }
.hg-bracket.bl { bottom: 10px; left: 10px; border-bottom-width: 1px; border-left-width: 1px; }
.hg-bracket.br { bottom: 10px; right: 10px; border-bottom-width: 1px; border-right-width: 1px; }
.hangar-slug { position: absolute; top: 14px; left: 42px; white-space: nowrap; font-family: var(--sans); font-size: 10.5px; font-weight: 500; letter-spacing: 0.3em; text-transform: uppercase; color: var(--hg-gold); text-shadow: 0 1px 12px rgba(0, 0, 0, 0.9); }

/* ---- readouts ---- */
.hangar-data { display: flex; flex-direction: column; gap: clamp(7px, 1.1vh, 13px); padding-top: clamp(2px, 1vh, 10px); }
.hd-eyebrow { font-family: var(--sans); font-size: 10.5px; font-weight: 500; letter-spacing: 0.32em; text-transform: uppercase; color: var(--hg-gold); }
.hd-name { font-family: var(--sans); font-weight: 500; font-size: clamp(30px, 4.3vw, 60px); line-height: 0.94; letter-spacing: -0.015em; text-transform: uppercase; color: #f5f6fb; margin: 0; white-space: nowrap; }
/* Every readout below the plate holds a FIXED height across all six craft: a
   one- vs two-line drive string used to change the column height on hover,
   which moved the filmstrip out from under the cursor and oscillated. */
.hd-drive { font-family: var(--sans); font-size: 11px; font-weight: 400; line-height: 1.35; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-faint); margin: 0; min-height: 2.7em; }
.hd-speed { display: flex; align-items: baseline; gap: 9px; margin-top: clamp(2px, 0.8vh, 8px); }
.hd-speed-num { font-family: var(--sans); font-weight: 300; font-size: clamp(42px, 6.4vw, 84px); line-height: 0.9; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: #fff; }
.hd-speed-unit { font-family: var(--sans); font-size: clamp(13px, 1.3vw, 17px); letter-spacing: 0.1em; color: var(--text-dim); }
.hd-desc { font-family: var(--serif); font-size: clamp(13.5px, 1.35vw, 16px); line-height: 1.5; color: var(--text-dim); margin: 0; max-width: 46ch; height: 4.5em; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hd-legs { display: flex; flex-direction: column; gap: clamp(6px, 1vh, 12px); margin-top: clamp(2px, 1vh, 8px); padding-top: clamp(8px, 1.4vh, 16px); border-top: 1px solid var(--hg-line); }
.hd-leg-label { display: block; font-family: var(--sans); font-size: 10px; font-weight: 500; letter-spacing: 0.24em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 3px; }
.hd-leg-val { font-family: var(--sans); font-weight: 300; font-size: clamp(22px, 2.6vw, 34px); line-height: 1; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; color: var(--hg-gold); }
.hd-leg.minor .hd-leg-val { font-size: clamp(15px, 1.5vw, 19px); color: var(--text-dim); }
.hd-engaged-wrap { display: flex; min-height: 40px; align-items: center; margin-top: clamp(2px, 0.8vh, 8px); }
.hd-engaged { display: inline-flex; align-items: center; gap: 9px; padding: 10px 20px; background: var(--hg-gold); color: #17130a; font-family: var(--sans); font-size: 11px; font-weight: 500; letter-spacing: 0.28em; text-transform: uppercase; box-shadow: 0 0 34px rgba(242, 205, 132, 0.34); opacity: 0; transform: translateY(5px); transition: opacity 0.4s ease, transform 0.4s ease; }
.hangar.engaged .hd-engaged { opacity: 1; transform: none; }
.hd-engaged.stamp { animation: hg-stamp 0.5s cubic-bezier(0.2, 0.9, 0.3, 1); }
@keyframes hg-stamp { 0% { transform: scale(1.14); opacity: 0; } 30% { opacity: 1; } 100% { transform: scale(1); opacity: 1; } }

/* ---- filmstrip: the whole fleet ---- */
.hangar-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: clamp(7px, 0.9vw, 13px); flex-shrink: 0; }
.hg-thumb { position: relative; aspect-ratio: 16 / 9; overflow: hidden; padding: 0; background: #05070e; border: 1px solid var(--hg-line); cursor: pointer; transition: border-color 0.4s ease, box-shadow 0.4s ease, transform 0.4s cubic-bezier(0.22, 0.8, 0.32, 1); }
.hg-thumb-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.5; filter: saturate(0.62) brightness(0.8); transition: opacity 0.45s ease, filter 0.45s ease; }
.hg-thumb-grade { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(2, 4, 10, 0.9) 0%, rgba(2, 4, 10, 0.35) 46%, rgba(2, 4, 10, 0.1) 100%); }
.hg-thumb-meta { position: absolute; inset: auto 0 0 0; display: flex; flex-direction: column; gap: 2px; padding: 9px 11px 10px; text-align: left; }
.hg-thumb-name { font-family: var(--sans); font-size: 10.5px; font-weight: 500; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(232, 235, 250, 0.72); transition: color 0.4s ease; }
.hg-thumb-speed { font-family: var(--sans); font-size: 10.5px; font-weight: 400; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; color: var(--text-faint); transition: color 0.4s ease; }
.hg-thumb:hover .hg-thumb-img { opacity: 0.62; filter: saturate(0.8) brightness(0.85); }
.hg-thumb:hover { border-color: rgba(242, 205, 132, 0.4); }
.hg-thumb.is-preview { border-color: var(--hg-gold); box-shadow: 0 0 0 1px rgba(242, 205, 132, 0.35), 0 0 30px -6px rgba(242, 205, 132, 0.35); transform: translateY(-3px); }
.hg-thumb.is-preview .hg-thumb-img { opacity: 1; filter: saturate(1) brightness(1); }
.hg-thumb.is-preview .hg-thumb-name { color: #fff; }
.hg-thumb.is-preview .hg-thumb-speed { color: var(--hg-gold); }
.hg-thumb.is-engaged::after { content: ""; position: absolute; top: 9px; right: 9px; width: 6px; height: 6px; background: var(--hg-gold); box-shadow: 0 0 12px rgba(242, 205, 132, 0.9); }
.hg-thumb:focus-visible { outline: 1px solid var(--hg-gold); outline-offset: 2px; }

/* ---- speed ladder: every craft on one log scale ---- */
.hangar-ladder { flex-shrink: 0; }
.hg-ladder-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 11px; }
.hg-ladder-head span { font-family: var(--sans); font-size: 10px; font-weight: 500; letter-spacing: 0.26em; text-transform: uppercase; color: var(--text-faint); }
.hg-bar { position: relative; height: 2px; background: rgba(158, 178, 255, 0.16); margin-bottom: 42px; }
.hg-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, var(--hg-gold), var(--hg-hot)); box-shadow: 0 0 16px rgba(255, 154, 60, 0.5); transition: width 0.95s cubic-bezier(0.2, 0.7, 0.2, 1); }
.hg-tick { position: absolute; top: -4px; width: 1px; height: 10px; background: rgba(158, 178, 255, 0.32); transform: translateX(-50%); transition: background 0.4s ease, height 0.4s ease; }
.hg-tick.on { background: var(--hg-gold); height: 16px; top: -7px; box-shadow: 0 0 10px rgba(242, 205, 132, 0.8); }
.hg-tlabel { position: absolute; top: 13px; transform: translateX(-50%); font-family: var(--sans); font-size: 10.5px; font-weight: 400; letter-spacing: 0.06em; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-faint); transition: color 0.4s ease; }
/* the four chemical ships crowd the low end of a log scale — stagger every other
   label onto a second row so all six can be read at once */
.hg-tlabel.row2 { top: 28px; }
.hg-tlabel.row2::before { content: ""; position: absolute; left: 50%; top: -13px; width: 1px; height: 11px; background: rgba(158, 178, 255, 0.18); }
.hg-tlabel.row2.on::before { background: rgba(242, 205, 132, 0.5); }
.hg-tlabel.on { color: var(--hg-gold); font-weight: 500; }

/* ---- status bar ---- */
.hangar-status { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-shrink: 0; padding-top: clamp(6px, 1.2vh, 12px); border-top: 1px solid rgba(158, 178, 255, 0.1); font-family: var(--sans); font-size: 10.5px; font-weight: 500; letter-spacing: 0.26em; text-transform: uppercase; color: var(--text-faint); }
.hs-left { display: flex; align-items: center; gap: 10px; color: var(--hg-gold); }
.hs-dot { width: 6px; height: 6px; background: var(--hg-gold); animation: hg-pulse 2.4s ease-in-out infinite; }
@keyframes hg-pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
.hs-right { display: flex; align-items: center; gap: 10px; }
.hs-sep { color: rgba(158, 178, 255, 0.3); }
.hs-val { color: var(--text-dim); }
.hs-left .hs-val { color: var(--hg-gold); font-variant-numeric: tabular-nums; }

/* ---- launch bar (gate mode only) ---- */
.hangar-launch { display: none; }
.hangar.gate .hangar-launch { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; flex-shrink: 0; }
.bay-launch-hint { font-family: var(--serif); font-size: clamp(13.5px, 1.6vw, 16px); line-height: 1.45; color: var(--text-dim); }
.bay-launch { display: inline-flex; align-items: center; gap: 11px; padding: 13px 26px; background: rgba(242, 205, 132, 0.09); border: 1px solid rgba(242, 205, 132, 0.42); color: var(--hg-gold); font-family: var(--sans); font-size: 11.5px; font-weight: 500; letter-spacing: 0.24em; text-transform: uppercase; cursor: pointer; transition: background 0.35s ease, border-color 0.35s ease, color 0.35s ease; }
.bay-launch:hover { background: rgba(242, 205, 132, 0.16); border-color: var(--hg-gold); color: #fff8e8; }
.bl-arrow { font-size: 14px; }

/* ---- short viewports: the plate yields first, then the prose ---- */
@media (max-height: 820px) {
  .hangar-plate { width: min(100%, 78vh); }
}
@media (max-height: 700px) {
  .hangar-plate { width: min(100%, 66vh); }
  .hd-desc { display: none; }
  .hd-engaged-wrap { min-height: 0; }
  .hd-engaged { padding: 8px 16px; }
  .hangar-inner { gap: 11px; }
}
@media (max-height: 620px) {
  .hg-ladder-head { display: none; }
  .hangar-plate { width: min(100%, 58vh); }
  .hd-name { font-size: clamp(26px, 3.4vw, 40px); }
  .hd-speed-num { font-size: clamp(34px, 5vw, 58px); }
  .hd-legs { gap: 6px; padding-top: 8px; }
  .hd-leg-val { font-size: clamp(19px, 2.2vw, 26px); }
}

/* ---- phones: stack the plate over the readouts, filmstrip scrolls ---- */
@media (max-width: 760px) {
  .hangar-inner { gap: 14px; padding: max(14px, env(safe-area-inset-top)) 18px calc(14px + env(safe-area-inset-bottom)); }
  .hangar-main { grid-template-columns: 1fr; gap: 16px; }
  .hangar-plate { width: 100%; }
  .hangar-data { padding-top: 0; gap: 8px; }
  .hd-name { font-size: clamp(28px, 8.6vw, 40px); }
  .hd-speed-num { font-size: clamp(38px, 12vw, 56px); }
  .hd-desc { display: none; }
  .hd-legs { flex-direction: row; gap: 22px; flex-wrap: wrap; }
  .hd-engaged-wrap { min-height: 0; }
  .hangar-strip { display: flex; overflow-x: auto; gap: 9px; padding-bottom: 4px; scrollbar-width: none; }
  .hangar-strip::-webkit-scrollbar { display: none; }
  .hg-thumb { flex: 0 0 40vw; min-height: 44px; }
  /* the crowded chemical labels collapse; the lit one and the extremes stay */
  .hg-tlabel:not(.on):not(.edge) { display: none; }
  .hangar-status { letter-spacing: 0.18em; font-size: 9.5px; }
  .hangar.gate .hangar-launch { flex-direction: column; align-items: stretch; }
  .bay-launch { justify-content: center; }
  .bay-launch-hint { text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .hangar-smoke, .hs-dot { animation: none; }
  .hangar-plate.sweep .hangar-sweep, .hd-engaged.stamp { animation: none; }
  .hplate-img { transition: opacity 0.3s ease; transform: none; }
  .hplate-img.is-live { transform: none; }
  .hg-fill { transition: none; }
}
