/* =============================================
   article.css — Article Page Design System
   Premium dental education article layout
   ============================================= */

/* ══════════════════════════════════════
   ARTICLE HERO — Top Banner
   ══════════════════════════════════════ */
.article-hero {
  padding: var(--space-2xl) var(--space-xl) var(--space-sm);
  max-width: 1000px;
  margin: 0 auto;
  opacity: 0;
  transform: translateY(20px);
  animation: articleFadeIn 0.8s cubic-bezier(0.32, 0.72, 0, 1) 0.15s forwards;
}

@keyframes articleFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Eyebrow badge — tiny pill */
.article-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--color-text-secondary);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: var(--space-lg);
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}

.article-eyebrow::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
  flex-shrink: 0;
}

/* Article main title */
.article-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-lg);
}

/* Topic intro paragraph — the 50-char thematic blurb */
.article-intro {
  font-family: var(--font-body);
  font-size: 1.2rem;
  color: var(--color-text-secondary);
  line-height: 1.85;
  font-weight: 300;
  max-width: 640px;
  padding: var(--space-lg);
  background: var(--color-surface);
  border-left: 3px solid var(--color-accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  box-shadow: 0 2px 16px rgba(61, 107, 132, 0.06);
}

/* Hero separator */
.article-hero-divider {
  border: none;
  height: 1px;
  background: var(--color-border);
  margin-top: var(--space-xl);
}


/* ══════════════════════════════════════
   ARTICLE BODY — Content Container
   ══════════════════════════════════════ */
.article-body {
  max-width: 1000px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-xl) var(--space-3xl);
}

/* Scroll-reveal for article sections */
.article-section {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.65s cubic-bezier(0.32, 0.72, 0, 1),
              transform 0.65s cubic-bezier(0.32, 0.72, 0, 1);
}

.article-section.is-visible {
  opacity: 1;
  transform: translateY(0);
}


/* ══════════════════════════════════════
   TYPOGRAPHY — Article Content Styles
   ══════════════════════════════════════ */

/* H2 — Section heading */
.article-body h2 {
  font-family: var(--font-display);
  font-size: clamp(1.725rem, 3.45vw, 2.125rem);
  font-weight: 800;
  color: var(--color-text-primary);
  line-height: 1.25;
  margin-top: var(--space-sm);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
  position: relative;
}

.article-body h2::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 48px;
  height: 2px;
  background: var(--color-accent);
}

/* H3 — Sub-section heading */
.article-body h3 {
  font-family: var(--font-display);
  font-size: clamp(1.32rem, 2.875vw, 1.55rem);
  font-weight: 800;
  color: var(--color-text-primary);
  line-height: 1.3;
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
  padding-left: var(--space-md);
  border-left: 3px solid var(--color-accent);
}

/* H4 — Minor heading */
.article-body h4 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1.4;
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

/* Paragraph */
.article-body p {
  font-family: var(--font-body);
  font-size: 1.15rem;
  color: var(--color-text-primary);
  line-height: 1.9;
  font-weight: 400;
  margin-bottom: var(--space-lg);
}

/* Bold text */
.article-body strong {
  font-weight: 500;
  color: var(--color-text-primary);
}

/* Emphasis / Italic */
.article-body em {
  font-style: italic;
  color: var(--color-text-secondary);
}

/* Inline highlight keyword */
.keyword {
  display: inline;
  padding: 2px 8px;
  background: var(--color-accent-light);
  border-radius: 4px;
  font-weight: 600;
  color: var(--color-accent);
  font-size: 1.02em;
}

/* Accent-colored text */
.text-accent {
  color: var(--color-accent);
  font-weight: 600;
}

/* Underline decoration */
.text-underline {
  text-decoration: underline;
  text-decoration-color: var(--color-accent);
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
}

/* Ordered & Unordered Lists */
.article-body ol,
.article-body ul {
  margin-bottom: var(--space-lg);
  padding-left: var(--space-lg);
}

.article-body ol {
  list-style: decimal;
}

.article-body ul {
  list-style: none;
}

.article-body ul li {
  position: relative;
  padding-left: var(--space-lg);
}

.article-body ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
}

.article-body li {
  font-family: var(--font-body);
  font-size: 1.15rem;
  color: var(--color-text-primary);
  line-height: 1.85;
  font-weight: 300;
  margin-bottom: var(--space-sm);
}

/* Blockquote — callout box */
.article-body blockquote {
  margin: var(--space-xl) 0;
  padding: var(--space-lg) var(--space-xl);
  background: var(--color-surface);
  border-left: 4px solid var(--color-accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  box-shadow: 0 2px 16px rgba(61, 107, 132, 0.06);
}

.article-body blockquote p {
  margin-bottom: 0;
  font-size: 1.1rem;
  font-style: italic;
  color: var(--color-text-secondary);
}

/* Horizontal rule */
.article-body hr {
  border: none;
  height: 1px;
  background: var(--color-border);
  margin: var(--space-xl) 0;
}


/* ══════════════════════════════════════
   IMAGE FIGURE — Rounded with Caption
   ══════════════════════════════════════ */

/* Double-bezel outer shell */
.article-figure {
  margin: var(--space-xl) 0;
  padding: 6px;
  background: var(--color-surface-alt);
  border-radius: calc(var(--radius-lg) + 6px);
  border: 1px solid var(--color-border);
  box-shadow: 0 4px 24px rgba(61, 107, 132, 0.07),
              0 1px 4px rgba(61, 107, 132, 0.04);
  overflow: hidden;
  transition: box-shadow 0.45s cubic-bezier(0.32, 0.72, 0, 1),
              transform 0.45s cubic-bezier(0.32, 0.72, 0, 1);
}

.article-figure:hover {
  box-shadow: 0 12px 40px rgba(61, 107, 132, 0.12),
              0 2px 8px rgba(61, 107, 132, 0.06);
  transform: translateY(-2px);
}

/* Inner image container */
.article-figure .figure-image-wrap {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.article-figure img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-lg);
  transition: transform 0.6s cubic-bezier(0.32, 0.72, 0, 1);
}

.article-figure:hover img {
  transform: scale(1.02);
}

/* Caption bar — sits below the image inside the bezel */
.figure-caption {
  display: block;
  padding: 10px 16px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  text-align: center;
  letter-spacing: 0.03em;
  line-height: 1.5;
  background: var(--color-surface-alt);
}

/* Premium overlay caption styled like Figure 2 (semi-transparent horizontal bar at the bottom of the image itself) */
.figure-image-wrap .image-caption-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(26, 26, 26, 0.15);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  color: #ffffff;
  padding: 3px 30px;
  font-family: var(--font-body);
  font-size: 0.7rem;
  text-align: left;
  letter-spacing: 0.05em;
  border-bottom-left-radius: calc(var(--radius-lg) - 1px);
  border-bottom-right-radius: calc(var(--radius-lg) - 1px);
  z-index: 5;
  transition: background 0.3s ease;
}

.article-figure:hover .image-caption-overlay {
  background: rgba(26, 26, 26, 0.4);
}

/* When there's no caption, the figure should look clean without the bar.
   Simply remove the <figcaption> or the overlay <div class="image-caption-overlay"> element from HTML to get a plain image. */


/* ══════════════════════════════════════
   FIGURE ROW — Side-by-side Images
   Height-matched: JS sets flex-grow per
   image aspect-ratio so widths scale
   proportionally while heights stay equal.
   ══════════════════════════════════════ */
.figure-row {
  display: flex;
  gap: 12px;
  margin: var(--space-xl) 0;
  align-items: stretch;
}

.figure-row .article-figure {
  flex: 1 1 0%;   /* JS overrides flex-grow with aspect ratio */
  margin: 0;
  min-width: 0;
}

.figure-row .figure-image-wrap {
  height: 100%;
}

.figure-row .article-figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 768px) {
  .figure-row {
    flex-direction: column;
    gap: var(--space-md);
  }

  /* Restore natural sizing on mobile stack */
  .figure-row .figure-image-wrap {
    height: auto;
  }

  .figure-row .article-figure img {
    height: auto;
    object-fit: initial;
  }
}

/* ══════════════════════════════════════
   ARTICLE VIDEO — Looping Video Embed
   ══════════════════════════════════════ */
.article-video {
  margin: var(--space-xl) 0;
  padding: 6px;
  background: var(--color-surface-alt);
  border-radius: calc(var(--radius-lg) + 6px);
  border: 1px solid var(--color-border);
  box-shadow: 0 4px 24px rgba(61, 107, 132, 0.07),
              0 1px 4px rgba(61, 107, 132, 0.04);
  overflow: hidden;
}

.article-video video {
  width: 100%;
  display: block;
  border-radius: var(--radius-lg);
}


/* ══════════════════════════════════════
   INFO / TIP / WARNING BOXES
   ══════════════════════════════════════ */
.info-box {
  margin: var(--space-xl) 0;
  padding: var(--space-lg) var(--space-xl);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 1.1rem;
  line-height: 1.75;
  font-weight: 300;
  box-shadow: 0 2px 12px rgba(61, 107, 132, 0.05);
}

.info-box.tip {
  background: #F0F8EC;
  border-left: 4px solid #6B9E5A;
  color: #3A5A2F;
}

.info-box.warning {
  background: #FFF8ED;
  border-left: 4px solid #D4914A;
  color: #7A5528;
}

.info-box.note {
  background: var(--color-accent-light);
  border-left: 4px solid var(--color-accent);
  color: #2A5168;
}

.info-box strong {
  font-weight: 500;
}


/* ══════════════════════════════════════
   BACK BUTTON — Floating Return
   ══════════════════════════════════════ */
.back-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--color-text-secondary);
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  text-decoration: none;
  transition: all 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 2px 8px rgba(61, 107, 132, 0.06);
}

.back-button:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  box-shadow: 0 4px 16px rgba(61, 107, 132, 0.1);
  transform: translateX(-3px);
}

.back-button:active {
  transform: scale(0.97);
}

.back-button svg {
  width: 16px;
  height: 16px;
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.back-button:hover svg {
  transform: translateX(-3px);
}


/* ══════════════════════════════════════
   ARTICLE FOOTER NAV — Prev / Next
   ══════════════════════════════════════ */
.article-nav {
  display: flex;
  justify-content: space-between;
  gap: var(--space-lg);
  padding: var(--space-xl) 0;
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-2xl);
}

.article-nav-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--font-body);
  text-decoration: none;
  color: var(--color-text-primary);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  transition: all 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  flex: 1;
  max-width: 48%;
  box-shadow: 0 2px 8px rgba(61, 107, 132, 0.04);
}

.article-nav-link:hover {
  border-color: var(--color-accent);
  box-shadow: 0 6px 20px rgba(61, 107, 132, 0.1);
  transform: translateY(-2px);
}

.article-nav-link.next {
  text-align: right;
  margin-left: auto;
}

.article-nav-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.article-nav-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.05em;
}


/* ══════════════════════════════════════
   TABLE — Article data tables
   Horizontally scrollable on mobile
   ══════════════════════════════════════ */

/* Scroll wrapper — auto-injected by JS around every <table> */
.table-scroll-wrapper {
  position: relative;
  margin: var(--space-xl) 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-border);
  box-shadow: 0 2px 12px rgba(61, 107, 132, 0.05);
}

.table-scroll-wrapper .table-scroll-inner {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
}

/* Subtle right-edge gradient hint — visible only when the table can scroll */
.table-scroll-wrapper .table-scroll-hint {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 32px;
  pointer-events: none;
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0) 0%,
    rgba(200, 210, 220, 0.35) 100%
  );
  opacity: 1;
  transition: opacity 0.4s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 2;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.table-scroll-wrapper .table-scroll-hint.is-hidden {
  opacity: 0;
}

/* The table itself — now lives inside the scroll wrapper */
.article-body table {
  width: 100%;
  min-width: 600px;
  border-collapse: separate;
  border-spacing: 0;
  margin: 0;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

.article-body th {
  font-family: var(--font-body);
  font-size: 0.98rem;
  font-weight: 500;
  text-align: left;
  padding: 14px 20px;
  background: var(--color-surface-alt);
  color: var(--color-text-primary);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.article-body td {
  font-family: var(--font-body);
  font-size: 1.04rem;
  font-weight: 300;
  padding: 14px 20px;
  background: var(--color-surface);
  color: var(--color-text-primary);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.article-body tr:last-child td {
  border-bottom: none;
}


/* ══════════════════════════════════════
   RESPONSIVE — Article-specific
   ══════════════════════════════════════ */
@media (max-width: 768px) {
  .article-hero {
    padding: var(--space-xl) var(--space-md) var(--space-lg);
  }

  .article-body {
    padding: var(--space-lg) var(--space-md) var(--space-2xl);
  }

  /* .article-title {
    font-size: 1.75rem;
  } */

  .article-intro {
    padding: var(--space-md);
    font-size: 0.95rem;
  }

  .article-nav {
    flex-direction: column;
  }

  .article-nav-link {
    max-width: 100%;
  }

  .article-nav-link.next {
    text-align: left;
  }

  .article-figure {
    margin: var(--space-lg) -4px;
  }

  .article-body h2 {
    margin-top: var(--space-xl);
    font-size: clamp(1.5rem, 3vw, 1.85rem);
  }

  .article-body h3 {
    margin-top: var(--space-lg);
    font-size: clamp(1.15rem, 2.5vw, 1.35rem);
  }

  .article-body h4 {
    font-size: 1.05rem;
  }

  .article-body p,
  .article-body li {
    font-size: 1rem;
  }

  .article-body blockquote p,
  .info-box {
    font-size: 0.95rem;
  }

  .article-body th {
    font-size: 0.85rem;
  }

  .article-body td {
    font-size: 0.9rem;
  }

  /* Reveal all sections immediately on mobile (no scroll trigger needed) */
  .article-section {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 480px) {
  .article-hero {
    padding: var(--space-lg) var(--space-md) var(--space-md);
  }

  .article-body {
    padding: var(--space-md) var(--space-md) var(--space-xl);
  }

  .back-button {
    font-size: 0.8rem;
    padding: 6px 14px;
  }
}

/* ══════════════════════════════════════
   REDUCED MOTION — Article
   ══════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .article-hero {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .article-section {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .article-figure {
    transition: none;
  }

  .article-figure:hover {
    transform: none;
  }

  .article-figure:hover img {
    transform: none;
  }
}
