/* Mobile refinements are deliberately isolated from the approved desktop design.
 * Keep these rules after assets/styles.css and theme-overrides.css on the site
 * and inside the visual editor. No content or saved block structure changes.
 */
@media screen and (max-width: 1050px) {
  .academy-opening {
    /* svh keeps the composition stable while mobile browser chrome retracts. */
    height: calc(100vh - 105px);
    height: calc(100svh - 105px);
    max-height: 1050px;
    min-height: 420px;
  }

  .academy-opening__frame {
    margin-top: clamp(28px, 6vh, 64px);
    margin-top: clamp(28px, 6svh, 64px);
    padding-block: 40px 32px;
  }

  .academy-opening__apply {
    /* A separate lower row is reserved for the video control. */
    bottom: 82px;
  }

  .motion-control {
    min-width: 44px;
    min-height: 44px;
    bottom: 16px;
    right: 16px;
    padding: 10px 14px;
    font-size: 11px;
  }

  .masthead__link {
    min-height: 44px;
    min-width: 44px;
    font-size: 12px;
    justify-content: center;
  }

  .invitation__heading a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding-block: 10px;
    font-size: 12px;
    line-height: 1.5;
    letter-spacing: .06em;
  }

  .founder__heading > a {
    display: inline-block;
    max-width: 100%;
    min-height: 44px;
    padding-block: 10px;
    font-size: 13px;
    line-height: 1.7;
  }

  .site-footer {
    align-items: center;
    flex-wrap: wrap;
    column-gap: 20px;
    row-gap: 4px;
    font-size: 11px;
    line-height: 1.6;
  }

  .site-footer > a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding-block: 10px;
  }

  .invitation__selection {
    font-size: 13px;
    line-height: 1.85;
  }

  .invitation__limited,
  .experience__note {
    font-size: 11px;
  }
}

@media screen and (max-width: 719px) {
  /* Two compact cards per row, with room for the full reverse-side text. */
  .faculties__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 24px 12px 30px;
  }

  .faculty {
    min-height: 0;
    height: 280px;
    max-width: none;
  }

  .faculty__front,
  .faculty__back {
    padding: 20px 10px 42px;
  }

  .faculty__title {
    font-size: clamp(15px, 4vw, 21px);
    line-height: 1.3;
    margin-top: -10px;
  }

  .faculty__back {
    font-size: clamp(13px, 3.4vw, 15px);
    line-height: 1.55;
    gap: 10px;
  }

  .faculty__back-title {
    font-size: clamp(13px, 3.4vw, 17px);
    line-height: 1.3;
  }

  .faculty__rule {
    width: 28px;
    margin-top: 16px;
  }

  .faculty__prompt,
  .faculty__return {
    bottom: 16px;
    font-size: 11px;
    letter-spacing: .06em;
  }

  .faculty__front::before,
  .faculty__back::before,
  .faculty__front::after,
  .faculty__back::after {
    width: 14px;
    height: 14px;
  }

  .faculty__front::before,
  .faculty__back::before { top: 10px; left: 10px; }

  .faculty__front::after,
  .faculty__back::after { bottom: 10px; right: 10px; }

  .masthead__link {
    font-size: 11px;
  }

  .academy-opening {
    height: calc(100vh - 88px);
    height: calc(100svh - 88px);
    min-height: 350px;
    max-height: 900px;
  }

  .academy-opening__frame {
    margin-top: clamp(24px, 5vh, 42px);
    margin-top: clamp(24px, 5svh, 42px);
    padding-block: clamp(26px, 4vh, 37px) clamp(22px, 3vh, 29px);
    padding-block: clamp(26px, 4svh, 37px) clamp(22px, 3svh, 29px);
  }

  .academy-opening__apply {
    bottom: 82px;
  }

  .motion-control {
    bottom: 14px;
  }

  /* Keep the date on the envelope. The priority link gets its own 44px
   * touch row beneath it, rather than competing with the seal at 320px.
   * The explicit margin reserves space in normal flow for that lower row.
   */
  .invitation__visual {
    margin-bottom: 64px;
  }

  .invitation__heading {
    top: 20%;
    bottom: -52px;
  }

  .invitation__heading h2 {
    font-size: 11px;
    line-height: 1.4;
    letter-spacing: .1em;
    margin-bottom: 6px;
  }

  .invitation__date {
    font-size: clamp(28px, 7vw, 46px);
  }

  .invitation__heading a {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: max-content;
    max-width: 100%;
    margin: 0;
  }

  .invitation__limited {
    letter-spacing: .16em;
  }

  .experience__note {
    letter-spacing: .08em;
  }

  .site-footer {
    padding-block: 18px;
  }
}

/* Phones held sideways need a shallow composition, not a portrait-sized hero.
 * The two controls occupy separate columns instead of overlapping the picture.
 */
@media screen and (max-width: 359px) {
  .masthead {
    padding-inline: 16px;
    grid-template-columns: 45px minmax(0, 1fr) auto;
    column-gap: 10px;
  }
  .masthead__wordmark { font-size: 26px; justify-self: center; }
  .masthead__link { white-space: nowrap; }
}

@media screen and (max-width: 1050px) and (max-height: 500px) and (orientation: landscape) {
  .masthead {
    height: 64px;
    padding-block: 6px;
  }

  .monogram {
    width: 44px;
  }

  .masthead__wordmark {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 44px;
    font-size: 23px;
  }

  .academy-opening {
    height: calc(100vh - 64px);
    height: calc(100svh - 64px);
    min-height: 235px;
  }

  .academy-opening__frame {
    width: min(76%, 560px);
    margin-top: 18px;
    padding: 20px 14px 17px;
  }

  .academy-name {
    font-size: clamp(34px, 5.7vw, 51px);
  }

  .academy-name__last {
    font-size: clamp(35px, 5.2vw, 48px);
    margin-top: 4px;
  }

  .academy-opening__apply {
    left: 32%;
    bottom: 18px;
    min-width: 176px;
    min-height: 44px;
    padding-block: 10px;
    font-size: 14px;
  }

  .motion-control {
    right: 16px;
    bottom: 18px;
  }
}
