/* ================================
   Isabelle Xu - Personal Site
   ================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Playfair+Display:ital,wght@0,400;1,400&display=swap');

/* Dark theme (default) */
:root {
  --bg: #0c0b0d;
  --bg-elevated: #161518;
  --bg-card: #1c1a1f;
  --text: #e8e4e0;
  --text-muted: #9a9498;
  --accent: #c8a87c;
  --accent-dim: #8a7460;
  --border: rgba(255, 255, 255, 0.06);
  --nav-bg: rgba(12, 11, 13, 0.85);
  --nav-mobile-bg: rgba(12, 11, 13, 0.97);
  --lightbox-bg: rgba(0, 0, 0, 0.92);
  --gallery-hover: rgba(12, 11, 13, 0.15);
  --radius: 8px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light theme */
[data-theme="light"] {
  --bg: #f5f3f0;
  --bg-elevated: #eae7e3;
  --bg-card: #e0ddd8;
  --text: #1a1a1a;
  --text-muted: #6b6560;
  --accent: #96714a;
  --accent-dim: #b08e6a;
  --border: rgba(0, 0, 0, 0.08);
  --nav-bg: rgba(245, 243, 240, 0.9);
  --nav-mobile-bg: rgba(245, 243, 240, 0.97);
  --lightbox-bg: rgba(0, 0, 0, 0.85);
  --gallery-hover: rgba(255, 255, 255, 0.25);
}

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

html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-dim) var(--bg);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* ================================
   Navigation
   ================================ */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0 2rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition), border-color var(--transition);
}

.nav-brand {
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-brand svg {
  width: 18px;
  height: 18px;
  opacity: 0.7;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  transition: color var(--transition);
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-social {
  display: flex;
  gap: 0;
  align-items: center;
}

.nav-social a {
  color: var(--text-muted);
  transition: color var(--transition);
  display: flex;
  align-items: center;
  padding: 8px;
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
}

.nav-social a:hover {
  color: var(--accent);
}

.nav-social svg {
  width: 17px;
  height: 17px;
}

.nav-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 0.25rem;
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  margin-left: 0.5rem;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(200, 168, 124, 0.08);
}

.theme-toggle svg {
  width: 15px;
  height: 15px;
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* Mobile nav */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 1.5px;
  background: var(--text);
  margin: 5px 0;
  transition: var(--transition);
}

.nav-menu {
  display: contents;
}

@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .nav-menu {
    display: none;
    position: fixed;
    inset: 60px 0 0 0;
    background: var(--nav-mobile-bg);
    backdrop-filter: blur(20px);
    flex-direction: column;
    padding: 2rem;
    gap: 2rem;
  }

  .nav-menu.open {
    display: flex;
  }

  .nav-links {
    flex-direction: column;
    gap: 1.5rem;
  }

  .nav-links a {
    font-size: 1.1rem;
  }

  .nav-divider {
    width: 40px;
    height: 1px;
  }

  .nav-right {
    display: contents;
  }
}

/* ================================
   Hero
   ================================ */

.hero {
  position: relative;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
}

.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.5s ease;
  background-size: cover;
  background-position: center;
}

.hero-slide.active {
  opacity: 1;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(12, 11, 13, 0.3) 0%,
    rgba(12, 11, 13, 0.15) 40%,
    rgba(12, 11, 13, 0.4) 70%,
    rgba(12, 11, 13, 0.95) 100%
  );
}

[data-theme="light"] .hero-overlay {
  background: linear-gradient(
    to bottom,
    rgba(245, 243, 240, 0.2) 0%,
    rgba(245, 243, 240, 0.05) 40%,
    rgba(245, 243, 240, 0.3) 70%,
    rgba(245, 243, 240, 0.97) 100%
  );
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 2rem;
}

.hero-title {
  font-family: 'Inter', sans-serif;
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 300;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  color: #fff;
}

.hero-subtitle {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: clamp(1rem, 2vw, 1.3rem);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: 0.04em;
}

[data-theme="light"] .hero-title {
  color: var(--text);
}

[data-theme="light"] .hero-subtitle {
  color: var(--text-muted);
}

.hero-indicators {
  position: absolute;
  bottom: 6rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  gap: 8px;
}

.hero-dot {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
  position: relative;
}

.hero-dot::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transition: var(--transition);
}

.hero-dot.active::after {
  background: rgba(255, 255, 255, 0.85);
  transform: translate(-50%, -50%) scale(1.3);
}

[data-theme="light"] .hero-dot::after {
  background: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .hero-dot.active::after {
  background: rgba(0, 0, 0, 0.6);
}

.hero-scroll {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

[data-theme="light"] .hero-scroll {
  color: var(--text-muted);
}

.hero-scroll-line {
  width: 1px;
  height: 30px;
  background: linear-gradient(to bottom, rgba(255,255,255,0.4), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}

[data-theme="light"] .hero-scroll-line {
  background: linear-gradient(to bottom, var(--text-muted), transparent);
}

@keyframes scrollPulse {
  0%, 100% { opacity: 0.4; transform: scaleY(1); }
  50% { opacity: 1; transform: scaleY(1.3); }
}

/* ================================
   About
   ================================ */

.about {
  padding: 8rem 2rem;
  max-width: 900px;
  margin: 0 auto;
}

.about-header {
  margin-bottom: 4rem;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.5rem;
}

.about-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 4rem;
  align-items: start;
}

.about-avatar {
  width: 200px;
  height: 200px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
}

.about-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.about-text h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  font-weight: 400;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.about-text p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 1.5rem;
}

.about-contact {
  font-size: 0.85rem;
  color: var(--accent);
  border-bottom: 1px solid var(--accent-dim);
  padding-bottom: 2px;
  display: inline-block;
  transition: var(--transition);
}

.about-contact:hover {
  color: var(--text);
  border-color: var(--text);
}

.about-social {
  display: flex;
  gap: 1.25rem;
  margin-top: 2rem;
}

.about-social a {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: var(--transition);
}

.about-social a:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(200, 168, 124, 0.08);
}

.about-social svg {
  width: 16px;
  height: 16px;
}

@media (max-width: 640px) {
  .about-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
    justify-items: center;
  }

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

  .about-social {
    justify-content: center;
  }

  .about {
    padding: 5rem 1.5rem;
  }
}

/* ================================
   Gallery Page
   ================================ */

.gallery-page {
  padding-top: 80px;
  min-height: 100vh;
}

.gallery-header {
  padding: 2rem 2.5rem 1rem;
}

.gallery-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 400;
}

.gallery-grid {
  columns: 4;
  column-gap: 10px;
  padding: 1.5rem 2.5rem 4rem;
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: 10px;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.gallery-item img {
  width: 100%;
  display: block;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item::after {
  content: attr(data-alt);
  position: absolute;
  inset: 0;
  background: var(--gallery-hover);
  opacity: 0;
  transition: opacity var(--transition);
  display: flex;
  align-items: flex-end;
  padding: 1rem;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  background: linear-gradient(to bottom, transparent 50%, rgba(0, 0, 0, 0.45) 100%);
}

.gallery-item:hover::after {
  opacity: 1;
}

.gallery-item:hover img {
  transform: scale(1.03);
}

/* Touch devices: always show titles since hover doesn't work */
@media (hover: none) {
  .gallery-item::after {
    opacity: 1;
  }
}

@media (max-width: 850px) {
  .gallery-grid {
    columns: 3;
    padding: 1rem 2rem 3rem;
  }
}

@media (max-width: 750px) {
  .gallery-grid {
    columns: 2;
    padding: 1rem 1.5rem 3rem;
  }
}

@media (max-width: 500px) {
  .gallery-grid {
    columns: 1;
    padding: 1rem 1rem 3rem;
  }

  .gallery-header {
    padding: 1.5rem 1rem 0.5rem;
  }
}

/* ================================
   Lightbox
   ================================ */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--lightbox-bg);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.lightbox.open {
  opacity: 1;
  visibility: visible;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 4px;
  transition: opacity 0.3s ease;
}

.lightbox-img.switching {
  opacity: 0;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 12px;
  min-width: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition);
}

.lightbox-close:hover {
  color: #fff;
}

.lightbox-close svg {
  width: 24px;
  height: 24px;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  padding: 1rem;
  min-width: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition);
}

.lightbox-nav:hover {
  color: #fff;
}

.lightbox-nav svg {
  width: 28px;
  height: 28px;
}

.lightbox-prev {
  left: 1rem;
}

.lightbox-next {
  right: 1rem;
}

.lightbox-caption {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* Mobile lightbox: move nav below image */
@media (max-width: 600px) {
  .lightbox-nav {
    top: auto;
    bottom: 3rem;
    transform: none;
  }

  .lightbox-prev {
    left: 25%;
  }

  .lightbox-next {
    right: 25%;
  }

  .lightbox-img {
    max-width: 95vw;
    max-height: 70vh;
  }

  .lightbox-caption {
    bottom: 0.75rem;
  }
}

/* ================================
   Footer
   ================================ */

.footer {
  padding: 3rem 2rem;
  text-align: center;
  border-top: 1px solid var(--border);
}

.footer p {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* ================================
   Animations
   ================================ */

.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}
