/* Three deliberate reading modes: desktop desk, iPad folio, phone briefing. */
html {
  -webkit-text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
}

img {
  max-width: 100%;
}

.site-header,
.shell,
footer {
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}

.shell {
  width: min(1240px, calc(100% - 48px));
  padding-left: 0;
  padding-right: 0;
}

.hero > p {
  text-wrap: pretty;
}

.card h3 {
  text-wrap: balance;
}

.search input,
.chips button {
  font: inherit;
}

.chips button,
.archive summary,
.card-foot a {
  min-height: 40px;
}

.chips button:focus-visible,
.card-foot a:focus-visible,
.source-media:focus-visible,
.archive summary:focus-visible,
.search input:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

/* Desktop browser: a wide editorial desk with readable line lengths. */
@media (min-width: 1180px) {
  .hero {
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
    padding-top: 96px;
  }

  .controls {
    position: sticky;
    top: 70px;
    z-index: 16;
    background: color-mix(in srgb, var(--paper) 94%, transparent);
    backdrop-filter: blur(14px);
  }

  .story-grid {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 42px;
  }

  .news-card:hover .card h3 {
    color: var(--blue);
  }

  .source-media {
    transition: transform .2s ease, box-shadow .2s ease;
  }

  .source-media:hover {
    transform: translate(-2px, -2px);
    box-shadow: 7px 7px 0 var(--ink);
  }
}

/* iPad portrait and landscape: compact folio, no desktop-sized headline. */
@media (min-width: 768px) and (max-width: 1179px) {
  .site-header {
    height: 64px;
  }

  .shell {
    width: min(960px, calc(100% - 56px));
  }

  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(260px, .62fr);
    gap: 32px;
    padding: 70px 0 50px;
  }

  .hero h1 {
    font-size: clamp(54px, 7.4vw, 76px);
  }

  .hero > p {
    font-size: 15px;
    line-height: 1.75;
  }

  .stats div {
    min-width: 0;
    flex: 1;
    margin-right: 24px;
    padding-right: 24px;
  }

  .controls {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .search {
    width: min(420px, 100%);
  }

  .chips {
    width: 100%;
  }

  .news-card {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .card {
    padding-left: 22px;
  }

  .story-grid {
    grid-template-columns: minmax(0, 1fr) minmax(190px, 240px);
    gap: 24px;
  }

  .card h3 {
    font-size: clamp(22px, 2.8vw, 28px);
  }
}

/* Phone: one-hand navigation and a single uninterrupted reading column. */
@media (max-width: 767px) {
  .site-header {
    padding-left: max(18px, env(safe-area-inset-left));
    padding-right: max(18px, env(safe-area-inset-right));
  }

  .brand {
    font-size: 18px;
  }

  .shell {
    width: calc(100% - 36px);
  }

  .hero {
    padding-top: 46px;
  }

  .hero h1 {
    font-size: clamp(43px, 13vw, 61px);
    line-height: .98;
  }

  .hero > p {
    max-width: 34em;
    line-height: 1.72;
  }

  .stats {
    gap: 0;
  }

  .stats div {
    padding-right: 10px;
    margin-right: 10px;
  }

  .stats span {
    margin-top: 4px;
  }

  .controls {
    margin-left: -18px;
    margin-right: -18px;
    padding-left: 18px;
    padding-right: 18px;
    box-shadow: 0 1px 0 var(--line);
  }

  .chips {
    margin-left: -4px;
    margin-right: -18px;
    padding-right: 18px;
    scroll-snap-type: x proximity;
  }

  .chips button {
    min-height: 38px;
    scroll-snap-align: start;
  }

  .day-heading {
    align-items: flex-start;
    gap: 18px;
  }

  .day-heading h2 {
    font-size: 31px;
  }

  .day-heading > span {
    padding-top: 8px;
    white-space: nowrap;
  }

  .category-stack {
    gap: 54px;
  }

  .news-card {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .rail {
    min-width: 0;
  }

  .rail strong {
    font-size: 17px;
  }

  .card {
    min-width: 0;
    padding-left: 13px;
  }

  .meta {
    row-gap: 8px;
  }

  .card h3 {
    margin-top: 13px;
    font-size: 21px;
    line-height: 1.36;
  }

  .summary {
    font-size: 14px;
    line-height: 1.75;
  }

  .story-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .source-media {
    order: -1;
    width: 100%;
    margin: 16px 0 18px;
  }

  .source-media img {
    aspect-ratio: 16 / 9;
  }

  .card-foot {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .card-foot a {
    display: inline-flex;
    align-items: center;
  }

  .archive summary {
    align-items: center;
    gap: 16px;
  }

  footer {
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    padding-bottom: max(38px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 390px) {
  .live {
    max-width: 95px;
    text-align: right;
  }

  .hero h1 {
    font-size: 42px;
  }

  .stats strong {
    font-size: 24px;
  }

  .stats span {
    font-size: 10px;
  }

  .section-heading {
    grid-template-columns: 42px auto 1fr;
  }

  .section-heading b {
    width: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
