/* ============================================================
   Nexshop Tutorials — Webflow-inspired design system
   Mobile-first. Single stylesheet, no build step.
   ============================================================ */

:root {
  /* Surface & ink */
  --primary: #080808;
  --on-primary: #ffffff;
  --ink: #080808;
  --ink-strong: #222222;
  --body: #363636;
  --body-mid: #5a5a5a;
  --mute: #898989;
  --mute-soft: #ababab;
  --hairline: #d8d8d8;
  --canvas: #ffffff;
  --canvas-soft: #f6f6f6;

  /* Five-stop chromatic accents (mapped per series) */
  --accent-purple: #7a3dff;
  --accent-pink: #ed52cb;
  --accent-blue: #3b89ff;
  --accent-orange: #ff6b00;
  --accent-green: #00d722;

  /* Radius */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-full: 9999px;

  /* Spacing (4px base) */
  --sp-xs: 4px;
  --sp-sm: 8px;
  --sp-md: 12px;
  --sp-lg: 16px;
  --sp-xl: 20px;
  --sp-2xl: 24px;
  --sp-3xl: 32px;
  --sp-4xl: 48px;
  --sp-5xl: 72px;

  /* Elevation — layered drop shadow (Webflow signature) */
  --shadow-2: 0 84px 24px rgba(0,0,0,0), 0 54px 22px rgba(0,0,0,0.01),
              0 30px 18px rgba(0,0,0,0.04), 0 13px 13px rgba(0,0,0,0.08),
              0 3px 7px rgba(0,0,0,0.09);

  --gutter: var(--sp-xl);
  --nav-h: 84px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 12px); }

body {
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-feature-settings: "ss01";
  background: var(--canvas);
  color: var(--body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ─── Typography ─── */
.eyebrow {
  font-size: 15px;
  font-weight: 500;
  line-height: 19.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--mute);
  margin-bottom: var(--sp-md);
}

/* ============================================================
   Navigation
   ============================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,0.9);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--hairline);
}
.nav__inner {
  max-width: 1200px;
  margin-inline: auto;
  min-height: var(--nav-h);
  padding: var(--sp-sm) var(--gutter); /* gọn để chứa logo lớn */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-lg);
}
.nav__brand { display: flex; align-items: center; gap: var(--sp-md); }
.nav__logoimg { height: 64px; width: auto; display: block; }
.footer__logoimg { height: 64px; width: auto; display: block; margin-bottom: var(--sp-md); }
.nav__logo {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  background: var(--primary);
  color: var(--on-primary);
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: 20px;
  flex: none;
}
.nav__logo--sm { width: 30px; height: 30px; font-size: 17px; }
.nav__wordmark { font-weight: 600; font-size: 16px; color: var(--ink); letter-spacing: -0.2px; }
.nav__sub { color: var(--mute); font-weight: 500; }

.nav__links { display: flex; align-items: center; gap: var(--sp-xs); }
.nav__links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--r-sm);
  white-space: nowrap;
}
.nav__links a:hover { background: var(--canvas-soft); }

.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px; height: 40px;
  background: none; border: none; cursor: pointer;
  border-radius: var(--r-sm);
}
.nav__toggle span {
  display: block; height: 2px; width: 20px;
  background: var(--ink); border-radius: 2px;
  transition: transform .25s ease, opacity .2s ease;
}
.nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   Hero
   ============================================================ */
.hero { padding: var(--sp-5xl) 0 var(--sp-4xl); }
.hero__title {
  font-size: clamp(34px, 9vw, 80px);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.01em; /* -0.8px @ 80px, per display-xxl token */
  color: var(--ink);
  margin-bottom: var(--sp-2xl);
}
.hero__lead {
  font-size: clamp(16px, 4.4vw, 20px);
  color: var(--body);
  max-width: 52ch;
  margin-bottom: var(--sp-3xl);
}
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--sp-md); }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.16px;
  padding: var(--sp-md) var(--sp-xl);
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, opacity .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--primary); color: var(--on-primary); }
.btn--primary:hover { opacity: .88; }
.btn--secondary { background: var(--canvas); color: var(--ink); border-color: var(--hairline); }
.btn--secondary:hover { background: var(--canvas-soft); }

/* ============================================================
   Series sections
   ============================================================ */
.series { padding: var(--sp-4xl) 0; border-top: 1px solid var(--hairline); }
.series__head { margin-bottom: var(--sp-3xl); }
.series__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-sm);
  font-size: 12.8px;
  font-weight: 550;
  color: var(--on-primary);
  padding: var(--sp-xs) var(--sp-md);
  border-radius: var(--r-sm);
  margin-bottom: var(--sp-lg);
}
.series__title {
  font-size: clamp(26px, 6vw, 44.8px); /* display-lg token */
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: 0; /* display-lg tracking per spec */
  color: var(--ink);
  margin-bottom: var(--sp-md);
}
.series__desc { font-size: 16px; color: var(--body-mid); max-width: 60ch; }
.series__format {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--mute); margin-top: var(--sp-md);
}
.series__format::before {
  content: ""; width: 8px; height: 8px; border-radius: 2px;
  background: var(--mute-soft);
}

/* ─── Video grid ─── */
.grid { display: grid; gap: var(--sp-xl); }
/* Long (16:9) — 1-up mobile, 2-up desktop */
.grid--long { grid-template-columns: 1fr; }
/* Short (9:16) — 2-up mobile, more on desktop */
.grid--short { grid-template-columns: repeat(2, 1fr); gap: var(--sp-md); }

/* ─── Video card ─── */
.card {
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: box-shadow .2s ease, transform .2s ease;
}
.card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }

.card__frame {
  position: relative;
  width: 100%;
  background: #000;
  overflow: hidden;
}
.card__frame--long { aspect-ratio: 16 / 9; }
.card__frame--short { aspect-ratio: 9 / 16; }

.card__frame iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
}

/* Facade (click-to-load) */
.facade {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0; padding: 0; cursor: pointer;
  background-size: cover; background-position: center;
  display: grid; place-items: center;
}
.facade::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,0.35));
}
.facade--fb {
  background: radial-gradient(120% 120% at 50% 0%, #2b2b2b, #080808);
}
.facade__play {
  position: relative; z-index: 1;
  width: 56px; height: 56px;
  border-radius: var(--r-full);
  background: rgba(255,255,255,0.94);
  display: grid; place-items: center;
  transition: transform .2s ease, background .2s ease;
}
.facade:hover .facade__play { transform: scale(1.08); background: #fff; }
.facade__play svg { width: 22px; height: 22px; fill: var(--primary); margin-left: 3px; }
.facade__label {
  position: absolute; z-index: 1; bottom: 10px; left: 12px; right: 12px;
  color: #fff; font-size: 12px; font-weight: 500;
  display: flex; align-items: center; gap: 6px;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
}
.facade__platform {
  font-size: 10px; letter-spacing: .5px; text-transform: uppercase;
  background: rgba(255,255,255,.2); padding: 2px 6px; border-radius: var(--r-sm);
  backdrop-filter: blur(4px);
}

.card__body { padding: var(--sp-lg); }
.card__ep {
  font-size: 12px; font-weight: 600; letter-spacing: .4px;
  text-transform: uppercase; color: var(--mute); margin-bottom: 4px;
}
.card__title {
  font-size: 15px; font-weight: 600; line-height: 1.35;
  color: var(--ink); letter-spacing: -0.01em;
}
.card__title:empty { display: none; } /* ẩn khi chưa/không lấy được tiêu đề */
.card__desc { font-size: 13px; color: var(--body-mid); margin-top: 6px; }

/* ============================================================
   Popup / modal player
   ============================================================ */
body.modal-open { overflow: hidden; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--sp-lg);
  background: rgba(8, 8, 8, 0.82);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.modal.is-open { display: flex; animation: modalIn .2s ease; }
@keyframes modalIn { from { opacity: 0; } to { opacity: 1; } }

.modal__dialog { position: relative; max-width: 100%; max-height: 100%; }

.modal__frame {
  position: relative;
  background: #000;
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: 0 24px 24px rgba(0,0,0,0.26), 0 6px 13px rgba(0,0,0,0.29);
}
/* Dọc 9:16 — chiều rộng bằng số nhỏ hơn giữa 94vw và (88vh khớp tỉ lệ) */
.modal__frame--short {
  width: min(94vw, calc(88vh * 9 / 16));
  aspect-ratio: 9 / 16;
}
/* Ngang 16:9 */
.modal__frame--long {
  width: min(94vw, calc(85vh * 16 / 9));
  aspect-ratio: 16 / 9;
}
.modal__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.modal__close {
  position: absolute;
  top: var(--sp-lg);
  right: var(--sp-lg);
  z-index: 1;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: var(--r-full);
  background: rgba(255,255,255,0.95);
  color: var(--primary);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform .15s ease, background .15s ease;
}
.modal__close:hover { background: #fff; transform: scale(1.06); }

/* ============================================================
   Footer
   ============================================================ */
.footer {
  border-top: 1px solid var(--hairline);
  padding: var(--sp-4xl) 0;
  background: var(--canvas);
}
.footer__inner { display: flex; flex-direction: column; gap: var(--sp-2xl); }
.footer p { font-size: 14px; color: var(--body-mid); max-width: 44ch; }
.footer__brand { font-weight: 600; color: var(--ink); margin: var(--sp-sm) 0 4px; font-size: 16px; }
.footer__copy { color: var(--mute); }

/* ============================================================
   Empty state
   ============================================================ */
.empty {
  border: 1px dashed var(--hairline);
  border-radius: var(--r-md);
  padding: var(--sp-4xl);
  text-align: center;
  color: var(--mute);
  font-size: 14px;
}

/* ============================================================
   Responsive — tablet & up
   ============================================================ */
@media (min-width: 768px) {
  :root { --gutter: var(--sp-3xl); }
  .grid--long { grid-template-columns: repeat(2, 1fr); }
  .grid--short { grid-template-columns: repeat(3, 1fr); gap: var(--sp-lg); }
}

@media (min-width: 992px) {
  .grid--short { grid-template-columns: repeat(5, 1fr); }
  .card__body { padding: var(--sp-xl); }
}

/* ─── Mobile nav ─── */
@media (max-width: 767px) {
  .nav__toggle { display: flex; }
  .nav__links {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--canvas);
    border-bottom: 1px solid var(--hairline);
    padding: var(--sp-sm) var(--gutter) var(--sp-lg);
    box-shadow: var(--shadow-2);
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
  }
  .nav__links.is-open { opacity: 1; transform: none; pointer-events: auto; }
  .nav__links a { padding: var(--sp-md); border-radius: var(--r-sm); }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
