* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-feature-settings: "ss01", "cv11", "cv02";
  letter-spacing: -0.005em;
  background: #F2F2F7;
  transition: background-color 0.5s ease, color 0.5s ease;
}
body.dark {
  background-color: #000;
  color: #f0f0f0;
}
body.dark ::selection { background: rgba(255,255,255,0.3); color: #fff; }
::selection { background: rgba(0,0,0,0.12); color: #000; }

.nav-link { position: relative; transition: opacity .3s ease; }
.nav-link:hover { opacity: .5; }
.nav-link::after {
  content: ''; position: absolute; left: 0; bottom: -4px; height: 1px; width: 0;
  background: #1A1A1A; transition: width .5s cubic-bezier(.2,.8,.2,1);
}
body.dark .nav-link::after { background: rgba(255,255,255,0.5); }
.nav-link:hover::after { width: 100%; }

.logo { transition: letter-spacing .6s ease; }
.logo:hover { letter-spacing: 0.3em; }

.fade-line {
  opacity: 0;
  transform: translateY(24px);
  animation: fadeUp 1.4s cubic-bezier(.2,.8,.2,1) forwards;
  animation-delay: var(--d, 0s);
}
@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 1.2s cubic-bezier(.2,.8,.2,1), transform 1.2s cubic-bezier(.2,.8,.2,1);
  transition-delay: var(--delay, 0s);
}
.reveal.in { opacity: 1; transform: translateY(0); }

/* ── Navigation ── */
nav {
  position: relative;
  backdrop-filter: blur(30px) saturate(200%);
  -webkit-backdrop-filter: blur(30px) saturate(200%);
  background: rgba(255,255,255,0.55);
}
nav::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.35) 0%,
    rgba(255,255,255,0.08) 40%,
    transparent 100%
  );
  border-radius: inherit;
}
body.dark nav {
  background: rgba(0,0,0,0.5);
  border-color: rgba(255,255,255,0.06);
}
body.dark nav::after {
  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.06) 0%,
    transparent 50%
  );
}

/* ── Gallery Cards ── */
.grid-item {
  cursor: pointer;
  position: relative;
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: 20px;
  overflow: hidden;
  transition: transform 0.5s cubic-bezier(.2,.8,.2,1),
              box-shadow 0.5s cubic-bezier(.2,.8,.2,1),
              border-color 0.4s ease;
  box-shadow:
    0 1px 3px rgba(0,0,0,0.03),
    0 4px 12px rgba(0,0,0,0.04),
    0 8px 30px rgba(0,0,0,0.04);
}
.grid-item::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  border-radius: 20px;
  background:
    linear-gradient(
      180deg,
      rgba(255,255,255,0.4) 0%,
      rgba(255,255,255,0.1) 25%,
      transparent 60%
    ),
    linear-gradient(
      135deg,
      transparent 0%,
      rgba(255,255,255,0.06) 40%,
      rgba(255,255,255,0.15) 70%,
      transparent 85%
    );
}
.grid-item:hover {
  transform: translateY(-4px);
  border-color: rgba(255,255,255,0.9);
  box-shadow:
    0 2px 6px rgba(0,0,0,0.04),
    0 12px 28px rgba(0,0,0,0.06),
    0 24px 56px rgba(0,0,0,0.08),
    0 40px 80px rgba(0,0,0,0.06);
}
.grid-item:hover::before {
  background:
    linear-gradient(
      180deg,
      rgba(255,255,255,0.5) 0%,
      rgba(255,255,255,0.12) 30%,
      transparent 65%
    ),
    linear-gradient(
      135deg,
      transparent 0%,
      rgba(255,255,255,0.08) 40%,
      rgba(255,255,255,0.2) 70%,
      transparent 85%
    );
}
body.dark .grid-item {
  background: rgba(44,44,46,0.55);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 8px 30px rgba(0,0,0,0.3);
}
body.dark .grid-item::before {
  background:
    linear-gradient(
      180deg,
      rgba(255,255,255,0.04) 0%,
      rgba(255,255,255,0.02) 20%,
      transparent 50%
    ),
    linear-gradient(
      135deg,
      transparent 0%,
      rgba(255,255,255,0.02) 50%,
      rgba(255,255,255,0.04) 75%,
      transparent 90%
    );
}
body.dark .grid-item:hover {
  border-color: rgba(255,255,255,0.12);
  box-shadow:
    0 2px 6px rgba(0,0,0,0.3),
    0 12px 28px rgba(0,0,0,0.4),
    0 24px 56px rgba(0,0,0,0.5);
}
body.dark .grid-item:hover::before {
  background:
    linear-gradient(
      180deg,
      rgba(255,255,255,0.06) 0%,
      rgba(255,255,255,0.03) 20%,
      transparent 55%
    ),
    linear-gradient(
      135deg,
      transparent 0%,
      rgba(255,255,255,0.03) 50%,
      rgba(255,255,255,0.06) 75%,
      transparent 90%
    );
}

.grid-item .img-wrap {
  position: relative;
  z-index: 3;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: transparent;
  margin: 0;
  border-radius: 20px 20px 0 0;
}
.grid-item img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 1.4s cubic-bezier(.2,.8,.2,1), filter .8s ease;
  will-change: transform;
}
.grid-item:hover img { transform: scale(1.06); filter: brightness(.98) saturate(1.02); }
body.dark .grid-item:hover img { filter: brightness(.98); }

.grid-item .item-info {
  position: relative;
  z-index: 1;
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 16px 18px;
  font-size: 10px; letter-spacing: .25em; color: #8E8E93;
  font-weight: 400;
  background: transparent;
}
.grid-item .item-title { color: #1C1C1E; font-weight: 500; }
body.dark .grid-item .item-title { color: #f0f0f0; }
body.dark .grid-item .item-info { color: #8E8E93; }

/* ── Contact ── */
.email-link { position: relative; display: inline-block; padding-bottom: 4px; color: #1C1C1E; }
body.dark .email-link { color: #f0f0f0; }
.email-link::after {
  content: ''; position: absolute; left: 0; bottom: 0; height: 1px; width: 35%;
  background: #1C1C1E; transition: width .6s cubic-bezier(.2,.8,.2,1);
}
body.dark .email-link::after { background: #f0f0f0; }
.email-link:hover::after { width: 100%; }

.social-link { color: #8E8E93; transition: color .3s ease; position: relative; font-weight: 400; }
.social-link:hover { color: #1C1C1E; }
body.dark .social-link:hover { color: #f0f0f0; }

/* ── QR Card ── */
.qr-card {
  position: relative;
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(30px) saturate(200%);
  -webkit-backdrop-filter: blur(30px) saturate(200%);
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: 24px;
  padding: 2.5rem;
  transition: transform .7s cubic-bezier(.2,.8,.2,1), box-shadow .7s ease, border-color .5s ease;
  box-shadow:
    0 1px 3px rgba(0,0,0,0.03),
    0 8px 24px rgba(0,0,0,0.06),
    0 20px 50px rgba(0,0,0,0.08);
  max-width: 340px;
  width: 100%;
  overflow: hidden;
}
.qr-card::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  border-radius: 24px;
  background:
    linear-gradient(
      180deg,
      rgba(255,255,255,0.35) 0%,
      rgba(255,255,255,0.08) 30%,
      transparent 65%
    ),
    linear-gradient(
      135deg,
      transparent 0%,
      rgba(255,255,255,0.04) 45%,
      rgba(255,255,255,0.12) 70%,
      transparent 85%
    );
}
.qr-card > * { position: relative; z-index: 2; }
.qr-card:hover {
  transform: translateY(-6px);
  box-shadow:
    0 2px 6px rgba(0,0,0,0.04),
    0 16px 40px rgba(0,0,0,0.08),
    0 40px 80px rgba(0,0,0,0.1);
  border-color: rgba(255,255,255,0.9);
}
.qr-card:hover::before {
  background:
    linear-gradient(
      180deg,
      rgba(255,255,255,0.45) 0%,
      rgba(255,255,255,0.1) 35%,
      transparent 70%
    ),
    linear-gradient(
      135deg,
      transparent 0%,
      rgba(255,255,255,0.06) 45%,
      rgba(255,255,255,0.18) 70%,
      transparent 85%
    );
}
body.dark .qr-card {
  background: rgba(44,44,46,0.55);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 8px 30px rgba(0,0,0,0.3);
}
body.dark .qr-card::before {
  background:
    linear-gradient(
      180deg,
      rgba(255,255,255,0.04) 0%,
      rgba(255,255,255,0.02) 25%,
      transparent 55%
    ),
    linear-gradient(
      135deg,
      transparent 0%,
      rgba(255,255,255,0.02) 50%,
      rgba(255,255,255,0.04) 75%,
      transparent 90%
    );
}
body.dark .qr-card:hover {
  border-color: rgba(255,255,255,0.12);
  box-shadow:
    0 2px 6px rgba(0,0,0,0.3),
    0 16px 40px rgba(0,0,0,0.4),
    0 40px 80px rgba(0,0,0,0.5);
}
body.dark .qr-card:hover::before {
  background:
    linear-gradient(
      180deg,
      rgba(255,255,255,0.06) 0%,
      rgba(255,255,255,0.03) 25%,
      transparent 60%
    ),
    linear-gradient(
      135deg,
      transparent 0%,
      rgba(255,255,255,0.03) 50%,
      rgba(255,255,255,0.06) 75%,
      transparent 90%
    );
}

.qr-inner { display: flex; flex-direction: column; }
.qr-placeholder {
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.04);
  border-radius: 16px;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
body.dark .qr-placeholder { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.06); }
.qr-svg {
  width: 100%;
  height: 100%;
  filter: grayscale(1) opacity(.65);
  transition: filter .7s ease;
}
.qr-card:hover .qr-svg { filter: grayscale(0) opacity(1); }

.qr-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 38px; height: 38px;
  background: #fff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.wechat-logo {
  color: #1C1C1E;
  transition: color .5s ease;
}
.qr-card:hover .wechat-logo { color: #07C160; }

/* ── Lightbox ── */
.lightbox {
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  background: rgba(242,242,247,0.9);
}
.lightbox.open { display: flex !important; animation: lbIn .5s ease; }
@keyframes lbIn { from { opacity: 0; } to { opacity: 1; } }
#lb-img { transition: transform .08s ease-out; max-width:100%; max-height:100%; border-radius: 1rem; }
#lb-view { -ms-overflow-style: none; scrollbar-width: none; background:transparent; overflow:hidden; border-radius: 1rem; }
body.dark .lightbox { background: rgba(0,0,0,0.85) !important; }
body.dark #lb-view { border-radius: 1rem; }
body.dark #lb-img { border-radius: 1rem; }
body.dark #lb-title { color: #f0f0f0; }
body.dark #lb-meta { color: #8E8E93; }
body.dark #lb-close { color: #f0f0f0; }

body.dark h1, body.dark h2, body.dark h3 { color: #f0f0f0; }
body.dark a { color: inherit; }

/* ── Theme Toggle ── */
.theme-toggle {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(20px) saturate(200%);
  -webkit-backdrop-filter: blur(20px) saturate(200%);
  border: 1px solid rgba(255,255,255,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  color: #1C1C1E;
  overflow: hidden;
  box-shadow:
    0 1px 2px rgba(0,0,0,0.04),
    inset 0 1px 0 rgba(255,255,255,0.6);
}
.theme-toggle::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 50%;
  border-radius: 50% 50% 0 0;
  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.4) 0%,
    transparent 100%
  );
  pointer-events: none;
}
.theme-toggle:hover {
  transform: scale(1.1);
  border-color: rgba(255,255,255,0.7);
  box-shadow:
    0 4px 16px rgba(0,0,0,0.1),
    inset 0 1px 0 rgba(255,255,255,0.7);
}
body.dark .theme-toggle {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.12);
  color: #f0f0f0;
  box-shadow:
    0 1px 2px rgba(0,0,0,0.2),
    inset 0 1px 0 rgba(255,255,255,0.08);
}
body.dark .theme-toggle::before {
  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.08) 0%,
    transparent 100%
  );
}
body.dark .theme-toggle:hover {
  border-color: rgba(255,255,255,0.18);
  box-shadow:
    0 4px 16px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.12);
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .qr-card { padding: 2rem; max-width: 300px; border-radius: 20px; }
  .grid-item { border-radius: 16px; }
  .grid-item:hover img { transform: scale(1.03); }
}
