/*
 * Long-form content: magazine articles, legal pages, pagination, comments.
 *
 * Almost none of this has an app counterpart to copy — the article body, the
 * excerpts and the legal pages are all things the app does not render (see
 * single-post.php and page-legal.php). What exists here is the minimum needed to
 * make real prose readable in the app's typography, not a new design.
 */

/* ── Magazine listing ─────────────────────────────────────────────────── */

/* The app's lead excerpt is a commented-out <p> inside a fixed 100px box. With
   real text, clamp instead of hard-cropping so a sentence never ends mid-letter. */
.rc-lead-excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rc-magazine-card {
  text-align: left;
  cursor: pointer;
  color: #171e27;
  padding: 10px;
  width: 100%;
  text-decoration: none;
  display: block;
}

.rc-magazine-card-title {
  font-size: 2.6rem;
  line-height: 1.2;
  margin: 8px 0 4px;
}

.rc-magazine-card:hover .rc-magazine-card-title {
  color: #ff7700;
}

/* The app fixes these at 20px tall with overflow:hidden, which slices the text
   through the middle of a line. Two clamped lines read as intended instead. */
.rc-magazine-card-excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Pagination ───────────────────────────────────────────────────────── */

.rc-pagination,
.navigation.pagination {
  padding: 30px 0 0;
  text-align: center;
}

.navigation.pagination .page-numbers {
  display: inline-block;
  padding: 8px 14px;
  margin: 0 4px;
  color: #171e27;
  text-decoration: none;
  border: 1px solid rgba(23, 30, 39, 0.2);
}

.navigation.pagination .page-numbers.current,
.navigation.pagination .page-numbers:hover {
  background: var(--color-orange);
  border-color: var(--color-orange);
  color: #fff;
}

/* ── Article ──────────────────────────────────────────────────────────── */

/* Clearance under the fixed 88px navbar.
 *
 * The app never needs this: MagazineArticle.js always renders
 * .magazine-article-head, even when featuredImage is empty — a 620px blank block
 * that happens to push the article clear. This template omits the block when
 * there is no featured image, which is better markup but removes the accident, so
 * the title slid under the navbar. Caught by rendering the page, not by reading it.
 */
.article-container {
  padding-top: 88px;
}

/* ...unless the header image is there, in which case it already does the job. */
.magazine-article-head + .article-container {
  padding-top: 0;
}

.rc-byline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rc-avatar {
  border-radius: 2px;
}

.rc-article-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 10px 0 24px;
  font-size: 1.5rem;
}

/* The body is editor output, so it has to style tags rather than classes. Sized
   to the 1.8rem the app set inline on its (empty) body paragraph. */
.rc-article-body {
  font-size: 1.8rem;
  line-height: 1.7;
  max-width: 78ch;
}

.rc-article-body > * + * {
  margin-top: 1.1em;
}

.rc-article-body h2 {
  font-size: 3.2rem;
  line-height: 1.25;
  margin-top: 1.6em;
}

.rc-article-body h3 {
  font-size: 2.4rem;
  line-height: 1.3;
  margin-top: 1.4em;
}

.rc-article-body a {
  color: var(--color-orange);
}

.rc-article-body img,
.rc-article-body iframe {
  max-width: 100%;
  height: auto;
}

.rc-article-body ul,
.rc-article-body ol {
  padding-left: 1.4em;
}

/* base.css strips list markers globally via App.css's `ul { list-style: none }`,
   which is right for navigation and wrong for prose. */
.rc-article-body ul {
  list-style: disc;
}

.rc-article-body blockquote {
  border-left: 3px solid var(--color-orange);
  padding-left: 1em;
  font-style: italic;
}

.rc-article-body figure {
  margin: 1.6em 0;
}

.rc-article-body figcaption {
  font-size: 1.4rem;
  opacity: 0.75;
  margin-top: 0.5em;
}

.rc-share {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

/* The links are the network logos now, so these are icon buttons: a fixed hit
   area rather than text, and the accessible name in .screen-reader-text. */
.rc-share-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--color-orange);
  font-size: 2rem;
  line-height: 1;
  transition: color 0.2s ease, transform 0.2s ease;
}

.rc-share-link:hover,
.rc-share-link:focus-visible {
  color: var(--color-orange-light);
  transform: translateY(-1px);
}

.rc-share-link:focus-visible {
  outline: 2px solid var(--color-orange);
  outline-offset: 2px;
}

/* Available to a screen reader, invisible on screen. `clip-path` with a 1px box
   rather than display:none, which would take the text out of the accessibility
   tree and leave each icon link with no name at all. */
.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ── Legal pages ──────────────────────────────────────────────────────── */

.rc-legal {
  background: var(--color-gray-dark);
  padding: 128px 20px 80px; /* clears the 88px fixed navbar */
}

.rc-legal-title,
.rc-legal-updated,
.rc-legal-body {
  max-width: 80ch;
  margin-left: auto;
  margin-right: auto;
}

.rc-legal-title {
  font-size: 4rem;
  line-height: 1.2;
}

.rc-legal-updated {
  opacity: 0.6;
  font-size: 1.5rem;
  margin: 8px auto 32px;
}

.rc-legal-body {
  font-size: 1.7rem;
  line-height: 1.7;
}

.rc-legal-body > * + * {
  margin-top: 1.1em;
}

.rc-legal-body h2 {
  font-size: 2.6rem;
  margin-top: 1.8em;
}

.rc-legal-body h3 {
  font-size: 2rem;
  margin-top: 1.4em;
}

.rc-legal-body a {
  color: var(--color-orange);
}

.rc-legal-body ul,
.rc-legal-body ol {
  padding-left: 1.4em;
}

.rc-legal-body ul {
  list-style: disc;
}

/* ── Comments ─────────────────────────────────────────────────────────── */

.comments-area {
  margin-top: 48px;
  max-width: 78ch;
  font-size: 1.6rem;
}

.comments-area .comment-list {
  list-style: none;
  padding: 0;
}

.comments-area .comment-body {
  padding: 16px 0;
  border-bottom: 1px solid rgba(23, 30, 39, 0.12);
}

.comments-area input[type="text"],
.comments-area input[type="email"],
.comments-area input[type="url"],
.comments-area textarea {
  width: 100%;
  padding: 10px;
  font-size: 1.6rem;
  border: 1px solid rgba(23, 30, 39, 0.25);
}

.comments-area .submit {
  background: var(--color-orange);
  color: #fff;
  border: 0;
  padding: 12px 26px;
  font-size: 1.6rem;
  cursor: pointer;
}

/* ── 404 ──────────────────────────────────────────────────────────────────
   No app counterpart to copy: the CRA app has no 404 route — an unknown path
   falls through to its catch-all and shows the home page. */
.rc-error {
  background: var(--color-gray-dark);
  padding: 160px 20px 100px; /* clears the 88px fixed navbar */
  text-align: center;
  min-height: 60vh;
}

.rc-error-title {
  font-size: 4rem;
  line-height: 1.2;
  margin-bottom: 12px;
}

.rc-error-body {
  font-size: 1.8rem;
  opacity: 0.8;
  max-width: 52ch;
  margin: 0 auto 32px;
}

.rc-error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 40px;
}

.rc-error .search-form {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.rc-error .search-field {
  padding: 12px 14px;
  font-size: 1.6rem;
  min-width: 260px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: var(--color-gray);
  color: #fff;
}

.rc-error .search-submit {
  padding: 12px 24px;
  font-size: 1.6rem;
  border: 0;
  background: var(--color-orange);
  color: #fff;
  cursor: pointer;
}

/* ── Video lightbox ────────────────────────────────────────────────────────
   The tiles on the home page and How It Works. One shared <dialog>, printed in
   the footer so it is positioned against the viewport rather than against one of
   this theme's skewed or clipped ancestors. */
.rc-video-dialog {
  width: min(92vw, 1100px);
  max-width: 92vw;
  /*
   * A modal <dialog> is centred by the UA stylesheet's `margin: auto`. base.css
   * opens with `* { margin: 0 }`, which beats it on specificity, so without this
   * the dialog pins to the top-left corner of the viewport and the close button —
   * positioned 44px above the frame — lands off-screen and cannot be clicked at
   * all. Restoring the centring is the whole fix; the same reset will do this to
   * any future dialog.
   */
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
  color: #fff;
}

.rc-video-dialog::backdrop {
  background: rgba(5, 5, 5, 0.82);
}

.rc-video-dialog-inner {
  position: relative;
}

/* 16:9, so the frame never letterboxes or jumps as the iframe loads. */
.rc-video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  background: #000;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.rc-video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.rc-video-close {
  position: absolute;
  top: -44px;
  right: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 3.4rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease;
}

.rc-video-close:hover,
.rc-video-close:focus-visible {
  color: var(--color-orange);
}

.rc-video-close:focus-visible {
  outline: 2px solid var(--color-orange);
  outline-offset: 4px;
}

/* On a phone the close button has no room above the frame, so it sits on it. */
@media screen and (max-width: 600px) {
  .rc-video-close {
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.55);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .rc-video-dialog[open] {
    animation: rc-video-in 0.18s ease-out;
  }

  @keyframes rc-video-in {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
  }
}
