/* ==========================================================================
   WBA Economic Forecast - Magazine Article Layout
   Newspaper/Magazine style editorial design
   ========================================================================== */

/* ==========================================================================
   Magazine Viewer Container
   ========================================================================== */

.magazine-viewer {
  background: #2a2a2a;
  min-height: calc(100vh - 140px);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.magazine-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
  color: white;
}

.magazine-nav-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.magazine-nav-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
}

.magazine-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.page-indicator {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  min-width: 100px;
  text-align: center;
}

/* ==========================================================================
   Magazine Spread Layout
   Standard US Magazine: 8.5" x 11" (ratio 0.7727:1)
   Two-page spread: 17" x 11"
   ========================================================================== */

.magazine-spread {
  display: flex;
  gap: 0;
  justify-content: center;
  align-items: stretch;
  /* Calculate height to fit viewport minus header/controls */
  --spread-height: min(calc(100vh - 200px), 750px);
  /* Each page width = height * 0.7727 (8.5/11 ratio) */
  --page-width: calc(var(--spread-height) * 0.7727);
  height: var(--spread-height);
}

.magazine-page {
  background: white;
  width: var(--page-width);
  height: var(--spread-height);
  padding: 1rem 1.25rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
  display: none;
  font-size: 0.68rem;
  line-height: 1.4;
  /* Ensure proper aspect ratio is maintained */
  aspect-ratio: 8.5 / 11;
}

.magazine-page.visible {
  display: block;
}

.magazine-page.left-page {
  border-radius: 3px 0 0 3px;
  /* Slight page curl shadow on the right edge */
  box-shadow:
    4px 0 8px -2px rgba(0, 0, 0, 0.15),
    0 4px 24px rgba(0, 0, 0, 0.4);
}

.magazine-page.right-page {
  border-radius: 0 3px 3px 0;
  /* Slight page curl shadow on the left edge */
  box-shadow:
    -4px 0 8px -2px rgba(0, 0, 0, 0.15),
    0 4px 24px rgba(0, 0, 0, 0.4);
}

/* Page gutter/binding shadow effect */
.magazine-page::before {
  content: '';
  position: absolute;
  top: 0;
  width: 20px;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.magazine-page.left-page::before {
  right: 0;
  background: linear-gradient(to left, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.02) 40%, transparent);
}

.magazine-page.right-page::before {
  left: 0;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.02) 40%, transparent);
}

/* Page numbers */
.page-number {
  position: absolute;
  bottom: 0.5rem;
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: var(--font-sans);
}

.magazine-page.left-page .page-number {
  left: 1rem;
}

.magazine-page.right-page .page-number {
  right: 1rem;
}

/* ==========================================================================
   Article Header (Page 1)
   ========================================================================== */

.article-header-page.visible {
  display: flex;
  flex-direction: column;
}

.article-header-page .article-category {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-gold);
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.article-header-page .article-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--wba-blue);
  line-height: 1.15;
  margin: 0 0 0.3rem;
  font-family: var(--font-sans);
}

.article-header-page .article-subtitle {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-style: italic;
  margin: 0 0 0.35rem;
  line-height: 1.3;
}

.article-header-page .article-byline {
  font-size: 0.6rem;
  color: var(--text-muted);
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 0.35rem;
}

/* ==========================================================================
   Two-Column Layout
   ========================================================================== */

.two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.two-column.wide-left {
  grid-template-columns: 1.3fr 1fr;
}

.two-column.wide-right {
  grid-template-columns: 1fr 1.3fr;
}

.column {
  min-width: 0;
}

.column-span-2 {
  grid-column: span 2;
}

/* ==========================================================================
   Typography - Compact Magazine Style
   ========================================================================== */

.magazine-page h2 {
  font-size: 0.8rem;
  color: var(--wba-blue);
  margin: 0.4rem 0 0.3rem;
  padding-top: 0.3rem;
  border-top: 1px solid var(--border-light);
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1.2;
}

.magazine-page h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.magazine-page h3 {
  font-size: 0.7rem;
  color: var(--wba-blue);
  margin: 0.3rem 0 0.2rem;
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1.2;
}

.magazine-page p {
  font-size: 0.68rem;
  line-height: 1.5;
  margin: 0 0 0.5rem;
  text-align: justify;
  font-family: var(--font-serif);
  hyphens: auto;
}

.magazine-page p.lead {
  font-size: 0.72rem;
  font-style: italic;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  line-height: 1.45;
  text-align: left;
}

.magazine-page p.small {
  font-size: 0.6rem;
  line-height: 1.45;
  margin-bottom: 0.4rem;
}

/* Drop cap for first paragraph */
.magazine-page p.drop-cap::first-letter {
  float: left;
  font-size: 2.2rem;
  line-height: 1;
  font-weight: 700;
  color: var(--wba-blue);
  margin-right: 0.15rem;
  margin-top: 0.05rem;
  font-family: var(--font-serif);
}

/* ==========================================================================
   Figures & Charts - Compact
   ========================================================================== */

.magazine-page figure {
  margin: 0.4rem 0;
}

.magazine-page figure img {
  width: 100%;
  border-radius: 2px;
  border: 1px solid var(--border-light);
}

.magazine-page figure.small-chart img {
  max-height: 100px;
  object-fit: contain;
}

.magazine-page figure.medium-chart img {
  max-height: 130px;
  object-fit: contain;
}

.magazine-page figcaption {
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  text-align: center;
  line-height: 1.3;
  font-family: var(--font-sans);
}

/* Inline figure (floated) */
.magazine-page figure.inline-left {
  float: left;
  width: 45%;
  margin: 0.25rem 0.5rem 0.25rem 0;
}

.magazine-page figure.inline-right {
  float: right;
  width: 45%;
  margin: 0.25rem 0 0.25rem 0.5rem;
}

/* ==========================================================================
   Pull Quotes - Compact
   ========================================================================== */

.magazine-page .pull-quote {
  margin: 0.3rem 0;
  padding: 0.3rem 0.4rem 0.3rem 0.5rem;
  border-left: 2px solid var(--accent-gold);
  background: var(--bg-light);
}

.magazine-page .pull-quote p {
  font-size: 0.62rem;
  font-style: italic;
  color: var(--text-secondary);
  margin: 0;
  text-align: left;
  line-height: 1.3;
}

.magazine-page .pull-quote .attribution {
  font-size: 0.6rem;
  font-style: normal;
  color: var(--wba-blue);
  margin-top: 0.2rem;
  font-weight: 500;
}

/* Sidebar pull quote */
.magazine-page .pull-quote.sidebar {
  background: var(--wba-light-blue);
  border-left: none;
  border-radius: 3px;
  padding: 0.5rem;
}

/* ==========================================================================
   Speaker/Headshot Components
   ========================================================================== */

.magazine-page .speaker-intro {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  margin: 0.3rem 0;
  padding: 0.35rem;
  background: var(--wba-light-blue);
  border-radius: 3px;
}

.magazine-page .speaker-headshot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid white;
  flex-shrink: 0;
}

.magazine-page .speaker-info h4 {
  font-size: 0.65rem;
  margin: 0 0 0.05rem;
  color: var(--wba-blue);
  font-weight: 600;
}

.magazine-page .speaker-info .title {
  font-size: 0.55rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.25;
}

/* Inline headshots */
.magazine-page .headshot-inline {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--wba-light-blue);
}

.magazine-page .headshot-group {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 0.25rem;
  align-items: center;
}

.magazine-page .headshot-caption {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-align: center;
}

/* ==========================================================================
   Section Dividers
   ========================================================================== */

.magazine-page hr {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 0.5rem 0;
}

.magazine-page hr.section-break {
  border-top: 2px solid var(--wba-blue);
  width: 50px;
  margin: 0.6rem 0;
}

/* ==========================================================================
   Key Takeaways Box
   ========================================================================== */

.magazine-page .takeaways-box {
  background: var(--bg-light);
  border: 1px solid var(--border-light);
  border-radius: 3px;
  padding: 0.4rem;
  margin: 0.3rem 0;
}

.magazine-page .takeaways-box h4 {
  font-size: 0.65rem;
  color: var(--wba-blue);
  margin: 0 0 0.2rem;
  font-weight: 600;
}

.magazine-page .takeaways-box ul {
  margin: 0;
  padding-left: 0.7rem;
  font-size: 0.58rem;
  line-height: 1.35;
}

.magazine-page .takeaways-box li {
  margin-bottom: 0.15rem;
}

.magazine-page .takeaways-box li strong {
  color: var(--wba-blue);
}

/* ==========================================================================
   Article Footer
   ========================================================================== */

.magazine-page .article-footer {
  margin-top: auto;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border-light);
  font-size: 0.6rem;
  color: var(--text-muted);
  font-style: italic;
}

.magazine-page .word-count {
  font-size: 0.55rem;
  background: var(--bg-light);
  padding: 0.1rem 0.3rem;
  border-radius: 2px;
  margin-top: 0.25rem;
  display: inline-block;
}

/* ==========================================================================
   Stat Highlights
   ========================================================================== */

.magazine-page .stat-highlight {
  text-align: center;
  padding: 0.3rem;
  background: var(--wba-light-blue);
  border-radius: 3px;
  margin: 0.25rem 0;
}

.magazine-page .stat-highlight .stat-number {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--wba-blue);
  line-height: 1;
}

.magazine-page .stat-highlight .stat-label {
  font-size: 0.5rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Inline stat row */
.stat-row {
  display: flex;
  gap: 0.3rem;
  margin: 0.3rem 0;
}

.stat-row .stat-highlight {
  flex: 1;
  margin: 0;
}

/* ==========================================================================
   Hide elements in magazine view
   ========================================================================== */

.magazine-page .download-bar,
.magazine-page .img-download-btn {
  display: none;
}

/* ==========================================================================
   Responsive - Adjust for different viewport sizes
   ========================================================================== */

/* Medium screens - reduce spread size */
@media (max-width: 1200px) {
  .magazine-spread {
    --spread-height: min(calc(100vh - 180px), 650px);
  }
}

/* Tablet - single page view */
@media (max-width: 900px) {
  .magazine-spread {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    --spread-height: auto;
    height: auto;
  }

  .magazine-page {
    width: 90vw;
    max-width: 500px;
    height: auto;
    aspect-ratio: 8.5 / 11;
    border-radius: 4px;
    padding: 1rem;
  }

  .magazine-page::before {
    display: none;
  }

  .two-column {
    grid-template-columns: 1fr;
  }

  .two-column.wide-left,
  .two-column.wide-right {
    grid-template-columns: 1fr;
  }

  .column-span-2 {
    grid-column: span 1;
  }
}

/* ==========================================================================
   Traditional Article Layout (for standalone article pages)
   ========================================================================== */

.article-wrapper {
  background: var(--bg-white);
  padding: 1.5rem 1rem;
}

.article-content {
  max-width: var(--max-article-width);
  margin: 0 auto;
}

/* Typography for standalone */
.article-content h1 {
  font-family: var(--font-sans);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--wba-blue);
  margin: 0 0 0.75rem;
}

.article-content h2 {
  font-family: var(--font-sans);
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--wba-blue);
  margin: 1.25rem 0 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border-light);
}

.article-content h3 {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 1rem 0 0.4rem;
}

.article-content p {
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-primary);
  margin: 0 0 1rem;
}

.article-lead {
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  font-family: var(--font-sans);
}

.article-meta {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-light);
}

.article-meta .byline {
  font-weight: 500;
  color: var(--text-secondary);
}

/* Pull Quotes */
.pull-quote {
  margin: 1rem 0;
  padding: 0.75rem 1rem 0.75rem 1.25rem;
  border-left: 3px solid var(--accent-gold);
  background: var(--bg-light);
  font-family: var(--font-serif);
  font-size: 1rem;
  font-style: italic;
  line-height: 1.5;
  color: var(--text-secondary);
}

.pull-quote p {
  margin: 0 0 0.5rem;
  font-size: inherit;
  line-height: inherit;
}

.pull-quote .attribution {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-style: normal;
  font-weight: 500;
  color: var(--wba-blue);
  margin-top: 0.5rem;
}

/* Speaker styles */
.speaker-intro {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 1rem 0;
  padding: 0.75rem;
  background: var(--wba-light-blue);
  border-radius: 6px;
}

.speaker-headshot {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.speaker-info h4 {
  margin: 0 0 0.2rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--wba-blue);
}

.speaker-info .title {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

.headshot-inline {
  float: left;
  margin: 0 1rem 0.75rem 0;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--wba-light-blue);
}

.headshot-group {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.headshot-group .headshot-inline {
  float: none;
  margin: 0;
  width: 60px;
  height: 60px;
}

/* Figures */
.article-figure {
  margin: 1rem 0;
  position: relative;
}

.article-figure img {
  display: block;
  width: 100%;
  border: 1px solid var(--border-light);
  border-radius: 4px;
}

.article-figure figcaption {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  text-align: center;
  font-style: italic;
}

/* Dividers */
.article-content hr {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 1.25rem 0;
}

.section-divider {
  border: none;
  border-top: 2px solid var(--wba-blue);
  margin: 1.5rem 0;
  width: 60px;
}

/* Article footer */
.article-footer {
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-light);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

.article-footer p {
  font-family: inherit;
  font-size: inherit;
  line-height: 1.5;
}

.word-count {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  background: var(--bg-light);
  border-radius: 3px;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
  .site-header,
  .site-footer,
  .download-bar,
  .img-download-btn,
  .sub-nav,
  .magazine-controls {
    display: none !important;
  }

  .main-content {
    margin-top: 0;
  }

  .magazine-page {
    box-shadow: none;
    page-break-after: always;
  }
}

/* ==========================================================================
   Responsive Standalone
   ========================================================================== */

@media (max-width: 768px) {
  .article-wrapper {
    padding: 1rem;
  }

  .article-content h1 {
    font-size: 1.5rem;
  }

  .article-content h2 {
    font-size: 1.15rem;
  }

  .article-content p {
    font-size: 0.95rem;
  }

  .speaker-intro {
    flex-direction: column;
    text-align: center;
  }

  .headshot-inline {
    float: none;
    display: block;
    margin: 0 auto 0.75rem;
  }

  .headshot-group {
    justify-content: center;
  }
}
