/* ===== Basics / Theme ===== */
* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

#web {
  --mx: 50%;
  --my: 30%;
  --ring: rgba(255, 255, 255, .25);
  font-family: "Montserrat", sans-serif;
  background: #000;
  color: #fff;
  min-height: 100%;
  margin: 0;
  text-align: center;
  position: relative;
  transition: background .6s ease, color .6s ease;
}

#web::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(900px 600px at var(--mx) var(--my), rgba(255, 255, 255, .07), transparent 40%), radial-gradient(60vw 60vw at 10% -10%, rgba(255, 255, 255, .04), transparent 50%);
  transition: background .12s ease;
}

/* ===== Tabs ===== */
.tab-content {
  display: none !important;
}

.tab-content.active {
  display: block !important;
}

/* ===== Nav ===== */
.nav {
  margin: 20px auto 0;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.tab-btn {
  padding: 10px 18px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: .25s, transform .18s;
}

.tab-btn:hover {
  transform: translateY(-1px);
}

.tab-btn.active,
.tab-btn:hover {
  background: #fff;
  color: #000;
}

/* ===== Home Card ===== */
.home-center {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

.greeting {
  opacity: .85;
  margin: 0;
  font-size: 14px;
}

h1 {
  font-size: clamp(42px, 6vw, 64px);
  margin: 10px 0 8px;
  line-height: 1.15;
}

h1 span {
  color: #fff;
}

#web.light-theme h1 span {
  color: #000;
}

.subtitle {
  font-size: 18px;
  opacity: .9;
  margin-bottom: 22px;
}

.avatar img {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  border: 4px solid currentColor;
  box-shadow: 0 0 24px rgba(255, 255, 255, .45);
  transition: transform .35s, box-shadow .35s;
}

.avatar img:hover {
  transform: scale(1.035) rotate(-1deg);
  box-shadow: 0 0 44px rgba(255, 255, 255, .85);
}

/* Buttons */
.socials {
  margin-top: 22px;
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.btn {
  background: transparent;
  color: currentColor;
  border: 1.5px solid currentColor;
  padding: 10px 18px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 800;
  transition: .25s, transform .18s;
}

.btn:hover {
  background: #fff;
  color: #000;
  transform: translateY(-1px);
}

.quick-actions {
  margin-top: 18px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.qa-btn {
  border: 1px solid var(--ring);
  background: transparent;
  color: #fff;
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 800;
  cursor: pointer;
  transition: .2s;
}

.qa-btn:hover {
  background: #fff;
  color: #000;
  transform: translateY(-1px);
}

.footer {
  text-align: center;
  font-size: 13px;
  opacity: .65;
  padding-top: 16px;
}

/* ===== Gallery ===== */
.container {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.gallery figure {
  margin: 0;
}

.gallery img {
  width: 100%;
  border-radius: 14px;
  cursor: pointer;
  transition: transform .25s, filter .25s, box-shadow .25s;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .45);
}

.gallery img:hover {
  transform: translateY(-4px) scale(1.02);
  filter: saturate(1.08);
}

.gallery figcaption {
  font-size: 14px;
  opacity: .9;
  margin-top: 8px;
}

/* ===== Gallery Popup ===== */
.popup {
  display: none;
  position: fixed;
  inset: 0;
  padding: 24px;
  background: rgba(0, 0, 0, .86);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transform: scale(.985);
  transition: opacity .25s ease, transform .25s ease;
}

.popup.visible {
  display: flex;
}

.popup.open {
  opacity: 1;
  transform: none;
}

.popup.closing {
  opacity: 0 !important;
  transform: scale(.985) !important;
}

#popupImg {
  max-width: min(90vw, 1200px);
  max-height: min(90vh, 90dvh);
  width: auto;
  height: auto;
  border-radius: 14px;
  transition: transform .25s ease;
  cursor: zoom-in;
}

.pop-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .4);
  color: #fff;
  border: 1px solid var(--ring);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.pop-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--ring);
  background: rgba(0, 0, 0, .35);
  color: #fff;
  font-weight: 900;
  display: grid;
  place-items: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.pop-prev {
  left: 18px;
}

.pop-next {
  right: 18px;
}

.pop-nav:hover,
.pop-close:hover {
  background: rgba(255, 255, 255, .92);
  color: #000;
}

/* ===== About Floating ===== */
.about-floating {
  position: fixed;
  left: 24px;
  bottom: 24px;
  width: 340px;
  text-align: left;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 14px;
  backdrop-filter: blur(10px);
  padding: 18px 18px 16px;
  z-index: 1100;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .35);
}

.about-floating h2 {
  margin: 0 0 10px;
  font-size: 22px;
}

.about-floating h3 {
  margin: 16px 0 8px;
  font-size: 18px;
}

/* Skills */
.skills {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
}

.skills li {
  margin-bottom: 14px;
  cursor: pointer;
}

.skills span {
  font-weight: 800;
  display: block;
  margin-bottom: 6px;
}

.skills .bar {
  height: 8px;
  background: rgba(255, 255, 255, .18);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.skills .bar div {
  --w: 80%;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #fff, #cfcfcf);
  box-shadow: 0 0 0 rgba(255, 255, 255, 0);
  animation: fillBar 1.1s ease forwards;
}

.skills .bar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, .18) 30%, transparent 60%);
  transform: translateX(-100%);
  animation: shimmer 1.6s ease-in-out infinite .3s;
}

/* Hover màu theo độ dài: đỏ, xanh dương, vàng, tím, xanh lá (Chat GPT) */
.skills li:nth-child(1) .bar div {
  --hover: #ff3b30;
}

.skills li:nth-child(2) .bar div {
  --hover: #0a84ff;
}

.skills li:nth-child(3) .bar div {
  --hover: #ffd60a;
}

.skills li:nth-child(4) .bar div {
  --hover: #bf5af2;
}

.skills li:nth-child(5) .bar div {
  --hover: #34c759;
}

.skills li:hover .bar div {
  background: linear-gradient(90deg, var(--hover), var(--hover));
  box-shadow: 0 0 16px color-mix(in oklab, var(--hover) 50%, white 0%);
}

@keyframes fillBar {
  from {
    width: 0
  }

  to {
    width: var(--w)
  }
}

@keyframes shimmer {
  to {
    transform: translateX(100%)
  }
}

/* ===== Control Dock ===== */
.control-dock {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--ring);
  border-radius: 16px;
  backdrop-filter: blur(10px);
  padding: 10px 12px;
  z-index: 1200;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

.dock-btn {
  appearance: none;
  border: 1px solid var(--ring);
  background: transparent;
  color: #fff;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: .2s;
}

.dock-btn:hover {
  background: rgba(255, 255, 255, .92);
  color: #000;
  transform: translateY(-1px);
}

.dock-sep {
  width: 1px;
  height: 28px;
  background: var(--ring);
}

.track-dropdown {
  position: relative;
}

.track-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 240px;
}

.track-toggle .label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 170px;
}

.track-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  list-style: none;
  margin: 0;
  padding: 6px;
  background: #111;
  color: #fff;
  border: 1px solid #333;
  border-radius: 12px;
  min-width: 260px;
  text-align: left;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  transform-origin: right bottom;
  transform: translateY(6px) scale(.96);
  opacity: 0;
  pointer-events: none;
  transition: transform .16s ease, opacity .16s ease;
  display: block;
}

.track-menu.open {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

.track-menu li {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

.track-menu li:hover,
.track-menu li[aria-selected="true"] {
  background: #222;
}

/* ===== Reveal ===== */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  animation: reveal .5s ease forwards;
}

.delay-1 {
  animation-delay: .05s
}

.delay-2 {
  animation-delay: .12s
}

.delay-3 {
  animation-delay: .20s
}

.delay-4 {
  animation-delay: .28s
}

.delay-5 {
  animation-delay: .36s
}

.delay-6 {
  animation-delay: .44s
}

@keyframes reveal {
  to {
    opacity: 1;
    transform: none
  }
}

/* ===== Hidden Audio ===== */
.sr-audio {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  left: -9999px;
  top: auto;
  opacity: 0;
  pointer-events: none;
}

/* ===== Light theme ===== */
#web.light-theme {
  background: #f9f9f9;
  color: #000;
}

#web.light-theme::before {
  background: radial-gradient(900px 600px at var(--mx) var(--my), rgba(0, 0, 0, .06), transparent 40%), radial-gradient(60vw 60vw at 10% -10%, rgba(0, 0, 0, .03), transparent 50%);
}

#web.light-theme .tab-btn {
  border-color: #000;
  color: #000;
}

#web.light-theme .tab-btn.active,
#web.light-theme .tab-btn:hover {
  background: #000;
  color: #fff;
}

#web.light-theme .btn {
  border-color: #000;
  color: #000;
}

#web.light-theme .btn:hover {
  background: #000;
  color: #fff;
}

#web.light-theme .avatar img {
  border-color: #000;
  box-shadow: 0 0 24px rgba(0, 0, 0, .2);
}

#web.light-theme .control-dock {
  background: rgba(255, 255, 255, .72);
  border-color: rgba(0, 0, 0, .45);
}

#web.light-theme .dock-btn {
  border-color: #000;
  color: #000;
}

#web.light-theme .dock-btn:hover {
  background: #000;
  color: #fff;
}

#web.light-theme .track-menu {
  background: #fff;
  color: #000;
  border-color: #000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .15);
}

#web.light-theme .about-floating {
  background: rgba(0, 0, 0, .06);
  border-color: rgba(0, 0, 0, .18);
}

/* Light theme: QA buttons & Skills */
#web.light-theme .qa-btn {
  color: #000;
  border-color: #000;
  background: rgba(0, 0, 0, .04);
}

#web.light-theme .qa-btn:hover {
  background: #000;
  color: #fff;
}

#web.light-theme .skills .bar {
  background: rgba(0, 0, 0, .18);
}

#web.light-theme .skills .bar div {
  background: linear-gradient(90deg, #000, #6f6f6f);
  box-shadow: none;
}

/* ===== QR modal (smooth + responsive) ===== */
.qr-modal {
  border: none;
  padding: 0;
  background: transparent;
}

/* backdrop đậm + blur để che text phía sau */
.qr-modal::backdrop {
  background: rgba(0, 0, 0, .7);
  backdrop-filter: blur(6px);
}

.qr-modal[closing]::backdrop {
  animation: qrBackdropOut .18s ease forwards;
}

.qr-card {
  width: clamp(280px, 86vw, 420px);
  max-height: min(86vh, 720px);
  margin: auto;
  overflow: auto;
  text-align: center;
  border-radius: 18px;
  padding: 18px 18px 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, .45);
  transform: translateY(8px) scale(.96);
  opacity: 0;
  animation: qrCardIn .22s cubic-bezier(.2, .7, .2, 1) forwards;
  /* default = dark theme */
  background: #111;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .2);
}

/* light theme cho QR card */
#web.light-theme .qr-card {
  background: #fff;
  color: #000;
  border: 1px solid rgba(0, 0, 0, .25);
}

.qr-modal[closing] .qr-card {
  animation: qrCardOut .18s ease forwards;
}

.qr-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 3px solid currentColor;
  box-shadow: 0 0 20px rgba(255, 255, 255, .35);
  margin: 6px auto 8px;
  object-fit: cover;
}

#web.light-theme .qr-avatar {
  border-color: #000;
  box-shadow: 0 0 20px rgba(0, 0, 0, .25);
}

.qr-card h3 {
  margin: 6px 0 4px;
  font-size: clamp(18px, 2.4vw, 22px);
}

.qr-sub {
  margin: 0 0 12px;
  opacity: .85;
  font-size: 13px;
}

.qr-img {
  display: block;
  width: min(72vw, 320px);
  height: auto;
  max-height: calc(70vh - 160px);
  margin: 0 auto 12px;
  background: #fff;
  padding: 10px;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px #000;
}

/* Animations for QR */
@keyframes qrBackdropOut {
  to {
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0);
  }
}

@keyframes qrCardIn {
  to {
    transform: none;
    opacity: 1;
  }
}

@keyframes qrCardOut {
  to {
    transform: translateY(8px) scale(.96);
    opacity: 0;
  }
}

/* ===== Responsive ===== */
@media (max-width:900px) {
  .about-floating {
    width: min(88vw, 380px);
    left: 12px;
    bottom: 12px;
  }
}

/* === Track menu – Light theme FIX === */
#web.light-theme .track-menu {
  background: #fff;
  color: #000;
  border-color: #000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .15);
}

/* Mặc định item nền trong suốt (trắng theo menu) */
#web.light-theme .track-menu li {
  color: #000;
  background: transparent;
}

/* Hover & selected: dùng xám nhẹ thay vì #222 của dark */
#web.light-theme .track-menu li:hover,
#web.light-theme .track-menu li[aria-selected="true"] {
  background: #f2f2f2;
}
/* ===== Mobile layout FIX ===== */
@media (max-width: 900px){
  /* About card không còn fixed để khỏi đè nội dung */
  .about-floating{
    position: static;           /* bỏ fixed */
    left:auto; bottom:auto;
    width: min(94vw, 560px);
    margin: 16px auto;          /* đưa ra giữa, có khoảng cách */
    z-index: 1;
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 20px rgba(0,0,0,.18);
  }

  /* Tăng padding đáy để tránh bị dock che */
  .home-center{ padding: 24px 16px 140px; }
  .container{   padding: 24px 16px 140px; }

  /* Dock căn giữa dưới đáy, an toàn cho iPhone notch */
  .control-dock{
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(14px + env(safe-area-inset-bottom));
  }
}

/* Track menu – light theme (giữ đẹp ở mobile) */
#web.light-theme .track-menu{
  background:#fff;
  color:#000;
  border-color:#000;
  box-shadow:0 10px 30px rgba(0,0,0,.15);
}
#web.light-theme .track-menu li{ color:#000; background:transparent; }
#web.light-theme .track-menu li:hover,
#web.light-theme .track-menu li[aria-selected="true"]{ background:#f2f2f2; }
/* Gallery popup smooth */
#popupImg {
  max-width: min(90vw,1200px);
  max-height: min(90vh,90dvh);
  width: auto; height: auto;
  border-radius: 14px;
  transition: transform .35s ease, opacity .35s ease; /* smooth */
  opacity: 0;
  transform: scale(.96);
}

#popupImg.visible {
  opacity: 1;
  transform: scale(1);
}
/* Gallery popup smooth */
#popupImg{
  transition: transform .35s ease, opacity .35s ease;
  opacity:0; transform:scale(.96);
}
#popupImg.visible{ opacity:1; transform:scale(1); }
