/* ============================================================
   COOPER DEBATE TEAM — tablet portrait layout
   Public pages only; landscape and desktop layouts are unchanged.
   ============================================================ */

@media screen and (min-width: 601px) and (max-width: 1100px) and (orientation: portrait) {
  html,
  body {
    max-width: 100%;
    overflow-x: clip;
  }

  .page-header-content,
  .section-wrap,
  .section-wrap > *,
  .two-col > *,
  .three-col > *,
  .four-col > *,
  .news-cards > *,
  .results-grid > *,
  .stats-grid > * {
    min-width: 0;
  }

  .page-title,
  .page-subtitle,
  .section-title,
  .section-sub,
  .btn,
  .resource-title,
  .resource-desc,
  .ann-card-title,
  .ann-card-body {
    overflow-wrap: anywhere;
  }

  /* Homepage content below the dedicated portrait hero. */
  .homepage-readiness__header {
    grid-template-columns: minmax(0, 1fr);
  }

  .homepage-readiness__details {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .homepage-readiness__card,
  .homepage-readiness__detail-card {
    min-width: 0;
  }

  /* News pages keep the featured callout readable without squeezing its CTA. */
  .ann-featured-copy,
  .ann-featured-detail {
    min-width: 0;
  }

  .ann-featured-detail {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .ann-featured-cta {
    min-width: 0;
    width: min(100%, 280px);
    transform: none;
  }

  /* Resources: convert the five-part desktop ribbon into a balanced tablet grid. */
  .resources-page .research-hub-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 14px;
  }

  .resources-page .research-hub-step {
    border-right: 1px solid rgba(255, 222, 125, 0.58);
    padding: 14px 16px;
  }

  .resources-page .research-hub-step:nth-child(2n) {
    border-right: 0;
  }

  .resources-page .research-hub-step:nth-child(n + 3) {
    border-top: 1px solid rgba(255, 222, 125, 0.42);
  }

  .resources-page .research-hub-cta {
    grid-column: 1 / -1;
    justify-self: center;
    width: auto;
    margin: 14px auto 0;
    white-space: nowrap;
  }

  .resources-page .skills-panel .two-col {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .resources-page .resource-card,
  .resources-page .template-card,
  .resources-page .topic-box,
  .resources-page .skills-panel {
    min-width: 0;
  }

  /* Application switcher and forms use a comfortable single reading column. */
  .application-workspace-switcher {
    padding: 38px 26px 30px;
  }

  .entry-choice-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .entry-choice-card {
    min-height: 0;
  }

  .entry-choice-swap {
    display: none;
  }

  .entry-card-description {
    margin: 16px 0 22px;
  }

  .entry-choice-card .entry-link {
    margin: auto 0 0;
  }

  .form-steps {
    width: 100%;
  }

  .form-step {
    min-width: 0;
  }

  .form-step-label {
    width: auto !important;
    max-width: 70px;
    overflow-wrap: anywhere;
  }

  .form-step-connector {
    width: auto !important;
    min-width: 8px;
    flex: 1 1 18px;
  }

  /* Debate Prep is embedded by Apply; do not leave its desktop workbench at 820–1024px. */
  .studio-shell {
    padding-inline: 24px;
  }

  .studio-mast {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
  }

  .studio-mast-copy,
  .studio-access-form {
    grid-column: 1;
    grid-row: auto;
  }

  .studio-access-form {
    justify-self: stretch;
    width: 100%;
    margin-top: 22px;
  }

  .brief-card,
  .route-grid,
  .workspace,
  .essay-row,
  .paper-grid,
  .paper-top-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .workspace .case-card,
  .workspace .sources-card,
  .workspace .essay-card,
  .workspace .stats-card {
    grid-column: auto !important;
    grid-row: auto !important;
  }

  .identity-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Awards controls and statistics retain comparison without desktop crowding. */
  .awards-page .aw-results-heading-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .awards-page .aw-metric-grid,
  .awards-page .aw-season-highlight-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .awards-page .aw-season-highlight-item:nth-child(odd) {
    border-left: 0;
  }

  .awards-page .aw-season-highlight-item:nth-child(even) {
    border-left: 1px solid rgba(242, 209, 107, 0.76);
  }

  /* Gallery cards are large enough to scan and tap in portrait. */
  .gallery-media-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gallery-media-card {
    min-width: 0;
    min-height: 0;
  }

  /* Tournament page navigation and feature panels become vertical compositions. */
  .tourney-section-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    overflow: visible !important;
    position: relative !important;
    top: auto !important;
  }

  .tourney-section-nav .section-wrap {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, calc(40% - 4px))) !important;
    justify-content: center;
    gap: 10px !important;
    overflow: visible !important;
  }

  .tourney-section-nav button {
    min-width: 0 !important;
    width: 100% !important;
    justify-self: center;
    white-space: normal !important;
  }

  .tourney-section-nav .section-wrap button:last-child {
    grid-column: 1 / -1;
    justify-self: center;
    width: calc(50% - 5px) !important;
  }

  /* Restore the desktop-style two-column introduction in portrait tablets:
     title on the left, divider in the middle, and context on the right. */
  .tournaments-page .tourney-panel-intro,
  .tournaments-page .tourney-panel-intro--calendar {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    grid-template-areas:
      "title"
      "picker" !important;
    align-items: center;
    align-content: center;
    gap: 8px clamp(32px, 5vw, 48px) !important;
    min-height: 120px !important;
    margin: 0 auto 18px !important;
    padding: 0;
    text-align: left;
  }

  .tournaments-page .tourney-panel-intro:not(.tourney-panel-intro--calendar) {
    grid-template-areas:
      "title copy" !important;
  }

  .tournaments-page .tourney-panel-intro--calendar {
    grid-template-areas:
      "title copy"
      "title picker" !important;
  }

  .tournaments-page .tourney-panel-intro-title,
  .tournaments-page .tourney-panel-intro--calendar .cal-section-header-copy {
    grid-area: title !important;
    width: auto;
    text-align: right !important;
  }

  .tournaments-page .tourney-panel-intro-title .section-title {
    text-align: right !important;
  }

  .tournaments-page .tourney-panel-intro-copy {
    grid-area: copy !important;
    width: auto;
    text-align: left !important;
  }

  .tournaments-page .tourney-panel-intro-copy .section-label {
    justify-content: flex-start !important;
    margin-bottom: 6px;
  }

  .tournaments-page .tourney-panel-intro-copy .section-label::after {
    content: none !important;
  }

  .tournaments-page .tourney-panel-intro-copy .section-sub,
  .tournaments-page .tourney-panel-intro-copy .public-calendar-intro,
  .tournaments-page .tourney-panel-intro-copy .volunteer-intro,
  .tournaments-page .tourney-panel-intro-copy .volunteer-privacy {
    text-align: left !important;
  }

  .tournaments-page .tourney-panel-intro--calendar .cal-section-header-right {
    display: contents;
  }

  .tournaments-page .tourney-panel-intro--calendar .cal-section-header-picker {
    grid-area: picker !important;
    justify-self: stretch !important;
    width: auto;
  }

  .tournaments-page .tourney-panel-intro::after {
    display: block !important;
  }

  .tournament-overview-guide {
    width: 100% !important;
    margin-left: 0 !important;
    transform: none !important;
  }

  .tournament-overview-event-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .tournament-overview-guide-header {
    grid-template-columns: minmax(230px, 38%) minmax(0, 1fr) !important;
    align-items: center;
    gap: 30px;
  }

  .tournament-day-card-main {
    grid-template-columns: minmax(250px, 42%) minmax(0, 1fr) !important;
    align-items: stretch;
    gap: 30px;
  }

  .tournament-day-card-content {
    padding-left: clamp(12px, 2vw, 20px);
  }

  .tournaments-page .tournament-overview-event-card-header,
  .tournaments-page .tournament-overview-event-card--training .tournament-overview-event-card-header,
  .tournaments-page .tournament-overview-event-card:not(.tournament-overview-event-card--training) .tournament-overview-event-card-header {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: center;
    gap: 32px;
    min-height: 180px;
  }

  .tournaments-page .tournament-overview-event-card-header::after,
  .tournaments-page .tournament-overview-event-card:not(.tournament-overview-event-card--training) .tournament-overview-event-card-header::after {
    top: 18px;
    bottom: 18px;
    left: calc(50% - 1px) !important;
  }

  .tournaments-page .tournament-overview-event-card-header img,
  .tournaments-page .tournament-overview-event-card--training .tournament-overview-event-card-header img {
    width: 230px;
    max-width: 100%;
    margin: 0 auto !important;
  }

  .tournaments-page .tournament-overview-event-card:not(.tournament-overview-event-card--training) .tournament-overview-event-card-header img {
    width: 215px;
    max-width: 100%;
    margin: 0 auto !important;
  }

  .tournaments-page .tournament-overview-event-card-header > div {
    align-self: center;
    min-width: 0;
    padding-left: clamp(24px, 4.5vw, 46px);
    box-sizing: border-box;
  }

  .tournament-overview-volunteer-callout {
    grid-template-columns: clamp(150px, 22vw, 190px) minmax(0, 1fr) !important;
    align-items: stretch;
    gap: 20px;
  }

  .tournament-overview-volunteer-art {
    align-items: center !important;
    justify-content: center !important;
    padding: 0 18px 0 0 !important;
  }

  .tournament-overview-volunteer-art::after {
    display: block !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: auto !important;
    width: 2px !important;
    height: auto !important;
    background: linear-gradient(180deg, rgba(255,255,255,0), rgba(255,255,255,.92) 50%, rgba(255,255,255,0)) !important;
  }

  .tournament-overview-guide-header-art {
    min-height: 230px !important;
    padding: 0 28px 0 0 !important;
  }

  .tournament-overview-guide-header-art::after {
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: auto !important;
    width: 2px !important;
    height: auto !important;
    background: linear-gradient(180deg, transparent, rgba(255,255,255,.92) 50%, transparent) !important;
  }

  .tournament-overview-guide-header-art img {
    width: min(250px, 100%) !important;
  }

  .tournament-day-card-art {
    padding: 8px 28px 8px 0 !important;
  }

  .tournament-day-card-art img {
    width: min(328px, 100%) !important;
  }

  .index-footer-main {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  /* Give the four official-link cards the full reading width, then place the
     two longer calls to action in their own horizontal row below them. */
  .tournament-overview-resource-row {
    display: flex !important;
    flex-direction: column;
    gap: 18px !important;
  }

  .tournament-overview-external-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    justify-content: stretch !important;
    gap: 14px 18px !important;
    width: 100%;
    max-width: none;
  }

  .tournament-overview-external-grid::after {
    display: none !important;
  }

  .tournament-overview-external-card {
    min-height: 60px;
    padding: 10px 12px;
  }

  .tournament-overview-guide-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-template-rows: none !important;
    gap: 14px !important;
    width: 100% !important;
    height: auto !important;
    margin-top: 0 !important;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, .34);
    justify-self: stretch !important;
    align-self: stretch !important;
  }

  .tournament-overview-guide-actions a {
    min-height: 48px;
    white-space: normal;
  }

  .tournament-overview-volunteer-content {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    align-content: start;
    align-items: start;
    column-gap: 18px;
  }

  .tournament-overview-volunteer-content .tournament-overview-event-kicker {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .tournament-overview-volunteer-content h3 {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .tournament-overview-volunteer-content > p:not(.tournament-overview-event-kicker) {
    grid-column: 1;
    grid-row: 3;
  }

  .tournament-overview-volunteer-content .btn {
    grid-column: 2;
    grid-row: 3;
    justify-self: end;
    align-self: end;
    margin-top: 0 !important;
  }

  .tourney-tryout-top-layout {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .tourney-tryout-output-heading h3 {
    white-space: normal !important;
  }

  .tourney-tryout-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Footer legal copy should wrap inside the viewport instead of clipping. */
  .index-footer .index-footer-bottom-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .index-footer-bottom-cell,
  .index-footer-bottom-cell:last-child {
    grid-column: auto !important;
    min-width: 0;
    padding: 20px 0 !important;
    border-top: 1px solid rgba(99, 133, 178, 0.24);
    border-left: 0 !important;
  }

  .index-footer-bottom-cell:first-child {
    border-top: 0;
  }

  .index-footer-bottom-links {
    display: flex !important;
    flex-wrap: nowrap;
    gap: 0;
    white-space: nowrap;
  }

  .index-footer-srr-title {
    display: inline;
    margin-top: 0;
    white-space: nowrap;
  }

  .index-footer-srr,
  .index-footer-srr-copy,
  .index-footer-bottom-sub,
  .index-footer-credit-line {
    min-width: 0;
    overflow-wrap: anywhere;
  }
}

@media screen and (min-width: 761px) and (max-width: 1100px) and (orientation: portrait) {
  .tournaments-page .public-countdown {
    display: grid !important;
    grid-template-areas:
      "label name"
      "date countdown" !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .tournaments-page .public-countdown > * {
    min-height: 92px;
  }

  .tournaments-page .public-countdown-label,
  .tournaments-page .public-countdown-name {
    border-bottom: 1px solid rgba(255, 232, 159, .48);
  }

  .tournaments-page .public-countdown-name {
    border-left: 0;
  }

  .tournaments-page .public-countdown-date {
    border-left: 0;
  }

  .tournaments-page .calendar-glance-link {
    display: flex;
    width: max-content;
    max-width: 100%;
    margin: 16px auto 0;
    padding-right: 20px;
    padding-left: 20px;
  }

  .index-footer-brand {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 20px;
    width: min(100%, 676px);
    max-width: none;
    margin: 0 auto;
    padding: 0 28px 42px;
    box-sizing: border-box;
    text-align: left;
  }

  .index-footer-lockup {
    display: contents;
  }

  .index-footer-jaguar {
    grid-column: 1;
    grid-row: 1 / 3;
  }

  .index-footer-lockup > div {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

  .index-footer-brand-title {
    text-align: left;
  }

  .index-footer-brand-details {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    margin-left: 0;
  }

  .index-footer-school,
  .index-footer-brand-copy {
    text-align: left;
  }

  .index-footer-location,
  .index-footer-motto {
    justify-content: flex-start;
  }
}

@media screen and (min-width: 601px) and (max-width: 760px) and (orientation: portrait) {
  .two-col,
  .three-col,
  .four-col,
  .wasdl-grid,
  .coach-grid,
  .stats-grid,
  .results-grid,
  .gallery-grid,
  .news-cards {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .ann-featured {
    grid-template-columns: minmax(0, 1fr);
    text-align: center;
  }

  .ann-featured-copy,
  .ann-featured-detail {
    align-items: center;
  }

  .resources-page .research-hub-bar,
  .gallery-media-grid,
  .form-row {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .resources-page .research-hub-step {
    border-top: 1px solid rgba(255, 222, 125, 0.42);
    border-right: 0;
  }

  .resources-page .research-hub-step:first-child {
    border-top: 0;
  }

  .gallery-media-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .index-footer-main {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .index-footer-column + .index-footer-column {
    border-left: 0 !important;
  }
}