/* ===========================================================================
   Article page: layout with a sticky left sidebar, table of contents, author
   box, and every content format the editor can produce. Loaded after
   articles.css on article pages.
   =========================================================================== */

.article-kicker {
  margin: 1.25rem 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-gold-text);
}

.article-meta-top {
  flex-wrap: wrap;
}

.article-meta-top a {
  color: var(--brand-green);
  text-decoration: underline;
  text-decoration-color: var(--brand-gold);
  text-underline-offset: 3px;
}

.article-meta-top .article-meta-item + .article-meta-item::before {
  content: "\2022";
  margin-right: 0.5rem;
  color: var(--brand-gold);
}

@media (max-width: 768px) {
  .article-meta-top {
    flex-direction: row;
    gap: 0.4rem 0.9rem;
    font-size: 0.8rem;
  }
}

.article-hero .article-breadcrumb {
  margin: 0 0 0.5rem;
}

/* --- Layout ---------------------------------------------------------------- */

.article-layout {
  max-width: 1440px;
  margin: 0 auto;
}

.article-main {
  min-width: 0;
}

/* Below desktop the sidebar follows the article as ordinary content. */
.article-sidebar {
  padding: 0 14px 2.5rem;
}

.article-sidebar-inner {
  max-width: 900px;
  margin: 0 auto;
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 640px) and (max-width: 1099px) {
  .article-sidebar-inner {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

@media (min-width: 1100px) {
  .article-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    column-gap: 8px;
    padding-right: 24px;
  }

  .article-main {
    grid-column: 1;
    grid-row: 1;
  }

  .article-sidebar {
    grid-column: 2;
    grid-row: 1;
    padding: 3rem 0;
  }

  .article-sidebar-inner {
    position: sticky;
    /* Clears the fixed 70px header. */
    top: 90px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    scrollbar-width: thin;
  }

  .article-main .article-container,
  .article-main .article-container-wide {
    max-width: 860px;
  }
}

/* --- Sidebar call to action ------------------------------------------------ */

.sidebar-cta {
  background: linear-gradient(150deg, var(--brand-green-dark) 0%, var(--brand-green) 100%);
  color: var(--text-white);
  border-radius: 14px;
  padding: 1.5rem 1.35rem;
  box-shadow: 0 8px 24px rgba(31, 62, 53, 0.25);
}

.sidebar-cta-eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-gold-light);
}

.sidebar-cta-title {
  margin: 0 0 0.6rem;
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
  font-size: 1.35rem;
  line-height: 1.3;
  font-weight: 700;
}

.sidebar-cta-text {
  margin: 0 0 1.1rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.9);
}

.sidebar-cta-btn {
  display: block;
  width: 100%;
  text-align: center;
}

/* --- Most read ------------------------------------------------------------- */

.sidebar-popular {
  background: var(--bg-white);
  border: 1px solid rgba(45, 95, 79, 0.15);
  border-radius: 14px;
  padding: 1.1rem 1rem 0.4rem;
}

.sidebar-heading {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dark);
}

.sidebar-popular ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-popular li + li {
  border-top: 1px solid rgba(45, 95, 79, 0.1);
}

.sidebar-popular a {
  display: grid;
  grid-template-columns: 22px 52px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 0.7rem 0;
  color: var(--text-dark);
  text-decoration: none;
}

.sidebar-popular a:hover .sidebar-popular-title,
.sidebar-popular a:focus-visible .sidebar-popular-title {
  color: var(--brand-green);
  text-decoration: underline;
}

.sidebar-rank {
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--brand-gold-text);
  text-align: center;
}

.sidebar-popular img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 8px;
}

.sidebar-popular-title {
  font-size: 0.92rem;
  line-height: 1.4;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* An item without a thumbnail keeps its title in the text column. */
.sidebar-popular a > .sidebar-popular-title:nth-child(2) {
  grid-column: 2 / -1;
}

/* --- Table of contents ----------------------------------------------------- */

.article-toc-band {
  padding-bottom: 0;
}

.article-toc {
  border: 1px solid rgba(45, 95, 79, 0.18);
  border-left: 4px solid var(--brand-gold);
  border-radius: 10px;
  background: var(--bg-off-white);
  padding: 1rem 1.25rem;
}

.article-toc summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--text-dark);
  font-size: 1rem;
}

.article-toc ol {
  margin: 0.75rem 0 0.25rem;
  padding-left: 1.25rem;
}

.article-toc li {
  margin: 0.35rem 0;
  line-height: 1.5;
}

.article-toc a {
  color: var(--brand-green);
  text-decoration: none;
}

.article-toc a:hover,
.article-toc a:focus-visible {
  text-decoration: underline;
}

/* Section links land below the fixed header. */
.article-main [id] {
  scroll-margin-top: 90px;
}

/* --- Author box and tags --------------------------------------------------- */

.article-author {
  display: flex;
  gap: 1.1rem;
  align-items: flex-start;
  padding: 1.4rem;
  border-radius: 12px;
  background: var(--bg-off-white);
  border: 1px solid rgba(45, 95, 79, 0.12);
}

.article-author img {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.article-author-label {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.article-author-name {
  margin: 0.15rem 0 0.4rem;
  font-weight: 700;
  font-size: 1.1rem;
}

.article-author-name a {
  color: var(--text-dark);
}

.article-author-bio {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.6;
}

.article-tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.25rem 0 0;
  padding: 0;
}

.article-tags li {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: rgba(45, 95, 79, 0.08);
  color: var(--brand-green);
  font-size: 0.85rem;
}

@media (max-width: 480px) {
  .article-author {
    flex-direction: column;
  }
}

/* ===========================================================================
   Body content formats from the editor
   =========================================================================== */

/* Images always fit their column, on any screen, whatever size was set. */
.article-main img,
.article-section img {
  max-width: 100%;
  height: auto;
}

.article-image-wrap {
  margin: 2rem 0;
  text-align: center;
}

.article-image-wrap img,
.article-figure img {
  border-radius: 12px;
  display: inline-block;
}

.article-figure {
  margin: 2rem 0;
  text-align: center;
}

.article-figure.align-left,
.article-figure.align-right,
.article-section img.align-left,
.article-section img.align-right {
  max-width: 50%;
}

.article-figure.align-left,
.article-section img.align-left {
  float: left;
  margin: 0.5rem 1.5rem 1rem 0;
}

.article-figure.align-right,
.article-section img.align-right {
  float: right;
  margin: 0.5rem 0 1rem 1.5rem;
}

.article-section img.align-center {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.article-section img.img-full,
.article-figure.img-full img {
  width: 100%;
}

.article-container::after,
.article-container-wide::after {
  content: "";
  display: table;
  clear: both;
}

.article-caption,
.article-figure figcaption {
  margin-top: 0.6rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-secondary);
  font-style: italic;
}

/* Floats would squeeze the text to a sliver on a phone. */
@media (max-width: 640px) {
  .article-figure.align-left,
  .article-figure.align-right,
  .article-section img.align-left,
  .article-section img.align-right {
    float: none;
    max-width: 100%;
    margin: 1.5rem auto;
    display: block;
  }
}

/* Numbered lists keep their numbers. */
.article-list.article-ol {
  counter-reset: article-ol;
}

.article-list.article-ol > li {
  counter-increment: article-ol;
}

.article-list.article-ol > li::before {
  content: counter(article-ol) ".";
  font-size: 1.05rem;
}

.article-list li > ul,
.article-list li > ol {
  margin: 0.75rem 0 0;
}

.article-lead {
  font-size: 1.3rem;
  line-height: 1.8;
  color: var(--text-dark);
  font-weight: 500;
}

.article-section a:not(.btn) {
  color: var(--brand-green);
  text-decoration: underline;
  text-decoration-color: var(--brand-gold);
  text-underline-offset: 3px;
}

.article-section mark {
  background: rgba(201, 169, 97, 0.35);
  color: inherit;
  padding: 0 0.15em;
  border-radius: 3px;
}

.article-section code {
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
  font-size: 0.9em;
  background: var(--bg-light-gray);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.article-code {
  background: #1f2a26;
  color: #f1f1f1;
  padding: 1.1rem 1.25rem;
  border-radius: 10px;
  overflow-x: auto;
  margin: 1.5rem 0 2rem;
  font-size: 0.92rem;
  line-height: 1.6;
}

.article-code code {
  background: none;
  padding: 0;
  color: inherit;
}

.article-table caption {
  caption-side: top;
  text-align: left;
  font-weight: 600;
  padding: 0 0 0.75rem;
  color: var(--text-dark);
}

.article-section h5,
.article-section h6 {
  font-size: 1.1rem;
  margin: 2rem 0 1rem;
  color: var(--text-dark);
}

.article-section sup,
.article-section sub {
  font-size: 0.75em;
}

.article-section abbr[title] {
  text-decoration: underline dotted;
  cursor: help;
}

/* Long words and URLs never push the page sideways on a phone. */
.article-section .article-text,
.article-section li {
  overflow-wrap: anywhere;
}

@media print {
  .article-sidebar,
  .article-toc {
    display: none;
  }
}

/* --- Cover inside the content column ---------------------------------------- */

.article-main .article-cover {
  padding: 2.5rem 0 0;
  background: var(--bg-white);
}

.article-main .article-cover img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* --- All-articles page: cards beside the sidebar ----------------------------- */

.articles-index-layout .article-main.page-section {
  background: transparent;
}

@media (min-width: 1100px) {
  .articles-index-layout .article-sidebar {
    padding-top: 60px;
  }

  /* Smaller cards so three sit beside the sidebar. */
  .articles-index-layout .articles-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
  }

  .articles-index-layout .articles-grid .panel-image {
    height: 140px;
  }

  .articles-index-layout .articles-grid .section-title {
    font-size: 1.05rem;
  }

  .articles-index-layout .articles-grid .section-subtitle,
  .articles-index-layout .articles-grid .section-text {
    font-size: 0.88rem;
    line-height: 1.55;
  }

  .articles-index-layout .articles-grid .btn {
    padding: 8px 14px;
    font-size: 0.9rem;
  }
}

@media (min-width: 1100px) {
  .articles-index-layout .articles-grid .service-panel {
    padding-bottom: 6px;
  }

  .articles-index-layout .articles-grid .service-panel .service-header {
    padding: 4px 4px 8px;
  }

  .articles-index-layout .articles-grid .panel-image {
    margin-bottom: 14px;
  }

  .articles-index-layout .articles-grid .section-subtitle {
    margin-bottom: 0.4rem;
  }

  .articles-index-layout .articles-grid .section-text {
    margin-bottom: 0.9rem;
  }
}

/* --- Videos fill their frame ------------------------------------------------
   In-text videos carried over from the original pages sit in an
   .article-video-wrapper whose inline "height:0" and absolutely positioned
   iframe were dropped by the save-time sanitiser. The box kept its 16:9
   padding while the player shrank to its default 150px, leaving an empty band
   under every video. These rules restore the fill for current and future
   articles, whatever inline styles survive. */
.article-video-wrapper,
.article-video-wrap {
  position: relative;
  width: 100%;
  height: 0 !important;
  padding-bottom: 56.25% !important;
  overflow: hidden;
  border-radius: 12px;
  background: #000;
}

.article-video-wrapper iframe,
.article-video-wrap iframe {
  position: absolute !important;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  border: 0;
}

/* The companion video under the cover sits close to it, not a band away. */
.article-main .article-video-band {
  padding: 1.75rem 0 0;
  background: var(--bg-white);
}

.article-main .article-video-band .article-video-wrap {
  margin: 0;
}

/* --- Whole article card is clickable -----------------------------------------
   The "Read Article" link stretches over the card, so a click anywhere opens
   the article while there is still only one link per card for keyboards and
   screen readers. */
.articles-grid .service-panel {
  position: relative;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.articles-grid .card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

.articles-grid .service-panel:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.1);
  border-color: var(--brand-gold);
}

.articles-grid .service-panel:hover .section-title {
  color: var(--brand-green);
}

.articles-grid .service-panel:focus-within {
  outline: 3px solid var(--brand-gold);
  outline-offset: 3px;
}

.articles-grid .card-link:focus-visible {
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  .articles-grid .service-panel,
  .articles-grid .service-panel:hover {
    transition: none;
    transform: none;
  }
}

/* The line that introduces a video sits just above it. */
.article-video-intro {
  margin-bottom: 0.75rem !important;
  font-style: italic;
}

.article-main .article-video-band .article-video-intro {
  margin-top: 0;
}


/* ===========================================================================
   Tables: scroll sideways on small screens instead of squeezing
   =========================================================================== */

.article-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  max-width: 100%;
  position: relative;
}

/* Columns keep a readable width; a table wider than the screen scrolls. */
.article-table {
  width: 100%;
  min-width: max-content;
}

.article-table th,
.article-table td {
  min-width: 8.5rem;
  max-width: 18rem;
  white-space: normal;
  vertical-align: top;
}

/* A soft fade on the right edge while there is more table to see. */
.article-table-wrapper.is-scrollable {
  background:
    linear-gradient(to right, var(--bg-light-gray) 30%, rgba(240, 240, 240, 0)) left center / 24px 100% no-repeat local,
    linear-gradient(to left, var(--bg-light-gray) 30%, rgba(240, 240, 240, 0)) right center / 24px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, 0.18), transparent) left center / 10px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.18), transparent) right center / 10px 100% no-repeat scroll,
    var(--bg-light-gray);
}

.article-table-hint {
  display: none;
  margin: -1.75rem 0 1.75rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: right;
}

.article-table-wrapper.is-scrollable + .article-table-hint {
  display: block;
}

/* ===========================================================================
   Phones: one 16px gutter instead of stacked paddings
   =========================================================================== */

@media (max-width: 640px) {
  .article-section,
  .article-hero,
  .article-main .article-cover,
  .article-sidebar {
    padding-left: 0;
    padding-right: 0;
  }

  .article-container,
  .article-container-wide,
  .article-main .article-container,
  .article-main .article-container-wide {
    padding-left: 0;
    padding-right: 0;
  }

  .article-sidebar {
    padding: 0 16px 2rem;
  }

  .article-section {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }

  .article-table-wrapper {
    padding: 0.5rem;
    margin: 1.75rem 0;
  }

  .article-table th,
  .article-table td {
    padding: 0.6rem 0.65rem;
    font-size: 0.9rem;
  }

  .article-infobox,
  .article-quote,
  .article-meta,
  .article-toc,
  .article-author {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .article-cta,
  .article-footer-cta {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Article cards on /articles: less inner padding, full-width image. */
  .articles-grid .service-panel {
    padding: 16px;
  }

  .articles-grid .panel-image {
    width: calc(100% + 32px);
    margin: -16px -16px 14px;
  }

  .articles-grid .service-panel .service-header {
    padding: 0;
  }
}
