/*
 * Wide-screen mobile layout for Gridiron Convergence.
 * A phone turned sideways should use its horizontal space as a game canvas,
 * rather than keep the desktop navigation rail and squeeze the content.
 * Portrait and full-size desktop layouts are deliberately unchanged.
 */
@media (orientation: landscape) and (max-width: 1200px) {
  html, body { max-width: 100%; }

  /* Make navigation a compact, independently scrollable game menu. */
  .workspace,
  .experience-page .workspace,
  body[data-route="home"] .workspace {
    display: block;
    width: 100%;
    max-width: none;
    margin-inline: 0;
  }

  .workspace > .sidebar,
  body[data-route="home"] .workspace > .sidebar,
  .experience-page .workspace > .sidebar {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 0;
    padding: 6px clamp(12px, 2vw, 26px);
    margin: 0;
    border-right: 0;
    border-bottom: 1px solid #476476;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: #4a8da3 #091620;
  }
  /* Broadcast themes re-show their section captions; omit them in landscape. */
  .workspace .sidebar .nav-label,
  .workspace .sidebar .sidebar-note { display: none; }
  .workspace .sidebar .nav-label { display: none !important; }
  .workspace .sidebar nav,
  body[data-route="home"] .sidebar nav {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 5px;
    margin: 0;
  }
  /* Short separator between PLAY and YOUR FRANCHISE link groups. */
  .workspace .sidebar nav[aria-label="Franchise sections"]::before {
    content: "";
    display: block;
    align-self: center;
    width: 2px;
    height: 27px;
    flex: 0 0 2px;
    margin: 0 9px 0 3px;
    background: linear-gradient(#365c70, #87c0d5 50%, #365c70);
    border-radius: 2px;
  }
  .workspace .sidebar nav a,
  body[data-route="home"] .sidebar nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    gap: 7px;
    min-height: 43px;
    padding: 9px 12px;
    border: 1px solid transparent;
    border-radius: 7px;
    clip-path: none;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
  }
  .workspace .sidebar nav a.active,
  body[data-route="home"] .sidebar nav a.active { border-color: #4d879b; }
  .workspace .sidebar nav .legacy-nav-icon { display: none; }
  .workspace .sidebar nav svg,
  body[data-route="home"] .sidebar nav svg {
    display: inline-block;
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
  }
  .workspace .sidebar nav a small { display: none; }

  /* Widen all modes, cards, franchise, Cup and match-center screens. */
  .workspace > main,
  .experience-page .workspace > main {
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    min-width: 0;
    padding: 22px clamp(16px, 2.5vw, 32px) 48px;
  }
  body[data-route="home"] .workspace > #content { padding: 0 0 28px; }
  .workspace .panel { padding: clamp(16px, 2.1vw, 28px); }

  .topbar,
  .experience-page header.topbar {
    height: auto;
    min-height: 65px;
    padding: 8px clamp(14px, 2.2vw, 28px);
    gap: 10px 17px;
    flex-wrap: wrap;
  }
  .topbar .brand,
  .experience-page .topbar .brand,
  body[data-route="home"] .topbar .brand {
    width: clamp(165px, 22vw, 210px);
    max-width: 38vw;
  }
  .topbar .brand img { max-height: 50px; }
  .topbar .preview-label,
  body[data-route="home"] .broadcast-network { display: none; }
  .topbar .working-link { width: auto; margin-left: auto; font-size: 11px; }
  .topbar .working-link + .working-link { margin-left: 0; }

  /* Never reduce the game-navigation tabs to tiny columns in landscape. */
  .experience-page .game-tabs,
  .game-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    padding: 6px;
  }
  .experience-page .game-tabs button,
  .game-tabs button {
    flex: 1 0 116px;
    min-width: 116px;
    padding: 11px 10px;
    white-space: normal;
  }

  /* Lab opponent choices benefit from the width instead of shrunk tiles. */
  .op-choice-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 11px; }
  .op-choice { min-height: 169px; padding: 11px; }
  .op-choice b { font-size: clamp(18px, 2.4vw, 25px); }
  .op-choice em { font-size: 10px; }
  .op-build-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  /* Both the Lab and Road to the Cup use this field/inspector builder. */
  .lf-workspace { padding: clamp(13px, 1.8vw, 21px); }
  .lf-head { min-height: 104px; flex-wrap: nowrap; gap: 15px; }
  .lf-head h2 { font-size: clamp(28px, 3.4vw, 39px); }
  .lf-head p { display: block; }
  .lf-point-group { width: auto; gap: 10px; }
  .lf-point-group > div:last-child { min-width: 112px; }
  .lf-meter { width: 91px; height: 91px; padding: 8px; }
  .lf-meter strong { font-size: 31px; }
  .lf-meter small { font-size: 8px; }
  .lf-toolbar { flex-direction: row; align-items: end; }
  .lf-toolbar > label { min-width: 170px; max-width: 320px; }
  .lf-grid { grid-template-columns: minmax(0, 1fr) 238px; gap: 13px; }
  .lf-field { height: 492px; }
  .lf-inspector { min-width: 0; }
  .lf-elevate-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lf-elevate-four { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Use lateral space for the main navigation and mode cards as well. */
  .mode-grid, .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { grid-template-columns: minmax(0, 1fr) 150px; }
  .tendencies .split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cup-deck-review-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .identity-layout { grid-template-columns: minmax(0, 1.15fr) minmax(230px, .85fr); }

  /* Keep the home hero wide and cinematic, rather than inset by a side rail. */
  .broadcast-hero {
    min-height: clamp(360px, 47vw, 520px);
    padding-inline: clamp(20px, 4vw, 52px);
    background-position: center, center, center 38%;
  }
  .broadcast-tiles { flex-direction: row; }
  .broadcast-tiles a { min-width: 0; }
}

/* Narrow landscape phones still get a full-width field, never overlapping cards. */
@media (orientation: landscape) and (max-width: 760px) {
  .workspace > main,
  .experience-page .workspace > main { padding-inline: 12px; }
  .lf-toolbar { flex-direction: column; align-items: stretch; }
  .lf-toolbar > label { max-width: none; }
  .lf-quick-actions { justify-content: flex-start; }
  .lf-grid { grid-template-columns: minmax(0, 1fr); }
  .lf-head { flex-wrap: wrap; }
  .lf-point-group { width: 100%; }
  .lf-field { height: 475px; }
  .lf-elevate-pair,
  .cup-deck-review-grid,
  .identity-layout { grid-template-columns: minmax(0, 1fr); }
  .op-choice-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .op-choice { min-height: 150px; }
  .op-build-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .broadcast-hero { min-height: 340px; }
}
