/* Phones held sideways (and any screen under 500px tall in landscape). Loaded last.
   Projects keep the desktop treatment, a full-screen photo with the type over it, at a size
   that fits; the studio page drops its photos so the name and contact keep their room; and
   nothing sits under the Dynamic Island, which the landscape safe-area insets cover. */

@media (orientation: landscape) and (max-height: 500px) {
  :root {
    --gutter: 18px;
    --deck-inset: 6px;
    --rail-space: 0px;
    --fs-title: clamp(26px, 10vh, 40px);
    --header-h: 44px;
  }


  .site-header {
    padding: calc(12px + env(safe-area-inset-top)) calc(var(--gutter) + env(safe-area-inset-right)) 12px
      calc(var(--gutter) + env(safe-area-inset-left));
    padding-right: calc(var(--gutter) + env(safe-area-inset-right) + var(--active-k, 0) * var(--peek));
  }

  /* No room for the section rail or the scroll cue: they collided with the captions and the
     studio text. Swiping up and down still moves between sections. */
  .rail,
  .scroll-cue {
    display: none;
  }

  /* ---- Projects ---- */

  /* Photos and type stay clear of the island and the rounded corners on either side; the
     panels' own backgrounds still run edge to edge. */
  .deck-stage {
    left: calc(var(--deck-inset) + env(safe-area-inset-left));
    right: calc(var(--deck-inset) + env(safe-area-inset-right));
  }

  .deck-caption {
    left: calc(var(--gutter) + env(safe-area-inset-left));
  }

  .deck-controls {
    right: calc(var(--gutter) + var(--k) * var(--peek) + env(safe-area-inset-right));
  }

  .deck-kicker {
    margin-bottom: 8px;
  }

  .deck-controls {
    gap: 8px;
  }

  .deck-room {
    display: none;
  }

  .deck-btn {
    width: 34px;
    height: 34px;
  }

  /* ---- Studio page: name across the top, blurb and contact beneath, no photos ---- */

  #studio .studio,
  #contact .studio {
    padding: var(--header-h) calc(var(--gutter) + env(safe-area-inset-right))
      calc(var(--gutter) + env(safe-area-inset-bottom)) calc(var(--gutter) + env(safe-area-inset-left));
    gap: 14px;
  }

  #studio .studio-name,
  #contact .studio-name {
    padding-left: 0 !important; /* left-aligned even when the fitter shrinks it to fit the height */
  }

  #studio .studio-photo-strip,
  #studio .studio-foot,
  #contact .studio-foot {
    display: none;
  }

  #studio .studio-name {
    margin: auto 0 0;
  }

  #studio .studio-grid {
    --strip-height: 0px;
    --strip-space: 0px;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: var(--gutter);
    padding-top: 14px;
    margin-bottom: auto;
  }

  #studio .studio-grid::before {
    top: 0;
  }

  #studio .studio-blurb {
    flex: 1 1 auto;
    max-width: 44ch;
    font-size: 15px;
    line-height: 1.38;
  }

  #studio .studio-contact {
    flex: none;
    row-gap: 8px;
  }

  #studio .studio-email {
    font-size: 16px;
  }

  #studio .studio-social {
    font-size: 14px;
  }

  /* ---- Contact slide: headline on the left at full height, contact details bottom right ---- */

  #contact .studio {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    column-gap: calc(var(--gutter) * 2);
  }

  #contact .studio-name {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    margin: 0;
  }

  /* The pause before "GET IN TOUCH" is set by its margin here, not centred on the divider,
     which now sits in the other column. */
  #contact .contact-cta {
    transform: none;
  }

  #contact .studio-grid {
    grid-column: 2;
    grid-row: 1;
    padding-top: 12px;
    margin-bottom: 4px;
  }

  #contact .studio-contact .studio-email {
    font-size: 16px;
  }
}
