/* ========================================
   ARTICLE PAGE LAYOUT (ap- prefix)
   Extracted from temp_packages/homepage/article.html
   ======================================== */

.af-header .af-reading-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  top: auto;
  height: 3px;
}

/* Takeaway link (takeaways serve as TOC when heading blocks present) */
.ap-takeaway-link {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}
.ap-takeaway-link:hover,
.ap-takeaway-link:focus-visible {
  color: var(--af-dark-blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.af-takeaways-item--active .ap-takeaway-link {
  color: var(--af-violet);
  font-weight: 600;
}

/* Continuation block (link to next part) */
.ap-continuation {
    display: block;
    background: var(--bg-secondary);
    border-radius: var(--radius, 4px);
    padding: var(--space-4, 16px) var(--space-5, 24px);
    margin: var(--space-5, 24px) 0;
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
}
.ap-continuation:hover,
.ap-continuation:focus-visible {
    background: var(--bg-tertiary, var(--bg-secondary));
}
.ap-continuation-label {
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: var(--tracking-widest);
    margin-bottom: var(--space-1, 4px);
}
.ap-continuation-text {
    font-family: var(--font-body);
    font-size: var(--text-base);
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* Previous-part link banner above hero */
.ap-continuation-link {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--space-2, 8px) var(--space-3, 12px);
    margin-bottom: var(--space-3, 12px);
    border-left: 3px solid var(--af-violet);
    background: var(--bg-secondary);
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
}
.ap-continuation-link:hover,
.ap-continuation-link:focus-visible {
    background: var(--bg-tertiary, var(--bg-secondary));
}
.ap-continuation-link .ap-continuation-label {
    margin-bottom: 0;
}
.ap-continuation-title {
    font-family: var(--font-headline, var(--font-body));
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
}

/* Heading anchor offset for sticky header */
.ap-prose h2.ap-block-heading[id],
.ap-prose h3.ap-block-heading[id],
.ap-prose h4.ap-block-heading[id] {
  scroll-margin-top: 80px;
}

.ap-hero-zone {
  padding-top: var(--space-5);
  padding-bottom: var(--space-5);
}

.ap-prose-width {
  max-width: 720px;
  margin: 0 auto;
}

.ap-category {
  margin-bottom: var(--space-1);
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  max-width: 65%;
}

.ap-category-rule {
  flex: 1;
  height: 2px;
  background: var(--af-violet);
  flex-shrink: 1;
  align-self: center;
  min-width: 24px;
}

.ap-article-number {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}

.ap-category-sep {
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}

.ap-article-date {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}

/* Share — match topbar icon pattern */
.af-share-btn {
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: none;
}
.af-share-btn:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

.af-share-channels { flex-wrap: wrap; }
.af-share-native { display: none; }

.af-share-btn.af-copy-done {
  color: var(--af-dark-blue);
}
[data-theme="dark"] .af-share-btn.af-copy-done {
  color: var(--af-violet);
}

/* Tap highlight — active press feedback */
[data-theme="dark"] .ap-takeaway-link:active,
[data-theme="dark"] .ap-article-nav-item:active,
[data-theme="dark"] .ap-author-name a:active {
  background-color: rgba(160, 112, 240, 0.15);
}

/* Byline — larger photo for article page */
.ap-hero-zone .af-byline-photo {
  width: 56px;
  height: 56px;
}
.ap-hero-zone .af-byline-name {
  font-size: var(--text-base);
}

.ap-title {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
  margin: 0 0 var(--space-3) 0;
}

.ap-lead {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0 0 var(--space-4) 0;
}

.ap-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

/* Hero variant A: single image (default) */
.ap-hero-figure {
  margin-bottom: var(--space-4);
}
.ap-hero-figure img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
}

/* Hero variant B: diptych (1+1) */
.ap-hero-diptych {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.ap-hero-diptych img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: var(--radius);
}
.ap-hero-diptych figcaption {
  grid-column: 1 / -1;
}

/* Hero variant C: triptych (1+1+1) */
.ap-hero-triptych {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.ap-hero-triptych img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: var(--radius);
}
.ap-hero-triptych figcaption {
  grid-column: 1 / -1;
}

/* Hero variant D: diptych on background (1+bg+1) */
.ap-hero-collage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
  background: var(--af-dark-blue);
  border-radius: var(--radius);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
}
.ap-hero-collage img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: var(--radius);
}
.ap-hero-collage figcaption {
  grid-column: 1 / -1;
  color: rgba(246, 247, 247, 0.6);
}
.ap-hero-collage .af-figcaption-credit {
  color: rgba(246, 247, 247, 0.4);
}

/* Hero variant E: asymmetric (2/3 + 1/3) */
.ap-hero-asymmetric {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.ap-hero-asymmetric .ap-hero-primary {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
}
.ap-hero-asymmetric .ap-hero-secondary {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius);
}
.ap-hero-asymmetric figcaption {
  grid-column: 1 / -1;
}

/* Hero variant F: portrait spotlight */
.ap-hero-spotlight {
  margin-bottom: var(--space-4);
  text-align: center;
}
.ap-hero-spotlight img {
  width: 50%;
  max-width: 360px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: var(--radius);
  margin: 0 auto;
  display: block;
}

/* Hero variant G: cinematic (21:9) */
.ap-hero-cinematic {
  margin-bottom: var(--space-4);
}
.ap-hero-cinematic img {
  width: 100%;
  aspect-ratio: 21 / 9;
  object-fit: cover;
  border-radius: var(--radius);
}

/* Hero variant H: image + pull quote */
.ap-hero-quote {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-bottom: var(--space-4);
  border-radius: var(--radius);
  overflow: hidden;
}
.ap-hero-quote img {
  width: 100%;
  height: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}
.ap-hero-pullquote {
  background: var(--af-dark-blue);
  color: var(--af-light-grey);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-6);
}
.ap-hero-pullquote p {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  line-height: 1.4;
  margin: 0 0 var(--space-3);
  font-style: italic;
}
.ap-hero-pullquote cite {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-style: normal;
  color: rgba(246, 247, 247, 0.6);
  letter-spacing: 0.02em;
}
.ap-hero-quote figcaption {
  grid-column: 1 / -1;
}

/* Hero variant I: no image (typographic) */
.ap-hero-typographic {
  margin-bottom: var(--space-4);
  padding: var(--space-4) 0;
  text-align: center;
}
.ap-hero-typo-rule {
  width: 120px;
  height: 2px;
  background: var(--af-violet);
  margin: 0 auto;
}

/* Hero variant J: picture-in-picture */
.ap-hero-pip {
  position: relative;
  margin-bottom: var(--space-4);
}
.ap-hero-pip .ap-hero-primary {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  display: block;
}
.ap-hero-pip .ap-hero-inset {
  position: absolute;
  bottom: var(--space-4);
  right: var(--space-4);
  width: 180px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: var(--radius);
  border: 3px solid var(--bg);
  box-shadow: var(--shadow-md);
}
.ap-hero-pip figcaption {
  position: relative;
}

/* Prose typography */
.ap-prose {
  max-width: 720px;
  margin: 0 auto;
}

.ap-prose p {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--text);
  margin: 0 0 var(--space-3) 0;
}

.ap-prose h2 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  margin: var(--space-5) 0 var(--space-3) 0;
}

.ap-prose h3 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  margin: var(--space-4) 0 var(--space-2) 0;
}

.ap-prose ul,
.ap-prose ol {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--text);
  margin: 0 0 var(--space-3) 0;
  padding-left: var(--space-4);
}

.ap-prose li {
  margin-bottom: var(--space-1);
}

.ap-prose .af-blockquote,
.ap-prose .af-pullquote,
.ap-prose .af-expert-quote {
  margin: var(--space-5) 0;
}
.ap-prose .af-takeaways,
.ap-prose .af-context-box,
.ap-prose .af-factcheck,
.ap-prose .af-timeline,
.ap-prose .af-figure {
  margin: var(--space-4) 0;
}

.ap-prose .af-figure img,
.ap-hero-figure img {
  background: var(--bg-tertiary);
}

.ap-prose .af-figure img {
  width: 100%;
  border-radius: var(--radius);
}

/* Tags + bottom share */
.ap-article-footer {
  max-width: 720px;
  margin: var(--space-5) auto 0;
}

.ap-tags-row {
  margin-bottom: var(--space-4);
}

.ap-bottom-share {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}
.ap-bottom-share-label {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  text-transform: uppercase;
  font-weight: 500;
  letter-spacing: 0.05em;
}

/* Author card section — unified with author profile page */
.ap-author-section {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-4) 0;
}

.ap-author-stage {
  background: var(--bg-tertiary);
  overflow: hidden;
}

.ap-author-bar-row {
  display: flex;
  justify-content: space-between;
}

.ap-author-content {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-4) var(--space-4);
}

.ap-author-portrait {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
}

.ap-author-info {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ap-author-name {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
  margin: 0 0 var(--space-1);
}

.ap-author-name a {
  color: inherit;
  text-decoration: none;
}
.ap-author-name a:hover {
  color: var(--af-violet);
}
.ap-author-name a:active {
  background-color: var(--af-violet-light-2);
}

.ap-author-role {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--af-violet);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
}

.ap-author-bio {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

/* Prev / Next navigation */
.ap-article-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-top: 1px solid var(--border-light);
}
.ap-article-nav-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  text-decoration: none;
  color: inherit;
  padding: var(--space-3);
  border-radius: var(--radius);
  transition: background var(--transition-fast);
}
.ap-article-nav-item:hover {
  background: var(--bg-secondary);
}
.ap-article-nav-item:active {
  background: var(--af-violet-light-2);
}
.ap-article-nav-item--next {
  text-align: right;
  align-items: flex-end;
}
.ap-article-nav-label {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--text-tertiary);
}
.ap-article-nav-number {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--af-violet);
  font-weight: 500;
}
.ap-article-nav-title {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

/* Related articles */
.ap-related-section {
  padding: var(--space-4) 0;
}

.ap-related-heading-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.ap-related-heading {
  white-space: nowrap;
}

.ap-related-rule {
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

.ap-related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

/* Back to section */
.ap-back-to-section {
  padding: var(--space-4) 0 var(--space-5);
  text-align: center;
}

.ap-back-to-section-link {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-3);
  text-decoration: none;
  color: inherit;
}

.ap-back-to-section-link .af-card-category {
  pointer-events: none;
}

.ap-back-to-section-text {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  transition: color var(--transition-fast);
}

.ap-back-to-section-link:hover .ap-back-to-section-text {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

/* Takeaway anchor links */
.ap-takeaway-link {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}
.ap-takeaway-link:hover,
.ap-takeaway-link:focus-visible {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.ap-takeaway-link:active {
  background-color: var(--af-violet-light-2);
}

/* Scroll offset for sticky header + progress bar */
.ap-prose h2[id],
.ap-prose h3[id],
.ap-prose p[id] {
  scroll-margin-top: 80px;
}

/* Newsletter (reused from homepage) */
.ap-newsletter-section {
  padding: var(--space-5) 0;
}

/* ========================================
   EDITORIAL ENHANCEMENTS
   ======================================== */

/* Section numbering — Roman numerals */
.ap-prose {
  counter-reset: ap-section;
}
.ap-prose > h2 {
  counter-increment: ap-section;
}
.ap-prose > h2::before {
  content: counter(ap-section, upper-roman);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--af-violet);
  display: block;
  margin-bottom: var(--space-1);
}

/* Conclusion zone */
.ap-conclusion {
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  position: relative;
}
.ap-conclusion::before {
  content: '';
  display: block;
  width: 120px;
  height: 2px;
  background: var(--af-violet);
  position: absolute;
  top: 0;
  left: 0;
}
.ap-conclusion p:last-child {
  margin-bottom: 0;
}

/* Updated date */
.ap-article-updated {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
  font-style: italic;
  margin-bottom: var(--space-2);
}
.ap-article-updated:empty {
  display: none;
}

/* Share layout + bookmark */
.af-share {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.af-share-sep {
  width: 1px;
  height: 16px;
  background: var(--border-light);
}

/* Part separator */
.ap-part-separator {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-5) 0 var(--space-3) 0;
}
.ap-part-rule {
  flex: 1;
  height: 1px;
  background: var(--border-light);
}
.ap-part-label {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--text-tertiary);
  white-space: nowrap;
}
.ap-continuation {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-5);
  margin: var(--space-5) 0;
  text-align: center;
}
.ap-continuation-label {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  margin-bottom: var(--space-1);
}
.ap-continuation-text {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
  body { padding-bottom: 56px; }

  .ap-hero-zone {
    padding-top: var(--space-4);
    padding-bottom: var(--space-3);
  }

  .ap-title {
    font-size: var(--text-3xl);
    margin-bottom: var(--space-2);
  }

  .ap-lead {
    margin-bottom: var(--space-3);
  }

  .ap-meta-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
  }

  .ap-category {
    max-width: 100%;
    flex-wrap: wrap;
    gap: var(--space-2);
  }
  .ap-category-sep {
    display: none;
  }
  .ap-article-date {
    width: 100%;
  }

  .ap-hero-figure img {
    aspect-ratio: 4 / 3;
  }

  /* Hero variants — mobile stacking */
  .ap-hero-diptych {
    grid-template-columns: 1fr;
  }
  .ap-hero-diptych img {
    aspect-ratio: 16 / 9;
  }
  .ap-hero-triptych {
    grid-template-columns: 1fr;
  }
  .ap-hero-triptych img {
    aspect-ratio: 16 / 9;
  }
  .ap-hero-collage {
    grid-template-columns: 1fr;
    padding: var(--space-3);
    gap: var(--space-3);
  }
  .ap-hero-collage img {
    aspect-ratio: 16 / 9;
  }
  .ap-hero-asymmetric {
    grid-template-columns: 1fr;
  }
  .ap-hero-asymmetric .ap-hero-primary {
    aspect-ratio: 16 / 9;
  }
  .ap-hero-asymmetric .ap-hero-secondary {
    aspect-ratio: 16 / 9;
  }
  .ap-hero-spotlight img {
    width: 70%;
  }
  .ap-hero-quote {
    grid-template-columns: 1fr;
  }
  .ap-hero-quote img {
    aspect-ratio: 16 / 9;
  }
  .ap-hero-pullquote {
    padding: var(--space-4);
  }
  .ap-hero-pullquote p {
    font-size: var(--text-lg);
  }
  .ap-hero-pip .ap-hero-inset {
    width: 120px;
    bottom: var(--space-2);
    right: var(--space-2);
  }

  .ap-prose h2 {
    font-size: var(--text-xl);
    margin-top: var(--space-4);
  }

  .ap-prose h3 {
    font-size: var(--text-lg);
  }

  .ap-author-content {
    grid-template-columns: 1fr;
    text-align: center;
    padding: var(--space-4) var(--space-3);
  }
  .ap-author-portrait {
    width: 140px;
    margin: 0 auto;
  }
  .ap-author-name {
    font-size: var(--text-xl);
  }
  .ap-author-info .af-author-card-expertise {
    justify-content: center;
  }

  .ap-related-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .ap-newsletter-section {
    padding: var(--space-4) 0;
  }
  .ap-newsletter-section .af-layout-horizontal {
    max-width: 100% !important;
  }
  .ap-newsletter-section .af-layout-photo-col {
    display: none;
  }
  .ap-newsletter-section .af-layout-content {
    grid-template-columns: 1fr !important;
  }

  .ap-article-footer {
    margin-top: var(--space-4);
  }

  .ap-conclusion {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
  }
  .ap-bottom-share-label { display: none; }
  .af-share-btn { width: 44px; height: 44px; }
  .af-share-native { display: inline-flex; }
  .af-share-channels .af-share-btn[aria-label="Share via email"],
  .af-share-channels .af-share-btn[aria-label="Share on X"],
  .af-share-channels .af-share-btn[aria-label="Share on LinkedIn"],
  .af-share-channels .af-share-btn[aria-label="Share on Facebook"],
  .af-share-channels .af-share-btn[aria-label="Share on Telegram"],
  .af-share-channels .af-share-btn[aria-label="Share on WhatsApp"] { display: none; }
}

@media (max-width: 480px) {
  .ap-title {
    font-size: var(--text-2xl);
  }
}

/* ============================================
   STATIC PAGE MODIFIERS
   ============================================ */

.ap-prose-width--page-top {
  padding-top: var(--space-3);
  margin-bottom: var(--space-4);
}

.ap-hero-figure--spaced {
  margin: var(--space-4) 0;
}

.ap-page-children--spaced {
  margin-top: var(--space-5);
}
