/* The landing scene always uses the visible viewport, even when the UI needs to scroll. */
@media (max-width: 740px) {
  body[data-view="home"] #arrival-scene {
    position: fixed;
    inset: 0;
    height: 100dvh;
  }

  body[data-view="home"] .experience-tools {
    position: fixed;
    inset: auto max(12px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) auto;
    display: grid;
    grid-template-columns: repeat(2, 44px);
    gap: 0;
    width: max-content;
    margin: 0;
    border: 1px solid #b5a28c;
    border-radius: 24px;
    background: #202c32;
    box-shadow: 0 2px 8px #0b151a66;
  }

  .experience-tools #motion::after {
    content: '';
    position: absolute;
    inset: 11px auto 11px 0;
    width: 1px;
    background: #b5a28c65;
    pointer-events: none;
  }

  body:not([data-view="home"]) .experience-tools { display: none; }

  .experience-tools :is(#theme-orbit, #motion) {
    position: relative;
    display: grid;
    place-items: center;
    width: 44px;
    min-width: 44px;
    max-width: none;
    height: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0;
    border: 0 !important;
    border-radius: 22px;
    background: transparent !important;
    color: #f4f1e7 !important;
    opacity: 1;
  }

  .experience-tools :is(#theme-orbit, #motion):focus-visible {
    outline: 2px solid #f4e6c6;
    outline-offset: -3px;
  }

  .experience-tools #theme-orbit .theme-caption,
  .experience-tools #motion .motion-word {
    display: none;
  }

  .experience-tools #theme-orbit .theme-astro {
    position: relative;
    inset: auto;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    clip-path: none;
    pointer-events: none;
  }

  .experience-tools #theme-orbit .moon-disc { box-shadow: inset -4px -2px 6px #33494770; }
  .experience-tools #theme-orbit .sun-rays { inset: -4px; }
  .experience-tools #motion > [aria-hidden="true"] {
    order: -1;
    width: 20px;
    height: 20px;
    flex-basis: 20px;
    border-color: #ab9275;
    background: transparent;
  }

}

@media (min-width: 560px) and (max-width: 740px) and (max-height: 499px) {
  body[data-view="home"] .experience-tools {
    inset: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) auto auto;
  }
}

/* Fit the controls and destinations above the visible terrain in portrait. */
@media (max-width: 740px) and (min-height: 500px) {
  html:has(body[data-view="home"]) {
    height: 100%;
    overflow: hidden;
  }

  body[data-view="home"],
  body[data-view="home"] > .app {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  body[data-view="home"] .app > main {
    overflow: hidden !important;
  }

  body[data-view="home"] #hero {
    height: 100%;
    min-height: 0;
    padding: clamp(5px, 2dvh, 20px) 6% 0;
  }

  body[data-view="home"] .intro {
    padding: 0;
    text-align: center;
  }

  body[data-view="home"] #hero-title {
    font-size: clamp(26px, min(8.1vw, 5.2dvh), 44px);
    margin-bottom: clamp(6px, 1.5dvh, 13px);
  }

  body[data-view="home"] .intro .lede {
    max-width: 36ch;
    margin-inline: auto;
    font-size: clamp(13px, 2.1dvh, 15px);
    line-height: 1.45;
  }

  body[data-view="home"] header.scene-header {
    min-height: 0;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: 5px;
  }

  body[data-view="home"] .signature-anchor {
    width: 100%;
    max-width: none;
    margin-top: max(12px, env(safe-area-inset-top));
  }

  body[data-view="home"] .signature-voyage[data-phase="done"] .identity {
    width: 100%;
    max-width: none;
    text-align: center;
  }

  body[data-view="home"] .signature-voyage[data-phase="done"] .identity-signature {
    justify-content: center;
  }

  body[data-view="home"] .signature-voyage[data-phase="done"] .identity-titles {
    text-align: left;
  }

  body[data-view="home"] .signature-voyage[data-phase="done"] :is(.identity-details, .signature-links) {
    margin-left: 0;
  }

  body[data-view="home"] .signature-voyage[data-phase="done"] .signature-links {
    justify-content: center;
  }
  body[data-view="home"] .signature-voyage .signature-links a { min-height: 44px; }

  .signature-voyage .identity-details {
    margin-top: 1px;
  }

  .signature-voyage .signature-links {
    margin-top: 0;
  }

  body[data-view="home"] .professional-worlds {
    position: relative;
    inset: auto;
    width: 100%;
    margin-top: clamp(7px, 2dvh, 24px);
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
    gap: clamp(4px, 2vw, 18px);
  }

  .professional-worlds .projects-link {
    grid-column: auto;
    flex-direction: column;
    gap: 0;
  }

  .professional-worlds .library-figure,
  .professional-worlds .observatory-figure,
  .professional-worlds .projects-figure {
    width: clamp(42px, min(21vw, 10dvh), 95px);
    flex: 0 0 auto;
  }

  .professional-worlds a .observatory-label {
    width: 100%;
    min-width: 0;
    min-height: 0;
    align-items: center;
    gap: 3px;
    text-align: center;
    padding: 0;
  }

  .professional-worlds a .destination-kicker {
    font-size: clamp(14px, 4vw, 19px) !important;
  }

  .professional-worlds a .destination-title {
    white-space: normal;
    line-height: 1.2;
    font-size: clamp(11px, 3vw, 13px) !important;
    margin-top: 2px;
    padding: 4px;
  }

  .professional-worlds a .destination-title > span {
    margin-left: 1px;
  }

  .professional-worlds .destination-action-text:not(.destination-action-short) { display: none; }
  .professional-worlds .destination-action-short { display: inline; overflow-wrap: normal !important; }
  .professional-worlds > .projects-link .destination-title {
    background: #334d4c;
    border-color: #aec6b5;
    color: #fff6e4 !important;
  }

  body[data-view="home"] #wand-trail {
    position: fixed;
    height: 100dvh;
  }
}

@media (max-width: 740px) and (min-height: 700px) {
  body[data-view="home"] .professional-worlds { margin-top: clamp(24px, calc((100dvh - 650px) * .22), 48px); }
}

@media (max-width: 740px) and (min-height: 500px) {
  #personal-world > .personal-caption {
    width: max-content !important;
    max-width: 46vw;
    gap: 2px;
    padding: 5px 8px;
    border-radius: 8px;
    background: #182731ee;
    box-shadow: 0 2px 9px #07111760;
  }

  #personal-world .personal-place { font-size: clamp(13px, 3.6vw, 17px); }
  #personal-world .personal-action { font-size: clamp(11px, 3vw, 13px); }
}

@media (max-width: 740px) and (min-height: 500px) and (max-height: 600px) {
  body[data-view="home"] #hero { padding-top: 5px; }
  body[data-view="home"] .intro .lede { max-width: 36ch; font-size: 12px; margin-bottom: 0; }
  body[data-view="home"] .professional-worlds { margin-top: 5px; }
  .professional-worlds .projects-figure,
  .professional-worlds .library-figure,
  .professional-worlds .observatory-figure { width: clamp(40px, 8dvh, 50px); }

}

@media (max-width: 740px) and (min-height: 500px) {
  .professional-worlds > a .destination-title {
    width: 100%;
    box-sizing: border-box;
    min-height: 36px;
    align-content: center;
    white-space: normal !important;
  }

  .professional-worlds .projects-link .observatory-label { width: 100%; }

}

@media (max-width: 359px) and (min-height: 500px) {
  .professional-worlds > a .destination-title { min-height: 42px; }
  .professional-worlds a .destination-action-text { overflow-wrap: anywhere; }
}
