/* ===== Homepage (home.html) – loaded after style.css, reuses header/hero/slider/popups ===== */

/* Tall lavender background behind news + features + socials */
.home-main {
  margin-top: 0; /* sects now sits between hero and this block */
  padding-top: 70px;
  padding-bottom: 40px;
  background:
    url("../images/home/page-bg.webp") center top / 100% 100% no-repeat,
    linear-gradient(transparent, #ece0fb 14vw);
}
.home-main > section, .socials { position: relative; z-index: 1; } /* above the divider ribbon */

/* ===== News & events ===== */
.news { max-width: 1100px; margin: 0 auto 90px; }
.news .section-title img, .home-features .section-title img { width: min(800px, 92vw); }
.news__tabs { display: flex; justify-content: center; gap: 24px; margin: -6px 0 28px; }
/* Tab text is an image; the active tab gets the gold button image behind it */
.news__tab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(200px, 21vw);
  aspect-ratio: 200 / 51;
  background: url("../images/home/tab-active-bg.png") center / 100% 100% no-repeat;
  background-size: 0 0;
  transition: filter .2s;
}
.news__tab img { width: auto; max-width: none; } /* native size: all texts share the same letter height (Tin Tức = 89x24) */
/* line up the capital letters: images differ in accent/descender padding */
.news__tab:nth-child(1) img { transform: translateY(1px); }
.news__tab:nth-child(2) img { transform: translateY(3.5px); }
.news__tab:nth-child(3) img { transform: translateY(2.5px); }
.news__tab:nth-child(4) img { transform: translateY(-1.5px); }
.news__tab:hover { filter: brightness(1.3); }
.news__tab.is-active { background-size: 100% 100%; filter: none; }
/* Sự Kiện / Hướng Dẫn / Giải Đấu have a full active image (gold button + dark text) */
.news__tab.is-active:nth-child(2) { background-image: url("../images/home/tab-events-active.png"); }
.news__tab.is-active:nth-child(3) { background-image: url("../images/home/tab-guides-active.png"); }
.news__tab.is-active:nth-child(4) { background-image: url("../images/home/tab-tournaments-active.png"); }
.news__tab.is-active:not(:first-child) img { visibility: hidden; }
/* Tính Năng: no text image yet (20/10/2026) → CSS text on the plain gold bg.
   Swap the <span> for an <img> + active image once design delivers them. */
.news__tab-text { color: #1e2a4a; font-size: 24px; font-weight: 700; line-height: 1; white-space: nowrap; }
.news__body { display: flex; gap: 28px; }

/* Banner slider: crossfade, small pill dots bottom-right */
.news__banner {
  position: relative;
  flex: 0 0 49%;
  aspect-ratio: 656 / 387;
  border: 1px solid #c9a7f5;
  box-shadow: 0 6px 20px rgba(60, 10, 110, .25);
}
.news__banner::after { /* thin white inner frame */
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(255, 255, 255, .8);
  pointer-events: none;
}
.news__slide { position: absolute; inset: 0; opacity: 0; transition: opacity .6s; }
.news__slide.is-active { opacity: 1; }
.news__slide img { width: 100%; height: 100%; object-fit: cover; }
.news__dots { position: absolute; right: 18px; bottom: 16px; z-index: 1; display: flex; align-items: center; gap: 5px; }
.news__dots button { width: 6px; height: 7px; background: url("../images/home/news-dot.png") center / 100% 100% no-repeat; }
.news__dots button.is-active { width: 31px; background-image: url("../images/home/news-dot-active.png"); }

/* News list: beige panel with gold border, XEM THÊM ribbon on the bottom edge */
.news__panel {
  position: relative;
  flex: 1;
  padding: 12px 6px 56px;
  background: #fbf6ef;
  border: 2px solid #c9a46c;
  box-shadow: 0 6px 20px rgba(60, 10, 110, .2);
}
.news__list { list-style: none; }
.news__list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid #c9a46c;
  color: #2a0b3d;
  font-size: 15px;
  transition: background .2s;
}
.news__list a:hover { background: #f1e3ff; }
.news__list span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.news__list time { color: #6b5a78; font-size: 14px; }
.news__more {
  position: absolute;
  left: 50%;
  bottom: -42px;
  width: 260px;
  transform: translateX(-50%);
  transition: filter .2s;
}
.news__more:hover { filter: brightness(1.2); }

/* ===== Features (slider styles come from style.css) ===== */
.home-features { margin-bottom: 70px; }
.home-features .slider__item { aspect-ratio: 743 / 483; } /* event banners (rss1-3), no baked-in frame */

/* ===== Community links: 3 diamonds ===== */
/* even spacing like the design: ~8% of a diamond between them */
.socials { display: flex; justify-content: center; gap: min(28px, 2.4vw); }
.socials a { width: min(333px, 30vw); transition: transform .2s, filter .2s; }
.socials a:hover { transform: translateY(-6px); filter: brightness(1.15); }

/* ===== Sects ===== */
/* Sects comes right after the hero, so it overlaps the hero bottom and carries the divider ribbon */
.sects {
  position: relative;
  z-index: 4;
  margin-top: -14vw;
  padding-top: 10vw;
  overflow-x: clip;
  background: linear-gradient(transparent, #ece0fb 14vw);
}
.sects > .section-title, .sects__stage { position: relative; z-index: 1; } /* above the ribbon */
.sects .section-title { margin-bottom: 12px; }
.sects .section-title img { width: min(800px, 92vw); }
/* Stage scales as one picture: 1cqw = 1% of its width (designed at 1920x595, right light panel baked into the bg) */
.sects__stage {
  position: relative;
  container-type: inline-size;
  aspect-ratio: 1920 / 595;
  background: url("../images/home/sect-stage-bg.webp") center / cover no-repeat;
}
.sects__char { position: absolute; left: 38cqw; top: -2cqw; width: 54cqw; pointer-events: none; }
/* Thiên Long art is a tighter crop (823x626), so it gets its own box */
.sects__char[src*="thienlong"] { left: 46cqw; top: auto; bottom: 0; width: 39.5cqw; } /* robe is cut flat: sits on the stage bottom */
/* Mạn Đà art fades out at the bottom, so it fills the stage height and the fade meets the bottom edge */
.sects__char[src*="manda"] { left: 38cqw; top: 0; width: 52cqw; }
/* Cái Bang art is cut at the legs: sized so its bottom edge sits on the stage bottom (stage is 31cqw tall) */
.sects__char[src*="caibang"] { left: 42cqw; top: 0; width: 50.6cqw; }
.sects__char[src*="thieulam"] { left: 48cqw; top: auto; bottom: 0; width: 46cqw; } /* cut at the waist: sits on the stage bottom */
/* Thiên Sơn (1041x595) and Nga My (884x595) are cut at the bottom too: full stage height, on the bottom edge */
.sects__char[src*="thienson"] { left: 45cqw; top: auto; bottom: 0; width: 54cqw; }
.sects__char[src*="ngamy"] { left: 52cqw; top: auto; bottom: 0; width: 46cqw; }
.sects__char[src*="minhgiao"] { left: 48cqw; top: auto; bottom: 0; width: 41cqw; } /* 794x595, legs cut at the bottom */
.sects__char[src*="tieudao"] { left: 50cqw; top: auto; bottom: 0; width: 44cqw; } /* 851x595, legs cut at the bottom */
.sects__char[src*="tinhtuc"] { left: 49cqw; top: auto; bottom: 0; width: 40cqw; } /* 778x595, legs cut at the bottom */
.sects__char[src*="vodang"] { left: 52cqw; top: auto; bottom: 0; width: 42cqw; } /* robe cut at the bottom */
/* sect switch: old art fades out to the left, new art fades in from the right (home.js) */
.sects__char.is-out, .sects__name.is-out { opacity: 0; transform: translateX(-3cqw); transition: opacity .25s, transform .25s; animation: none; } /* none: logoIn fill would pin opacity, and it replays on return */
.sects__char.is-in { animation: sectCharIn .5s ease-out; }
@keyframes sectCharIn { from { opacity: 0; transform: translateX(4cqw); } }
.sects__name[hidden] { display: none; } /* global img display:block would override [hidden] */
.sects__name { position: absolute; left: 30cqw; top: 6cqw; z-index: 1; width: 29cqw; animation: logoIn .6s ease-out both; }
.sects__name:not([src*="acnhancoc"]) { left: 27cqw; top: 10cqw; width: 26cqw; }
.sects__menu {
  position: absolute;
  left: 15cqw;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.sects__arrow { width: 5cqw; margin: .5cqw 0; transition: filter .2s; }
.sects__arrow:hover { filter: brightness(1.3); }
/* Window of 6 entries; the list is doubled in JS and slides so the picked one sits on top (loops) */
.sects__window {
  height: 13.2cqw; /* 6 x li height (2.2cqw) */
  overflow: hidden;
  /* lower entries fade out like in the design */
  -webkit-mask: linear-gradient(#000 60%, transparent 105%);
  mask: linear-gradient(#000 60%, transparent 105%);
}
.sects__list { list-style: none; transition: transform .5s ease; }
.sects__list li {
  position: relative;
  padding: .4cqw 0 .4cqw 2.2cqw;
  color: rgba(255, 255, 255, .7);
  font-size: 1.2cqw;
  line-height: 1.4cqw;
  white-space: nowrap;
  font-weight: 700;
  cursor: pointer;
  transition: color .2s;
}
.sects__list li::before { /* purple dot, bigger glowing one on the active entry */
  content: "";
  position: absolute;
  left: .2cqw;
  top: 50%;
  width: .5cqw;
  aspect-ratio: 1;
  transform: translateY(-50%);
  background: url("../images/home/sect-dot.png") center / contain no-repeat;
}
.sects__list li.is-active::before { left: 0; width: 1.1cqw; background-image: url("../images/home/sect-dot-active.png"); }
.sects__list li:hover, .sects__list li.is-active { color: #fff; }
.sects__list li.is-active { text-shadow: 0 0 .6cqw #d9a8ff, 0 0 1.2cqw #a35cff; }

/* ===== Side menu (fixed right) ===== */
.side {
  position: fixed;
  top: 150px;
  right: 18px;
  z-index: 60;
  width: 180px;
  aspect-ratio: 248 / 573;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform .35s;
}
/* Frame on a pseudo layer so the toggle tab can sit underneath it */
.side::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: url("../images/home/side-frame.png") center / 100% 100% no-repeat;
}
.side.is-collapsed { transform: translateX(calc(100% + 18px)); }
/* yellow arrow tab sticking out on the frame's left edge (only its right sliver sits under the frame) */
.side__toggle { position: absolute; left: -7.5%; top: 20%; z-index: -2; width: 16%; transition: transform .35s; }
.side__toggle img { width: 100%; }
/* collapsed: "open" tab (left arrow) swapped in as background, shifted so the whole tab is on screen */
.side.is-collapsed .side__toggle { transform: translateX(-60%); background: url("../images/home/side-toggle-open.png") center / 100% 100% no-repeat; }
.side.is-collapsed .side__toggle img { visibility: hidden; }
.side__topup { width: 150px; margin: 4% 0 8%; padding-left: 8px; }
.side__btn { width: 72%; margin-bottom: 1.5%; }
.side__support { position: absolute; top: 81.5%; width: 80%; }
.side a { transition: transform .2s, filter .2s; }
.side a:hover { transform: scale(1.05); filter: brightness(1.1); }

/* ===== Responsive ===== */
@media (max-width: 960px) {
  .news { padding: 0 20px; }
  .news__tabs { gap: 0; }
}
@media (max-width: 768px) {
  .home-main { padding-top: 10vw; }
  .news { margin-bottom: 18vw; padding: 0 4vw; }
  .news__tabs { gap: .6vw; margin-bottom: 4vw; }
  .news__tab { width: 18.5vw; }
  .news__tab img, .news__tab-text { zoom: .5; } /* same ratio for every text so letters stay equal; fits 5 tabs on a phone */
  .news__body { flex-direction: column; gap: 4vw; }
  .news__list a { gap: 2vw; padding: 2.4vw 2vw; font-size: 3.4vw; }
  .news__list time { font-size: 3vw; }
  .news__panel { padding-bottom: 10vw; }
  .news__more { bottom: -8vw; width: 46vw; }
  .home-features { margin-bottom: 14vw; }
  .socials { gap: 2vw; }
  .socials a { width: 30vw; }

  /* Sects: taller crop, names in a row above the art */
  .sects { padding-top: 14vw; }
  .sects__stage { aspect-ratio: 393 / 330; }
  .sects__stage { background-position: 62% center; } /* keep the dark/light split behind the character */
  .sects__char { left: 14cqw; top: 8cqw; width: 100cqw; }
  .sects__name { left: 3cqw; top: 22cqw; width: 46cqw; }
  .sects__name:not([src*="acnhancoc"]) { left: 3cqw; top: 26cqw; width: 41cqw; } /* one-line names, same letter height as Ác Nhân Cốc */
  .sects__char[src*="thienlong"] { left: 26cqw; top: auto; bottom: 0; width: 74cqw; }
  .sects__char[src*="caibang"], .sects__char[src*="thieulam"],
  .sects__char[src*="thienson"], .sects__char[src*="ngamy"], .sects__char[src*="minhgiao"],
  .sects__char[src*="tieudao"], .sects__char[src*="tinhtuc"], .sects__char[src*="vodang"] { left: 8cqw; top: auto; bottom: 0; width: 100cqw; }
  .sects__char[src*="manda"] { left: 4cqw; top: 14cqw; width: 116cqw; }
  .sects__menu { left: 0; right: 0; bottom: auto; z-index: 2; padding-top: 2cqw; }
  .sects__arrow { display: none; }
  /* one row; picked entry slides to the left edge */
  .sects__window {
    width: 100%;
    height: auto;
    padding-left: 4cqw;
    -webkit-mask: linear-gradient(90deg, #000 75%, transparent);
    mask: linear-gradient(90deg, #000 75%, transparent);
  }
  .sects__list { display: flex; gap: 0 3cqw; width: max-content; }
  .sects__list li { padding: 1cqw 0 1cqw 3cqw; font-size: 3.4cqw; line-height: 1.3; }
  .sects__list li::before { width: 1.4cqw; }
  .sects__list li.is-active::before { width: 2.6cqw; }

  .side { top: auto; bottom: 4vw; right: 2vw; width: 30vw; }
  .side.is-collapsed { transform: translateX(calc(100% + 2vw)); }
  .side__topup { width: 83%; } /* 150/180 of the frame, like desktop */
}

/* Câu trạng thái trong khung tin trang chủ (đang tải / chưa có bài / lỗi) */
.news__list .news__state { padding: 24px 12px; color: #6b5a78; text-align: center; }
.news__list .news__state--error { color: #b3001b; font-weight: 700; }
