/* Final small-screen layer. Loaded last so the portfolio remains stable on phones and tablets. */
@media (max-width: 900px) {
  body.modal-open { overflow: hidden; }

  .archive-wall-panel {
    background-color: #e9efed;
    background-position: center top;
    background-repeat: no-repeat;
    background-size: 100% auto;
  }

  .archive-wall-panel::before {
    background:
      repeating-linear-gradient(90deg, transparent 0 24.8%, rgba(91, 111, 104, 0.1) 25%, transparent 25.2%),
      repeating-linear-gradient(0deg, transparent 0 218px, rgba(91, 111, 104, 0.08) 219px, rgba(255, 255, 255, 0.32) 220px, transparent 222px),
      linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(219, 229, 226, 0.16));
    mix-blend-mode: normal;
  }

  .lab-header nav a {
    display: flex;
    min-height: 44px;
    align-items: center;
  }

  .lab-header-actions a,
  .lab-header-actions button,
  .hologram-close {
    min-height: 44px;
  }

  .lab-header-actions .language-button,
  .hologram-close {
    min-width: 44px;
    min-height: 44px;
  }

  .profile-card.is-hologram .holo-contacts a,
  footer a {
    min-height: 44px;
  }

  .modal-backdrop {
    overflow: hidden;
    overscroll-behavior: contain;
  }

  .modal-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  html { scroll-padding-top: 108px; }

  /* Dedicated portrait specimen wall for phones. */
  .archive-wall-panel.panel-green,
  .archive-wall-panel.panel-blue,
  .archive-wall-panel.panel-violet {
    height: clamp(820px, 219vw, 940px);
    background-color: #eef2f0;
    background-image: url('./mobile-specimen-wall-v3.webp');
    background-position: center top;
    background-repeat: no-repeat;
    background-size: auto 100%;
  }

  .archive-wall-panel::before,
  .archive-wall-panel::after {
    border: 0;
    background: none;
    box-shadow: none;
  }

  .archive-readout,
  .archive-bays,
  .archive-ghost-dimmer,
  .archive-graffiti {
    display: none;
  }

  .archive-wall-panel .vacuum-work {
    width: 64% !important;
    height: 15.5% !important;
    margin: 0 !important;
  }

  .archive-wall-panel .vacuum-work.slot-a { left: 18%; top: 12.8%; }
  .archive-wall-panel .vacuum-work.slot-b { left: 18%; top: 30.5%; }
  .archive-wall-panel .vacuum-work.slot-c { left: 18%; top: 48.4%; }
  .archive-wall-panel .vacuum-work.slot-d { left: 18%; top: 66.5%; }

  .lab-header {
    top: max(8px, env(safe-area-inset-top));
    right: 8px;
    left: 8px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
    padding: 6px 7px;
  }

  .lab-header-actions {
    grid-row: 1;
    justify-content: flex-end;
    gap: 5px;
  }

  .lab-header nav {
    grid-row: 2;
    display: grid;
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    overflow: visible;
  }

  .lab-header nav a {
    display: flex;
    min-width: 0;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(7, 16, 24, 0.1);
    background: rgba(255, 255, 255, 0.3);
    font-size: 10px;
    letter-spacing: 0.035em;
  }

  .lab-header-actions a,
  .lab-header-actions button,
  .lab-header-actions .language-button {
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    justify-content: center;
    padding: 0;
  }

  .lab-header-actions svg {
    width: 18px;
    height: 18px;
  }

  .lab-hero {
    min-height: 100svh;
    padding: 138px 14px 94px;
  }

  .lab-hero-copy {
    right: 14px;
    left: 14px;
    max-width: none;
  }

  .lab-hero h1 {
    font-size: clamp(42px, 13vw, 56px);
    line-height: 0.96;
  }

  .lab-actions {
    display: grid;
    width: min(100%, 300px);
    gap: 8px;
  }

  .lab-actions a {
    min-height: 46px;
    justify-content: center;
    padding: 0 15px;
  }

  .lab-hud-corner.is-tl,
  .lab-hud-corner.is-tr { top: 116px; }
  .lab-hud-readout.is-a { top: 130px; }

  .studio {
    height: max(820px, 100svh);
  }

  .studio-heading {
    top: 112px;
    right: 14px;
    left: 14px;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px 10px;
  }

  .studio-heading h2 {
    font-family: Impact, "Arial Black", sans-serif !important;
    font-size: clamp(28px, 8vw, 36px) !important;
    line-height: 1 !important;
    white-space: nowrap;
  }

  .computer-hotspot {
    left: 5%;
    top: 28%;
    width: 58%;
    height: 28%;
    border-color: rgba(184, 255, 0, 0.3);
    background: rgba(184, 255, 0, 0.025);
  }

  .computer-hotspot span {
    bottom: 8px;
    display: flex;
    min-height: 40px;
    align-items: center;
    opacity: 1;
    transform: translateX(-50%);
  }

  .profile-card.is-hologram {
    position: fixed;
    z-index: 55;
    top: calc(max(8px, env(safe-area-inset-top)) + 98px);
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 10px;
    width: auto;
    height: auto;
    max-height: none;
    padding: 22px 18px;
    transform: translateY(18px) scale(0.98);
    transform-origin: center;
    overscroll-behavior: contain;
  }

  .profile-card.is-hologram.is-open { transform: none; }
  .profile-card.is-hologram > span { padding-right: 50px; font-size: 12px; }

  .hologram-close {
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
  }

  .holo-intro {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 14px;
    margin-top: 16px;
  }

  .holo-portrait { width: 82px; height: 104px; }
  .holo-intro small { font-size: 9px; }

  .profile-card.is-hologram h3 {
    font-family: Impact, "Arial Black", sans-serif;
    font-size: 29px;
    line-height: 0.9;
    overflow-wrap: anywhere;
  }

  .profile-card.is-hologram .holo-lead { font-size: 15px; line-height: 1.5; }
  .profile-facts div { grid-template-columns: 74px minmax(0, 1fr); gap: 9px; padding: 10px; }
  .profile-facts dt,
  .profile-facts dd { font-size: 11px; }
  .profile-card.is-hologram .chips i { font-size: 10px; }

  .profile-card.is-hologram .holo-contacts a {
    display: flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    font-size: 11px;
  }

  .modal-backdrop {
    place-items: start center;
    padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
  }

  .modal-shell {
    width: 100%;
    max-height: calc(100svh - 20px);
    overflow: auto;
    overscroll-behavior: contain;
  }

  .modal-media,
  .modal-media video,
  .modal-media img {
    width: 100%;
    min-height: 0;
  }

  .modal-media { aspect-ratio: 16 / 9; }

  .modal-media video,
  .modal-media img {
    display: block;
    height: 100%;
    object-fit: contain;
  }

  .lab-page .modal-copy {
    padding: 24px 18px 32px;
    border-top-width: 2px;
  }

  .lab-page .modal-copy h2 { margin-top: 16px; font-size: 34px; line-height: 1; }
  .lab-page .modal-copy p { font-size: 15px; line-height: 1.55; }
  .lab-page .modal-copy dl { gap: 14px; margin-top: 20px; padding-top: 18px; }
  .lab-page .modal-copy dt { font-size: 11px; }
  .lab-page .modal-copy dd { font-size: 15px; }

  .lab-page .modal-close {
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
  }

  footer {
    height: auto;
    min-height: 190px;
    display: grid;
    grid-template-columns: 1fr;
    align-content: center;
    gap: 14px;
    padding: 28px 18px calc(28px + env(safe-area-inset-bottom));
  }

  footer > span { font-size: 22px; }
  footer small { font-size: 10px; line-height: 1.4; }

  footer a {
    display: flex;
    min-height: 44px;
    align-items: center;
    margin: 0;
    font-size: 11px;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 360px) {
  .lab-header nav a { font-size: 9px; }
  .profile-card.is-hologram { padding-right: 15px; padding-left: 15px; }
  .holo-intro { grid-template-columns: 72px minmax(0, 1fr); }
  .holo-portrait { width: 72px; height: 94px; }
  .profile-card.is-hologram h3 { font-size: 25px; }
}
