/* =============================================================================
   LAUNCH POPUP: TABS + ORBIT TAB
   (load after archive.css)
============================================================================= */

/* ---------- Tabs ---------- */

.launch-modal-tabs {
    display: flex;
    gap: 10px;
    padding: 16px 24px 0;
}

.launch-modal-tabs[hidden] {
    display: none;
}

.launch-modal-tab {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 9px 16px;
    border: 1px solid rgba(62, 166, 255, .3);
    border-radius: 8px;
    background: rgba(7, 20, 31, .7);
    color: #8eb4ca;
    font: 700 .66rem 'IBM Plex Sans', sans-serif;
    letter-spacing: .14em;
    cursor: pointer;
    transition: border-color .2s, background .2s, color .2s, box-shadow .2s;
}

.launch-modal-tab[hidden] {
    display: none;
}

.launch-modal-tab i {
    font-size: .85rem;
}

.launch-modal-tab:hover {
    border-color: rgba(62, 166, 255, .6);
    color: #d5efff;
}

.launch-modal-tab.is-active {
    border-color: #3EA6FF;
    background: rgba(33, 150, 243, .2);
    color: #FFFFFF;
    box-shadow: 0 0 14px rgba(62, 166, 255, .3), inset 0 0 10px rgba(62, 166, 255, .15);
}

.launch-modal-tab-hint:empty {
    display: none;
}

.launch-modal-tab-hint {
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(62, 166, 255, .15);
    color: #8FD0FF;
    font-size: .6rem;
    letter-spacing: .06em;
}

.launch-modal-tab:focus-visible {
    outline: 2px solid #3EA6FF;
    outline-offset: 2px;
}

/* ---------- Panes ---------- */

.launch-modal-pane[hidden] {
    display: none;
}

.launch-modal-pane[data-pane="orbit"],
.launch-modal-pane[data-pane="reusability"] {
    padding: 18px 24px;
}

/* The reusability card is always full width now */
.launch-modal-pane[data-pane="reusability"] .launch-modal-card--reusable {
    min-height: 0;
}

/* ---------- Orbit layout ---------- */

.orbit-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr);
    gap: 20px;
    align-items: start;
}

.orbit-map {
    margin-top: 14px;
    border: 1px solid rgba(62, 166, 255, .18);
    border-radius: 6px;
    overflow: hidden;
}

.orbit-map canvas {
    display: block;
    width: 100%;
}

.orbit-map-note {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: .7rem;
    color: #8fa6c2;
}

.orbit-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #50ffa0;
    box-shadow: 0 0 8px rgba(80, 255, 160, .8);
    animation: orbit-pulse 1.6s ease-in-out infinite;
}

@keyframes orbit-pulse {
    0%, 100% { opacity: .45; }
    50%      { opacity: 1; }
}

/* Deep space / no data */
.orbit-deep {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 260px;
    margin-top: 14px;
    border: 1px dashed rgba(168, 85, 247, .35);
    border-radius: 6px;
    background: radial-gradient(ellipse at center, rgba(168, 85, 247, .1), transparent 70%);
    text-align: center;
    color: #c4b5fd;
}

.orbit-deep i {
    font-size: 2rem;
    color: #a855f7;
}

.orbit-deep strong {
    font-size: 1rem;
    color: #f1f7fc;
}

.orbit-deep span {
    font-size: .8rem;
}

/* ---------- Side panel ---------- */

.orbit-side {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.orbit-picker {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
    font-size: .65rem;
    letter-spacing: .08em;
    color: #8fa6c2;
}

.orbit-picker select {
    height: 34px;
    padding: 0 10px;
    border: 1px solid rgba(62, 166, 255, .35);
    border-radius: 6px;
    background: #071622;
    color: #e8f2ff;
    font: 600 .78rem 'IBM Plex Sans', sans-serif;
    cursor: pointer;
}

.orbit-identity {
    padding-bottom: 12px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(48, 111, 147, .18);
}

.orbit-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: #f1f7fc;
}

.orbit-ids {
    margin: 3px 0 9px;
    font-size: .7rem;
    color: #8fa6c2;
    font-variant-numeric: tabular-nums;
}

.orbit-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border: 1px solid;
    border-radius: 999px;
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .12em;
}

.orbit-status span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 6px currentColor;
}

.orbit-status--in-orbit   { color: #50ffa0; border-color: rgba(80, 255, 160, .35);  background: rgba(80, 255, 160, .08); }
.orbit-status--docked     { color: #7cc4ff; border-color: rgba(124, 196, 255, .4);  background: rgba(124, 196, 255, .08); }
.orbit-status--returned   { color: #2dd4bf; border-color: rgba(45, 212, 191, .4);   background: rgba(45, 212, 191, .08); }
.orbit-status--reentered  { color: #ff6b6b; border-color: rgba(255, 107, 107, .4);  background: rgba(255, 107, 107, .08); }
.orbit-status--deep-space { color: #c084fc; border-color: rgba(192, 132, 252, .4);  background: rgba(192, 132, 252, .08); }

/* Live readouts */
.orbit-live {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 6px 0 8px;
}

.orbit-live div {
    padding: 8px 10px;
    border: 1px solid rgba(124, 196, 255, .12);
    border-radius: 7px;
    background: rgba(124, 196, 255, .04);
}

.orbit-live span {
    display: block;
    font-size: .6rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #8fa6c2;
}

.orbit-live strong {
    font-size: .95rem;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

/* Rows */
.orbit-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 32px;
    border-bottom: 1px solid rgba(48, 111, 147, .18);
    font-size: .72rem;
}

.orbit-row span {
    color: #aebbc5;
}

.orbit-row strong {
    color: #35b9ff;
    text-align: right;
}

.orbit-row--alert strong {
    color: #ff6b6b;
}

.orbit-subtitle {
    margin: 14px 0 2px;
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .14em;
    color: #35c5ff;
}

.orbit-subtitle em {
    font-style: normal;
    font-weight: 500;
    letter-spacing: .04em;
    color: #8fa6c2;
}

.orbit-foot {
    margin-top: 12px;
    font-size: .66rem;
    color: rgba(143, 166, 194, .75);
}

/* ---------- Smaller screens ---------- */

@media (max-width: 900px) {
    .orbit-layout {
        grid-template-columns: 1fr;
    }

    .launch-modal-tabs {
        flex-wrap: wrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    .orbit-live-dot { animation: none; }
}

/* =============================================================================
   "LOOK HERE" PULSE on Orbit / Reusability until the tab is opened once
============================================================================= */

.launch-modal-tab:not([data-tab="overview"]):not(.is-active):not(.is-seen) {
    animation: tab-hint 2.2s ease-in-out infinite;
}

@keyframes tab-hint {
    0%, 100% {
        border-color: rgba(62, 166, 255, .3);
        box-shadow: 0 0 0 rgba(62, 166, 255, 0);
    }
    50% {
        border-color: rgba(143, 208, 255, .9);
        box-shadow: 0 0 16px rgba(62, 166, 255, .55), inset 0 0 10px rgba(62, 166, 255, .2);
        color: #e8f2ff;
    }
}

/* =============================================================================
   ORBIT STATUS BADGES next to SUCCESS in the status row
============================================================================= */

.orbit-status-badges {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-left: 6px;
}

.orbit-status--link {
    font-family: 'IBM Plex Sans', sans-serif;
    cursor: pointer;
    transition: filter .2s, box-shadow .2s;
}

.orbit-status--link:hover {
    filter: brightness(1.25);
    box-shadow: 0 0 10px currentColor;
}

.orbit-status--link:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* The status cell may need two lines now */
#launchModalStatus {
    flex-wrap: wrap;
    row-gap: 6px;
}

@media (prefers-reduced-motion: reduce) {
    .launch-modal-tab:not([data-tab="overview"]):not(.is-active):not(.is-seen) {
        animation: none;
        border-color: rgba(143, 208, 255, .8);
    }
}

/* =============================================================================
   REUSABILITY RAIL - a column on the right of the popup, next to the tabs
   (replaces the Reusability tab)
============================================================================= */

/* The popup widens when there is a rail */
.launch-details-modal.has-rail {
    width: min(1440px, 96vw);
    max-width: min(1440px, 96vw);
}

.launch-modal-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

.has-rail .launch-modal-body {
    grid-template-columns: minmax(0, 1fr) 340px;
}

.launch-modal-main {
    min-width: 0;
}

.launch-modal-rail {
    display: flex;
    min-width: 0;
    padding: 16px 24px 18px 0;
}

.launch-modal-rail[hidden] {
    display: none;
}

.launch-modal-rail > .launch-modal-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.launch-modal-rail .launch-modal-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ---------- Stacking inside the rail ---------- */

.launch-modal-rail .reusable-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 12px;
}

/* Every booster takes the full width... */
.launch-modal-rail .reusable-grid > .reusable-entry {
    grid-column: 1 / -1;
}

/* ...except Falcon Heavy's side boosters, which sit side by side under the core */
.launch-modal-rail .reusable-grid--3 > .reusable-entry:nth-child(n + 2) {
    grid-column: auto;
}

/* Separators: dashed line between rows, and between the two side boosters */
.launch-modal-rail .reusable-grid > .reusable-entry + .reusable-entry {
    margin-top: 0;
    padding-top: 14px;
    margin-top: 14px;
    padding-left: 0;
    border-left: none;
    border-top: 1px dashed rgba(124, 196, 255, .2);
}

.launch-modal-rail .reusable-grid--3 > .reusable-entry:nth-child(3) {
    padding-left: 12px;
    border-left: 1px dashed rgba(124, 196, 255, .2);
}

/* Picture sizes: one booster gets the full height, stacks get less */
.launch-modal-rail .reusable-grid--1 .launcher-modal-image {
    max-height: 380px;
}

.launch-modal-rail .reusable-grid--2 .launcher-modal-image {
    max-height: 170px;
}

.launch-modal-rail .reusable-grid--3 > .reusable-entry:first-child .launcher-modal-image {
    max-height: 190px;
}

/* Side boosters: picture above the details, they're only half as wide */
.launch-modal-rail .reusable-grid--3 > .reusable-entry:nth-child(n + 2) {
    grid-template-columns: 1fr;
}

.launch-modal-rail .reusable-grid--3 > .reusable-entry:nth-child(n + 2) .launcher-modal-image {
    max-height: 110px;
}

.launch-modal-rail .reusable-grid--3 > .reusable-entry:nth-child(n + 2) .launcher-image-column {
    padding: 4px 0;
}

.launch-modal-rail .reusable-grid--3 > .reusable-entry:nth-child(n + 2) .launcher-info-column {
    padding: 6px 0 0;
}

/* Compact rows in the rail */
.launch-modal-rail .reusable-entry .modal-card-row {
    min-height: 28px;
    padding-top: 4px;
    padding-bottom: 4px;
}

/* ---------- Smaller screens: the rail drops below the cards ---------- */

@media (max-width: 1250px) {
    .has-rail .launch-modal-body {
        grid-template-columns: minmax(0, 1fr);
    }

    .launch-modal-rail {
        padding: 0 24px 18px;
    }

    .launch-modal-rail .reusable-grid {
        grid-template-columns: repeat(var(--boosters, 1), minmax(0, 1fr));
    }

    .launch-modal-rail .reusable-grid > .reusable-entry,
    .launch-modal-rail .reusable-grid--3 > .reusable-entry:nth-child(n + 2) {
        grid-column: auto;
    }

    .launch-modal-rail .reusable-grid > .reusable-entry + .reusable-entry {
        margin-top: 0;
        padding-top: 0;
        border-top: none;
        padding-left: 12px;
        border-left: 1px dashed rgba(124, 196, 255, .2);
    }
}

/* ==========================================================
   WIDER POPUP
   ========================================================== */

/* popup without the reusability rail (most launches) */
.launch-details-modal {
    width: min(1280px, 96vw);
    max-width: min(1280px, 96vw);
}

/* popup with the reusability rail (Falcon 9, FH, Starship…) */
.launch-details-modal.has-rail {
    width: min(1640px, 97vw);
    max-width: min(1640px, 97vw);
}

/* give the rail a little more room too */
.has-rail .launch-modal-body {
    grid-template-columns: minmax(0, 1fr) 380px;
}

/* No catalogued objects: muted grey badge with a tooltip */
.orbit-status--uncatalogued {
    color: #8a9bb0;
    border-color: rgba(138, 155, 176, .35);
    background: rgba(138, 155, 176, .07);
    border-style: dashed;
    cursor: help;
}

/* Ground-track legend under the map */
.orbit-map-note { flex-wrap: wrap; row-gap: 6px; }

.orbit-legend-title {
    color: #cfe3f7;
    font-weight: 600;
    margin-right: 6px;
}

.orbit-legend {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px 16px;
}

.orbit-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.orbit-legend-swatch {
    display: inline-block;
    width: 18px;
    height: 3px;
    border-radius: 2px;
}

.orbit-legend-swatch--past    { background: rgba(62, 166, 255, .55); }
.orbit-legend-swatch--current { background: #50ffa0; box-shadow: 0 0 6px rgba(80, 255, 160, .7); }
.orbit-legend-swatch--next    { background: #ff9f43; box-shadow: 0 0 5px rgba(255, 159, 67, .6); }
.orbit-legend-swatch--approx  { background: #3EA6FF; box-shadow: 0 0 5px rgba(62, 166, 255, .6); }

.orbit-legend-swatch--site {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #FFC600;
    box-shadow: 0 0 6px rgba(255, 198, 0, .8);
}

/* Data credit under the map: same look as the legend line */
.orbit-credit {
    margin-top: 6px;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: .7rem;
    line-height: 1.4;
    color: #5f7590;
}

.orbit-credit a {
    color: #7cc4ff;
    text-decoration: none;
}

.orbit-credit a:hover {
    text-decoration: underline;
}

/* =============================================================================
   TABS ABOVE BOTH COLUMNS: rail lines up with the cards
============================================================================= */

.launch-modal-body {
    grid-template-rows: auto 1fr;
}

.launch-modal-main {
    display: contents;          /* tabs and panes become direct grid items */
}

.launch-modal-tabs   { grid-column: 1; grid-row: 1; }
.launch-modal-panes  { grid-column: 1; grid-row: 2; min-width: 0; }

.has-rail .launch-modal-tabs { grid-column: 1 / -1; }

.launch-modal-rail {
    grid-column: 2;
    grid-row: 2;
    padding-top: 18px;          /* same as the panes, so the card tops line up */
}

@media (max-width: 1250px) {
    .has-rail .launch-modal-rail {
        grid-column: 1;
        grid-row: 3;
        padding: 0 24px 18px;
    }
}

/* =============================================================================
   ORBIT: "AT A GLANCE" card under the map
============================================================================= */

.orbit-layout {
    align-items: stretch;
}

.orbit-left {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

.orbit-left > .orbit-map-card {
    flex: none;
    min-height: 0;
}

.orbit-glance {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.orbit-glance-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    align-content: center;
    margin-top: 14px;
}

.orbit-glance-tile {
    padding: 12px 12px 10px;
    border: 1px solid rgba(124, 196, 255, .12);
    border-radius: 7px;
    background: rgba(124, 196, 255, .04);
    min-width: 0;
}

.orbit-glance-tile span {
    display: block;
    font-size: .6rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #8fa6c2;
}

.orbit-glance-tile strong {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: .95rem;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.orbit-glance-tile em {
    display: block;
    margin-top: 3px;
    font-size: .64rem;
    font-style: normal;
    color: #5f7590;
}

.orbit-glance-tile strong .bi-sun-fill        { color: #FFC600; }
.orbit-glance-tile strong.is-shadow           { color: #9fb3c8; }
.orbit-glance-tile strong.is-shadow .bi       { color: #7c8cff; }

@media (max-width: 900px) {
    .orbit-glance-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}