/* Reading Progress Bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: transparent;
  z-index: 100;
}

.reading-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--color-accent);
  transition: width 0.1s linear;
}

/* Publication Header */
.pub-header {
  padding: 48px 0 32px 0;
  max-width: 660px;
  margin: 0 auto;
}

.pub-category {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

.pub-title {
  font-family: 'Source Serif Pro', 'Georgia', 'Times New Roman', serif;
  font-size: 2.4rem;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--color-text);
  margin-bottom: 12px;
}

.pub-date {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

/* Evaluation Framework metadata */
.pub-eval-framework {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 8px;
  padding-left: 10px;
  border-left: 2px solid var(--color-accent);
}

/* Attribution Statement */
.pub-attribution {
  max-width: 660px;
  margin: 40px auto 0 auto;
  padding: 16px 0 16px 16px;
  border-left: 2px solid var(--color-accent);
}

.pub-attribution h2 {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.pub-attribution p {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--color-text-muted);
  margin: 0;
}

/* Hero Image — breaks out of parent container */
.pub-hero-image {
  width: 100vw;
  max-width: 1100px;
  margin-left: 50%;
  transform: translateX(-50%);
  margin-bottom: 40px;
}

.pub-hero-image img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 2px solid var(--color-border);
  display: block;
  cursor: zoom-in;
  transition: opacity 0.2s ease;
}

.pub-hero-image img:hover {
  opacity: 0.85;
}

/* Table of Contents */
.pub-toc {
  margin: 0 0 32px 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: 20px 0;
}

.pub-toc-heading {
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-muted);
  margin-bottom: 10px;
}

.pub-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pub-toc-list li {
  margin-bottom: 4px;
}

.pub-toc-list li.toc-sub {
  padding-left: 16px;
}

.pub-toc-link {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.pub-toc-link:hover {
  color: var(--color-text);
}

.pub-toc-link.active {
  color: var(--color-accent);
}

/* Article Body */
.pub-body {
  max-width: 660px;
  margin: 0 auto;
}

.pub-body section {
  margin-bottom: 40px;
}

.pub-body h2 {
  font-family: 'Source Serif Pro', 'Georgia', 'Times New Roman', serif;
  font-size: 1.6rem;
  font-weight: 400;
  line-height: 1.3;
  margin-bottom: 16px;
}

.pub-body h3 {
  font-family: 'Source Serif Pro', 'Georgia', 'Times New Roman', serif;
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1.4;
  margin-bottom: 12px;
  margin-top: 32px;
}

.pub-body p {
  font-size: 1.1rem;
  line-height: 1.75;
  margin-bottom: 16px;
}

.pub-body a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
  text-decoration-color: var(--color-border);
  transition: text-decoration-thickness 0.2s ease, text-underline-offset 0.2s ease;
}

.pub-body a:hover {
  text-decoration-thickness: 0.5px;
  text-underline-offset: 2px;
}

.pub-body ul,
.pub-body ol {
  font-size: 1.1rem;
  line-height: 1.75;
  margin-bottom: 16px;
  padding-left: 24px;
}

.pub-body li {
  margin-bottom: 6px;
}

/* Inline Figures */
.pub-figure {
  margin: 32px 0;
}

.pub-figure img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  display: block;
  cursor: zoom-in;
  transition: opacity 0.2s ease;
}

.pub-figure img:hover {
  opacity: 0.85;
}

/* Image Lightbox Overlay */
.pub-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.pub-lightbox.visible {
  opacity: 1;
}

.pub-lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
  transform: scale(0.95);
  transition: transform 0.25s ease;
}

.pub-lightbox.visible img {
  transform: scale(1);
}

.pub-figure figcaption {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 8px;
}

/* Key Findings */
.key-findings-box {
  background: rgba(0, 0, 0, 0.03);
  border-radius: 8px;
  padding: 32px 36px;
}

.key-findings-box h2 {
  margin-bottom: 24px;
}

.key-finding {
  padding: 20px 0;
  border-top: 1px solid var(--color-border);
}

.key-finding:last-child {
  padding-bottom: 0;
}

.key-finding p {
  margin-bottom: 0;
}

.key-finding-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.key-finding-table th {
  text-align: left;
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  padding: 0 0 8px 0;
  border-bottom: 1px solid var(--color-border);
}

.key-finding-table td {
  padding: 10px 0;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--color-border);
}

.key-finding-table td:first-child {
  color: var(--color-text-muted);
}

/* Comparison Table */
.comparison-table-wrap {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  overflow: hidden;
  margin: 24px 0;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
}

.comparison-table thead {
  background: rgba(0, 0, 0, 0.04);
}

.comparison-table th {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  padding: 14px 20px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.comparison-table th.highlight-col {
  color: var(--color-accent);
}

.comparison-table td {
  padding: 14px 20px;
  font-size: 0.95rem;
  line-height: 1.5;
  border-bottom: 1px solid var(--color-border);
}

.comparison-table tbody tr:last-child td {
  border-bottom: none;
}

.comparison-table .metric-label {
  font-weight: 500;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.comparison-table .highlight-col {
  background: rgba(217, 119, 87, 0.06);
  font-weight: 500;
}

@media (max-width: 480px) {
  .comparison-table th,
  .comparison-table td {
    padding: 10px 12px;
    font-size: 0.85rem;
  }

  .comparison-table .metric-label {
    white-space: normal;
  }
}

/* Footnote References */
.footnote-ref {
  font-size: 0.7em;
  vertical-align: super;
  line-height: 0;
  color: var(--color-accent);
  cursor: pointer;
  transition: color 0.2s ease;
}

.footnote-ref:hover {
  color: var(--color-text);
}

/* Footnote Popovers */
.footnote-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  width: 320px;
  max-width: calc(100vw - 48px);
  background: #fff;
  border-radius: 10px;
  padding: 16px 18px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--color-text-muted);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
}

.footnote-popover.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* Footnotes Section (bottom fallback) */
.pub-footnotes {
  max-width: 660px;
  margin: 40px auto 0 auto;
  padding-top: 32px;
  border-top: 1px solid var(--color-border);
}

.pub-footnotes h2 {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}

.pub-footnotes ol {
  padding-left: 20px;
}

.pub-footnotes li {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

/* Example Cards */
.example-card {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 28px 32px;
  margin-bottom: 24px;
}

.example-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 20px;
}

.example-topic {
  font-family: 'Source Serif Pro', 'Georgia', 'Times New Roman', serif;
  font-size: 1.15rem;
  font-weight: 600;
}

.example-grades {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.grade-expected {
  color: var(--color-text-muted);
}

.grade-arrow {
  color: var(--color-accent);
  font-size: 1rem;
}

.grade-actual {
  color: var(--color-accent);
  font-weight: 600;
}

.example-text {
  background: rgba(0, 0, 0, 0.03);
  border-left: 3px solid var(--color-border);
  border-radius: 0 6px 6px 0;
  padding: 16px 20px;
  margin: 0 0 20px 0;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--color-text);
}

.example-synthesis {
  font-size: 0.95rem;
  line-height: 1.65;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: rgba(217, 119, 87, 0.06);
  border-radius: 6px;
}

.example-reasoning {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.example-reasoning summary {
  cursor: pointer;
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  transition: color 0.2s ease;
}

.example-reasoning summary:hover {
  color: var(--color-text);
}

.example-reasoning-body {
  margin-top: 12px;
  padding-left: 4px;
  line-height: 1.65;
}

.example-reasoning-body p {
  font-size: 0.85rem !important;
  line-height: 1.65;
  margin-bottom: 10px;
}

@media (max-width: 480px) {
  .example-card {
    padding: 20px;
  }

  .example-card-header {
    flex-direction: column;
    gap: 4px;
  }
}

/* Wide screens — TOC sidebar */
@media (min-width: 1200px) {
  .pub-body {
    position: relative;
  }

  .pub-toc {
    position: sticky;
    top: 24px;
    width: 200px;
    margin: 0;
    border: none;
    border-top: none;
    border-bottom: none;
    padding: 0;
    float: left;
    margin-left: -240px;
  }
}

/* Publication Meta (author + date row) */
.pub-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.pub-meta-dot {
  font-size: 1rem;
}

.pub-author {
  font-weight: 500;
}

/* Sourced Terms */
.sourced-term {
  position: relative;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: var(--color-accent);
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
  cursor: help;
  transition: text-decoration-style 0.2s ease;
}

.sourced-term:hover {
  text-decoration-style: solid;
}

/* Sourced Term Popover */
.sourced-term-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  width: 300px;
  max-width: calc(100vw - 48px);
  background: #fff;
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--color-text-muted);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
  text-decoration: none;
}

.sourced-term-popover.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.sourced-term-popover a {
  color: var(--color-accent);
  font-style: italic;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sourced-term-popover a:hover {
  color: var(--color-text);
}

.sourced-term-popover .source-label {
  font-style: italic;
  color: var(--color-text-muted);
}

/* Dr. Seuss Whimsy */
.sourced-term--whimsy {
  text-decoration: none;
  font-weight: inherit;
  cursor: default;
}

.sourced-term--whimsy:hover {
  text-decoration: none;
  cursor: pointer;
}

.sourced-term--whimsy:hover .whimsy-text {
  background: linear-gradient(90deg, #d97757, #d4a853, #6ba89a, #a88bc4);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: seuss-wiggle 0.6s ease-in-out;
  letter-spacing: 0.04em;
}

.whimsy-text {
  display: inline;
  letter-spacing: 0;
  transition: letter-spacing 0.3s ease;
}

/* Seuss-style popover */
.sourced-term--whimsy .sourced-term-popover {
  background: #fffef5;
  border: 2.5px solid #d4a853;
  border-radius: 18px 18px 18px 4px;
  transform: translateX(-50%) translateY(4px) rotate(-1.5deg);
  box-shadow: 4px 6px 0 rgba(217, 119, 87, 0.15);
  padding: 16px 20px;
  font-style: italic;
}

.sourced-term--whimsy .sourced-term-popover.visible {
  transform: translateX(-50%) translateY(0) rotate(-1.5deg);
}

@keyframes seuss-wiggle {
  0%, 100% { transform: translateY(0) rotate(0); }
  20% { transform: translateY(-2px) rotate(-1deg); }
  40% { transform: translateY(0) rotate(1deg); }
  60% { transform: translateY(-1px) rotate(-0.5deg); }
  80% { transform: translateY(0) rotate(0.5deg); }
}

/* Responsive — 768px */
@media (max-width: 768px) {
  .pub-title {
    font-size: 1.8rem;
  }

  .pub-body p {
    font-size: 1rem;
  }

  .pub-body ul,
  .pub-body ol {
    font-size: 1rem;
  }

  .pub-body h2 {
    font-size: 1.4rem;
  }

  .pub-body h3 {
    font-size: 1.15rem;
  }

  /* Mobile bottom-sheet popover */
  .sourced-term-popover.bottom-sheet {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: translateY(100%);
    width: 100%;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    padding: 20px 24px calc(20px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
    z-index: 200;
  }

  .sourced-term-popover.bottom-sheet.visible {
    transform: translateY(0);
  }

  /* Disable whimsy animation on mobile */
  .sourced-term--whimsy:hover .whimsy-text {
    animation: none;
    letter-spacing: 0;
  }

  /* Seuss popover as bottom-sheet on mobile */
  .sourced-term--whimsy .sourced-term-popover.bottom-sheet {
    border-radius: 18px 18px 0 0;
    transform: translateY(100%) rotate(0);
    border: 2.5px solid #d4a853;
    border-bottom: none;
    background: #fffef5;
    font-style: italic;
    box-shadow: 0 -4px 0 rgba(217, 119, 87, 0.15);
  }

  .sourced-term--whimsy .sourced-term-popover.bottom-sheet.visible {
    transform: translateY(0) rotate(0);
  }
}

/* Responsive — 480px */
@media (max-width: 480px) {
  .pub-header {
    padding: 32px 0 24px 0;
  }

  .pub-title {
    font-size: 1.5rem;
  }

  .pub-toc {
    padding: 16px 0;
  }

  .pub-hero-image {
    margin-bottom: 28px;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .sourced-term--whimsy:hover .whimsy-text {
    animation: none;
    letter-spacing: 0;
  }

  .sourced-term--whimsy .sourced-term-popover {
    transform: translateX(-50%) translateY(4px) rotate(0);
  }

  .sourced-term--whimsy .sourced-term-popover.visible {
    transform: translateX(-50%) translateY(0) rotate(0);
  }
}
