/* Lift the desktop card below the header and clear the expanded destination tray. */
.object-introduction { display:contents; }

/* Deep stellar systems keep their return row in place when a title wraps. */
@media (min-width:761px) and (min-height:501px) {
  body.fixed-object-intro:not(.mobile-workspace):not(.guide-active) .object-info {
    display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) 36px;
    gap:20px;bottom:195px;max-height:370px;
  }
  body.fixed-object-intro:not(.mobile-workspace) .object-introduction {
    display:block;grid-row:1;min-height:0;overflow-x:hidden;overflow-y:auto;
    overscroll-behavior-y:contain;scrollbar-width:thin;scrollbar-color:#456373 transparent;
    scrollbar-gutter:stable;padding-right:5px;
  }
  body.fixed-object-intro:not(.mobile-workspace) .object-introduction:focus-visible {
    outline:1px solid #93c8eb66;outline-offset:3px;border-radius:4px;
  }
  body.fixed-object-intro:not(.mobile-workspace) .object-description { margin-bottom:0; }
  body.fixed-object-intro:not(.mobile-workspace) .object-info>.object-navigation {grid-row:2;align-self:start;margin:0;}
}
@media (min-width:761px) and (max-width:1100px) and (min-height:501px) {
  body.fixed-object-intro:not(.mobile-workspace):not(.guide-active) .object-info {bottom:235px;}
}

/* Deep-sky detail pages keep one action baseline as names and copy change. */
@media (min-width:761px) and (min-height:501px) {
  body:not(.mobile-workspace):not(.guide-active):is([data-scene-kind="nebula"],[data-scene-kind="cluster"]) .object-info {
    display:grid;
    grid-template-columns:minmax(0,1fr);
    grid-template-rows:minmax(0,1fr) 36px;
    gap:20px;
    bottom:195px;
    max-height:322px;
  }
  body:not(.mobile-workspace):not(.guide-active):is([data-scene-kind="nebula"],[data-scene-kind="cluster"]) .object-introduction {
    display:block;
    grid-row:1;
    min-height:0;
    overflow-x:hidden;
    overflow-y:auto;
    overscroll-behavior-y:contain;
    scrollbar-width:thin;
    scrollbar-color:#456373 transparent;
    scrollbar-gutter:stable;
    padding-right:5px;
  }
  body:not(.mobile-workspace):not(.guide-active):is([data-scene-kind="nebula"],[data-scene-kind="cluster"]) .object-introduction:focus-visible {
    outline:1px solid #93c8eb66;
    outline-offset:3px;
    border-radius:4px;
  }
  body:not(.mobile-workspace):not(.guide-active):is([data-scene-kind="nebula"],[data-scene-kind="cluster"]) .object-info h1 {min-block-size:2lh;}
  body:not(.mobile-workspace):not(.guide-active):is([data-scene-kind="nebula"],[data-scene-kind="cluster"]) .object-english {min-block-size:1lh;}
  body:not(.mobile-workspace):not(.guide-active):is([data-scene-kind="nebula"],[data-scene-kind="cluster"]) .object-description {margin-bottom:0;}
  body:not(.mobile-workspace):not(.guide-active):is([data-scene-kind="nebula"],[data-scene-kind="cluster"]) .object-info > .object-navigation {
    grid-row:2;
    align-self:start;
    margin:0;
  }
}
@media (min-width:761px) and (max-width:1549px) and (min-height:501px) {
  body:not(.mobile-workspace):not(.guide-active):is([data-scene-kind="nebula"],[data-scene-kind="cluster"]) .object-info {max-height:340px;}
  body:not(.mobile-workspace):not(.guide-active):is([data-scene-kind="nebula"],[data-scene-kind="cluster"]) .object-english {min-block-size:2lh;}
}
@media (min-width:761px) and (max-width:1150px) and (min-height:501px) {
  body:not(.mobile-workspace):not(.guide-active):is([data-scene-kind="nebula"],[data-scene-kind="cluster"]) .object-info {max-height:370px;}
}
@media (min-width:761px) and (max-width:1100px) and (min-height:501px) {
  body:not(.mobile-workspace):not(.guide-active):is([data-scene-kind="nebula"],[data-scene-kind="cluster"]) .object-info {bottom:235px;}
}

/* Keep Solar System return buttons aligned as body descriptions change.
   A minimum leaves longer copy readable and does not affect phone sheets. */
@media (min-width:761px) and (min-height:501px) {
  body.solar-navigation-active:not(.solar-near-orbit):is([data-scene-kind="planet"],[data-scene-kind="satellite"],[data-destination="sun"]) .object-description {
    min-block-size:3lh;
  }
}
@media (min-width:761px) and (max-width:1150px) and (min-height:501px) {
  body.solar-navigation-active:not(.solar-near-orbit):is([data-scene-kind="planet"],[data-scene-kind="satellite"],[data-destination="sun"]) .object-description {
    min-block-size:4lh;
  }
}
/* Short desktop windows keep the same action row and scroll the introduction. */
@media (min-width:761px) and (min-height:501px) and (max-height:740px) {
  body.solar-navigation-active:not(.solar-near-orbit):is([data-scene-kind="planet"],[data-scene-kind="satellite"],[data-destination="sun"]):not(.mobile-workspace) .object-introduction {
    display:block;
    block-size:clamp(80px,calc(100dvh - 610px),130px);
    overflow-y:auto;
    overflow-x:hidden;
    overscroll-behavior-y:contain;
    scrollbar-width:thin;
    scrollbar-color:#456373 transparent;
    scrollbar-gutter:stable;
    padding-right:5px;
  }
  body.solar-navigation-active:not(.solar-near-orbit):is([data-scene-kind="planet"],[data-scene-kind="satellite"],[data-destination="sun"]):not(.mobile-workspace) .object-info h1 {font-size:32px;line-height:1.2;margin:8px 0;}
  body.solar-navigation-active:not(.solar-near-orbit):is([data-scene-kind="planet"],[data-scene-kind="satellite"],[data-destination="sun"]):not(.mobile-workspace) .object-english {font-size:9px;letter-spacing:3px;margin-bottom:12px;}
  body.solar-navigation-active:not(.solar-near-orbit):is([data-scene-kind="planet"],[data-scene-kind="satellite"],[data-destination="sun"]):not(.mobile-workspace) .object-description {min-block-size:0;}
  body.solar-navigation-active:not(.solar-near-orbit):is([data-scene-kind="planet"],[data-scene-kind="satellite"],[data-destination="sun"]):not(.mobile-workspace) .object-navigation {margin-top:10px;}
}

/* All spacecraft share fixed action rows; only their introduction scrolls.
   Reserve the model-control row even for craft without deployment controls. */
@media (min-width:761px) {
  body[data-scene-kind="craft"]:not(.guide-active) .object-info {
    display:grid;
    grid-template-columns:minmax(0,1fr);
    grid-template-rows:minmax(0,1fr) 79px 132px;
    gap:16px;
    bottom:170px;
    max-height:570px;
  }
  body[data-scene-kind="craft"] .object-introduction {
    display:block;
    grid-row:1;
    min-height:0;
    overflow-x:hidden;
    overflow-y:auto;
    overscroll-behavior-y:contain;
    scrollbar-width:thin;
    scrollbar-color:#456373 transparent;
    scrollbar-gutter:stable;
    padding-right:5px;
  }
  body[data-scene-kind="craft"] .object-introduction:focus-visible {
    outline:1px solid #93c8eb66;
    outline-offset:3px;
    border-radius:4px;
  }
  body[data-scene-kind="craft"] .object-introduction .object-description { margin-bottom:0; }
  body[data-scene-kind="craft"] .object-info > #earth-actions { display:none; }
  body[data-scene-kind="craft"] .object-info > .object-navigation {
    grid-row:2;
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    grid-template-rows:repeat(2,minmax(0,1fr));
    gap:7px;
    margin:0;
  }
  body[data-scene-kind="craft"] .object-navigation button {
    min-width:0;
    padding:7px 5px;
    white-space:nowrap;
  }
  body[data-scene-kind="craft"] .object-info > .special-controls {
    grid-row:3;
    min-height:0;
    margin:0;
    overflow-y:auto;
    overscroll-behavior-y:contain;
    scrollbar-width:thin;
    scrollbar-color:#456373 transparent;
  }
}
@media (min-width:761px) and (max-width:1100px) {
  body[data-scene-kind="craft"]:not(.guide-active) .object-info { bottom:210px; }
}
@media (min-width:761px) and (max-height:800px) {
  body[data-scene-kind="craft"]:not(.guide-active) .object-info {
    grid-template-rows:minmax(0,1fr) 67px 100px;
    gap:12px;
  }
}
@media (min-width:761px) and (max-height:600px) {
  body[data-scene-kind="craft"]:not(.guide-active) .object-info {
    grid-template-rows:minmax(0,1fr) 61px 50px;
    gap:8px;
  }
}

@media (min-width: 761px) and (min-height: 601px) {
  body .explorer .facts-panel { top: 0; }
  body .explorer .facts-panel:not(.collapsed) {
    max-height: calc(100dvh - var(--header-height) - 250px - env(safe-area-inset-bottom, 0px));
  }
}
/* The destination tray has a second heading row on smaller desktop screens. */
@media (min-width: 761px) and (max-width: 1100px) and (min-height: 601px) {
  body .explorer .facts-panel:not(.collapsed) {
    max-height: calc(100dvh - var(--header-height) - 290px - env(safe-area-inset-bottom, 0px));
  }
}

/* One reading edge for desktop introductions and their return navigation. */
@media (min-width: 761px) and (min-height: 501px) {
  body { --explorer-gutter: 40px; }
  body .explorer .cosmic-breadcrumb { left: var(--explorer-gutter); }
  body .explorer .object-info { left: var(--explorer-gutter); }
  body .constellation-hero { left: var(--explorer-gutter); }
}
@media (min-width: 761px) and (max-width: 1150px) and (min-height: 501px) {
  body { --explorer-gutter: 35px; }
}
@media (min-width: 761px) and (max-width: 1100px) and (min-height: 501px) {
  body { --explorer-gutter: 22px; }
}
@media (min-width: 761px) and (min-height: 501px) and (max-height: 600px) {
  body { --explorer-gutter: 22px; }
}

/* Lift tall-screen introductions; compact layouts already sit below the nav. */
@media (min-width: 761px) and (min-height: 801px) {
  body .explorer .object-info { top: calc(17% - 28px); }
  body .constellation-hero { top: calc(25% - 28px); }
}
@media (min-width: 1550px) and (min-height: 801px) {
  body .explorer .object-info { top: calc(20% - 28px); }
}
@media (min-width: 761px) and (max-width: 1150px) and (min-height: 801px) {
  body .explorer .object-info { top: calc(15% - 20px); }
}

.guide-lesson-heading {display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:10px;}
.guide-lesson-heading .guide-kicker {margin:0;line-height:1.6;}
.guide-lesson-toggle {display:flex;align-items:center;gap:7px;flex-shrink:0;min-height:32px;padding:6px 10px;border:1px solid #9dcce633;border-radius:6px;background:#16314466;color:#bcdce9;font-size:11px;}
.guide-lesson-toggle:hover {background:#2d566c80;color:#e1f6ff;}
.guide-lesson-toggle svg {width:12px;height:12px;transform:rotate(90deg);}
.guide-lesson-toggle[aria-expanded="false"] svg {transform:rotate(-90deg);}
.guide-lesson.is-collapsed {width:min(420px,calc(100vw - 36px));padding:12px 18px;max-height:none;overflow:visible;}
.guide-lesson.is-collapsed .guide-lesson-heading {margin-bottom:0;}
/* Tighten the expanded lesson's upper spacing without changing its controls. */
@media (min-width:761px) and (min-height:501px) {
  .guide-lesson:not(.is-collapsed) {padding-top:14px;}
  .guide-lesson:not(.is-collapsed) .guide-lesson-heading {margin-bottom:6px;}
}
@media(max-width:760px) {
  .guide-lesson-heading {gap:10px;margin-bottom:8px;}
  .guide-lesson-toggle {min-height:32px;font-size:10px;padding:6px 9px;}
  .guide-lesson.is-collapsed {left:50%;right:auto;transform:translateX(-50%);}
}

/* Keep the lesson, chapter navigation and 3D subject on one page axis. */
@media (min-width: 761px) and (min-height: 501px) {
  .guide-lesson,.guide-navigation { left:50%; }
}
/* A horizontal chapter rail leaves centered lessons clear on narrow screens. */
@media (min-width:761px) and (max-width:1150px), (max-height:500px) and (orientation:landscape) {
  .guide-chapters {left:20px;right:20px;top:96px;width:auto;display:flex;align-items:center;gap:6px;padding:3px 0 10px;overflow-x:auto;scrollbar-width:thin;scrollbar-color:#456373 transparent;}
  .guide-rail-heading,.guide-rail-note {display:none;}
  .guide-chapters>button {width:auto;flex:0 0 auto;gap:7px;min-height:35px;margin:0;padding:8px 11px;font-size:10px;white-space:nowrap;}
  .guide-chapters>button svg {display:none;}
}
@media (max-height:500px) and (orientation:landscape) {
  .guide-chapters {top:62px;}
  .guide-lesson,.guide-navigation {left:50%;right:auto;transform:translateX(-50%);width:min(650px,calc(100vw - 48px));max-width:none;}
}

/* Reserve the footer below the vertical chapter rail, including its reading note. */
@media (min-width:1151px) and (min-height:501px) {
  .guide-chapters {
    top:clamp(132px,18dvh,220px);
    bottom:112px;
    max-height:none;
    overflow-x:hidden;
    overflow-y:auto;
    overscroll-behavior-y:contain;
    padding:0 6px 12px 0;
    scroll-padding-block:12px;
  }
  .guide-rail-heading {margin-bottom:20px;}
  .guide-chapters>button {min-height:clamp(40px,5dvh,58px);margin:4px 0;padding:10px 14px;font-size:13px;}
  .guide-chapters>button .chapter-number {font-size:11px;}
  .guide-rail-note {margin:18px 8px 0;font-size:12px;line-height:1.7;color:#9bb8c9;}
}

/* Larger, brighter status text shares a fixed baseline across desktop scenes. */
@media (min-width:761px) and (min-height:501px) {
  .control-footer {--footer-gutter:40px;}
  body .control-footer .scene-disclaimer {
    position:absolute;left:var(--footer-gutter);bottom:58px;transform:none;
    font-size:12px;line-height:18px;letter-spacing:.5px;color:#a6bfd0;
  }
  .control-footer .scale-readout {position:absolute;left:var(--footer-gutter);bottom:12px;gap:10px;}
  .control-footer .scale-readout>div {gap:3px;min-width:0;max-width:calc(50vw - 200px);}
  .control-footer .scale-readout #scale-label {font-size:13px;line-height:20px;letter-spacing:.6px;color:#d0e1ea;}
  body .control-footer .scale-readout #distance-label {font-size:12px;line-height:18px;letter-spacing:.2px;color:#a0bacb;}
  .control-footer .scale-readout :is(#scale-label,#distance-label) {white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
  .control-footer .footer-actions {margin-left:auto;gap:9px;}
  .control-footer .gesture-hint {font-size:12px;line-height:1.6;letter-spacing:.2px;color:#a6bfd0;margin-right:5px;}
  .control-footer .gesture-hint svg {width:15px;height:15px;}
  .control-footer .quality-select {max-width:118px;min-height:34px;font-size:12px;line-height:1.5;padding:6px 9px;color:#c4dce9;}
}
@media (min-width:1550px) and (min-height:501px) {
  .control-footer {--footer-gutter:50px;}
}
@media (min-width:761px) and (max-width:1150px) and (min-height:501px) {
  .control-footer {--footer-gutter:30px;}
  body .control-footer .scale-readout #distance-label {font-size:11px;}
}

/* On phones the footer uses two rows, keeping enlarged utility text clear of playback. */
@media (max-width:760px) and (orientation:portrait) {
  body .control-footer .playback-controls {position:absolute;left:50%;bottom:calc(36px + env(safe-area-inset-bottom,0px));transform:translateX(-50%);}
  body .control-footer .scene-disclaimer {position:absolute;left:12px;bottom:calc(10px + env(safe-area-inset-bottom,0px));transform:none;font-size:10px;line-height:16px;letter-spacing:.2px;color:#a6bfd0;}
  body .control-footer .footer-actions {position:absolute;right:12px;bottom:calc(4px + env(safe-area-inset-bottom,0px));margin:0;gap:6px;}
  .control-footer .quality-select {max-width:102px;min-height:28px;font-size:11px;padding:4px 6px;color:#c4dce9;}
  .guide-navigation {bottom:calc(91px + env(safe-area-inset-bottom,0px));}
  .guide-lesson {bottom:calc(146px + env(safe-area-inset-bottom,0px));max-height:calc(100dvh - 355px - env(safe-area-inset-bottom,0px));}
}
@media (max-width:760px) and (max-height:700px) and (orientation:portrait) {
  .guide-navigation {bottom:calc(84px + env(safe-area-inset-bottom,0px));}
  .guide-lesson {bottom:calc(136px + env(safe-area-inset-bottom,0px));max-height:calc(100dvh - 295px - env(safe-area-inset-bottom,0px));}
}

/* Source attribution is reading content; full local credits expand in this dialog. */
.source-copy .source-attribution {color:#b9d7e5;text-decoration:none;cursor:text;}
.source-credits {margin-top:20px;padding-top:16px;border-top:1px solid var(--line);}
.source-credits summary {color:#c2deeb;font-size:13px;line-height:1.7;cursor:pointer;}
.source-credits pre {margin:12px 0 0;padding:14px;border-radius:8px;background:rgba(4,15,27,.45);color:#a9c4d3;font-family:inherit;font-size:12px;line-height:1.8;white-space:pre-wrap;overflow-wrap:anywhere;}
