/* ==========================================================
   Trang chi tiết: Kinh Dương Vương (Thuỷ Tổ)
   Thiết kế gốc: thẻ 1024x569 trên canvas Full HD 1920px
   (1rem = 10px tại 1920px).
   Breakpoint: PC > 1024px | Tablet 601-1024px | Mobile <= 600px
   ========================================================== */

@view-transition { navigation: auto; }

@font-face {
  font-family: "MTD Whittier";
  src: url("../fonts/MTD-Whittier.woff2") format("woff2"),
       url("../fonts/MTD-Whittier.ttf") format("truetype");
  font-display: swap;
}

:root {
  --c-backdrop: #1f1f1f;
  --c-red: #97050b;
  --c-gold: #e9ee74;
  --c-border: rgba(192, 121, 63, .49);
  --ff-body: "Nunito Sans", Arial, sans-serif;
  --ff-button: "MTD Whittier", "Segoe Script", cursive;

  --card-w: 102.4rem;
  --card-radius: 2rem;
  --panel-mx: 2.4rem;
  --panel-mt: 1.6rem;
  --panel-px: 3.8rem;
  --panel-pt: 2.6rem;
  --panel-pb: 5rem;
  --title-fs: 3.2rem;
  --body-fs: 2.4rem;
  --footer-gap: 1.4rem;
  --btn-w: 18.7rem;
  --btn-h: 5rem;
  --border-bottom: 1.9rem;
  --border-left: 3.3rem;
  --border-w: 95.1rem;
  --border-h: 2.5rem;

  --ease: cubic-bezier(.22, .8, .24, 1);
}

html {
  font-size: min(calc(100vw / 192), 10px);
  -webkit-text-size-adjust: 100%;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--c-backdrop);
  font-family: var(--ff-body);
  color: #000;
}

img { display: block; max-width: 100%; }

.detail {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.detail__navigation {
  position: fixed;
  z-index: 10;
  top: 50%;
  right: 2rem;
  left: 2rem;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  transform: translateY(-50%);
}

.detail__nav {
  display: inline-flex;
  align-items: center;
  gap: .8rem;
  min-height: 5rem;
  padding: 1rem 1.4rem;
  border: .2rem solid var(--c-gold);
  border-radius: .5rem;
  background: var(--c-red);
  color: var(--c-gold);
  font-family: var(--ff-button);
  font-size: 2rem;
  line-height: 1.2;
  text-decoration: none;
  pointer-events: auto;
  transition: transform .25s var(--ease), background .25s, color .25s;
}

.detail__nav:hover,
.detail__nav:focus-visible {
  background: #76040a;
  color: #fffbb0;
  transform: translateY(-.2rem);
}

.detail__nav:focus-visible { outline: .3rem solid var(--c-gold); outline-offset: .3rem; }
.detail__nav.is-disabled { opacity: .45; }

/* ---------- Thẻ ---------- */
.card {
  position: relative;
  width: var(--card-w);
  max-width: 100%;
  padding-bottom: .3rem;
  overflow: hidden;
  border: .3rem solid var(--c-border);
  border-radius: var(--card-radius);
  background: var(--c-red);
  box-shadow: 0 .4rem 2rem rgba(0, 0, 0, .25);
  animation: card-in .9s var(--ease) both;
}

.card--lac-long-quan {
  height: auto;
  min-height: 40.6rem;
}

.card__panel {
  margin: var(--panel-mt) var(--panel-mx) 0;
  padding: var(--panel-pt) var(--panel-px) var(--panel-pb);
  border-radius: 1rem;
  background: #fff;
}

.card__title,
.card__years,
.card__text {
  margin: 0;
  font-size: var(--body-fs);
  line-height: 1.364;
}

.card__title {
  font-size: var(--title-fs);
  font-weight: 800;
  text-align: center;
  color: var(--c-red);
  animation: fade-up .7s .35s var(--ease) both;
}

.card__years {
  margin-top: 1.2rem;
  font-weight: 600;
  text-align: center;
  animation: fade-up .7s .5s var(--ease) both;
}

.card__text {
  margin-top: 3.2rem;
  font-weight: 400;
  text-align: justify;
  animation: fade-up .8s .65s var(--ease) both;
}

.card__illustration {
  float: right;
  width: min(34%, 30rem);
  height: auto;
  margin: 3.2rem 0 2rem 2.4rem;
}

.card--illustrated {
  padding-bottom: .8rem;
}

.card--illustrated .card__panel { display: flow-root; }

.card--illustrated .card__footer {
  position: relative;
  margin-top: var(--footer-gap);
}

.card--illustrated .card__border {
  bottom: calc(var(--btn-h) - var(--border-h) - .8rem);
  z-index: 0;
}

.card--lac-long-quan .card__panel {
  margin-bottom: 7rem;
  padding-bottom: 5.5rem;
}

.card--lac-long-quan .card__text {
  margin-top: 2.4rem;
}

.card--long-form .card__panel {
  position: relative;
  isolation: isolate;
  margin-bottom: 7rem;
  padding-bottom: 4rem;
  overflow: hidden;
}

.card--long-form .card__panel::before {
  position: absolute;
  z-index: 0;
  top: 0;
  right: 0;
  left: 0;
  height: 100rem;
  background: url("https://www.figma.com/api/mcp/asset/caa47667-d504-4fb5-bef3-d3e475c9ba8d.png") center top / min(139rem, 143.3%) auto no-repeat;
  content: "";
  opacity: .28;
  filter: grayscale(1);
  -webkit-mask-image: linear-gradient(#000 0%, #000 62%, transparent 100%);
  mask-image: linear-gradient(#000 0%, #000 62%, transparent 100%);
  pointer-events: none;
}

.card--long-form .card__title,
.card--long-form .card__text,
.card--long-form .card__section-title,
.card--long-form .card__districts {
  position: relative;
  z-index: 1;
}

.card__banner-image {
  position: relative;
  z-index: 1;
  width: 100%;
  height: auto;
  margin: 2.4rem auto 0;
  border-radius: 1.6rem;
}

.card--long-form .card__districts {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: district;
  font-size: var(--body-fs);
  line-height: 1.364;
}

.card--long-form .card__districts li {
  counter-increment: district;
}

.card--long-form .card__districts li::before {
  content: counter(district) "- ";
}

.card--long-form .card__text {
  margin-top: 3.2rem;
  text-align: left;
}

.card--long-form .card__districts + .card__text,
.card--long-form .card__section-title + .card__text {
  margin-top: 2.4rem;
}

.card--long-form .card__section-title {
  margin: 3rem 0 0;
  font-weight: 800;
  line-height: 1.364;
}

.card h2.card__section-title { font-size: 2.8rem; }
.card--long-form h3.card__section-title { font-size: 2.4rem; }

.card--long-form .card__footer {
  position: absolute;
  right: 0;
  bottom: .8rem;
  left: 0;
  margin-top: 0;
}

/* ---------- Chân thẻ ---------- */
.card__footer {
  display: flex;
  justify-content: center;
  margin-top: var(--footer-gap);
}

.card--lac-long-quan .card__footer {
  position: absolute;
  right: 0;
  bottom: .8rem;
  left: 0;
  margin-top: 0;
}

.card--lac-long-quan .card__border {
  bottom: calc(var(--btn-h) - var(--border-h) - .8rem);
}

.card__border {
  position: absolute;
  bottom: var(--border-bottom);
  left: var(--border-left);
  width: var(--border-w);
  max-width: none;
  height: var(--border-h);
  transform: rotate(180deg);
  animation: border-in 1.2s .5s var(--ease) both;
}

.card__home {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--btn-w);
  height: var(--btn-h);
  overflow: hidden;
  border: .2rem solid var(--c-gold);
  border-radius: .5rem;
  background: var(--c-red);
  color: var(--c-gold);
  font-family: var(--ff-button);
  font-size: 2.4rem;
  line-height: 1.2;
  text-decoration: none;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), color .35s;
}

.card__home::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -40%;
  width: 30%;
  background: linear-gradient(100deg, transparent, rgba(255, 251, 176, .35), transparent);
  transform: skewX(-20deg);
  opacity: 0;
}

.card__home:hover,
.card__home:focus-visible {
  transform: translateY(-.3rem);
  color: #fffbb0;
  box-shadow: 0 .8rem 1.6rem rgba(0, 0, 0, .35), 0 0 1.6rem rgba(233, 238, 116, .35);
}

.card__home:hover::after,
.card__home:focus-visible::after { animation: sheen .9s var(--ease); }

.card__home:active { transform: translateY(0) scale(.97); }

.card__home:focus-visible {
  outline: .3rem solid var(--c-gold);
  outline-offset: .3rem;
}

/* ---------- Animation ---------- */
@keyframes card-in {
  from { opacity: 0; transform: translateY(3rem) scale(.96); }
  to   { opacity: 1; transform: none; }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(1.6rem); }
  to   { opacity: 1; transform: none; }
}

@keyframes border-in {
  from { clip-path: inset(0 50% 0 50%); opacity: 0; }
  to   { clip-path: inset(0); opacity: 1; }
}

@keyframes sheen {
  from { left: -40%; opacity: 1; }
  to   { left: 120%; opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- Tablet ---------- */
@media (max-width: 1024px) {
  html { font-size: 10px; }

  .detail {
    flex-wrap: wrap;
    align-content: center;
    gap: 1.2rem;
    padding-bottom: 1.2rem;
  }

  .detail__navigation {
    top: 50%;
    right: 1.2rem;
    left: 1.2rem;
  }

  .detail__nav { min-height: 4.4rem; padding: .8rem 1.2rem; font-size: 1.8rem; }

  :root {
    --card-w: min(102.4rem, 94vw);
    --panel-mx: 1.6rem;
    --panel-px: 3rem;
    --panel-pb: 3.6rem;
    --title-fs: 2.8rem;
    --body-fs: 2rem;
    --border-left: 1.6rem;
    --border-w: calc(100% - 3.2rem);
    --border-h: 2.2rem;
  }

  .card__border { object-fit: cover; }
  .card__home { font-size: 2.2rem; }
  .card--lac-long-quan {
    height: auto;
    min-height: 40.6rem;
  }

  .card__illustration { width: min(38%, 28rem); }

  .card--long-form .card__panel {
    margin-bottom: 7rem;
    padding-bottom: 3.6rem;
  }
  .card--long-form .card__text,
  .card--long-form .card__districts { font-size: 1.6rem; }
  .card h2.card__section-title { font-size: 2.2rem; }
  .card--long-form h3.card__section-title { font-size: 1.6rem; }
  .card--long-form .card__title { font-size: 2.8rem; }
}

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  :root {
    --card-radius: 1.6rem;
    --panel-mx: 1rem;
    --panel-mt: 1rem;
    --panel-px: 1.6rem;
    --panel-pt: 2rem;
    --panel-pb: 2.4rem;
    --title-fs: 2.4rem;
    --body-fs: 1.6rem;
    --btn-w: 15rem;
    --btn-h: 4.4rem;
    --border-bottom: 1.2rem;
    --border-left: 1rem;
    --border-w: calc(100% - 2rem);
    --border-h: 2rem;
  }

  .detail { padding: 1.2rem; }
  .card__years { margin-top: .8rem; }
  .card__text { margin-top: 2rem; }
  .card__home { font-size: 2rem; }
  .card__illustration {
    float: none;
    width: min(68%, 24rem);
    margin: 2rem auto;
  }
  .card--lac-long-quan .card__text { margin-top: 1.8rem; }
  .card--long-form .card__title { font-size: 2.4rem; }
  .card--lac-long-quan .card__panel {
    margin-bottom: 7rem;
    padding-bottom: 2.4rem;
  }
  .card--long-form .card__panel {
    margin-bottom: 7rem;
    padding-bottom: 2.4rem;
  }
  .card--long-form .card__text { margin-top: 2rem; }
  .card--long-form .card__districts + .card__text,
  .card--long-form .card__section-title + .card__text { margin-top: 1.8rem; }
  .card--long-form .card__section-title { margin-top: 2.4rem; }
  .card h2.card__section-title { font-size: 1.9rem; }
  .card--long-form h3.card__section-title { font-size: 1.6rem; }
}
