/* =====================================================
   HELLO CÀ MAU — Article Page Styles v2
   Dùng chung cho tất cả bài viết
   ===================================================== */

/* ─── INLINE CITATION TOOLTIPS ──────────── */
/*
  Usage:
  <cite class="ref-inline" data-num="1" data-source="Tên nguồn (url, năm)">[1]</cite>
  The tooltip pops up on hover/focus showing data-source.
*/

.ref-inline {
  display: inline;
  font-style: normal;
  position: relative;
  cursor: help;
}

.ref-inline sup {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--red);
  color: var(--cream-white);
  font-size: 10px;
  font-weight: 700;
  border-radius: 3px;
  line-height: 1;
  margin-left: 2px;
  vertical-align: top;
  margin-top: 2px;
  transition: background var(--t-fast);
  font-family: var(--font-body);
}

.ref-inline:hover sup,
.ref-inline:focus sup {
  background: var(--red-deep);
}

/* The tooltip bubble */
.ref-inline::after {
  content: attr(data-source);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--wood-dark);
  color: var(--cream);
  font-size: 12px;
  line-height: 1.5;
  padding: 8px 12px;
  border-radius: 6px;
  width: 280px;
  max-width: 80vw;
  text-align: left;
  white-space: normal;
  font-family: var(--font-body);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  border-left: 3px solid var(--gold-warm);
}

/* Arrow */
.ref-inline::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--wood-dark);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 101;
}

.ref-inline:hover::after,
.ref-inline:hover::before,
.ref-inline:focus::after,
.ref-inline:focus::before {
  opacity: 1;
  visibility: visible;
}

/* On mobile: click to toggle */
.ref-inline.tooltip-active::after,
.ref-inline.tooltip-active::before {
  opacity: 1;
  visibility: visible;
}

/* Flip tooltip if near top of viewport */
.ref-inline.flip-down::after {
  top: calc(100% + 8px);
  bottom: auto;
}

.ref-inline.flip-down::before {
  top: calc(100% + 2px);
  bottom: auto;
  border-top-color: transparent;
  border-bottom-color: var(--wood-dark);
}

/* ─── SIDENOTE CITATION (desktop only) ── */
/* On wide screens, citation pops out to the right margin */
@media (min-width: 1100px) {
  .article-main {
    position: relative;
  }

  /* We use JS to optionally show sidenotes — fallback stays as tooltip */
}

/* ─── CITATION COUNTER ───────────────────
   Shows a "Sources: X" badge on article cards */
.cite-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 8px;
  background: var(--cream-light);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
}



/* ─── ARTICLE HERO ─────────────────────── */
.article-hero {
  position: relative;
  height: 72vh;
  min-height: 520px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  margin-top: 0;
}

.article-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  transform: scale(1.03);
}

.article-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(28,15,6,0.96) 0%,
    rgba(28,15,6,0.55) 45%,
    rgba(28,15,6,0.15) 100%
  );
}

.article-hero-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 0 var(--sp-8) var(--sp-12);
}

.article-h1 {
  font-family: var(--font-display);
  font-size: clamp(var(--text-2xl), 4.5vw, var(--text-4xl));
  font-weight: 900;
  color: var(--cream-white);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-5);
}

.article-meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  font-size: var(--text-sm);
  color: rgba(245,236,216,0.6);
}

.article-meta-bar span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ─── BREADCRUMB ────────────────────────── */
.breadcrumb {
  margin-bottom: var(--sp-5);
}

.breadcrumb ol {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  list-style: none;
  padding: 0;
  font-size: var(--text-sm);
  color: rgba(245,236,216,0.5);
}

.breadcrumb a {
  color: var(--gold-light);
  transition: color var(--t-fast);
}

.breadcrumb a:hover { color: var(--gold-warm); }

/* ─── INFOBOX ───────────────────────────── */
.infobox {
  background: var(--cream-light);
  border: 1px solid var(--border-mid);
  border-left: 4px solid var(--red);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  margin: var(--sp-8) auto;
  max-width: 820px;
}

.infobox-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--sp-5);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border);
}

.infobox-grid {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.infobox-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: var(--sp-4);
  padding: var(--sp-2) 0;
  border-bottom: 1px dashed var(--border);
}

.infobox-row:last-child { border-bottom: none; }

.infobox-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
}

.infobox-value {
  font-size: var(--text-sm);
  color: var(--text-primary);
  line-height: 1.6;
}

.infobox-value sup a {
  color: var(--red);
  text-decoration: none;
  font-size: 0.75em;
}

/* ─── ARTICLE MAIN CONTENT ──────────────── */
.article-main {
  max-width: 820px;
  margin: 0 auto;
  padding: var(--sp-12) var(--sp-8) var(--sp-20);
}

.article-lead {
  font-size: var(--text-xl);
  color: var(--text-secondary);
  line-height: 1.85;
  margin-bottom: var(--sp-10);
  padding-bottom: var(--sp-8);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-display);
  font-style: italic;
}

.article-body h2 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  margin: var(--sp-12) 0 var(--sp-5);
  padding-bottom: var(--sp-3);
  border-bottom: 2px solid var(--border);
  position: relative;
}

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

.article-body h3 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--red);
  margin: var(--sp-8) 0 var(--sp-4);
}

.article-body p {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: 1.95;
  margin-bottom: var(--sp-5);
}

.article-body p strong { color: var(--text-primary); font-weight: 600; }
.article-body p em { color: var(--text-muted); }

.article-body ul, .article-body ol {
  padding-left: var(--sp-6);
  margin-bottom: var(--sp-5);
}

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

.article-body li {
  color: var(--text-secondary);
  font-size: var(--text-base);
  line-height: 1.8;
  margin-bottom: var(--sp-2);
}

.article-body sup a {
  color: var(--red);
  font-size: 0.75em;
  text-decoration: none;
  font-weight: 700;
  transition: color var(--t-fast);
}

.article-body sup a:hover { color: var(--red-mid); }

/* ─── FIGURE ────────────────────────────── */
.article-figure {
  margin: var(--sp-10) 0;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.article-figure img {
  width: 100%;
  display: block;
}

.article-figure figcaption {
  padding: var(--sp-3) var(--sp-5);
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-style: italic;
  background: var(--cream-light);
  line-height: 1.6;
}

/* ─── HIGHLIGHT CALLOUT ─────────────────── */
.highlight-callout {
  display: flex;
  gap: var(--sp-5);
  background: var(--gold-pale);
  border: 1px solid rgba(184,134,11,0.3);
  border-left: 4px solid var(--gold);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  margin: var(--sp-8) 0;
}

.callout-icon { font-size: 2rem; flex-shrink: 0; line-height: 1; }

.callout-body {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: 1.8;
}

.callout-body strong { color: var(--wood-dark); }

/* ─── TRANSPORT GRID ────────────────────── */
.transport-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-4);
  margin: var(--sp-6) 0 var(--sp-8);
}

.transport-card {
  background: var(--cream-light);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  transition: all var(--t-base);
}

.transport-card:hover {
  border-color: var(--red);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.transport-icon {
  font-size: 2rem;
  margin-bottom: var(--sp-3);
  display: block;
}

.transport-card h4 {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--sp-2);
}

.transport-card p {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.7;
  margin: 0;
}

/* ─── ITINERARY ─────────────────────────── */
.itinerary {
  background: var(--cream-light);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin: var(--sp-6) 0;
}

.itinerary-day {
  display: flex;
  gap: var(--sp-5);
  padding: var(--sp-6);
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}

.itinerary-day:last-child { border-bottom: none; }

.day-badge {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--red);
  color: var(--cream-white);
  font-weight: 700;
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-red);
}

.day-content h4 {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--sp-3);
  font-size: var(--text-base);
}

.day-content ul {
  list-style: none;
  padding: 0;
}

.day-content li {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--sp-2);
  padding-left: var(--sp-4);
  position: relative;
}

.day-content li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--red);
  font-weight: 700;
}

/* ─── COST TABLE ────────────────────────── */
.cost-table {
  margin: var(--sp-6) 0;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

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

.cost-table th {
  background: var(--red);
  color: var(--cream-white);
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  font-size: var(--text-sm);
  font-weight: 600;
}

.cost-table td {
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.cost-table tr:last-child td { border-bottom: none; }
.cost-table tr:nth-child(even) td { background: var(--cream-light); }

/* ─── DOS & DONTS ───────────────────────── */
.dos-donts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-5);
  margin: var(--sp-6) 0;
}

.dos, .donts {
  padding: var(--sp-6);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
}

.dos { background: #F0FAF4; border-top: 3px solid #1A6B3C; }
.donts { background: var(--red-soft); border-top: 3px solid var(--red); }

.dos-title { color: #1A6B3C; font-weight: 700; margin-bottom: var(--sp-4); }
.donts-title { color: var(--red-deep); font-weight: 700; margin-bottom: var(--sp-4); }

.dos ul, .donts ul {
  list-style: none;
  padding: 0;
}

.dos li, .donts li {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--sp-2);
  padding-left: var(--sp-4);
  position: relative;
}

.dos li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #1A6B3C;
  font-weight: 700;
}

.donts li::before {
  content: '✗';
  position: absolute;
  left: 0;
  color: var(--red);
  font-weight: 700;
}

/* ─── REFERENCES ────────────────────────── */
.article-references {
  margin-top: var(--sp-16);
  padding: var(--sp-8);
  background: var(--cream-light);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

.article-references h2 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--sp-2);
}

.article-references h2::before { display: none; }

.ref-note {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--sp-5);
  font-style: italic;
}

.ref-list {
  list-style: decimal;
  padding-left: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.ref-list li {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.7;
  padding-bottom: var(--sp-3);
  border-bottom: 1px dashed var(--border);
}

.ref-list li:last-child { border-bottom: none; }

.ref-list a {
  color: var(--red);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}

.ref-list a:hover { color: var(--red-mid); }

.ref-disclaimer {
  margin-top: var(--sp-5);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ─── RELATED ARTICLES ──────────────────── */
.related-articles {
  padding-top: var(--sp-12);
  border-top: 2px solid var(--border);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--sp-5);
}

/* ─── AUTO TABLE OF CONTENTS ─────────────── */
.toc-nav {
  background: var(--cream-light);
  border: 1px solid var(--border);
  border-left: 4px solid var(--red);
  border-radius: 0 var(--r-lg) var(--r-lg) 0;
  padding: var(--sp-5) var(--sp-6);
  margin: var(--sp-6) 0 var(--sp-8);
}

.toc-title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--sp-4);
}

.toc-list {
  margin: 0;
  padding-left: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.toc-list li { margin: 0; }

.toc-list a {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--t-fast);
  line-height: 1.5;
}

.toc-list a:hover {
  color: var(--red);
  text-decoration: underline;
}

/* ─── SHARE BUTTONS ─────────────────────── */
.share-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  padding: var(--sp-5) 0;
  margin: var(--sp-8) 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.share-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin-right: var(--sp-2);
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-full);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  text-decoration: none;
  border: 1.5px solid var(--border-mid);
  background: var(--cream-white);
  color: var(--text-secondary);
  transition: all var(--t-fast);
}

.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.share-copy:hover  { border-color: var(--gold); color: var(--gold-deep); background: var(--gold-pale); }
.share-fb:hover    { border-color: #1877F2; color: #1877F2; background: #EAF2FF; }
.share-tiktok:hover { border-color: #000; color: #000; background: #F0F0F0; }
.share-tw:hover    { border-color: #1DA1F2; color: #1DA1F2; background: #E8F5FF; }

/* ─── ARTICLE INDEX SEARCH ───────────────── */
.search-wrap {
  position: relative;
  max-width: 560px;
  margin: var(--sp-8) auto var(--sp-2);
}

.search-wrap input {
  width: 100%;
  padding: var(--sp-4) var(--sp-5) var(--sp-4) 48px;
  border: 2px solid var(--border-mid);
  border-radius: var(--r-full);
  font-size: var(--text-base);
  font-family: var(--font-body);
  background: var(--cream-white);
  color: var(--text-primary);
  transition: all var(--t-fast);
  outline: none;
  box-shadow: var(--shadow-sm);
}

.search-wrap input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(155,32,32,0.12);
}

.search-wrap::before {
  content: '🔍';
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  pointer-events: none;
}

/* ─── RESPONSIVE ────────────────────────── */
@media (max-width: 768px) {
  .article-hero { height: 60vh; min-height: 440px; }
  .article-h1   { font-size: var(--text-2xl); }
  .infobox-row  { grid-template-columns: 1fr; gap: var(--sp-1); }
  .transport-grid { grid-template-columns: 1fr; }
  .dos-donts    { grid-template-columns: 1fr; }
  .article-main { padding: var(--sp-8) var(--sp-5) var(--sp-16); }
  .share-bar    { gap: var(--sp-2); }
  .share-label  { width: 100%; }
}

