@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;800&display=swap");

:root {
  --card-width: 480px;
  --card-height: 480px;
  transition:
    filter 0s,
    opacity 0s;
  transition: none;
}

.loader-logo {
  width: 300px;
  margin-bottom: 15px;
  opacity: 0.95;
}

.loader-text {
  letter-spacing: 5px;
  font-size: 30px;
  color: #eeeeee;
  margin-bottom: 10px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  outline: none;
}

body {
  width: 100%;
  height: calc(var(--vh, 1vh) * 100);
  background: #000;
  overflow: hidden;
  font-family: "Montserrat", sans-serif;
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* --- NÚT ĐIỀU HƯỚNG CHÍNH --- */
.main-nav-link {
  position: fixed;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  /* Cao nhất để không bị ảnh đè */
  border-width: 1.5px;
  border-radius: 8px;
  padding: 12px 35px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 5px;

  color: rgba(255, 255, 255, 0.6);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  text-decoration: none;
  letter-spacing: 4px;

  transition:
    color 0.4s,
    border-color 0.4s,
    background 0.4s,
    box-shadow 0.4s;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(5px);
}

.main-nav-link:hover {
  color: #fff;
  border-color: #fff;
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(-50%);
}

.app {
  width: 100%;
  height: 100vh;
  /* Ép nó cao bằng toàn bộ màn hình */
  position: relative;
  overflow: hidden;
}

/* --- BACKGROUND --- */
.app__bg {
  position: absolute;
  inset: 0;
  z-index: -5;
  filter: blur(80px);
  pointer-events: none;
}

.app__bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0.85;
}

.app__bg__image {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.5s ease;
}

.app__bg__image.active {
  opacity: 1;
}

.app__bg__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.8);
}

/* --- NAVIGATION: SÁT BIÊN --- */
.nav-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  font-size: 50px;
  font-weight: 100;
  color: rgba(255, 255, 255, 0.1);
  z-index: 1000;
  cursor: pointer;
  transition: 0.3s;
  padding: 30px;
}

.nav-btn:hover {
  color: white;
  scale: 1.2;
}

.nav-btn.left {
  left: 1.5%;
}

.nav-btn.right {
  right: 1.5%;
}

/* --- CAROUSEL --- */
.cardList {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: grab;
  perspective: 2000px;
}

.cardList:active {
  cursor: grabbing;
  /* Hiện bàn tay nắm lại khi đang kéo */
}
.card:first-child {
  opacity: 1;
}
.card {
  position: absolute;
  left: 50%;
  top: 40%;
  width: var(--card-width);
  height: var(--card-height);
  margin-left: calc(var(--card-width) / -2);
  margin-top: calc(var(--card-height) / -2);
  border-radius: 4px;
  overflow: hidden;
  opacity: 0;
  filter: blur(0px) brightness(1.1);
  transform: translate3d(0, 0, 150px);
  transform-style: preserve-3d;
  backface-visibility: hidden;
  pointer-events: none;
  transition: none;
}

/* TẤM GIỮA: Chỉ tấm này nhận biến xoay --rx, --ry */
.card.current {
  /* Thay translate3d(0, 0, 150px) thành 50px */
  transform: translate3d(0, 0, 50px) rotateX(var(--rx, 0deg))
    rotateY(var(--ry, 0deg));
  z-index: 100;
  opacity: 1;
  filter: brightness(1.1);
  pointer-events: auto;
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
  /* Chặn trình duyệt kéo ảnh mặc định */
}

/* --- INFO (Bottom-Left) --- */
.infoList {
  transform-style: preserve-3d;
  /* ĐẨY MẠNH NÓ RA PHÍA TRƯỚC: TĂNG GIÁ TRỊ TỪ 250px LÊN 350px HOẶC 400px */
  transform: translate3d(0, 20px, 400px) rotateX(var(--rx, 0deg))
    rotateY(var(--ry, 0deg));

  position: absolute;
  left: -40px;
  bottom: -80px;
  width: 100%;
  pointer-events: none;
  z-index: 300;
  /* Z cao nhất để đảm bảo không bị đè */
}

/* INFO LIST: Khóa tâm với ảnh */
#info-wrapper {
  position: absolute;
  left: 50%;
  top: 40%;
  width: var(--card-width);
  height: var(--card-height);
  margin-left: calc(var(--card-width) / -2);
  margin-top: calc(var(--card-height) / -2);
  pointer-events: none;
  z-index: 150;
  transform: translate3d(0, 0, 400px);
}

.info {
  position: absolute;
  left: -80px;
  bottom: -95px;
  opacity: 0;
  pointer-events: none;
  text-align: left;
}

#enter-btn {
  position: fixed;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;

  will-change: transform, opacity;
  backface-visibility: hidden;
}

.card,
.info {
  will-change: transform, opacity;
  backface-visibility: hidden;
}

.info.active {
  display: block;
  opacity: 1;
}

.info h1 {
  font-size: 64px;
  font-weight: 800;
  text-transform: uppercase;
  line-height: 0.8;
  text-shadow:
    0 30px 50px rgba(0, 0, 0, 1),
    0 10px 10px rgba(0, 0, 0, 0.5);
}

.info h4 {
  font-size: 12px;
  color: #888;
  letter-spacing: 2px;
  border-left: 2px solid #fff;
  padding-left: 15px;
  margin-top: 15px;
  text-transform: uppercase;
}

/* --- THIẾT KẾ TECH-GRID MỚI --- */
.tech-grid {
  margin-top: 25px;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  max-width: 400px;
}

.tech-item {
  display: flex;
  flex-direction: column; /* Nhãn ở trên, giá trị ở dưới */
  gap: 4px;
  border-left: 1px solid rgba(255, 255, 255, 0.1); /* Vạch ngăn cực mảnh */
  padding-left: 12px;
}

.tech-item .label {
  font-size: 8px;
  color: #b6b6b6; /* Màu mờ hẳn đi làm nền */
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 800;
}

.tech-item .value {
  font-size: 9px;
  color: #ccc; /* Màu sáng hơn để nổi bật thông số */
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 400;
}

/* Hiệu ứng Hover cho tech-item (Optional) */
.tech-item:hover {
  border-left-color: #fff;
  transition: 0.3s;
}
.tech-item:hover .label {
  color: #888;
}
/* LOADING */
#loader {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.bar-container {
  width: 300px;
  height: 3px; /* 👈 từ 2px → 4px */
  background: #222;
  border-radius: 10px;
  overflow: hidden;
  margin-top: 50px;
}

#bar {
  display: block;
  height: 100%;
  background: rgb(219, 219, 219);
  width: 0%;
}

/* Định dạng cho 3 dòng thông số kỹ thuật */
.info .tech-specs {
  margin-top: 15px;
  opacity: 0.8; /* Làm mờ nhẹ để tạo phân cấp thị giác */
}

.info .tech-specs p {
  font-size: 9px; /* Nhỏ hơn h4 (11px) */
  text-transform: uppercase;
  letter-spacing: 2px; /* Giãn chữ nhẹ để giữ chất Mastery */
  line-height: 1.8;
  margin: 0;
  color: #c9c9c9;
}

/* Lớp phủ dùng để chuyển trang mượt mà */
.transition-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
}

/* --- IPAD LANDSCAPE (MÀN HÌNH NGANG) --- */
@media screen and (min-width: 769px) and (max-width: 1400px) and (orientation: landscape) {
  :root {
    /* Thu nhỏ Card lại để không chiếm hết chiều cao màn hình */
    --card-width: 480px;
    --card-height: 480px;
  }

  .card,
  #info-wrapper {
    /* Đẩy trọng tâm lên cao một chút (40%) để hở chân cho nút PORTFOLIO */
    top: 40%;
  }

  .info {
    /* Đưa chữ về vị trí đẹp: lệch trái và nằm dưới ảnh */
    left: -100px;
    bottom: -95px;
    width: auto;
    text-align: left;
  }

  .info h1 {
    font-size: 70px;
    /* Chữ vừa phải, không quá choán chỗ */
  }

  .info h4 {
    font-size: 10px;
    letter-spacing: 4px;
  }

  .main-nav-link {
    bottom: 60px;
    /* Giữ khoảng cách an toàn với thanh Home Bar của iPad */
    padding: 15px 45px;
    /* Tăng độ dày (15px) và độ dài (45px) của nút */
    min-width: 220px;
    /* Nút sẽ dài tối thiểu 220px nhìn rất sang */
    font-size: 13px;
    /* Chữ to lên từ 10px -> 13px cho dễ đọc */
    letter-spacing: 5px;
    /* Giãn chữ ra thêm tí nữa cho đúng chất Lab */
    border-width: 1.5px;
    /* Viền dày hơn một chút cho cứng cáp */
  }

  .nav-btn {
    /* Hiện lại mũi tên nhưng cho nhỏ lại và mờ đi cho tinh tế */
    font-size: 30px;
    opacity: 0.3;
  }
}

/* Cho iPad / Tablet */
@media (max-width: 1194px) {
  #enter-btn {
    bottom: 100px;
  }

  :root {
    --card-width: 700px;
    --card-height: 700px;
  }

  .info {
    position: absolute;
    left: -80px;
    bottom: -108px;
    width: auto;
    text-align: left;
  }

  .info h1 {
    font-size: 100px;
  }
  .main-nav-link {
    padding: 20px 50px;
    font-size: 16px;
    width: auto;
    text-align: center;
    bottom: -30px;
  }

  /* Thu nhỏ chữ tiêu đề */
  .nav-btn {
    display: none;
  }

  /* Thu nhỏ nút mũi tên */
}

/* Cho Mobile */
@media (max-width: 768px) {
  :root {
    --card-width: 280px;
    --card-height: 280px;
    --top-position: 32%;
  }

  .card,
  #info-wrapper {
    top: var(--top-position); /* Đẩy toàn bộ cụm lên 30% màn hình thay vì 40% */
  }

  .info h1 {
    font-size: 32px;
    /* Giảm từ 64px xuống 32px */
    line-height: 1;
    text-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    /* Giảm độ đổ bóng cho đỡ bẩn chữ */
  }

  .info h4 {
    font-size: 9px;
    letter-spacing: 3px;
    /* Thu hẹp khoảng cách chữ cho đỡ loãng trên màn nhỏ */
    margin-top: 10px;
  }

  .info {
    left: 0;
    bottom: -250px;
    /* Đẩy chữ xuống dưới tâm ảnh một chút */
    width: auto;
    text-align: left;
    /* Mobile nên để Center nhìn sẽ Mastery hơn là để lệch */
  }

  /* Đưa chữ về giữa cho cân */

  .nav-btn {
    /* Mobile thì dùng vuốt (Swipe) là chính, ẩn nút cho thoáng */
    display: none;
  }

  .main-nav-link {
    /* Nút Portfolio to ra cho dễ bấm */
    text-align: center;
    margin-bottom: -65px;
    min-width: 120px;
    padding: 12px 40px;
    font-size: 11px;
  }
}

/* --- FIX CHO MOBILE NẰM NGANG (LANDSCAPE) --- */
@media (orientation: landscape) and (max-height: 500px) {
  :root {
    /* Giảm mạnh kích thước Card vì chiều cao màn hình ngang rất thấp */
    --card-width: 240px;
    --card-height: 240px;
  }
  #enter-btn {
    bottom: 30px;
  }
  .card,
  #info-wrapper {
    top: 45%;
    /* Đẩy lên nhẹ để chừa chỗ cho nút ở dưới */
  }

  .info h1 {
    font-size: 22px;
    /* Chữ phải cực nhỏ để không chiếm chỗ */
    line-height: 1;
    text-align: left;
  }

  .info h4 {
    font-size: 8px;
    margin-top: 5px;
    letter-spacing: 2px;
    text-align: left;
  }

  .info {
    bottom: -50px;
    /* Đưa chữ sát vào ảnh */
    left: -230px;
    text-align: left;
    width: auto;
  }

  .loader-logo {
    width: 150px;
    margin-bottom: 15px;
    opacity: 0.95;
  }

  .loader-text {
    letter-spacing: 5px;
    font-size: 20px;
    color: #eeeeee;
    margin-bottom: 10px;
  }

  .bar-container {
    width: 200px;
    height: 2px; /* 👈 từ 2px → 4px */
    margin-top: 15px;
  }

  .main-nav-link {
    /* Nút Portfolio to ra cho dễ bấm */
    text-align: center;
    margin-bottom: -8px;
    min-width: 120px;
    padding: 12px 40px;
    font-size: 11px;
  }
  .nav-btn {
    display: none;
    /* Tắt hẳn mũi tên ở chế độ ngang vì quá chật */
  }
}

/* --- TÙY CHỈNH THÊM CHO MÀN HÌNH CỰC NHỎ (Dưới 480px) --- */
@media (max-width: 480px) {
  .info h1 {
    font-size: 26px;
    /* Nếu 32px vẫn to thì hạ tiếp xuống 26px */
  }
}
