/* ==========================================================================
   STYLE.CSS - INTERACTIVE LONGFORM / E-MAGAZINE BÁO CHÍ DỮ LIỆU
   HTX DÂU TẰM HẠNH LÊ - LÀO CAI
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,600;0,6..72,700;1,6..72,400;1,6..72,600&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;700&display=swap');

:root {
  /* Color Palette: Dark Sericulture Editorial */
  --bg-dark: #06110a;
  --bg-deep: #0a1910;
  --bg-card: rgba(14, 31, 21, 0.72);
  --bg-card-hover: rgba(20, 44, 30, 0.88);
  --bg-card-solid: #0e2216;
  --bg-card-elevated: #153221;

  --border-glass: rgba(52, 211, 153, 0.15);
  --border-highlight: rgba(245, 158, 11, 0.35);
  --border-bright: rgba(52, 211, 153, 0.4);

  --accent-emerald: #10b981;
  --accent-emerald-light: #34d399;
  --accent-emerald-glow: rgba(16, 185, 129, 0.25);

  --accent-gold: #f59e0b;
  --accent-gold-light: #fbbf24;
  --accent-silk: #fef08a;
  --accent-gold-glow: rgba(245, 158, 11, 0.2);

  --text-main: #f8fafc;
  --text-body: #ffffff;
  --text-secondary: #ffffff;
  --text-muted: #ffffff;
  --text-dim: #ffffff;

  /* Typography */
  --font-serif: 'Newsreader', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Space Grotesk', monospace;

  /* Sizing Constraints (Tuân thủ nghiêm ngặt yêu cầu) */
  --font-size-body: 1.15rem;
  /* ~18.4px >= 16px */
  --font-size-info-min: 18px;
  /* Infographic font tối thiểu 18px */

  /* Layout */
  --content-width: 780px;
  --feature-width: 1140px;
  --wide-width: 1320px;
  --section-padding: clamp(4rem, 8vw, 7.5rem);

  /* Transitions */
  --transition-smooth: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-bounce: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Reset & Base Setup */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  background-color: var(--bg-dark);
  color: var(--text-body);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-body);
  line-height: 1.85;
  background: radial-gradient(circle at 50% 0%, #0d2719 0%, var(--bg-dark) 55%, #040905 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: #1e3a29;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-emerald);
}

/* Selection */
::selection {
  background: rgba(16, 185, 129, 0.35);
  color: #ffffff;
}

/* ==========================================================================
   TOP READING PROGRESS BAR & SLIM HEADER
   ========================================================================== */
#progress-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  z-index: 1000;
}

#reading-progress {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-emerald) 0%, var(--accent-emerald-light) 50%, var(--accent-gold-light) 100%);
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.7);
  transition: width 0.1s ease-out;
}

.top-bar {
  position: fixed;
  top: 4px;
  left: 0;
  width: 100%;
  padding: 0.75rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(6, 17, 10, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-glass);
  z-index: 990;
  transform: translateY(-100%);
  transition: transform 0.4s ease;
}

.top-bar.visible {
  transform: translateY(0);
}

.top-bar-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}

.top-bar-meta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.875rem;
  color: var(--accent-emerald-light);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.reading-time-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid var(--border-glass);
}

/* ==========================================================================
   HERO / COVER SECTION
   ========================================================================== */
.hero-wrapper {
  position: relative;
  min-height: 96vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 6rem 1.5rem 5rem;
  overflow: hidden;
}

.hero-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 38%;
  transform: scale(1.05);
  transition: transform 1.2s ease;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg,
      rgba(6, 17, 10, 0.4) 0%,
      rgba(6, 17, 10, 0.7) 45%,
      var(--bg-dark) 96%);
  z-index: 2;
}

.hero-content {
  position: relative;
  z-index: 3;
  max-width: var(--feature-width);
  margin: 0 auto;
  width: 100%;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(52, 211, 153, 0.4);
  color: var(--accent-silk);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.hero-tag .pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-gold-light);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-gold);
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.35);
    opacity: 0.6;
  }
}

.main-title {
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 5.2vw, 4.2rem);
  font-weight: 700;
  line-height: 1.18;
  color: #ffffff;
  letter-spacing: -0.02em;
  margin-bottom: 2rem;
  text-shadow: 0 4px 25px rgba(0, 0, 0, 0.7);
  max-width: 1080px;
}

.hero-sapo-box {
  border-left: 3px solid var(--accent-gold);
  padding-left: 1.75rem;
  max-width: 860px;
  margin-bottom: 2.5rem;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.08) 0%, transparent 100%);
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  border-radius: 0 8px 8px 0;
}

.hero-sapo {
  font-size: clamp(1.2rem, 1.8vw, 1.38rem);
  line-height: 1.8;
  color: #f1f5f9;
  font-weight: 500;
  font-style: italic;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.hero-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.95rem;
  color: var(--text-muted);
}

.author-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-main);
  font-weight: 600;
}

.author-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-emerald-light);
}

.location-chip,
.date-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ==========================================================================
   ARTICLE WRAPPER & SECTIONS
   ========================================================================== */
.article-container {
  position: relative;
  z-index: 10;
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.article-section {
  padding: var(--section-padding) 0;
  position: relative;
}

.article-section:not(:last-of-type) {
  border-bottom: 1px solid rgba(52, 211, 153, 0.12);
}

/* Section Header */
.section-header {
  text-align: center;
  margin-bottom: 4rem;
  position: relative;
}

.section-number {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--accent-gold-light);
  text-transform: uppercase;
  padding: 0.35rem 1.25rem;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid var(--border-highlight);
  border-radius: 999px;
  margin-bottom: 1.2rem;
}

.section-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 3.8vw, 3rem);
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
  letter-spacing: -0.015em;
  text-shadow: 0 2px 15px rgba(0, 0, 0, 0.4);
}

.section-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-emerald), var(--accent-gold));
  margin: 1.25rem auto 0;
  border-radius: 2px;
}

/* Standard Reading Text Block */
.prose-content {
  max-width: var(--content-width);
  margin: 0 auto 3.5rem;
}

.prose-content p {
  font-size: var(--font-size-body);
  line-height: 1.9;
  color: var(--text-body);
  margin-bottom: 2rem;
  text-align: justify;
  text-justify: inter-word;
}

.prose-content p:last-child {
  margin-bottom: 0;
}

/* First letter dropcap for initial section */
.dropcap::first-letter {
  font-family: var(--font-serif);
  float: left;
  font-size: 4.6rem;
  line-height: 0.85;
  font-weight: 700;
  color: var(--accent-emerald-light);
  padding: 0.1rem 0.65rem 0.1rem 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Pull-Quotes */
.editorial-quote {
  position: relative;
  max-width: 860px;
  margin: 4rem auto;
  padding: 2.5rem 3rem;
  background: linear-gradient(135deg, rgba(14, 34, 22, 0.85) 0%, rgba(7, 18, 12, 0.9) 100%);
  border: 1px solid var(--border-bright);
  border-left: 6px solid var(--accent-gold);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.editorial-quote::before {
  content: '“';
  position: absolute;
  top: -10px;
  left: 20px;
  font-family: var(--font-serif);
  font-size: 6.5rem;
  line-height: 1;
  color: rgba(245, 158, 11, 0.2);
  pointer-events: none;
}

.quote-text {
  font-family: var(--font-serif);
  font-size: clamp(1.28rem, 2vw, 1.55rem);
  line-height: 1.7;
  color: #ffffff;
  font-style: italic;
  font-weight: 600;
  position: relative;
  z-index: 2;
  margin-bottom: 1.25rem;
}

.quote-author {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-emerald-light);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.quote-author::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 2px;
  background: var(--accent-emerald-light);
}

/* ==========================================================================
   INFOGRAPHIC CONTAINERS & CARDS (DATA JOURNALISM)
   TUÂN THỦ: FONT SIZE TỐI THIỂU 18PX, SVG THUẦN DỮ LIỆU
   ========================================================================== */
.infographic-wrapper {
  max-width: var(--wide-width);
  margin: 4.5rem auto;
  background: radial-gradient(ellipse at 50% 10%, rgba(16, 185, 129, 0.08) 0%, var(--bg-card-solid) 65%, #08160e 100%);
  border: 1px solid var(--border-bright);
  border-radius: 20px;
  padding: clamp(2rem, 4vw, 3.5rem);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.infographic-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.5rem;
  margin-bottom: 3rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-glass);
}

.infographic-kicker {
  font-family: var(--font-mono);
  font-size: var(--font-size-info-min);
  /* 18px */
  font-weight: 700;
  color: var(--accent-gold-light);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.infographic-title {
  font-family: var(--font-sans);
  font-size: clamp(1.5rem, 2.6vw, 2.2rem);
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.3;
}

.infographic-caption {
  font-size: var(--font-size-info-min);
  /* 18px */
  color: var(--text-muted);
  max-width: 480px;
  line-height: 1.6;
}

/* Stat Counters Grid */
.stat-counter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  padding: 1.75rem 1.5rem;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.stat-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-bright);
  background: var(--bg-card-hover);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4), 0 0 20px var(--accent-emerald-glow);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-emerald), transparent);
}

.stat-card.gold::after {
  background: linear-gradient(90deg, var(--accent-gold), transparent);
}

.stat-num-row {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.counter-val {
  font-family: var(--font-mono);
  font-size: clamp(2.4rem, 3.8vw, 3.4rem);
  font-weight: 700;
  color: #ffffff;
  line-height: 1;
  letter-spacing: -0.02em;
}

.stat-card.gold .counter-val {
  color: var(--accent-gold-light);
}

.counter-unit {
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-emerald-light);
}

.stat-card.gold .counter-unit {
  color: var(--accent-silk);
}

.stat-label {
  font-size: var(--font-size-info-min);
  /* 18px */
  font-weight: 600;
  color: var(--text-body);
  line-height: 1.45;
}

/* ==========================================================================
   SVG VISUALIZATION DIAGRAMS
   ========================================================================== */
.svg-canvas-container {
  width: 100%;
  background: rgba(5, 14, 9, 0.8);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6);
  position: relative;
}

svg.infographic-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

/* Infographic SVG text requirements: font-size >= 18px */
.svg-text-title {
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 700;
  fill: #ffffff;
}

.svg-text-highlight {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  fill: var(--accent-gold-light);
}

.svg-text-body {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 600;
  fill: #ffffff !important;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.9));
}

.svg-text-badge {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 800;
  fill: var(--accent-emerald-light);
  letter-spacing: 0.04em;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.9));
}

/* Animated Flow Paths */
.flow-line-animated {
  stroke-dasharray: 8 6;
  animation: flow-dash 25s linear infinite;
}

@keyframes flow-dash {
  to {
    stroke-dashoffset: -1000;
  }
}

/* Pulse animation on nodes */
.pulsing-node {
  animation: node-pulse 3s ease-in-out infinite;
  transform-origin: center;
}

@keyframes node-pulse {

  0%,
  100% {
    filter: drop-shadow(0 0 6px var(--accent-emerald));
  }

  50% {
    filter: drop-shadow(0 0 16px var(--accent-emerald-light));
  }
}

/* ==========================================================================
   EDITORIAL IMAGE & MEDIA CALLOUTS
   ========================================================================== */
.editorial-photo-card {
  max-width: var(--feature-width);
  margin: 4.5rem auto;
  background: var(--bg-card-solid);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.editorial-img-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 540px;
  overflow: hidden;
}

.editorial-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s ease;
}

.editorial-photo-card:hover .editorial-img {
  transform: scale(1.03);
}

.photo-caption {
  padding: 1.25rem 2rem;
  font-size: var(--font-size-info-min);
  /* 18px */
  color: var(--text-muted);
  background: rgba(10, 24, 16, 0.95);
  border-top: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.photo-caption strong {
  color: var(--accent-emerald-light);
}

/* ==========================================================================
   AUTHOR SIGNATURE & FOOTER
   ========================================================================== */
.article-footer {
  margin-top: 5rem;
  padding: 4rem 1.5rem;
  border-top: 1px solid var(--border-bright);
  background: linear-gradient(180deg, transparent 0%, rgba(4, 10, 6, 0.9) 100%);
  text-align: center;
}

.author-signature-block {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2rem 3.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  margin-bottom: 2.5rem;
}

.author-label {
  font-family: var(--font-mono);
  font-size: var(--font-size-info-min);
  /* 18px */
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent-gold-light);
}

.author-name {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.02em;
}

.footer-credits {
  font-size: 1rem;
  color: var(--text-dim);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ==========================================================================
   INTERACTIVE SCROLL & ANIMATION TRIGGER CLASSES
   ========================================================================== */
.fade-in-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.fade-in-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delay */
.stagger-1 {
  transition-delay: 0.1s;
}

.stagger-2 {
  transition-delay: 0.2s;
}

.stagger-3 {
  transition-delay: 0.3s;
}

.stagger-4 {
  transition-delay: 0.4s;
}

/* ==========================================================================
   RESPONSIVE DESIGN (DESKTOP, TABLET, MOBILE)
   ========================================================================== */
@media (max-width: 1024px) {
  :root {
    --font-size-body: 1.125rem;
    /* 18px */
  }

  .stat-counter-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .editorial-quote {
    padding: 2rem;
    margin: 3rem auto;
  }
}

@media (max-width: 768px) {
  :root {
    --font-size-body: 1.0625rem;
    /* 17px >= 16px */
    --font-size-info-min: 18px;
    /* Giữ 18px theo yêu cầu */
  }

  .hero-wrapper {
    min-height: 90vh;
    padding: 5rem 1.25rem 3.5rem;
  }

  .main-title {
    font-size: 2.1rem;
    line-height: 1.25;
  }

  .hero-sapo {
    font-size: 1.15rem;
  }

  .stat-counter-grid {
    grid-template-columns: 1fr;
  }

  .infographic-wrapper {
    padding: 1.5rem 1rem;
    border-radius: 14px;
  }

  .infographic-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .svg-canvas-container {
    padding: 0.75rem;
    overflow-x: auto;
  }

  svg.infographic-svg {
    min-width: 650px;
    /* Cho phép cuộn ngang mượt mà trên mobile nhỏ mà không bị vỡ hình */
  }

  .prose-content p {
    text-align: left;
  }

  .editorial-quote {
    padding: 1.75rem 1.25rem;
  }

  .editorial-quote::before {
    font-size: 4rem;
    top: -15px;
    left: 10px;
  }

  .top-bar {
    padding: 0.6rem 1rem;
  }

  .top-bar-title {
    max-width: 50%;
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .hero-byline {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .author-signature-block {
    padding: 1.5rem 2rem;
    width: 100%;
  }

  .author-name {
    font-size: 1.8rem;
  }
}