/* Mobile orientation guidance. These rules are opt-in for touch devices only. */
.mobile-orientation-gate {
  display: none;
}

@media screen and (max-width: 620px) and (orientation: portrait) and (pointer: coarse) {
  html,
  body {
    min-height: 100%;
    overflow: hidden !important;
  }

  .mobile-orientation-gate {
    position: fixed;
    z-index: 10000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    background: #f6f4ef;
    color: #292b36;
    touch-action: none;
  }

  .mobile-orientation-card {
    width: min(100%, 420px);
    padding: clamp(22px, 7vw, 32px);
    border: 1px solid #e0ddd7;
    border-radius: 13px;
    background: #fbfaf7;
    box-shadow: 0 16px 40px rgba(35, 37, 42, .07);
  }

  .mobile-orientation-icon {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    margin-bottom: 19px;
    border: 1px solid #e2deeb;
    border-radius: 13px;
    background: #f2f0f7;
    color: #5e5988;
  }

  .mobile-orientation-icon svg {
    width: 27px;
    height: 27px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.55;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .mobile-orientation-label {
    margin-bottom: 8px;
    color: #5e5988;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .08em;
  }

  .mobile-orientation-card h2 {
    color: #292b36;
    font-size: 22px;
    line-height: 1.45;
  }

  .mobile-orientation-card > p:not(.mobile-orientation-label) {
    margin-top: 9px;
    color: #6d7180;
    font-size: 14px;
    line-height: 1.8;
  }

  .mobile-orientation-divider {
    height: 1px;
    margin: 19px 0 13px;
    background: #e5e2dc;
  }

  .mobile-orientation-card small {
    color: #87858e;
    font-size: 11px;
    line-height: 1.65;
  }
}

/* The analysis page keeps its existing 844px landscape responsive layout.
   For the architecture page, show the same desktop reference artwork used by
   the landscape preview, fitted to the phone width. */
@media screen and (max-width: 900px) and (orientation: landscape) and (pointer: coarse) {
  body:has(#architecture.active) {
    overflow-x: hidden !important;
  }

  body:has(#architecture.active) .nav {
    box-shadow: none !important;
  }

  body:has(#architecture.active) .nav-inner {
    max-width: none !important;
    min-height: clamp(42px, 6vw, 72px) !important;
    padding-inline: min(4vw, 48px) !important;
    gap: 2.5vw !important;
  }

  body:has(#architecture.active) .nav .logo .brand-logo-image {
    width: clamp(78px, 12.1667vw, 146px) !important;
  }

  body:has(#architecture.active) .nav-links {
    gap: min(2.0833vw, 25px) !important;
  }

  body:has(#architecture.active) .nav-links a {
    font-size: clamp(8px, 1.1667vw, 14px) !important;
  }

  #architecture.active {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: var(--bg) !important;
  }

  #architecture .arch-reference-poster {
    position: relative !important;
    display: block !important;
    width: min(100%, 1322px) !important;
    height: auto !important;
    margin: 0 auto !important;
    object-fit: contain;
    pointer-events: none !important;
  }

  #architecture .arch-detail-reference {
    display: block !important;
    width: min(100%, 1322px) !important;
    height: auto !important;
    margin: 2.6667vw auto 0 !important;
    pointer-events: none !important;
  }

  #architecture > .arch-page-heading,
  #architecture > .arch-board,
  #architecture > .arch-real-trace,
  #architecture > .arch-stack {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 1px !important;
    height: 1px !important;
    max-width: 1px !important;
    max-height: 1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
}
