/* Bảng màu: sông Thu Bồn (xanh rêu sẫm), gỗ (nâu đồng), giấy (kem) */
.mgz-root {
  --ink: #1f1a13;
  --muted: #6a5b49;
  --paper: #f3ece0;
  --river: #163430;
  --wood: #9c5d2c;
  --gold: #d9a868;
  position: relative;
  background-color: var(--paper);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", Times, serif;
  transition: background-color 1.2s ease;
}

/* Đổi sắc giấy theo từng chặng của câu chuyện */
.mgz-root[data-mgz-scene="2"] { background-color: #e7e9da; }
.mgz-root[data-mgz-scene="3"] { background-color: #f0e4d1; }

/* Reset nền */
.mgz-root figure { margin: 0; }
.mgz-root p { margin: 0 0 1.5em; }
.mgz-root h2,
.mgz-root h3 { margin: 0; font-weight: 400; }
.mgz-root img { max-width: 100%; }

/* Cột chữ chuẩn */
.mgz-root .mgz-col { box-sizing: content-box; max-width: 44rem; margin-left: auto; margin-right: auto; padding-left: 20px; padding-right: 20px; }

.mgz-root .mgz-col p { font-size: 1.25rem; line-height: 1.8; }

.mgz-root .mgz-dropcap::first-letter {
  float: left;
  font-size: 3.7em;
  line-height: .82;
  padding: .06em .1em 0 0;
  color: var(--wood);
}

/* Cảnh mở đầu */
.mgz-root .mgz-hero {
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  padding: 16svh 0 8svh;
  background-color: var(--river);
  background-image: radial-gradient(120% 80% at 15% 0%, rgba(217, 168, 104, .28), rgba(217, 168, 104, 0) 60%), linear-gradient(180deg, #0f231f 0%, #163430 60%, #26473a 100%);
  color: #f3e8d4;
}

.mgz-root .mgz-hero-grain {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  pointer-events: none;
  opacity: .6;
  background-image: repeating-linear-gradient(0deg, rgba(243, 232, 212, 0) 0 22px, rgba(243, 232, 212, .05) 22px 23px);
}

.mgz-root .mgz-hero-inner {
  position: relative;
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 20px;
}

.mgz-root .mgz-kicker {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 1.4rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: .8125rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold);
}

.mgz-root .mgz-kicker::before {
  content: "";
  display: block;
  width: 44px;
  height: 1px;
  background: currentColor;
}

.mgz-root .mgz-title {
  font-size: clamp(2.3rem, 6vw, 5.2rem);
  line-height: 1.05;
  letter-spacing: -.015em;
  max-width: 17ch;
  text-wrap: balance;
}

.mgz-root .mgz-byline {
  margin: 2.2rem 0 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: .8125rem;
  letter-spacing: .32em;
  color: rgba(243, 232, 212, .78);
}

.mgz-root .mgz-lead-wrap {
  position: relative;
  margin-top: 7svh;
}

.mgz-root .mgz-hero .mgz-lead {
  margin: 0;
  padding-left: 20px;
  border-left: 2px solid var(--gold);
  font-size: 1.25rem;
  line-height: 1.7;
  color: rgba(243, 232, 212, .92);
}

.mgz-root .mgz-cue {
  position: relative;
  display: block;
  width: 1px;
  height: 56px;
  margin: 6svh auto 0;
  background: linear-gradient(rgba(243, 232, 212, 0), rgba(243, 232, 212, .8));
  animation: mgz-breathe 2.8s ease-in-out infinite;
}

.mgz-root .mgz-cue::after {
  content: "\2193";
  position: absolute;
  left: -6px;
  bottom: -1.5em;
  width: 13px;
  text-align: center;
  color: var(--gold);
  font-family: system-ui, sans-serif;
  font-size: .9rem;
}

@keyframes mgz-breathe {
  0% { opacity: .35; }
  50% { opacity: 1; }
  100% { opacity: .35; }
}

/* Mở mỗi chặng */
.mgz-root .mgz-chapter { position: relative; padding-bottom: 6svh; }

.mgz-root .mgz-chapter-head {
  position: relative;
  max-width: 64rem;
  margin: 0 auto;
  padding: 20svh 20px 7svh;
}

.mgz-root .mgz-num {
  display: block;
  margin-bottom: -.16em;
  font-size: clamp(5.5rem, 15vw, 12rem);
  line-height: .8;
  letter-spacing: -.04em;
  color: rgba(156, 93, 44, .28);
}

@supports (-webkit-text-stroke: 1px black) {
  .mgz-root .mgz-num {
    color: transparent;
    -webkit-text-stroke: 1.5px rgba(156, 93, 44, .65);
  }
}

.mgz-root .mgz-chapter-title {
  position: relative;
  max-width: 20ch;
  font-size: clamp(1.9rem, 4.2vw, 3.3rem);
  line-height: 1.12;
  color: var(--river);
  text-wrap: balance;
}

.mgz-root .mgz-chapter-title::after {
  content: "";
  display: block;
  width: 72px;
  height: 2px;
  margin-top: 1.6rem;
  background: var(--wood);
}

/* Ảnh: mặc định hiện trọn, đúng tỷ lệ */
.mgz-root .mgz-bleed { margin: 11svh 0; }
.mgz-root .mgz-inset { max-width: 62rem; margin: 10svh auto; }
.mgz-root .mgz-frame { position: relative; }

.mgz-root figure img {
  display: block;
  width: 100%;
  height: auto;
}

.mgz-root .mgz-cap {
  box-sizing: content-box;
  max-width: 44rem;
  margin: 0 auto;
  padding: 14px 20px 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: .875rem;
  line-height: 1.55;
  color: var(--muted);
}

.mgz-root .mgz-cap::before {
  content: "";
  display: inline-block;
  width: 22px;
  height: 1px;
  margin-right: 10px;
  vertical-align: middle;
  background: var(--wood);
}

/* Khoảnh khắc nghỉ */
.mgz-root .mgz-pause {
  max-width: 52rem;
  margin: 12svh auto;
  padding: 0 20px;
  text-align: center;
}

.mgz-root .mgz-rule {
  width: 64px;
  height: 0;
  margin: 0 auto;
  border: 0;
  border-top: 1px solid var(--wood);
}

.mgz-root .mgz-statement {
  margin: 2.4rem 0;
  font-size: clamp(1.7rem, 4.2vw, 3rem);
  line-height: 1.25;
  font-style: italic;
  color: var(--river);
  text-wrap: balance;
}

/* Kết kỳ */
.mgz-root .mgz-col .mgz-end {
  margin-top: 3rem;
  text-align: center;
  font-size: 1.125rem;
  color: var(--muted);
}

.mgz-root .mgz-col .mgz-end::before {
  content: "\2766";
  display: block;
  margin-bottom: .6rem;
  font-size: 1.5rem;
  color: var(--wood);
}

.mgz-root a:focus-visible,
.mgz-root button:focus-visible {
  outline: 3px solid var(--wood);
  outline-offset: 3px;
}

/* Chữ hiện dần: chỉ giấu khi JS đã chạy */
.mgz-root.mgz-js [data-mgz-animate] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 1s ease, transform 1.1s cubic-bezier(.2, .7, .2, 1);
}

.mgz-root.mgz-js [data-mgz-animate].mgz-visible {
  opacity: 1;
  transform: none;
}

/* Màn rộng: cảnh mở đầu phủ màn hình, ảnh tràn lề có thị sai */
@media (min-width: 768px) {
  .mgz-root .mgz-hero {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 100svh;
    padding: 14svh 0 10svh;
    background-image: linear-gradient(180deg, rgba(12, 28, 25, .55) 0%, rgba(12, 28, 25, .74) 55%, rgba(12, 28, 25, .95) 100%), url("https://storage.baovanhoa.vn/uploaded/images/2026/11/19/01a1f4a6-5bce-78e2-b17d-9bb385f6e5bb.jpg");
    background-size: cover;
    background-position: center 40%;
  }

  .mgz-root .mgz-parallax .mgz-frame {
    height: 88svh;
    overflow: hidden;
    background: var(--river);
  }

  .mgz-root .mgz-parallax .mgz-pimg {
    position: absolute;
    left: 0;
    top: -8%;
    width: 100%;
    height: 116%;
    max-width: none;
    object-fit: cover;
    will-change: transform;
  }

  .mgz-root .mgz-inset .mgz-frame { padding: 0 20px; }

  .mgz-root .mgz-inset img { box-shadow: 0 30px 60px -30px rgba(30, 25, 18, .45); }
}

/* Điện thoại */
@media (max-width: 760px) {
  .mgz-root .mgz-col p { font-size: 1.125rem; line-height: 1.75; }
  .mgz-root .mgz-hero { padding: 12svh 0 7svh; }
  .mgz-root .mgz-hero .mgz-lead { font-size: 1.125rem; }
  .mgz-root .mgz-chapter-head { padding: 13svh 20px 5svh; }
  .mgz-root .mgz-num { font-size: 5rem; }
  .mgz-root .mgz-bleed,
  .mgz-root .mgz-inset { margin: 8svh 0; }
  .mgz-root .mgz-pause { margin: 9svh auto; }
  .mgz-root .mgz-statement { font-size: 1.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  .mgz-root { transition: none; }
  .mgz-root .mgz-cue { animation: none; }
  .mgz-root.mgz-js [data-mgz-animate] { opacity: 1; transform: none; transition: none; }
  .mgz-root .mgz-parallax .mgz-pimg { transform: none; }
}

@media print {
  .mgz-root,
  .mgz-root .mgz-hero { background: #fff; color: #000; }
  .mgz-root .mgz-hero .mgz-lead,
  .mgz-root .mgz-byline,
  .mgz-root .mgz-kicker { color: #000; }
  .mgz-root.mgz-js [data-mgz-animate] { opacity: 1; transform: none; }
}