/* ===================================
   XUONG TIEN — Tinh Hoa Tu Nhien
   =================================== */

:root {
  --bg: #fcfcf9;
  --text: #1a1a1a;
  --muted: #8c8c8c;
  --accent: #d4cfc3;
  --serif: "Playfair Display", serif;
  --sans: "Inter", sans-serif;
  --transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
  --glass: rgba(255,255,255,0.25);
  --glass-border: rgba(255,255,255,0.3);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--accent); }

/* ===================================
   HEADER
   =================================== */
header {
  position: absolute;
  top: 0; width: 100%;
  padding: 40px 6%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
  mix-blend-mode: difference;
  color: white;
  transition: 0.4s ease;
}
.logo {
  font-family: var(--serif);
  font-size: 1.8rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
nav { display: flex; gap: 50px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.25em; }
nav a { position: relative; }
nav a::after {
  content: ""; position: absolute; bottom: -5px; left: 0; width: 0%; height: 1px;
  background: white; transition: var(--transition);
}
nav a:hover::after { width: 100%; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: inherit;
  font-size: 1.5rem;
  cursor: pointer;
}

/* ===================================
   HERO SECTION
   =================================== */
.hero {
  height: 100vh;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 0;
  overflow: hidden;
}
.hero-video {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
}
.hero-poster {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0.7;
}
.hero-video-iframe {
  position: absolute;
  top: -60px; left: -10%;
  width: 120%; height: calc(100% + 120px);
  border: 0;
  opacity: 0.7;
  pointer-events: none;
}
.hero-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.4);
}
.hero-content {
  position: relative;
  z-index: 2;
  color: white;
  padding: 0 20px;
  opacity: 0;
  transform: translateY(40px);
  transition: all 1.2s ease;
}
.hero-content.active {
  opacity: 1;
  transform: translateY(0);
}
.hero-content span {
  font-size: 0.8rem;
  letter-spacing: 0.5em;
  opacity: 0.8;
  display: block;
  margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(3rem, 10vw, 7rem);
  line-height: 0.9;
  margin-bottom: 30px;
  font-weight: 400;
}

/* ===================================
   CARDS & GRID
   =================================== */
.card {
  opacity: 0;
  transform: translateY(50px);
  transition: all 1.2s cubic-bezier(0.23, 1, 0.32, 1);
}
.card.in-view {
  opacity: 1;
  transform: translateY(0);
}

.container { max-width: 1400px; margin: 0 auto; padding: 150px 6%; }
.section-header {
  margin-bottom: 100px;
  max-width: 600px;
  opacity: 0;
  transform: translateY(50px);
  transition: all 1.2s cubic-bezier(0.23, 1, 0.32, 1);
}
.section-header.in-view {
  opacity: 1;
  transform: translateY(0);
}
.section-header h2 { font-size: 3.5rem; line-height: 1.1; margin-bottom: 20px; }
.section-header p { color: var(--muted); font-weight: 300; font-size: 1.1rem; }

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.card.small,
.card.large  { grid-column: span 1; }
.card.center { grid-column: span 1; }

.card-img-wrapper {
  overflow: hidden;
  background: #eee;
  aspect-ratio: 4/5;
  margin-bottom: 25px;
}
.card img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.card:hover img {
  transform: scale(1.05);
}
/* YouTube thumbnails have baked-in black bars — scale up to crop them out */
.card-img-wrapper[data-video-id] img {
  transform: scale(1.5);
}
.card:hover .card-img-wrapper[data-video-id] img {
  transform: scale(1.55);
}

.card-img-wrapper {
  position: relative;
}
.card-play-btn {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 60px; height: 60px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: white;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.3s ease;
}
.card:hover .card-play-btn {
  transform: translate(-50%, -50%) scale(1.15);
}
.card-img-wrapper img {
  transition: opacity 0.4s ease, transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}
/* Landscape / standard video iframe */
.card-video-iframe {
  position: absolute;
  top: -10%; left: -10%;
  width: 120%; height: 120%;
  border: 0;
  pointer-events: none;
}
/* Native video elements (Imgur etc.) — use object-fit instead of oversizing */
video.card-video-iframe {
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
/* Vertical (Shorts 9:16) — wrapper is already 9:16 so iframe fills cleanly */
.card-video-vertical .card-video-iframe {
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.card-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.card-info h3 {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 400;
}
.card-info p {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 5px;
}

/* ===================================
   CATEGORY FILTER BAR
   =================================== */
.filter-bar {
  display: flex;
  gap: 15px;
  margin-bottom: 60px;
  flex-wrap: wrap;
}
.filter-btn {
  padding: 10px 24px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
  transition: var(--transition);
}
.filter-btn:hover,
.filter-btn.active {
  background: var(--text);
  color: white;
  border-color: var(--text);
}

/* ===================================
   STORIES / BLOG SECTION
   =================================== */
.stories-section {
  border-top: 1px solid var(--accent);
}
.stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 50px;
}
.story-card {
  opacity: 0;
  transform: translateY(50px);
  transition: all 1.2s cubic-bezier(0.23, 1, 0.32, 1);
  cursor: pointer;
}
.story-card.in-view {
  opacity: 1;
  transform: translateY(0);
}
.story-card-img {
  overflow: hidden;
  aspect-ratio: 16/9;
  margin-bottom: 20px;
  background: #eee;
}
.story-card-img img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.story-card:hover img {
  transform: scale(1.05);
}
.story-card h3 {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 400;
  margin-bottom: 10px;
}
.story-card p {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 300;
}
.story-card .story-date {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

/* ===================================
   GLASSMORPHISM SLIDER BUTTONS
   =================================== */
.slider-nav {
  position: absolute;
  top: 50%;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 30px;
  transform: translateY(-50%);
  pointer-events: none;
}
.btn-slider {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: white;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.3s ease;
}
.btn-slider:hover {
  background: rgba(255,255,255,0.4);
  transform: scale(1.1);
}

/* ===================================
   THUMBNAIL GALLERY
   =================================== */
.thumbnail-gallery {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  background: rgba(0, 0, 0, 0.4);
  padding: 12px;
  border-radius: 8px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  max-width: 90%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.3) transparent;
}
.thumbnail-gallery::-webkit-scrollbar {
  height: 4px;
}
.thumbnail-gallery::-webkit-scrollbar-track {
  background: transparent;
}
.thumbnail-gallery::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
}
.thumbnail-gallery::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.5);
}
.thumbnail-item {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  cursor: pointer;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  opacity: 0.7;
}
.thumbnail-item img,
.thumbnail-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.thumbnail-item:hover {
  opacity: 1;
  border-color: rgba(255, 255, 255, 0.6);
  transform: scale(1.05);
}
.thumbnail-item.active {
  border-color: white;
  opacity: 1;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.4);
}

/* ===================================
   DETAIL VIEW — FULLSCREEN OVERLAY
   =================================== */
#detail-view {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 2000;
  display: none;
  opacity: 0;
  transition: opacity 0.5s ease;
  overflow-y: auto;
}

.detail-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

.detail-slider {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow: hidden;
}
.detail-slider-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.8s ease;
}
.detail-slide {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
}
.detail-slide picture {
  width: 100%; height: 100%;
}
.detail-slide picture img,
.detail-slide video {
  width: 100%; height: 100%;
  object-fit: cover;
}
.detail-slide video {
  position: absolute;
  top: 0; left: 0;
}
.detail-slide iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: 0;
}
/* Vertical (YouTube Shorts 9:16) — fit iframe to 9:16 centered so the player renders
   with no pillarbox black bars. Background fills leftover space. */
.detail-slide-vertical {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.detail-slide-vertical iframe {
  position: relative;
  width: auto;
  height: 100%;
  aspect-ratio: 9 / 16;
  max-width: 100%;
}

.detail-content {
  padding: 10% 15%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.close-detail {
  position: fixed;
  top: 40px;
  right: 40px;
  font-size: 1rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  z-index: 2100;
  background: none;
  border: none;
  color: var(--text);
}

.detail-body {
  margin-bottom: 30px;
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text);
}
.detail-body h2, .detail-body h3 {
  font-family: var(--serif);
  margin: 1.5em 0 0.5em;
}
.detail-body img {
  max-width: 100%;
  margin: 1em 0;
}
.detail-body p {
  margin-bottom: 1em;
}
.detail-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 20px;
  margin: 1.5em 0;
  font-style: italic;
  color: var(--muted);
}

.detail-price {
  font-family: var(--serif);
  font-size: 1.5rem;
  margin-top: 20px;
}

/* ===================================
   CTA BUTTON
   =================================== */
.cta-button {
  display: inline-block;
  padding: 18px 40px;
  border: 1px solid var(--text);
  color: var(--text);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-top: 40px;
  transition: var(--transition);
  text-align: center;
  background: none;
  cursor: pointer;
}
.cta-button:hover {
  background: var(--text);
  color: white;
}

/* ===================================
   SHOP BUTTONS
   =================================== */
.shop-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 16px;
  margin-top: 40px;
  width: 100%;
}
.shop-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  border: 2px solid var(--accent);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  transition: var(--transition);
  cursor: pointer;
  background: white;
  min-height: 100px;
}
.shop-icon-img {
  width: 50px;
  height: 50px;
  object-fit: contain;
  transition: var(--transition);
}
.shop-btn:hover .shop-icon-img {
  transform: scale(1.1);
}
.shop-btn:hover {
  background: var(--accent);
  border-color: var(--text);
  transform: translateY(-4px);
}
.shopee-btn { border-color: #ee4d2d; }
.shopee-btn:hover { background: #ee4d2d; border-color: #ee4d2d; }
.tiktok-btn { border-color: #000000; }
.tiktok-btn:hover { background: #000000; border-color: #000000; }
.lazada-btn { border-color: #5b0000; }
.lazada-btn:hover { background: #5b0000; border-color: #5b0000; }
.etsy-btn { border-color: #f1641e; }
.etsy-btn:hover { background: #f1641e; border-color: #f1641e; }

/* ===================================
   INFINITE SCROLL LOADER
   =================================== */
.scroll-sentinel {
  height: 1px;
  width: 100%;
}
.loader {
  text-align: center;
  padding: 40px;
}
.loader-spinner {
  display: inline-block;
  width: 30px;
  height: 30px;
  border: 2px solid var(--accent);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===================================
   FOOTER
   =================================== */
footer {
  padding: 100px 6%;
  text-align: center;
  background: #111;
  color: #fff;
}
footer a { color: #fff; }
.footer-title {
  font-family: var(--serif);
  font-size: 4vw;
  margin-bottom: 50px;
  opacity: 0.2;
}

/* ===================================
   RESPONSIVE
   =================================== */
/* ===================================
   RESPONSIVE — TABLET
   =================================== */
@media (max-width: 1024px) {
  .grid {
    gap: 16px;
  }
  .detail-content {
    padding: 8% 8%;
  }
}

/* ===================================
   RESPONSIVE — MOBILE
   =================================== */
@media (max-width: 768px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .card.small,
  .card.large,
  .card.center {
    grid-column: span 1;
  }

  /* Hero */
  .hero { height: 85vh; }
  .hero h1 { font-size: clamp(2.2rem, 9vw, 3.5rem); }
  .hero-content span { font-size: 0.65rem; letter-spacing: 0.3em; }
  .hero-poster { object-position: center; }
  .hero-video-iframe {
    top: -30px; left: -20%;
    width: 140%; height: calc(100% + 60px);
  }

  /* Header */
  header {
    padding: 16px 5%;
  }
  .logo { font-size: 1.3rem; }
  nav {
    display: none;
  }
  nav.open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.95);
    justify-content: center;
    align-items: center;
    gap: 30px;
    z-index: 999;
    font-size: 1.2rem;
  }
  .nav-toggle {
    display: block;
    z-index: 1001;
  }

  /* Detail view */
  .detail-container {
    grid-template-columns: 1fr;
  }
  .detail-slider {
    height: 45vh;
    position: sticky;
    top: 0;
  }
  .detail-content {
    padding: 30px 6% 60px;
  }
  #d-title { font-size: 2rem !important; margin-bottom: 12px !important; }
  .detail-price { font-size: 1.2rem; }
  .close-detail {
    top: 16px;
    right: 16px;
    font-size: 0.8rem;
    background: rgba(255,255,255,0.8);
    padding: 8px 14px;
    border-radius: 4px;
  }
  .btn-slider {
    width: 40px; height: 40px;
    font-size: 1rem;
  }
  .slider-nav { padding: 0 12px; }

  /* Thumbnail Gallery */
  .thumbnail-gallery {
    bottom: 12px;
    padding: 8px;
    gap: 6px;
  }
  .thumbnail-item {
    width: 50px;
    height: 50px;
  }

  /* Cards */
  .card-img-wrapper { margin-bottom: 15px; }
  .card-info h3 { font-size: 1.2rem; }
  .card-play-btn { width: 48px; height: 48px; font-size: 1.1rem; }

  /* Stories */
  .stories-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  .story-card h3 { font-size: 1.2rem; }

  /* Filter bar — horizontal scroll */
  .filter-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
    gap: 10px;
    margin-bottom: 40px;
  }
  .filter-btn {
    padding: 8px 18px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Sections */
  .section-header { margin-bottom: 50px; }
  .section-header h2 { font-size: 2rem; }
  .section-header p { font-size: 0.95rem; }
  .container {
    padding: 60px 5%;
  }

  /* Footer */
  .footer-title { font-size: 8vw; }

  /* CTA */
  .cta-button {
    padding: 14px 30px;
    font-size: 0.7rem;
    width: 100%;
  }
}

/* ===================================
   RESPONSIVE — SMALL MOBILE
   =================================== */
@media (max-width: 400px) {
  .hero h1 { font-size: 2rem; }
  .detail-slider { height: 35vh; }
  #d-title { font-size: 1.6rem !important; }
}

/* ===================================
   LANG SWITCHER (header)
   =================================== */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 8px;
}

/* Each VI / EN button looks like a small bordered pill */
.lang-switcher button {
  background: none;
  border: 1px solid currentColor;
  cursor: pointer;
  padding: 5px 11px;
  font-family: var(--sans);
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  color: inherit;        /* inherits white from header; mix-blend-mode handles contrast */
  opacity: 0.45;
  transition: opacity 0.25s ease;
  line-height: 1;
}

.lang-switcher button:hover  { opacity: 0.8; }
.lang-switcher button.active { opacity: 1; }

/* divider dot */
.lang-switcher .lang-divider {
  opacity: 0.3;
  font-size: 0.5rem;
}

/* ===================================
   LANG MODAL (first-visit)
   =================================== */
#lang-modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 15, 0.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.7s ease;
}

#lang-modal.visible {
  opacity: 1;
  pointer-events: all;
}

.lang-modal-card {
  background: var(--bg);
  border: 1px solid var(--accent);
  padding: 64px 72px;
  text-align: center;
  max-width: 480px;
  width: 88%;
  transform: translateY(28px);
  transition: transform 0.9s cubic-bezier(0.23, 1, 0.32, 1);
}

#lang-modal.visible .lang-modal-card {
  transform: translateY(0);
}

.lang-modal-eyebrow {
  font-size: 0.6rem;
  letter-spacing: 0.38em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 28px;
}

.lang-modal-heading {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 400;
  line-height: 1.25;
  margin-bottom: 48px;
  color: var(--text);
}

.lang-modal-btns {
  display: flex;
  gap: 16px;
}

.lang-modal-btn {
  flex: 1;
  padding: 18px 10px;
  border: 1px solid var(--text);
  background: none;
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text);
}

.lang-modal-btn:hover {
  background: var(--text);
  color: var(--bg);
}

@media (max-width: 480px) {
  .lang-modal-card { padding: 48px 32px; }
  .lang-modal-btns { flex-direction: column; }
}
