/* Shared sizing for the public theme and its editorial templates. */
@media screen {
  .tpm-site {
    --tpm-page-inset: clamp(1rem, 3.2vw, 2rem);
    --tpm-section-space: clamp(1.5rem, 4vw, 3rem);
    --tpm-page-heading: clamp(1.75rem, 1.28rem + 2.3vw, 3.25rem);
    --tpm-card-heading: clamp(1.125rem, 1rem + .65vw, 1.5rem);
    --tpm-reading-default: clamp(1.125rem, 1.04rem + .35vw, 1.3125rem);
  }

  .tpm-site .tpm-container {
    width: min(77.5rem, calc(100% - 2 * var(--tpm-page-inset)));
  }

  .tpm-site .tpm-main :is(h1, h2, h3, h4),
  .tpm-site .tpm-footer :is(a, p) {
    overflow-wrap: anywhere;
  }

  .tpm-site .tpm-main :is(.tpm-news-heading, .tpm-page-hero, .tpm-error-page) h1,
  .tpm-main.tpm-article h1,
  .tpm-radio-page__content h1 {
    font-size: var(--tpm-page-heading);
    line-height: 1.12;
    text-wrap: balance;
  }

  .tpm-site .tpm-section {
    padding-block: var(--tpm-section-space);
  }

  .tpm-site .tpm-content-card {
    padding: clamp(1rem, 3vw, 1.75rem);
    font-size: clamp(1rem, .94rem + .25vw, 1.125rem);
  }

  .tpm-home-reference .tpm-ref-lead h3,
  .tpm-newsroom .tpm-news-lead > .tpm-news-card:first-child h2 {
    font-family: var(--font);
    font-size: clamp(1.5rem, 1.2rem + 1.35vw, 2.5rem);
    line-height: 1.14;
    text-wrap: pretty;
  }

  .tpm-home-reference .tpm-ref-story h3,
  .tpm-site .tpm-news-body h2,
  .tpm-site .tpm-news-lead > .tpm-news-card:not(:first-child) h2,
  .tpm-site .tpm-show-card h3 {
    font-size: var(--tpm-card-heading);
    line-height: 1.25;
    text-wrap: pretty;
  }

  .tpm-home-reference .tpm-ref-lead p,
  .tpm-site .tpm-news-body p,
  .tpm-site .tpm-show-card p {
    font-size: clamp(.9375rem, .9rem + .18vw, 1.0625rem);
    line-height: 1.6;
  }

  .tpm-site .tpm-news-heading p,
  .tpm-site .tpm-page-hero p {
    max-width: 62ch;
    font-size: clamp(1rem, .93rem + .28vw, 1.1875rem);
  }

  .tpm-site .tpm-article-page {
    padding-block: clamp(1rem, 3vw, 2rem) var(--tpm-section-space);
  }

  .tpm-article-page .tpm-reading-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--tpm-section-space);
  }

  .tpm-article-page .tpm-reading-layout > .tpm-article-sidebar {
    grid-column: auto;
    grid-row: auto;
  }

  .tpm-article-page .tpm-reading-article .tpm-reading-header h1 {
    font-size: var(--tpm-page-heading);
    line-height: 1.1;
    margin-bottom: .4em;
  }

  .tpm-reading-article .tpm-article-deck {
    font-size: clamp(1.0625rem, .96rem + .48vw, 1.375rem);
    line-height: 1.55;
    margin-bottom: 1.125rem;
  }

  .tpm-article-page .tpm-reading-prose.tpm-prose {
    font-size: var(--tpm-reading-size, var(--tpm-reading-default));
    max-width: 66ch;
    line-height: 1.7;
    overflow-wrap: anywhere;
  }

  .tpm-reading-prose.tpm-prose > p {
    margin-block: 0 1.15em;
  }

  .tpm-reading-prose.tpm-prose :is(h2, h3, h4) {
    line-height: 1.25;
    text-wrap: pretty;
  }

  .tpm-reading-prose.tpm-prose h2 {
    font-size: 1.4em;
    margin-block: 1.45em .55em;
  }

  .tpm-reading-prose.tpm-prose h3 {
    font-size: 1.2em;
    margin-block: 1.35em .5em;
  }

  .tpm-site :is(.tpm-prose, .tpm-content-card) :is(figure, iframe, pre, .wp-block-column) {
    min-width: 0;
    max-width: 100%;
  }

  .tpm-site :is(.tpm-prose, .tpm-content-card) :is(.wp-block-table, .tpm-table-scroll, pre) {
    max-width: 100%;
    overflow-x: auto;
  }

  .tpm-site :is(.tpm-prose, .tpm-content-card) :is(img, video) {
    max-width: 100%;
    height: auto;
  }

  .tpm-site .tpm-article-breadcrumb,
  .tpm-site .tpm-article-end,
  .tpm-site .tpm-tv-experience__top {
    flex-wrap: wrap;
    row-gap: .5rem;
  }
}

@media screen and (min-width: 64rem) {
  .tpm-article-page .tpm-reading-layout {
    grid-template-columns: minmax(0, 1fr) minmax(15rem, 24%);
  }

  .tpm-article-page .tpm-reading-layout > .tpm-article-sidebar {
    grid-column: 2;
    grid-row: 1;
  }
}

@media screen and (max-width: 45rem) {
  .tpm-home-reference .tpm-air-desk {
    display: block;
  }

  .tpm-home-reference .tpm-ref-brief:has(.tpm-ref-brief-art),
  .tpm-home-reference .tpm-ref-story:has(.tpm-ref-story-art),
  .tpm-newsroom .tpm-news-lead > .tpm-news-card:not(:first-child) {
    grid-template-columns: minmax(0, 1fr) clamp(4rem, 19vw, 5.5rem);
    align-items: start;
    gap: .875rem;
  }

  .tpm-home-reference :is(.tpm-ref-brief-art, .tpm-ref-story-art),
  .tpm-newsroom .tpm-news-lead > .tpm-news-card:not(:first-child) .tpm-news-art {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
  }

  .tpm-home-reference .tpm-ref-story-copy,
  .tpm-newsroom .tpm-news-lead > .tpm-news-card:not(:first-child) .tpm-news-body {
    grid-column: 1;
    grid-row: 1;
  }

  .tpm-site .tpm-newsroom :is(.tpm-news-lead, .tpm-news-grid),
  .tpm-site :is(.tpm-contact-layout, .tpm-radio-page__inner) {
    grid-template-columns: minmax(0, 1fr);
  }

  .tpm-site .tpm-search input[type="search"] {
    font-size: 1rem;
  }

  .tpm-site .tpm-reading-cover {
    margin-bottom: .875rem;
  }
}

/* Keep sharing usable on narrow phones, including when native share is absent. */
@media screen {
  .tpm-site .tpm-share,
  .tpm-site .tpm-share-links {
    min-width: 0;
    max-width: 100%;
  }

  .tpm-site .tpm-share-links > :is(a, button) {
    min-height: 44px;
    min-width: 44px;
    padding: .5rem .65rem;
    gap: .4rem;
    font-size: .8125rem;
    line-height: 1.25;
    text-align: center;
  }

  .tpm-site .tpm-share-links > :is(a, button) > span {
    position: static;
    display: inline;
    width: auto;
    height: auto;
    margin: 0;
    clip-path: none;
    overflow: visible;
    overflow-wrap: anywhere;
    white-space: normal;
    font-size: inherit;
  }

  .tpm-site .tpm-share-links :is(svg, i) {
    flex: none;
  }

  .tpm-site .tpm-share-links > :focus-visible,
  .tpm-site .tpm-manual-copy:focus-visible {
    outline: 2px solid #ff9a50;
    outline-offset: 2px;
  }

  .tpm-site .tpm-share-status {
    font-size: .8125rem;
    overflow-wrap: anywhere;
  }

  .tpm-site .tpm-share .tpm-manual-copy {
    min-width: 0;
    max-width: 100%;
    min-height: 44px;
    font-size: 1rem;
  }
}

@media screen and (max-width: 45rem) {
  .tpm-site .tpm-share,
  .tpm-site .tpm-reading-article .tpm-reader-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .625rem;
  }

  .tpm-site .tpm-share-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 7rem), 1fr));
    gap: .5rem;
  }

  .tpm-site .tpm-reading-article .tpm-reader-toolbar .tpm-reader-tools {
    justify-content: flex-start;
    min-width: 0;
  }
}

/* Keep the story opening clear and group sharing with the article footer. */
@media screen {
  .tpm-article-page .tpm-reading-header {
    margin-bottom: clamp(1rem, 2.5vw, 1.5rem);
  }

  .tpm-reading-article .tpm-article-byline {
    align-items: center;
    row-gap: .5rem;
  }

  .tpm-reading-article .tpm-reading-cover figcaption,
  .tpm-reading-prose.tpm-prose figcaption {
    color: #b8b8b8;
    font-size: .8125rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
  }

  .tpm-reading-prose.tpm-prose > p:first-of-type {
    font-size: 1em;
    line-height: inherit;
  }

  .tpm-reading-prose.tpm-prose a {
    text-decoration: underline;
    text-underline-offset: .18em;
  }

  .tpm-reading-prose.tpm-prose blockquote {
    padding: clamp(.875rem, 2.5vw, 1.5rem);
    font-size: 1.08em;
  }

  .tpm-reading-article .tpm-reader-toolbar {
    margin-top: clamp(1.25rem, 3vw, 2rem);
  }

  .tpm-article-page .tpm-article-toc summary {
    min-height: 44px;
  }
}

@media screen and (max-width: 45rem) {
  .tpm-article-page .tpm-article-breadcrumb {
    margin-bottom: 1rem;
  }

  .tpm-article-page .tpm-reading-header .tpm-categories {
    margin-bottom: .75rem;
  }
}
