/* =========================================
   Tuệ Vấn – Design System
   ========================================= */

:root {
  --color-primary:   #aa3fad;
  --color-secondary: #7539ad;
  --color-overlay:   #461B6F;
  --color-dark:      #102136;
  --color-teal:      #33cccc;
  --color-white:     #ffffff;
  --color-light:     #F3F5F7;

  --header-height: 90px;
  --footer-height: 80px;

  --container-max: 1200px;
  --container-pad: 40px;

  --font-body:    'Montserrat', sans-serif;
  --font-heading: 'Roboto Slab', serif;

  --transition: 0.3s ease;
}

/* =========================================
   Reset & Base
   ========================================= */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-dark);
  background: var(--color-white);
  overflow-x: hidden;
}

body.menu-open {
  overflow: hidden;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color var(--transition);
}

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

ul {
  list-style: none;
}

button {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
}

/* Visible keyboard focus (a11y) */
a:focus-visible,
button:focus-visible,
.btn-chat:focus-visible,
.btn-start:focus-visible,
.btn-teal:focus-visible,
.hamburger:focus-visible {
  outline: 3px solid var(--color-teal);
  outline-offset: 3px;
  border-radius: 4px;
}

/* =========================================
   Layout Containers
   ========================================= */

.header-container,
.hero-container,
.footer-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-pad);
}

/* =========================================
   HEADER
   ========================================= */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--header-height);
  transition: background var(--transition), box-shadow var(--transition), height var(--transition);
}

/* Transparent state (over hero) */
.site-header[data-transparent="true"] {
  background: transparent;
}

/* Sticky / scrolled state */
.site-header.is-sticky {
  background: var(--color-dark);
  box-shadow: 0 2px 20px rgba(0,0,0,0.25);
  height: 70px;
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
}

.header-container {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* Logo */
.header-logo a {
  display: flex;
  align-items: center;
}

.header-logo img {
  height: 48px;
  width: auto;
  transition: opacity var(--transition);
}

/* Show white logo by default (transparent header) */
.logo-default { display: block; }
.logo-sticky  { display: none; }

/* Show color logo when sticky */
.site-header.is-sticky .logo-default { display: none; }
.site-header.is-sticky .logo-sticky  { display: block; }

/* Desktop Nav */
.header-nav {
  flex: 1;
  display: flex;
  justify-content: center;
}

.header-nav ul {
  display: flex;
  align-items: center;
  gap: 36px;
}

.header-nav a {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  color: var(--color-white);
  letter-spacing: 0.02em;
  position: relative;
  padding-bottom: 4px;
}

.header-nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-teal);
  transition: width var(--transition);
}

.header-nav a:hover::after {
  width: 100%;
}

.site-header.is-sticky .header-nav a {
  color: rgba(255,255,255,0.85);
}

/* CTA Button */
.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-chat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--color-white);
  font-size: 14px;
  font-weight: 500;
  border: 1.5px solid rgba(255,255,255,0.6);
  border-radius: 4px;
  padding: 8px 18px;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.btn-chat:hover {
  background: var(--color-secondary);
  border-color: var(--color-secondary);
  color: var(--color-white);
}

.btn-chat svg {
  flex-shrink: 0;
}

/* Hamburger – mobile only */
.hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--color-white);
  width: 44px;
  height: 44px;
  border: 1.5px solid rgba(255,255,255,0.5);
  border-radius: 4px;
  transition: border-color var(--transition);
}

.hamburger:hover {
  border-color: var(--color-white);
}

/* =========================================
   OFFCANVAS MENU
   ========================================= */

.offcanvas-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 1099;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}

.offcanvas-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

.offcanvas {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 85vw);
  background: var(--color-dark);
  z-index: 1100;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.offcanvas.is-open {
  transform: translateX(0);
}

.offcanvas-inner {
  padding: 32px 28px 40px;
  display: flex;
  flex-direction: column;
  gap: 36px;
  min-height: 100%;
}

.offcanvas-close {
  align-self: flex-end;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: rgba(255,255,255,0.7);
  border: 1.5px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  transition: color var(--transition), border-color var(--transition);
}

.offcanvas-close:hover {
  color: var(--color-white);
  border-color: rgba(255,255,255,0.5);
}

.offcanvas-nav ul {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.offcanvas-nav li {
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.offcanvas-nav a {
  display: block;
  color: rgba(255,255,255,0.85);
  font-size: 16px;
  font-weight: 500;
  padding: 14px 0;
  transition: color var(--transition), padding-left var(--transition);
}

.offcanvas-nav a:hover,
.offcanvas-nav li.active a {
  color: var(--color-teal);
  padding-left: 8px;
}

.offcanvas-info p {
  color: rgba(255,255,255,0.6);
  font-size: 14px;
  line-height: 1.6;
}

.offcanvas-info strong {
  color: var(--color-white);
}

.offcanvas-info a {
  color: rgba(255,255,255,0.6);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.offcanvas-info a:hover {
  color: var(--color-teal);
}

.offcanvas-socials {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: auto;
}

.offcanvas-socials a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  color: rgba(255,255,255,0.65);
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: 50%;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.offcanvas-socials a:hover {
  color: var(--color-white);
  border-color: var(--color-primary);
  background: var(--color-primary);
}

/* =========================================
   HERO SECTION
   ========================================= */

.hero-section {
  position: relative;
  width: 100%;
  min-height: 100vh;
  background-image: url('../images/hero-bg.jpg'); /* fallback */
  background-image: -webkit-image-set(url('../images/hero-bg.webp') type('image/webp'), url('../images/hero-bg.jpg') type('image/jpeg'));
  background-image: image-set(url('../images/hero-bg.webp') type('image/webp'), url('../images/hero-bg.jpg') type('image/jpeg'));
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
  display: flex;
  align-items: center;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  /* Scrim đồng đều, đủ tương phản cho chữ căn giữa trên mobile/tablet */
  background: linear-gradient(180deg, rgba(70, 27, 111, 0.86) 0%, rgba(70, 27, 111, 0.80) 100%);
}

.hero-container {
  position: relative;
  z-index: 1;
  width: 100%;
  padding-top: 200px;
  padding-bottom: 200px;
}

.hero-content {
  max-width: 53.649%;
}

.hero-greeting {
  color: var(--color-teal);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 14px;
  opacity: 0;
  animation: fadeInUp 0.6s ease 0.2s forwards;
}

.hero-title {
  font-family: var(--font-heading);
  color: var(--color-white);
  font-size: 45px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: 24px;
  opacity: 0;
  animation: fadeInUp 0.6s ease 0.4s forwards;
}

.hero-desc {
  color: rgba(255,255,255,0.95);
  font-size: 17px;
  line-height: 1.75;
  max-width: 52ch;
  margin-bottom: 40px;
  opacity: 0;
  animation: fadeInUp 0.6s ease 0.6s forwards;
}

.hero-cta {
  opacity: 0;
  animation: fadeInUp 0.6s ease 0.8s forwards;
}

.btn-start {
  display: inline-block;
  background: var(--color-teal);
  color: var(--color-dark);
  font-size: 16px;
  font-weight: 600;
  border: 2px solid var(--color-teal);
  border-radius: 4px;
  padding: 14px 34px;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 18px rgba(51, 204, 204, 0.25);
  transition: background var(--transition), border-color var(--transition),
              transform var(--transition), box-shadow var(--transition);
}

.btn-start:hover {
  background: #2ab8b8;
  border-color: #2ab8b8;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(51, 204, 204, 0.35);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .hero-greeting,
  .hero-title,
  .hero-desc,
  .hero-cta {
    animation: none;
    opacity: 1;
  }
}

/* =========================================
   FOOTER
   ========================================= */

.site-footer {
  background: var(--color-dark);
  height: var(--footer-height);
  display: flex;
  align-items: center;
}

.footer-container {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.footer-copyright p {
  color: rgba(255,255,255,0.7);
  font-size: 13px;
}

.footer-copyright a {
  color: rgba(255,255,255,0.7);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--transition);
}

.footer-copyright a:hover {
  color: var(--color-teal);
}

.footer-socials {
  display: flex;
  align-items: center;
  gap: 14px;
}

.footer-socials a {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.6);
  transition: color var(--transition), transform var(--transition);
}

.footer-socials a:hover {
  color: var(--color-teal);
  transform: translateY(-2px);
}

/* =========================================
   PAGE SECTIONS (About + Services shared)
   ========================================= */

.page-section {
  position: relative;
  width: 100%;
  min-height: 100vh;
  background-image: url('../images/hero-bg.jpg'); /* fallback */
  background-image: -webkit-image-set(url('../images/hero-bg.webp') type('image/webp'), url('../images/hero-bg.jpg') type('image/jpeg'));
  background-image: image-set(url('../images/hero-bg.webp') type('image/webp'), url('../images/hero-bg.jpg') type('image/jpeg'));
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
  display: flex;
  align-items: center;
}

.page-overlay {
  position: absolute;
  inset: 0;
}

.about-overlay {
  background: linear-gradient(180deg, rgba(51, 22, 78, 0.88) 0%, rgba(51, 22, 78, 0.82) 100%);
}

.services-overlay {
  background: linear-gradient(180deg, rgba(70, 27, 111, 0.86) 0%, rgba(70, 27, 111, 0.80) 100%);
}

.page-section-container {
  position: relative;
  z-index: 1;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 200px var(--container-pad);
  width: 100%;
  display: flex;
  gap: 0;
}

/* Shared typography */
.section-title {
  font-family: var(--font-heading);
  font-size: 45px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: #F3F5F7;
  margin-bottom: 0;
}

/* Signature "dòng sông": divider là một đường sóng nước teal khẽ trôi */
.section-divider {
  width: 100%;
  height: 8px;
  margin: 16px 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='8' viewBox='0 0 48 8'%3E%3Cpath d='M0 4 q 6 -3 12 0 t 12 0 t 12 0 t 12 0' fill='none' stroke='%2333cccc' stroke-width='1.4'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-size: 48px 8px;
  background-position: 0 center;
  opacity: 0.85;
}

@media (prefers-reduced-motion: no-preference) {
  .section-divider {
    animation: riverFlow 5s linear infinite;
  }
}

@keyframes riverFlow {
  to { background-position: 48px center; }
}

.section-text {
  color: var(--color-white);
  font-size: 15px;
  line-height: 1.7;
}

.desktop-only { display: block; }

/* Active nav link */
.header-nav a.active { color: var(--color-teal); }
.header-nav a.active::after { width: 100%; }

/* =========================================
   ABOUT PAGE
   ========================================= */

.about-section .page-section-container {
  align-items: flex-start;
}

.about-col { width: 50%; }

.about-col-left {
  padding-right: 10%;
}

.about-col-right {
  padding-left: 10%;
}

.video-link {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 40px;
  cursor: pointer;
}

.video-play-icon {
  display: flex;
  align-items: center;
  color: rgba(0,0,0,0);
}

.video-link-text {
  color: var(--color-white);
  font-weight: 500;
  font-size: 15px;
}

/* Team list */
.team-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.team-member {
  display: flex;
  align-items: center;
  gap: 20px;
}

.team-photo img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.team-info {
  flex: 1;
}

.team-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-white);
  margin-bottom: 4px;
  line-height: 1.3;
}

.team-role {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
}

/* =========================================
   SERVICES PAGE
   ========================================= */

.services-layout {
  align-items: stretch;
  gap: 40px;
}

.services-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 51%;
}

.services-right {
  width: 49%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
}

.services-eyebrow {
  color: var(--color-teal);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.services-cta {
  margin-top: 32px;
}

.btn-teal {
  display: inline-block;
  background: var(--color-teal);
  color: var(--color-dark);
  font-size: 14px;
  font-weight: 600;
  border-radius: 4px;
  padding: 12px 26px;
  box-shadow: 0 6px 18px rgba(51, 204, 204, 0.25);
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}

.btn-teal:hover {
  background: #2ab8b8;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(51, 204, 204, 0.35);
}

/* Service cards */
.service-card {
  background: var(--color-white);
  border-radius: 10px;
  padding: 0;
  margin-bottom: 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  transition: transform var(--transition), box-shadow var(--transition);
  overflow: hidden;
}

.service-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

.service-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 30px 0;
}

.service-card-header img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex-shrink: 0;
}

.service-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-secondary);
  line-height: 1.3;
}

.service-card-desc {
  font-size: 14px;
  line-height: 1.65;
  color: var(--color-dark);
  padding: 10px 30px 30px;
}

/* =========================================
   SIMPLE PAGES (Sự kiện, Liên hệ)
   ========================================= */

.stub-section .page-section-container {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.stub-content {
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stub-content .section-divider {
  width: 80px;
  margin-left: auto;
  margin-right: auto;
}

.stub-text {
  color: rgba(255,255,255,0.95);
  font-size: 16px;
  line-height: 1.75;
  margin-bottom: 28px;
}

.contact-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 32px;
}

.contact-list li {
  color: var(--color-white);
  font-size: 15px;
}

.contact-list strong {
  color: var(--color-teal);
  font-weight: 600;
  margin-right: 6px;
}

.contact-list a {
  color: var(--color-white);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.contact-list a:hover {
  color: var(--color-teal);
}

/* =========================================
   BACK TO TOP
   ========================================= */

.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: var(--color-dark);
  color: var(--color-white);
  border-radius: 4px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--transition), transform var(--transition), background var(--transition);
  pointer-events: none;
}

.back-to-top:not([hidden]) {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--color-primary);
}

/* =========================================
   DESKTOP – FULL-SCREEN, NO SCROLL
   Khóa cuộn trên desktop: header + nội dung + footer
   vừa khít đúng một màn hình (giống trang gốc).
   ========================================= */

/* Desktop: scrim có hướng — đậm phía chữ (trái), lộ ảnh phía phải.
   Chữ nằm bên trái ở hero và trang dịch vụ. */
@media screen and (min-width: 1025px) {
  .hero-overlay,
  .services-overlay {
    background: linear-gradient(90deg,
      rgba(70, 27, 111, 0.92) 0%,
      rgba(70, 27, 111, 0.86) 40%,
      rgba(70, 27, 111, 0.55) 100%);
  }
}

/* Phao cứu: chỉ khóa cuộn khi viewport đủ CAO (>=760px).
   Màn thấp sẽ tự cho cuộn để không cắt mất nội dung. */
@media screen and (min-width: 1025px) and (min-height: 760px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  /* Hero (trang chủ) */
  .hero-section {
    height: calc(100vh - var(--footer-height));
    min-height: 0;
    overflow: hidden;
  }

  .hero-container {
    padding-top: var(--header-height);
    padding-bottom: var(--header-height);
  }

  /* Về chúng tôi + Dịch vụ */
  .page-section {
    height: calc(100vh - var(--footer-height));
    min-height: 0;
    overflow: hidden;
  }

  .page-section-container {
    padding-top: var(--header-height);
    padding-bottom: var(--header-height);
    max-height: 100%;
  }

  /* Không cần nút lên đầu trang khi không cuộn */
  .back-to-top {
    display: none;
  }
}

/* =========================================
   RESPONSIVE – TABLET (max 1024px)
   ========================================= */

@media screen and (max-width: 1024px) {
  .header-nav {
    display: none;
  }

  .btn-chat {
    display: none;
  }

  .hamburger {
    display: flex;
  }

  /* Hero */
  .hero-container {
    padding-top: 250px;
    padding-bottom: 150px;
  }

  .hero-content {
    max-width: 100%;
    text-align: center;
  }

  .hero-greeting,
  .hero-title,
  .hero-desc { text-align: center; }

  .hero-title { font-size: 30px; }

  .hero-cta {
    display: flex;
    justify-content: center;
  }

  /* Footer */
  .footer-container {
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    text-align: center;
  }

  .site-footer {
    height: auto;
    padding: 20px 0;
  }

  /* About page */
  .page-section-container {
    padding-top: 250px;
    padding-bottom: 150px;
    flex-direction: column;
  }

  .about-col {
    width: 100%;
  }

  .about-col-left {
    padding-right: 0;
  }

  .about-col-right {
    padding-left: 0;
    padding-top: 48px;
  }

  .section-title {
    font-size: 30px;
    text-align: center;
  }

  .section-text {
    text-align: center;
  }

  .section-divider {
    margin-left: auto;
    margin-right: auto;
  }

  /* Services page */
  .services-layout {
    flex-direction: column;
  }

  .services-left,
  .services-right {
    width: 100%;
  }

  .services-left {
    text-align: center;
    align-items: center;
  }

  .desktop-only {
    display: none;
  }
}

/* =========================================
   RESPONSIVE – MOBILE (max 767px)
   ========================================= */

@media screen and (max-width: 767px) {
  :root {
    --container-pad: 20px;
  }

  .site-header {
    height: 70px;
  }

  .site-header.is-sticky {
    height: 60px;
  }

  .header-logo img {
    height: 36px;
  }

  /* Hero */
  .hero-container {
    padding-top: 150px;
    padding-bottom: 100px;
  }

  .hero-title { font-size: 26px; }
  .hero-desc  { font-size: 15px; }

  /* Page sections */
  .page-section-container {
    padding-top: 150px;
    padding-bottom: 100px;
  }

  /* About: stack team member portrait on mobile */
  .team-member {
    flex-direction: column;
    text-align: center;
  }

  /* Services: card desc justify */
  .service-card-desc {
    text-align: justify;
  }

  .site-footer {
    height: auto;
    min-height: 80px;
    padding: 16px 0;
  }
}

/* Mobile: dùng ảnh hero nhẹ hơn (WebP ~60KB) để tiết kiệm băng thông */
@media screen and (max-width: 767px) {
  .hero-section,
  .page-section {
    background-image: url('../images/hero-bg.jpg'); /* fallback */
    background-image: -webkit-image-set(url('../images/hero-bg-mobile.webp') type('image/webp'), url('../images/hero-bg.jpg') type('image/jpeg'));
    background-image: image-set(url('../images/hero-bg-mobile.webp') type('image/webp'), url('../images/hero-bg.jpg') type('image/jpeg'));
  }
}
