/* Mobile reading and archive layouts. Desktop and stored article formatting stay intact. */
@media (max-width: 980px) {
  body.legacy-mode .archive-card,
  body.legacy-mode .detail-text,
  body.legacy-mode .timeline-story,
  body.legacy-mode .gallery-tile,
  body.legacy-mode .gallery-reference,
  body.legacy-mode .podcast-episode {
    --muted: #5e5659;
  }

  body.legacy-mode .content-layout,
  body.legacy-mode.route-list .content-layout,
  body.legacy-mode.route-detail .content-layout {
    width: calc(100% - 32px);
    max-width: 900px;
    min-width: 0;
    margin-inline: auto;
    padding: 24px 0 40px;
    scroll-margin-top: calc(var(--mobile-header-height, 140px) + 16px);
  }

  body.legacy-mode .results-area,
  body.legacy-mode.route-list .results-area,
  body.legacy-mode.route-detail .results-area {
    width: 100%;
    min-width: 0;
    padding: 0;
  }

  /* Natural rows avoid desktop masonry spans and keep each complete cover visible. */
  body.legacy-mode.route-home .cards-grid,
  body.legacy-mode.route-list .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: auto;
    grid-auto-flow: row;
    align-items: start;
    gap: 22px 18px;
    min-width: 0;
  }

  body.legacy-mode .cards-grid .archive-card,
  body.legacy-mode .cards-grid .archive-card:first-child {
    display: flex;
    flex-direction: column;
    grid-column: auto;
    grid-row: auto !important;
    width: 100%;
    min-width: 0;
    min-height: 0 !important;
    margin: 0;
    border: 0;
    border-radius: 5px;
    background: #fff;
    color: #201c1e;
    box-shadow: none;
    transform: none;
  }

  body.legacy-mode .cards-grid .archive-card .card-media,
  body.legacy-mode .cards-grid .archive-card.featured-card .card-media {
    flex: none;
    width: 100%;
    height: auto !important;
    min-height: 0;
    aspect-ratio: var(--media-ratio, 16 / 10);
    background: #111;
  }

  body.legacy-mode .cards-grid .card-media::before {
    display: none;
  }

  body.legacy-mode .cards-grid .card-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    filter: none;
  }

  body.legacy-mode .cards-grid .archive-card .card-body,
  body.legacy-mode .cards-grid .archive-card.featured-card .card-body {
    min-width: 0;
    gap: 10px;
    padding: 17px 18px 18px;
  }

  body.legacy-mode .cards-grid .card-meta {
    flex-wrap: wrap;
    gap: 5px 10px;
    color: #665d60;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.5;
  }

  body.legacy-mode .cards-grid .archive-card .card-body h3,
  body.legacy-mode .cards-grid .archive-card.featured-card .card-body h3 {
    margin: 0;
    color: #181416;
    font-size: 19px;
    font-weight: 750;
    line-height: 1.4;
    letter-spacing: -.015em;
    overflow-wrap: anywhere;
    -webkit-line-clamp: 3;
  }

  body.legacy-mode .cards-grid .archive-card .card-body p,
  body.legacy-mode .cards-grid .archive-card.featured-card .card-body p {
    margin: 0;
    color: #5e5659;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.65;
    overflow-wrap: anywhere;
    -webkit-line-clamp: 3;
  }

  body.legacy-mode .cards-grid .card-footer {
    gap: 12px;
    margin-top: 3px;
  }

  body.legacy-mode .cards-grid .read-button,
  body.legacy-mode #showMore {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    border-radius: 3px;
  }

  body.legacy-mode #showMore {
    margin-top: 26px;
    margin-bottom: 32px;
    background: #ab1930;
    color: #fff;
    border: 1px solid #c72c44;
  }

  body.legacy-mode .cards-grid .saved-dot {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    color: #a56a05;
  }

  body.legacy-mode .cards-grid .media-badge {
    min-height: 29px;
    height: auto;
    top: 10px;
    left: 10px;
    right: auto;
    padding: 5px 8px;
    gap: 5px;
    border-radius: 3px;
    background: #171b1ee8;
    color: #fff;
    font-size: 11px;
    font-weight: 750;
    line-height: 1.3;
    letter-spacing: .025em;
  }

  body.legacy-mode .cards-grid .media-badge svg {
    width: 14px;
    height: 14px;
  }

  body.legacy-mode.route-detail .detail-breadcrumb {
    width: 100%;
    min-width: 0;
    flex-wrap: wrap;
    gap: 7px 10px;
    margin: 0 0 18px;
    padding: 0;
    color: #d4c9cd;
    font-size: 13px;
    line-height: 1.5;
  }

  body.legacy-mode.route-detail .detail-page {
    width: 100%;
    min-width: 0;
    min-height: 0;
    padding: 0;
    margin: 0 auto;
    gap: 0;
    border-radius: 5px;
    scroll-margin-top: calc(var(--mobile-header-height, 140px) + 16px);
  }

  body.legacy-mode.route-detail .detail-page .preview-meta {
    flex-wrap: wrap;
    gap: 8px 14px;
    padding: 26px 24px 0;
    font-size: 11px;
    line-height: 1.6;
    letter-spacing: .06em;
  }

  body.legacy-mode.route-detail .detail-page .preview-content > #previewTitle {
    width: 100%;
    min-width: 0;
    padding: 20px 24px 32px;
    font-size: clamp(26px, 4vw, 32px);
    line-height: 1.3;
    letter-spacing: -.025em;
    overflow-wrap: anywhere;
    text-wrap: pretty;
  }

  body.legacy-mode.route-detail .detail-page #previewTitle[dir="rtl"] {
    letter-spacing: 0;
    line-height: 1.6;
  }

  body.legacy-mode.route-detail .detail-page .preview-media {
    min-width: 0;
    min-height: 0;
    gap: 18px;
    padding: 20px 18px 0;
  }

  body.legacy-mode.route-detail .detail-page .preview-media > img,
  body.legacy-mode.route-detail .detail-page .preview-media > video,
  body.legacy-mode.route-detail .detail-page .preview-media > iframe {
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: 0;
    height: auto;
    max-height: 75svh;
    object-fit: contain;
  }

  body.legacy-mode .video-poster img {
    object-fit: contain !important;
  }

  body.legacy-mode.route-detail .detail-page .detail-text {
    width: 100%;
    min-width: 0;
    max-width: none;
    max-height: none;
    padding: 28px 24px 8px;
    color: #332c2f;
    font-size: 17px;
    line-height: 1.85;
    overflow: visible;
    overflow-wrap: anywhere;
  }

  body.legacy-mode.route-detail .detail-page .detail-text > p,
  body.legacy-mode.route-detail .detail-page .detail-text > ul,
  body.legacy-mode.route-detail .detail-page .detail-text > ol,
  body.legacy-mode.route-detail .detail-page .detail-text > blockquote {
    margin-bottom: 20px;
  }

  body.legacy-mode.route-detail .detail-page .detail-text p {
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
  }

  body.legacy-mode.route-detail .detail-page .detail-text[lang="ar"] {
    font-size: 21px;
    line-height: 2;
  }

  body.legacy-mode.route-detail .detail-page .detail-text h2 {
    padding-top: 8px;
    font-size: 26px;
    line-height: 1.45;
  }

  body.legacy-mode.route-detail .detail-page .detail-text h3 {
    font-size: 22px;
    line-height: 1.5;
  }

  body.legacy-mode.route-detail .detail-page .detail-text blockquote {
    padding: 16px 18px;
  }

  body.legacy-mode.route-detail .detail-page .detail-text ul,
  body.legacy-mode.route-detail .detail-page .detail-text ol {
    padding-inline-start: 23px;
  }

  body.legacy-mode.route-detail .detail-page .detail-text img,
  body.legacy-mode.route-detail .detail-page .detail-text video,
  body.legacy-mode.route-detail .detail-page .detail-text iframe {
    max-width: 100%;
  }

  body.legacy-mode.route-detail .detail-page .tag-row {
    gap: 8px;
    padding: 16px 24px 24px;
  }

  body.legacy-mode.route-detail .detail-page .tag-row a {
    max-width: 100%;
    padding: 7px 10px;
    font-size: 12px;
    line-height: 1.5;
    overflow-wrap: anywhere;
  }

  body.legacy-mode.route-detail .detail-page .media-links {
    min-width: 0;
    padding: 0 24px 18px;
    font-size: 14px;
    line-height: 1.7;
  }

  body.legacy-mode.route-detail .detail-page .preview-actions {
    flex-wrap: wrap;
    gap: 10px;
    padding: 18px 24px;
  }

  body.legacy-mode.route-detail .detail-page .preview-actions .secondary-action {
    justify-content: center;
    min-height: 44px;
    padding: 10px 16px;
    font-size: 14px;
    line-height: 1.4;
  }

  body.legacy-mode .source-links ul {
    columns: 1;
  }

  body.legacy-mode .source-links a,
  body.legacy-mode .media-links a {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  body.legacy-mode .media-carousel {
    min-width: 0;
    border-radius: 3px;
  }

  body.legacy-mode .media-carousel-stage {
    aspect-ratio: 16 / 10;
  }

  body.legacy-mode .media-carousel-stage > img,
  body.legacy-mode .media-carousel-stage .video-stage video {
    object-fit: contain;
  }

  body.legacy-mode .media-carousel-controls {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
  }

  body.legacy-mode .media-carousel-arrows button {
    width: 44px;
    height: 40px;
  }

  body.legacy-mode .media-carousel-strip {
    padding: 0 12px 12px;
  }

  body.legacy-mode .gallery-page-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 18px;
    min-width: 0;
  }

  body.legacy-mode .gallery-filters {
    gap: 8px;
    margin-bottom: 22px;
  }

  body.legacy-mode .gallery-filters button {
    min-height: 42px;
    padding: 9px 12px;
    font-size: 13px;
    line-height: 1.5;
  }

  body.legacy-mode .gallery-provenance {
    color: #d4c9cd;
    font-size: 14px;
    line-height: 1.75;
  }

  body.legacy-mode .gallery-tile {
    min-width: 0;
    border-radius: 4px;
    overflow: clip;
  }

  body.legacy-mode .gallery-tile > a {
    display: block;
    background: #111;
  }

  body.legacy-mode .gallery-tile > a > img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 72svh;
    object-fit: contain;
  }

  body.legacy-mode .gallery-caption {
    padding: 17px 18px 19px;
  }

  body.legacy-mode .gallery-caption h3 {
    font-size: 18px;
    line-height: 1.5;
    overflow-wrap: anywhere;
  }

  body.legacy-mode .gallery-caption > a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    font-size: 14px;
    line-height: 1.5;
  }

  body.legacy-mode .gallery-reference {
    min-height: 0;
    padding: 22px 20px;
    font-size: 16px;
    line-height: 1.8;
    overflow-wrap: anywhere;
  }

  body.legacy-mode .timeline-intro {
    padding: 4px 0 24px;
  }

  body.legacy-mode .timeline-intro h1,
  body.legacy-mode .podcasts-heading h1 {
    color: #fff;
    font-size: 30px;
    line-height: 1.25;
    letter-spacing: -.02em;
  }

  body.legacy-mode .timeline-intro p,
  body.legacy-mode .podcasts-heading p {
    color: #cec2c7;
    font-size: 16px;
    line-height: 1.75;
  }

  body.legacy-mode .timeline-months {
    gap: 8px;
    margin: 22px 0 28px;
  }

  body.legacy-mode .timeline-months button {
    min-height: 42px;
    padding: 9px 12px;
    font-size: 13px;
    line-height: 1.5;
  }

  body.legacy-mode .timeline-entry {
    display: block;
    min-width: 0;
    margin-left: 5px;
    padding: 0 0 24px 18px;
    border-left: 2px solid #64222b;
  }

  body.legacy-mode .timeline-date {
    padding: 0 0 12px;
    border: 0;
    color: #ded0d5;
    font-size: 13px;
    line-height: 1.6;
  }

  body.legacy-mode .timeline-dot {
    left: -25px;
    top: 6px;
  }

  body.legacy-mode .timeline-month-heading {
    margin: 32px 0 20px;
    color: #fff;
    font-size: 23px;
    line-height: 1.4;
  }

  body.legacy-mode .timeline-story {
    min-width: 0;
    padding: 22px;
  }

  body.legacy-mode .timeline-story h3 {
    color: #201a1d;
    font-size: 23px;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }

  body.legacy-mode .timeline-text {
    color: #3e3439;
    font-size: 16px;
    line-height: 1.85;
  }

  body.legacy-mode .timeline-text p {
    color: inherit;
    font-size: inherit;
    line-height: inherit;
  }

  body.legacy-mode .timeline-permalink {
    min-height: 40px;
    padding-top: 9px;
    font-size: 14px;
  }

  body.legacy-mode .memorial-soon {
    min-height: 340px;
    padding: 52px 22px;
  }

  body.legacy-mode .memorial-soon h1 {
    font-size: 30px;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  body.legacy-mode .podcasts-heading {
    display: block;
    padding-top: 4px;
    margin-bottom: 24px;
  }

  body.legacy-mode .podcasts-heading p {
    margin-top: 10px;
  }

  body.legacy-mode .podcasts-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 30px;
  }

  body.legacy-mode .podcast-now {
    position: static;
    min-width: 0;
    padding: 22px;
  }

  body.legacy-mode .podcast-current-heading {
    flex-wrap: wrap;
    gap: 12px;
  }

  body.legacy-mode .podcast-current-heading button {
    width: 44px;
    height: 40px;
  }

  body.legacy-mode .podcast-current-intro {
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 18px;
  }

  body.legacy-mode .podcast-current-intro h2 {
    font-size: 25px;
    line-height: 1.4;
  }

  body.legacy-mode .podcast-playback-tools {
    flex-wrap: wrap;
    gap: 10px;
  }

  body.legacy-mode .podcast-playback-tools button,
  body.legacy-mode .podcast-playback-tools select {
    min-height: 40px;
    font-size: 14px;
  }

  body.legacy-mode .podcast-notes-text {
    max-height: none;
    overflow: visible;
    font-size: 16px;
    line-height: 1.85;
  }

  body.legacy-mode .podcast-library-heading {
    flex-wrap: wrap;
    gap: 8px 16px;
  }

  body.legacy-mode .podcast-library-heading h2 {
    font-size: 25px;
    line-height: 1.4;
  }

  body.legacy-mode .podcast-filters button {
    min-height: 42px;
  }

  body.legacy-mode .podcast-episode > button {
    min-width: 0;
    padding: 16px;
    gap: 14px;
  }

  body.legacy-mode .podcast-episode-copy > strong {
    font-size: 17px;
    line-height: 1.5;
    overflow-wrap: anywhere;
  }

  body.legacy-mode .podcast-story-links {
    gap: 8px 18px;
  }

  body.legacy-mode .podcast-story-links a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
  }

  body.legacy-mode .contact-status {
    grid-column: 1 / -1;
    width: 100%;
    font-size: 14px;
    line-height: 1.75;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 600px) {
  body.legacy-mode.route-home .cards-grid,
  body.legacy-mode.route-list .cards-grid,
  body.legacy-mode .gallery-page-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  body.legacy-mode.route-detail .detail-page .preview-meta {
    padding: 24px 20px 0;
  }

  body.legacy-mode.route-detail .detail-page .preview-content > #previewTitle {
    padding: 18px 20px 28px;
    font-size: 27px;
  }

  body.legacy-mode.route-detail .detail-page .preview-media {
    padding: 18px 12px 0;
  }

  body.legacy-mode.route-detail .detail-page .detail-text {
    padding: 26px 20px 8px;
    font-size: 16px;
    line-height: 1.85;
  }

  body.legacy-mode.route-detail .detail-page .detail-text[lang="ar"] {
    font-size: 20px;
  }

  body.legacy-mode.route-detail .detail-page .tag-row {
    padding-inline: 20px;
  }

  body.legacy-mode.route-detail .detail-page .media-links,
  body.legacy-mode.route-detail .detail-page .preview-actions {
    padding-inline: 20px;
  }

  body.legacy-mode .media-carousel-stage {
    aspect-ratio: 4 / 3;
  }

  body.legacy-mode .media-carousel-thumb {
    flex-basis: 72px;
    width: 72px;
    height: 54px;
  }

  body.legacy-mode .gallery-filters button {
    padding-inline: 10px;
    font-size: 12px;
  }

  body.legacy-mode .timeline-story {
    padding: 18px;
  }

  body.legacy-mode .timeline-story h3 {
    font-size: 22px;
  }

  body.legacy-mode .podcast-now {
    padding: 18px;
  }

  body.legacy-mode .podcast-current-intro {
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 14px;
  }

  body.legacy-mode .podcast-current-intro h2 {
    font-size: 22px;
  }

  body.legacy-mode .podcast-episode > button {
    padding: 14px;
    gap: 12px;
  }

  body.legacy-mode .podcast-episode > button > img {
    width: 58px;
    height: 58px;
  }

  body.legacy-mode .podcast-select-label {
    display: none;
  }
}
