/* Phone design layer: one frame, one type scale, one label voice, a composed footer. Phones only (max 719px).
   Selectors start with :root so this layer wins ties against stylesheets the server appends after it. */
@media (max-width: 719px) {
  /* One 20px frame for header, content and footer on every page. */
  :root body.inner {
    --gutter: 20px;
  }
  :root body.inner.public-topbar .masthead .masthead-inner,
  :root body.site-ui.public-home .masthead .site-masthead-inner {
    padding-inline-start: max(20px, env(safe-area-inset-left, 0px));
    padding-inline-end: max(20px, env(safe-area-inset-right, 0px));
  }
  :root body.site-ui.public-home {
    --home-hero-edge-start: max(20px, env(safe-area-inset-left, 0px));
    --home-hero-edge-end: max(20px, env(safe-area-inset-right, 0px));
  }

  /* The 404 page shares the same frame. */
  :root body.not-found-page .not-found-main {
    width: calc(100% - 2 * max(20px, var(--safe-left, 0px), var(--safe-right, 0px)));
  }

  /* Titles: regular weight and one scale. */
  :root body.inner:not(.studio-page):not(.not-found-page) main .wrap > h1,
  :root body.inner.blog-page main .blog-intro > h1,
  :root body.inner.landing-series main .series-entry-title,
  :root body.inner.blog-article-page .blog-article-head h1 {
    font-size: 34px;
    letter-spacing: -.03em;
  }
  :root body.inner.watch-page .player-main > #v-title {
    font-size: 28px;
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: -.02em;
  }
  :root body.inner.reading-page:not(.blog-page):not(.landing-series) main .wrap > h2,
  :root body.inner.library-page main .cal-group,
  :root body.inner.join-page main .shop-heading,
  :root body.inner.landing-series main .landing > h2,
  :root body.inner.landing-series main .landing-faq > h2,
  :root body.inner.landing-series main .landing-related > h2 {
    font-size: 26px;
    font-weight: 400;
    line-height: 1.25;
    letter-spacing: -.02em;
  }

  /* Card titles sit one clear step below their section headings. */
  :root .public-home #solar-system [data-mobile-cradle] .episode-card h3,
  :root .public-home #cosmic .episode-card h3,
  :root body.inner.blog-page:not(.blog-article-page) main .blog-list h2 {
    font-size: 24px;
    line-height: 1.2;
    letter-spacing: -.02em;
  }

  /* One label voice for episode and film metadata. */
  :root .public-home #solar-system [data-mobile-cradle] .episode-card > .card-meta,
  :root .public-home #cosmic .episode-card > .card-meta,
  :root body.inner.landing-series main .landing-episodes .series-access {
    color: #8fc6e0;
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
    letter-spacing: .12em;
    text-transform: uppercase;
  }

  /* Plans and Films: segmented controls share one shape. */
  :root body.join-page .plans-jump,
  :root body.library-page .filters {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 14px;
    background: rgba(232, 241, 255, .03);
  }
  :root body.join-page .plans-jump a,
  :root body.library-page .filter {
    flex: 1 0 auto;
    border-radius: 10px;
    white-space: nowrap;
  }
  :root body.join-page .plans-jump a {
    color: #dce9f1;
    font-size: 14px;
  }
  :root body.library-page .filters {
    margin-top: 18px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  :root body.library-page .filters::-webkit-scrollbar {
    display: none;
  }
  :root body.library-page .filter {
    padding-inline: 10px;
  }

  /* Series questions match the site's FAQ rows. */
  :root body.inner.landing-series main .landing-faq details {
    padding: 0;
  }
  :root body.inner.landing-series main .landing-faq summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 56px;
    padding: 14px 0;
    font-size: 17px;
    list-style: none;
  }
  :root body.inner.landing-series main .landing-faq summary::-webkit-details-marker {
    display: none;
  }
  :root body.inner.landing-series main .landing-faq summary::after {
    content: "+";
    flex: none;
    color: var(--accent-text, #58add5);
    font-size: 22px;
    font-weight: 200;
    line-height: 1;
    transition: transform .25s ease-out;
  }
  :root body.inner.landing-series main .landing-faq details[open] summary::after {
    transform: rotate(45deg);
  }
  :root body.inner.landing-series main .landing-faq details[open] {
    padding-bottom: 18px;
  }
  :root body.inner.landing-series main .landing-faq details p {
    margin: 0;
    color: #c8d7df;
    line-height: 1.7;
  }

  /* Footer: links in an even two-column grid, then the copyright line. */
  :root body:is(.inner, .site-ui):not(.studio-page) footer[data-footer] .footer-legal > .site-footer {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    text-align: center;
  }
  :root body:is(.inner, .site-ui):not(.studio-page) footer[data-footer] .footer-legal > .site-footer > :first-child {
    order: 2;
    color: #8aa3b3;
    font-size: 12px;
    letter-spacing: .04em;
  }
  :root body:is(.inner, .site-ui):not(.studio-page) footer[data-footer] .footer-legal > .site-footer > nav.footer-links[aria-label="Footer"] {
    order: 1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 12px;
    justify-items: center;
    width: 100%;
    font-size: 14px;
    line-height: 1.4;
  }
  :root body:is(.inner, .site-ui):not(.studio-page) footer[data-footer] .footer-legal > .site-footer > nav.footer-links[aria-label="Footer"] > a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0 8px;
    font-size: 14px;
  }
  :root body:is(.inner, .site-ui):not(.studio-page) footer[data-footer] .footer-legal > .site-footer > nav.footer-links[aria-label="Footer"] > a:is([href^="mailto:"], [href$="#settings"]) {
    grid-column: 1 / -1;
  }
}

/* Narrow phones: controls stay on one line where they fit, and wrap as separate pills where they do not. */
@media (max-width: 389px) {
  :root body.library-page .filter {
    padding-inline: 8px;
    font-size: 12.5px;
  }
  :root body.join-page .plans-jump a {
    flex: 1 1 auto;
    padding-inline: 4px;
    font-size: 13px;
  }
}
@media (max-width: 374px) {
  :root body.library-page .filter {
    padding-inline: 6px;
  }
}
@media (max-width: 359px) {
  :root body.library-page .filters {
    flex-wrap: wrap;
    gap: 6px;
    padding: 0;
    overflow: visible;
    border: 0;
    background: transparent;
  }
  :root body.library-page .filter {
    flex: 0 0 auto;
    border: 1px solid rgba(255, 255, 255, .12);
  }
}

@media (max-width: 719px) and (prefers-reduced-motion: reduce) {
  :root body.inner.landing-series main .landing-faq summary::after {
    transition: none;
  }
}
