/* =================================================
        GLOBAL & AMBIENT BACKGROUND
        ================================================= */

body {
  opacity: 0;
  transition: opacity 1s ease;
}

body.page-loaded {
  opacity: 1;
}

body.page-exit {
  opacity: 0;
}

body {
  margin: 0;
  background: #0c0c0c;
  color: #e5e5e5;
  font-family: "Inter", sans-serif;
  letter-spacing: 0.02em;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
}
body::before,
body::after {
  content: "";
  position: fixed;
  width: 200vmax;
  height: 200vmax;
  z-index: -1;
  pointer-events: none;
}
body::before {
  top: -50%;
  left: -50%;
  background: radial-gradient(
    circle at center,
    rgba(100, 150, 255, 0.05) 0%,
    transparent 35%
  );
  animation: ambientMove1 35s infinite alternate ease-in-out;
}
body::after {
  bottom: -50%;
  right: -50%;
  background: radial-gradient(
    circle at center,
    rgba(255, 255, 255, 0.03) 0%,
    transparent 35%
  );
  animation: ambientMove2 45s infinite alternate-reverse ease-in-out;
}
@keyframes ambientMove1 {
  0% {
    transform: translate(-5%, -5%);
  }
  100% {
    transform: translate(5%, 10%);
  }
}
@keyframes ambientMove2 {
  0% {
    transform: translate(5%, 5%);
  }
  100% {
    transform: translate(-10%, -5%);
  }
}

/* =================================================
        HEADER & LAYOUT
        ================================================= */
header,
.section {
  padding: 40px 12%;
  max-width: 1300px;
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 5px;
}
.logo {
  width: 150px;
  height: auto;
  object-fit: contain;
  margin-top: -15px;
  transition: filter 0.3s ease;
}

.logo-link {
  display: inline-block;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.logo-link:hover .logo {
  filter: brightness(1.1) contrast(1.2);
}

h1 {
  font-size: 40px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 0;
  color: #fff;
}
.subtitle {
  font-size: 17px;
  color: #aaa;
  font-weight: 300;
  margin: 0;
}
.hero-role {
  margin-top: 4px;
  font-size: 11px;
  color: #555;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.hero-divider {
  width: 200px;
  height: 1px;
  margin: 20px auto 15px auto;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.6) 0%,
    rgba(255, 255, 255, 0) 80%
  );
}
.hero-note {
  text-align: center;
  font-size: 12px;
  letter-spacing: 3px;
  color: #686868;
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* =================================================
        PROFILE SECTION
        ================================================= */
.fade {
  opacity: 0;
  transform: translateY(30px);
  will-change: opacity, transform;
}
.fade.show {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 1.2s cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.about h2 {
  font-size: 18px;
  font-weight: 500;
  color: #fff;
  margin-bottom: 25px;
  text-transform: uppercase;
  letter-spacing: 2px;
}
.about-intro {
  font-size: 16px;
  color: #c5c5c5;
  margin-bottom: 40px;
  line-height: 1.8;
  font-weight: 300;
  max-width: 850px;
}
.about-intro strong {
  color: #fff;
  font-weight: 500;
}

.core-values {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 40px;
  margin-bottom: 50px;
}
.value-item .v-title {
  font-size: 13px;
  letter-spacing: 3px;
  color: #cecdcd;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.value-item .v-text {
  font-size: 13px;
  color: #9b9b9b;
  font-weight: 300;
  line-height: 1.7;
}

.about-highlights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 35px;
  margin-top: 50px;
}
.highlight-title {
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #c0c0c0;
  margin-bottom: 10px;
}
.highlight-text {
  color: #999999;
  font-size: 13px;
  font-weight: 300;
  line-height: 1.7;
}

.skills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
}
.skill {
  border: 1px solid #4e4e4e;
  padding: 6px 16px;
  font-size: 11px;
  border-radius: 30px;
  background: #111;
  color: #a0a0a0;
}

.cv-download-btn {
  display: flex;
  gap: 12px;
  margin-top: 35px;
  flex-wrap: wrap;
}

.cv-btn {
  position: relative;
  overflow: hidden;

  padding: 12px 20px;
  border: 1.5px solid #fff;
  border-radius: 20px;
  color: #fff;
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-decoration: none;
  background: transparent;
  transition: 0.3s ease;
}

.cv-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -150%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    120deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  animation: autoShine 3s infinite;
}

.cv-btn:hover {
  background: #fff;
  color: #000;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
}

@keyframes autoShine {
  0% {
    left: -150%;
  }
  20% {
    left: 150%;
  }
  100% {
    left: 150%;
  }
}

.section h2 {
  font-family: "Inter", sans-serif;
  font-weight: 400; /* Độ đậm vừa phải */
  text-transform: uppercase; /* Viết hoa toàn bộ */
  letter-spacing: 4px; /* Giãn chữ rộng ra nhìn cho nghệ */
  font-size: 1.2rem; /* Kích cỡ vừa vặn */
  margin-bottom: 50px; /* Khoảng cách với nội dung bên dưới */
  color: #fff;
  position: relative;
}

/* =================================================
    PORTFOLIO MASONRY GRID (OPTIMIZED)
================================================= */

.filter-container {
  position: relative;
  margin-bottom: 35px;
}

.archive-layout {
  display: block;
}

.filter-scroll {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: flex-start;
  scroll-behavior: smooth;
  gap: 6px;
  padding: 6px 8px;

  position: relative;

  background: rgba(255, 255, 255, 0.02);
  border-radius: 40px;
  border: 1px solid rgba(255, 255, 255, 0.05);

  justify-content: flex-start;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.filter-btn {
  background: none;
  border: none;
  opacity: 0.6;
  color: #9e9e9e;
  font-size: 11px;

  text-align: left;

  padding: 6px 8px;

  cursor: pointer;

  letter-spacing: 1px;
  text-transform: uppercase;

  position: relative;

  transition: color 0.25s ease;
}

.filter-btn:hover {
  color: #ffffff;
}

.filter-btn.active {
  color: #ffffff;
  opacity: 0.8;
}

.tab-indicator {
  position: absolute;

  background: rgba(255, 255, 255, 0.144);
  border-radius: 40px;
  transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  padding: 3px 4px; /* Nới rộng: 6px trên-dưới, 12px trái-phải */
  margin-top: -3px; /* Bù lại đúng số pixel trên-dưới để cân giữa */
  margin-left: -4px;
}

#projectGrid {
  display: grid;
  align-items: start;
  grid-template-columns: repeat(4, 1fr);
  gap: 30px;
  width: 100%;
  min-height: 60vh;
  transition: opacity 0.3s ease;
}

.project-link {
  display: block;
  width: 100%;
  text-decoration: none;
}

.project {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: #111;
  border: 1px solid rgba(255, 255, 255, 0.03);
  aspect-ratio: 1/1;
  opacity: 0;
  transform: translateY(15px);
  will-change: transform, opacity;
}

/* ✅ TẠO VỆT SÁNG TỰ ĐỘNG CHẠY QUA ẢNH (GIỐNG HỆT NÚT) */
.project::before {
  content: "";
  position: absolute;
  top: -50%; /* Nới rộng lên trên để quét hết góc chéo */
  left: -150%;
  width: 50%; /* Làm vệt sáng rộng hơn để đường chéo rõ hơn */
  height: 200%; /* Cao hơn để che phủ hết khi xoay chéo */
  background: linear-gradient(
    to right,
    transparent,
    rgba(255, 255, 255, 0.2),
    /* Độ sáng nhẹ hơn nút một chút để không bị chói mắt */ transparent
  );
  transform: rotate(25deg);
  /* Chạy tự động mỗi 4 giây (nên để chậm hơn nút 1 tí cho tinh tế) */
  animation: autoShineThumb 6s infinite;
  z-index: 2; /* Nằm trên ảnh nhưng nằm dưới các chữ (nếu có) */
  pointer-events: none; /* Để không ngăn cản việc click vào ảnh */
}

/* Định nghĩa chuyển động riêng cho Thumbnail */
@keyframes autoShineThumb {
  0% {
    left: -150%;
  }
  13% {
    left: 150%;
  } /* Lướt qua nhanh */
  100% {
    left: 150%;
  } /* Nghỉ lâu hơn nút một chút */
}

.project.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 0.8s ease,
    transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.project img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: translate3d(0, 0, 0);
  transition:
    opacity 0.6s ease,
    transform 0.9s ease,
    filter 0.9s ease;
  will-change: transform;
}
.project img.loaded {
  opacity: 1;
}
.project:hover img {
  transform: scale(1.05);
  filter: brightness(0.3);
}

.project-title {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -40%);
  width: 85%;
  text-align: center;
  font-size: 10px;
  color: #fff;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0;
  transition: all 0.8s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 2;
}
.project:hover .project-title {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.lab-card,
.lab-info h3,
.lab-info p,
.btn-launch {
  font-family: "Inter", sans-serif; /* Ép dùng font Inter giống phía trên */
}

/* Chỉnh tiêu đề Lab (GLB Inspector) cho sang */
.lab-info h3 {
  font-weight: 500;
  font-size: 1.4rem;
  letter-spacing: -0.02em; /* Hơi khít lại tí nhìn rất Tech */
  margin-bottom: 15px;
  color: #fff;
}

/* Chỉnh nội dung mô tả cho giống phần About ở trên */
.lab-info p {
  font-weight: 300; /* Nét thanh mảnh giống Profile */
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.6); /* Màu xám nhẹ cho tinh tế */
  font-size: 0.95rem;
}

/* Đảm bảo tiêu đề section "The Lab" giống các section khác */
.section.lab h2 {
  font-family: "Inter", sans-serif;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 4px;
}
/* --- [KHUNG LAB] VIỀN NỔI BẬT & GLASSMORPHISM --- */
.lab-card {
  display: flex;
  gap: 50px;
  padding: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(15px);
  /* ✅ Viền rực rỡ khi nhìn vào */
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  transition: all 0.4s ease;
}

.lab-card:hover {
  border-color: rgba(255, 255, 255, 0.4); /* Hover viền sáng rực */
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.05);
}

/* --- [NÚT BẤM] VỆT SÁNG CHẠY QUA (SHINE EFFECT) --- */
.btn-launch {
  display: inline-block;
  margin-top: 25px;
  padding: 12px 30px;
  border-radius: 25px;
  color: #fff;
  text-decoration: none;
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  border: 2px solid #fff; /* Viền trắng dày nổi bật */
  position: relative;
  overflow: hidden; /* Quan trọng để giấu vệt sáng */
  transition: 0.3s;
}

.btn-launch::before {
  content: "";
  position: absolute;
  top: 0;
  left: -150%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    120deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  /* ✅ Vệt sáng tự động lướt qua mỗi 3 giây */
  animation: autoShine 3s infinite;
}
.btn-launch:hover::before {
  left: 150%;
} /* Vệt sáng chạy vèo qua */
.btn-launch:hover {
  background: #fff;
  color: #000;
  box-shadow: 0 0 20px #fff;
}

/* --- [GALLERY] CHIA LẠI LƯỚI 3 CỘT --- */
.lab-gallery {
  margin-top: 40px;
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* ✅ CHIA ĐÚNG 3 CỘT */
  gap: 20px;
}

.lab-gallery img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 10px;
  opacity: 0.6;
}

.lab-gallery img:hover {
  transform: translateY(-5px);
  border-color: #fff;
  opacity: 1;
}

/* --- [LIGHTBOX] VIỀN NỔI BẬT KHI ZOOM --- */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.lightbox-close {
  position: absolute;
  top: 20px; /* Cách mép trên */
  right: 30px; /* Cách mép phải */
  color: rgba(255, 255, 255, 0.6);
  font-size: 45px;
  font-weight: 100; /* ✅ Nét cực thanh nhìn cho sang */
  line-height: 0.8; /* ✅ Khử lỗi bị lệch tâm */
  cursor: pointer;
  z-index: 10001;
  transition: 0.3s;
  user-select: none;
}

.lightbox-overlay.active {
  display: flex;
  animation: fadeIn 0.3s forwards;
}

.lightbox-img {
  max-width: 85%;
  max-height: 85%;
  border-radius: 15px;
  padding: 8px;
  background: #111;
  border: 1px solid rgba(255, 255, 255, 0.3); /* Viền nổi bật cho ảnh zoom */
  box-shadow: 0 0 50px rgba(255, 255, 255, 0.1);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Mobile: Xếp dọc */
@media (max-width: 992px) {
  .lab-card {
    flex-direction: column;
    text-align: center;
    gap: 30px;
  }
  .lab-gallery {
    grid-template-columns: repeat(2, 1fr);
  } /* Mobile để 2 cột */
}

/* =================================================
        CONTACT & FOOTER
        ================================================= */
.contact {
  margin-top: clamp(30px, 5vw, 60px);
  padding-bottom: 60px;
}
.contact h2 {
  font-size: 23px;

  font-weight: 500;
  color: #fff;
  letter-spacing: 2px;
}
.contact-links {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 22px;
}
.contact-links a {
  color: #fff;
  text-decoration: none;
  font-size: 15px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: 0.3s;
}
.contact-links a:hover {
  border-bottom: 1px solid #fff;
  color: #aaa;
}

.filter-btn.active::before {
  display: none;
}
/* group link */
.contact-actions {
  margin-left: 20px;
  display: flex;
  gap: 30px;
  flex-wrap: wrap;
}

/* style link nếu cần */
.contact-actions a {
  color: #aaa;
  text-decoration: none;
  transition: 0.2s;
}

.contact-actions a:hover {
  color: #fff;
}

/* dòng email */
.email-display {
  font-size: 16px;
  color: #aaa;
  cursor: pointer;
  transition: 0.2s;
  letter-spacing: 2px;
  margin-left: 20px;
  margin-top: -15px;
  margin-bottom: 10px;
}

.email-display:hover {
  text-decoration: underline;
  color: #fff;
}

footer {
  padding: 40px 12%;
  color: #333;
  font-size: 10px;
  text-align: center;
}

/*TABLET */
@media (max-width: 1200px) {
  .archive-layout {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 10px;
  }

  .filter-scroll {
    flex-direction: column;
    align-items: flex-start;
    align-items: stretch;
    background: none;
    border: none;
    padding: 0;
    gap: 12px;
  }

  .filter-btn {
    text-align: left;
    padding: 8px 10px;
  }

  #projectGrid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }

  .filter-container {
    max-height: 50vh;
    overflow: auto;
    position: sticky;
    top: 80px;
    scrollbar-width: none;
  }

  .filter-container::-webkit-scrollbar {
    display: none;
  }

  /* MOBILE INDICATOR */

  .filter-btn.active::before {
    display: block;
    content: "";
    position: absolute;
    left: 0px;
    top: 50%;
    width: 2px;
    height: 70%;
    transform: translateY(-50%);
    background: #fff;
    border-radius: 2px;
  }
}

@media (max-width: 500px) {
  .archive-layout {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 10px;
  }

  .filter-scroll {
    flex-direction: column;
    align-items: flex-start;
    align-items: stretch;
    background: none;
    border: none;
    padding: 0;
    gap: 12px;
  }

  .filter-btn {
    text-align: left;
    padding: 8px 10px;
  }

  #projectGrid {
    grid-template-columns: repeat(1, 1fr);
    gap: 10px;
  }

  .filter-container {
    max-height: 50vh;
    overflow: auto;
    position: sticky;
    top: 80px;
    scrollbar-width: none;
  }

  .filter-container::-webkit-scrollbar {
    display: none;
  }

  /* MOBILE INDICATOR */

  .filter-btn.active::before {
    display: block;
    content: "";
    position: absolute;
    left: 0px;
    top: 50%;
    width: 2px;
    height: 70%;
    transform: translateY(-50%);
    background: #fff;
    border-radius: 2px;
  }
}
