/* Tablet */
@media (max-width: 991px) {
  .top-grid {
    grid-template-columns: 1fr 2fr;
  }
  .side-list {
    grid-column: 1/-1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
  .main-nav {
    justify-content: flex-start;
  }
  .lead h3 {
    font-size: 30px;
  }
  .masthead {
    padding: 0 16px;
  }
  .container-xl {
    padding: 0 20px;
  }
  .dark-band {
    margin-left: -20px;
    margin-right: -20px;
  }
  .edition {
    font-size: 10px;
  }
}
/* Mobile */
@media (max-width: 600px) {
  .masthead {
    height: 65px;
  }
  .masthead .header-actions > a {
    display: none;
  }
  .brand span {
    width: 31px;
    height: 31px;
    font-size: 22px;
  }
  .header-actions {
    gap: 2px;
  }
  .main-nav a {
    padding: 13px 12px;
    font-size: 13px;
  }
  .edition span:first-child {
    display: none;
  }
  .top-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
  }
  .top-grid > .lead {
    order: -1;
  }
  .side-list {
    display: block;
  }
  .lead h3 {
    font-size: 29px;
  }
  .feature-grid {
    grid-template-columns: 1fr;
  }
  .feature-grid h3 {
    font-size: 25px;
  }
  .section-title {
    font-size: 37px;
  }
  .article h1 {
    font-size: 34px;
  }
  .article {
    margin-top: 26px;
  }
  .article .standfirst {
    font-size: 18px;
  }
  .article-copy {
    font-size: 18px;
  }
  .result {
    grid-template-columns: 105px 1fr;
    gap: 15px;
  }
  .result h2 {
    font-size: 20px;
  }
  .result p {
    display: none;
  }
  .promo {
    padding: 24px;
    display: block;
  }
  .promo .btn {
    margin-top: 14px;
  }
  .subnav {
    overflow: auto;
    white-space: nowrap;
  }
  .rule-title {
    font-size: 17px;
  }
  footer nav {
    gap: 18px;
  }
  .article-tools {
    flex-wrap: wrap;
  }
}
@media (max-width: 991px) {
  .editorial-rail {
    grid-auto-columns: calc((100% - 32px) / 3);
  }
  .editorial-dark {
    margin-left: -20px;
    margin-right: -20px;
  }
  .topic-columns .section-heading {
    min-height: 0;
  }
  .spotlight h3 {
    font-size: 27px;
  }
}
@media (max-width: 600px) {
  .editorial-section {
    margin-top: 28px;
  }
  .editorial-rail {
    grid-auto-columns: 78%;
  }
  .editorial-dark {
    padding: 20px;
  }
  .section-heading {
    font-size: 17px;
    margin-bottom: 16px;
  }
  .spotlight h3 {
    font-size: 27px;
  }
  .discover-banner {
    padding: 24px;
  }
  .discover-banner h2 {
    font-size: 30px;
  }
  .discover-banner:after {
    font-size: 110px;
    right: 5px;
    top: 60px;
  }
  .discovery-card {
    padding: 17px 13px;
    min-height: 185px;
  }
  .discovery-card h3 {
    font-size: 22px;
  }
  .section-page-header h1 {
    font-size: 39px;
  }
  .horizontal-story .story h3 {
    font-size: 21px;
  }
  .topic-columns .col-md-6 {
    margin-bottom: 10px;
  }
  .editorial-section .col-md-3 .story h3 {
    font-size: 23px;
  }
  .related-inline {
    margin-bottom: 24px;
  }
  .rail-toolbar {
    font-size: 11px;
  }
  .numbered {
    margin-bottom: 15px;
  }
  .watch-feature h2 {
    font-size: 28px;
  }
}
@media print {
  header,
  footer,
  .article-tools,
  .editorial-section,
  .rule-title,
  .article ~ .row {
    display: none !important;
  }
  .article {
    max-width: none;
    margin: 0;
  }
  .article img {
    max-height: 350px;
    object-fit: contain;
  }
}
/* Reference page layouts: tablet and mobile. */
@media (max-width: 991px) {
  .reference-news-grid {
    grid-template-columns: 2fr 1fr;
  }
  .reference-briefs {
    grid-column: 1/-1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
  }
  .headline-strip {
    grid-template-columns: repeat(3, 1fr);
  }
  .more-story {
    grid-template-columns: 65px minmax(0, 1fr) 180px;
    gap: 18px;
  }
  .video-explore {
    border-left: 0;
  }
  .video-explore > a {
    max-width: 650px;
  }
}
@media (max-width: 600px) {
  .news-page-heading h1 {
    font-size: 40px;
    margin: 24px 0 18px;
  }
  .category-page-heading h1 {
    font-size: 36px;
  }
  .reference-news-grid {
    display: block;
  }
  .reference-lead .story h3 {
    font-size: 28px;
  }
  .reference-secondary .story {
    display: flow-root;
  }
  .reference-secondary .story img {
    float: right;
    width: 38%;
    margin: 0 0 12px 15px;
  }
  .reference-secondary .story h3 {
    font-size: 22px;
  }
  .reference-briefs {
    display: block;
  }
  .reference-briefs .story h3 {
    font-size: 21px;
  }
  .headline-strip {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
  }
  .headline-strip > a {
    border-right: 0;
    border-bottom: 1px solid #ddd;
    padding: 16px 0;
  }
  .rank-grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }
  .article-heading h1 {
    font-size: 32px;
  }
  .reference-article {
    margin-top: 28px;
  }
  .article-topline {
    align-items: flex-start;
    gap: 12px;
  }
  .article-topline .article-tools {
    gap: 0;
    flex-wrap: nowrap;
  }
  .article-tools .btn-link {
    padding: 0 6px;
    font-size: 13px;
  }
  .reference-article .article-copy {
    font-size: 17px;
  }
  .article-intro {
    font-size: 18px;
  }
  .more-story {
    grid-template-columns: minmax(0, 1fr) 110px;
    gap: 12px;
  }
  .more-date {
    grid-column: 1/-1;
  }
  .more-story h3 {
    font-size: 21px;
  }
  .more-story p {
    display: none;
  }
  .article-related .col-md-4 {
    border-bottom: 1px solid #ddd;
    padding-bottom: 16px;
  }
  .inline-related a {
    font-size: 17px;
  }
  .article-hero {
    margin-left: -20px !important;
    margin-right: -20px !important;
  }
  .article-hero figcaption {
    padding: 0 20px;
  }
}

/* Consolidated responsive component overrides. */
@media (prefers-reduced-motion: reduce) {
  dialog.drawer[open] {
    animation: none;
  }
}

@media (hover: hover) and (pointer: fine) {
  .editorial-rail,
  .main-nav,
  .subnav {
    cursor: grab;
  }
  .editorial-rail a,
  .main-nav a,
  .subnav a {
    cursor: inherit;
  }
}

@media (max-width: 767px) {
  .masthead .account-actions .account-desktop {
    display: none;
  }
  .masthead .account-actions .profile-link {
    display: inline-flex;
  }
  .masthead .account-actions {
    gap: 0;
  }
  .account-page {
    margin: 28px auto 44px;
  }
  .account-card h1 {
    font-size: 32px;
  }
  .account-back {
    margin-bottom: 22px;
  }
}

@media (max-width: 600px) {
  .brand .brand-main {
    font-size: 29px;
  }
  .brand .brand-sub {
    font-size: 9px;
    letter-spacing: 4.4px;
    padding-left: 4.4px;
  }
  .discover-banner:after {
    font-size: 70px;
  }
}

@media (max-width: 600px) {
  .rail-toolbar .rail-controls button {
    width: 44px;
    height: 44px;
  }
  .rail-toolbar {
    gap: 12px;
  }
}

@media (max-width: 600px) {
  .brand .brand-main {
    gap: 3px;
  }
  .brand .brand-main .brand-letter {
    width: 24px;
    height: 27px;
    font-size: 21px;
  }
  .brand .brand-sub {
    font-size: 8px;
    letter-spacing: 4.5px;
    padding-left: 4.5px;
  }
  .brand {
    gap: 3px;
  }
}

@media (max-width: 600px) {
  :root {
    --masthead-height: 65px;
  }
}

@media print {
  #header {
    display: none !important;
  }
  html {
    scroll-padding-top: 0;
  }
}

@media (max-width: 600px) {
  .category-page-heading h1 {
    font-size: 28px;
    margin: 22px 0 16px;
  }
  .category-page-heading .subnav {
    gap: 10px 18px;
    font-size: 13px;
    line-height: 1.5;
  }
}

/* Give promotional titles room to breathe on phones. */
@media (max-width: 575.98px) {
  .discovery-grid > .col-6 {
    width: 100%;
  }
  .discovery-card {
    padding: 20px;
    min-height: 164px;
  }
  .discovery-card .label {
    font-size: 11px;
    line-height: 1.4;
    letter-spacing: 1.5px;
  }
  .discovery-card h3 {
    font-size: 24px;
    line-height: 1.2;
    margin: 12px 0 20px;
  }
  .discovery-arrow {
    line-height: 1.5;
  }
}

/* Shared fluid typography: phone → tablet → desktop.
   rem bounds preserve browser font-size preferences and zoom. */
body {
  font-size: clamp(0.9375rem, 0.91304rem + 0.1087vw, 1rem);
}
h1,
.section-title,
.news-page-heading h1 {
  font-size: clamp(1.5rem, 1.25543rem + 1.08696vw, 2.125rem);
}
.section-page-header h1 {
  font-size: clamp(1.625rem, 1.38043rem + 1.08696vw, 2.25rem);
}
.category-page-heading h1 {
  font-size: clamp(1.5rem, 1.30435rem + 0.86957vw, 2rem);
}
.article h1,
.article-heading h1 {
  font-size: clamp(1.5rem, 1.25543rem + 1.08696vw, 2.125rem);
}
.account-card h1 {
  font-size: clamp(1.5rem, 1.30435rem + 0.86957vw, 2rem);
}
h2,
.discover-banner h2 {
  font-size: clamp(1.375rem, 1.22826rem + 0.65217vw, 1.75rem);
}
.lead h3,
.reference-lead .story h3 {
  font-size: clamp(1.375rem, 1.17935rem + 0.86957vw, 1.875rem);
}
.feature-grid h3,
.spotlight h3,
.watch-feature h2 {
  font-size: clamp(1.3125rem, 1.16576rem + 0.65217vw, 1.6875rem);
}
h3,
.editorial-section .story h3,
.horizontal-story .story h3,
.more-story h3,
.discovery-card h3 {
  font-size: clamp(1.125rem, 1.02717rem + 0.43478vw, 1.375rem);
}
.rail-card h3,
.article-related h3 {
  font-size: clamp(1.125rem, 1.05163rem + 0.32609vw, 1.3125rem);
}
.side-list .story h3,
.reference-secondary .story h3,
.numbered h3 {
  font-size: clamp(1.125rem, 1.07609rem + 0.21739vw, 1.25rem);
}
.editorial-section .col-md-3 .story h3,
.reference-briefs .story h3,
.headline-strip h3 {
  font-size: clamp(1.0625rem, 1.01359rem + 0.21739vw, 1.1875rem);
}
.topic-story h3 {
  font-size: clamp(1.0625rem, 1.01359rem + 0.21739vw, 1.1875rem);
}
.topic-story:first-of-type h3 {
  font-size: clamp(1.125rem, 1.05163rem + 0.32609vw, 1.3125rem);
}
.result h2 {
  font-size: clamp(1.125rem, 1.00272rem + 0.54348vw, 1.4375rem);
}
.rule-title,
.section-heading,
.topic-columns .section-heading {
  font-size: clamp(0.9375rem, 0.88859rem + 0.21739vw, 1.0625rem);
}
.article-copy,
.reference-article .article-copy {
  font-size: clamp(1rem, 0.95109rem + 0.21739vw, 1.125rem);
}
.article .standfirst,
.article-intro {
  font-size: clamp(1.0625rem, 1.01359rem + 0.21739vw, 1.1875rem);
}
.inline-related a {
  font-size: clamp(1rem, 0.97554rem + 0.1087vw, 1.0625rem);
}
.story p,
.rail-card p,
.horizontal-story .story p,
.more-story p,
.section-page-header > p,
.account-intro {
  font-size: clamp(0.875rem, 0.85054rem + 0.1087vw, 0.9375rem);
}
.lead p,
.reference-lead .story p,
.spotlight p {
  font-size: clamp(0.9375rem, 0.91304rem + 0.1087vw, 1rem);
}
.main-nav a,
.subnav,
.category-page-heading .subnav,
footer nav,
.account-tabs a,
.account-card form > label,
.account-switch {
  font-size: clamp(0.8125rem, 0.78804rem + 0.1087vw, 0.875rem);
}
.meta,
.topic-story .meta,
.article figcaption,
.article-byline span,
footer .legal,
footer p,
.account-preview,
.password-help {
  font-size: clamp(0.75rem, 0.72554rem + 0.1087vw, 0.8125rem);
}
.form-control,
.form-select,
.account-card .form-control {
  font-size: clamp(1rem, 1rem + 0vw, 1rem);
}

/* Allow long backend titles and URLs to wrap without widening the page. */
main h1,
main h2,
main h3,
main p,
main li,
.article-copy a,
.discovery-card,
footer a {
  overflow-wrap: anywhere;
}
main h1,
main h2,
main h3 {
  line-height: 1.2;
}
.story,
.rail-card,
.topic-story,
.result > *,
.top-grid > *,
.reference-news-grid > *,
.more-story > * {
  min-width: 0;
}
.rule-title,
.section-heading {
  line-height: 1.35;
}
.article-topline,
.related-inline {
  flex-wrap: wrap;
}
@media (max-width: 600px) {
  .article-topline .article-tools {
    flex-wrap: wrap;
  }
  .result {
    grid-template-columns: minmax(72px, 28%) minmax(0, 1fr);
    gap: 12px;
  }
}

/* Mobile subcategories are available in the left menu. */
@media (max-width: 767px) {
  .category-page-heading .subnav {
    display: none;
  }
}
/* Archive rows keep readable headline widths on small screens. */
@media (max-width: 767px) {
  #latest-category .more-story,
  .more-story {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 22px 0;
  }
  .more-story > a:last-child {
    grid-row: 1;
  }
  .more-story .more-date {
    grid-row: 2;
  }
  .more-story > div {
    grid-row: 3;
  }
  .more-story h3 {
    font-size: clamp(1.125rem, 1.02717rem + 0.43478vw, 1.375rem);
    line-height: 1.3;
  }
  .more-story img {
    display: block;
    width: 100%;
    aspect-ratio: 16/9;
  }
  .settings-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .settings-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .settings-nav a {
    padding: 14px;
    font-size: 0.875rem;
  }
  .settings-content {
    padding: 20px 0;
  }
  .auth-main {
    padding-top: 70px;
  }
  .auth-main h1 {
    margin-bottom: 30px;
  }
  .account-menu summary {
    font-size: 12px;
    max-width: 80px;
  }
}

/* Compact article and lead headlines across every screen size. */
.article h1,
.article-heading h1,
.lead h3,
.reference-lead .story h3 {
  line-height: 1.25;
  letter-spacing: -0.015em;
}

/* Supporting text: consistent sizing across all templates and devices. */
main h4,
.video-explore h4 {
  font-size: clamp(1rem, 0.95rem + 0.22vw, 1.125rem);
  line-height: 1.35;
}
main h5,
main h6 {
  font-size: 1rem;
  line-height: 1.4;
}
main p,
main li {
  line-height: 1.6;
}
.article-copy p,
.reference-article .article-copy p {
  line-height: 1.7;
}
main label,
.settings-nav a,
.hub-tabs a,
.account-main label {
  font-size: clamp(0.875rem, 0.85rem + 0.11vw, 0.9375rem);
  line-height: 1.5;
}
.btn,
.auth-primary,
.auth-secondary,
.story-pagination button {
  font-size: 0.875rem;
  line-height: 1.5;
}
.more-date,
.article-topline,
.article-note,
.article-byline,
.rail-toolbar,
.footer-explore,
.discovery-arrow {
  font-size: clamp(0.75rem, 0.72554rem + 0.1087vw, 0.8125rem);
  line-height: 1.5;
}
dialog.drawer nav a {
  font-size: clamp(0.9375rem, 0.91304rem + 0.1087vw, 1rem);
  line-height: 1.5;
}
dialog.drawer .drawer-subcategories a {
  font-size: 0.875rem;
}
.auth-main h1 {
  font-size: clamp(1.5rem, 1.30435rem + 0.86957vw, 2rem);
}
.auth-main h2,
.settings-content h2 {
  font-size: clamp(1.125rem, 1.02717rem + 0.43478vw, 1.375rem);
  line-height: 1.3;
}
.auth-main input,
.search-form input,
textarea,
select,
.form-control,
.form-select {
  font-size: 1rem;
  line-height: 1.5;
}

/* Compact pagination fits all five buttons on a 320px phone. */
@media (max-width: 575.98px) {
  .story-pagination {
    gap: 5px;
  }
  .story-pagination button {
    padding: 8px;
    min-width: 40px;
    min-height: 44px;
  }
  .story-pagination .pagination-label {
    display: none;
  }
}
@media (max-width: 767px) {
  .story-grid .more-story,
  #latest-category .story-grid .more-story {
    grid-template-columns: minmax(0, 1fr);
  }
  .story-grid .more-story > a:last-child {
    grid-column: 1;
    grid-row: 1;
  }
  .story-grid .more-story .more-date {
    grid-column: 1;
    grid-row: 2;
  }
  .story-grid .more-story > div {
    grid-column: 1;
    grid-row: 3;
  }
}
