/* ====
   RESET & BASE
==== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #fff;
  --fg: #111;
  --muted: #888;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', Arial, sans-serif;
  --gap: 20px;
  --row-height: 380px;
  --pad: 24px;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

/* ====
   HEADER
==== */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  padding: 0 2rem;
  height: 52px;
  display: flex;
  align-items: center;
}

.header-inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.filters {
  display: flex;
  gap: 0.2rem;
}

.filter-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.8rem;
  letter-spacing: -0.01em;
  color: var(--muted);
  padding: 0.3rem 0.8rem;
  border-radius: 2px;
  transition: color 0.2s;
  text-transform: none;
  text-decoration: none;
  display: inline-block;
}

.filter-btn:hover {
  color: var(--fg);
}

.filter-btn.active {
  color: var(--fg);
  font-weight: 600;
  border-bottom: 2px solid var(--fg);
  padding-bottom: calc(0.3rem - 2px);
}

/* P3: focus-visible for keyboard nav */
.filter-btn:focus-visible,
.monogram:focus-visible,
.lightbox-close:focus-visible,
.lightbox-prev:focus-visible,
.lightbox-next:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
  border-radius: 2px;
}

.site-name {
  font-size: 0.8rem;
  letter-spacing: -0.01em;
  color: var(--fg);
  text-transform: none;
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s;
}

.site-name:hover {
  opacity: 0.6;
}

/* ====
   INTRO
==== */
.intro {
  position: relative;
  width: 100%;
  height: 100vh;
  margin-top: -52px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.intro-video {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  object-fit: cover;
  z-index: 0;
}

.intro-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1;
}

/* P5: intro text fade-in on load */
.intro-text {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 2rem;
  max-width: 720px;
  opacity: 0;
  transform: translateY(16px);
  animation: introFadeIn 1.2s ease 0.3s forwards;
}

@keyframes introFadeIn {
  to { opacity: 1; transform: translateY(0); }
}

.intro-text h1 {
  font-size: 3.6rem;
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: #fff;
  margin-bottom: 1.2rem;
  text-shadow: 0 2px 20px rgba(0,0,0,0.4);
}

.intro-text p {
  font-size: 1rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 300;
  letter-spacing: 0em;
  margin-bottom: 2rem;
}

.contact-link {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: opacity 0.2s;
  border-bottom: 1px solid rgba(255,255,255,0.25);
  padding-bottom: 2px;
}

.contact-link:hover {
  opacity: 0.7;
}

/* ====
   JUSTIFIED GALLERY
==== */
.gallery {
  padding: var(--gap);
}

.gallery-row {
  display: flex;
  flex-direction: row;
  gap: var(--gap);
  margin-bottom: var(--gap);
  width: 100%;
  align-items: stretch;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.gallery-item.show {
  opacity: 1;
  transform: translateY(0);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.gallery-item img.loaded {
  opacity: 1;
}

.gallery-item:hover img {
  transform: scale(1.03);
}

.gallery-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.3s ease;
  z-index: 1;
  pointer-events: none;
}

.gallery-item:hover::after {
  background: rgba(0, 0, 0, 0.25);
}

.gallery-item.hidden {
  display: none;
}

/* ====
   LIGHTBOX
==== */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  overflow: hidden;
}

.lightbox-video-bg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  object-fit: cover;
  z-index: 0;
  opacity: 0.05;
  pointer-events: none;
}

.lightbox.open {
  display: flex;
}

/* P2a: click-outside backdrop */
.lightbox-backdrop {
  position: absolute;
  inset: 0;
  z-index: 1;
  cursor: pointer;
}

.lightbox-content {
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  position: relative;
  z-index: 10;
  min-width: 80px;
  min-height: 80px;
}

.lightbox-content img {
  max-width: 90vw;
  max-height: 82vh;
  object-fit: contain;
  display: block;
}

.lightbox-content iframe {
  width: 80vw;
  height: 45vw;
  max-height: 80vh;
  border: none;
}

.lightbox-content video {
  max-width: 90vw;
  max-height: 82vh;
}

/* P2e: loading spinner */
.lightbox-content.loading::after {
  content: '';
  display: block;
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.lightbox-caption {
  color: rgba(255,255,255,0.55);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  margin-top: 1rem;
  text-transform: uppercase;
  position: relative;
  z-index: 10;
}

/* P2 bonus: image counter */
.lightbox-counter {
  color: rgba(255,255,255,0.35);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  margin-top: 0.4rem;
  position: relative;
  z-index: 10;
}

.lightbox-close {
  position: fixed;
  top: 1.2rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.2s;
  z-index: 1001;
}

.lightbox-close:hover { opacity: 1; }

.lightbox-prev,
.lightbox-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s;
  padding: 1rem;
  z-index: 1001;
}

.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }
.lightbox-prev:hover,
.lightbox-next:hover { opacity: 1; }

/* ====
   LIGHTBOX HINT
==== */
.lightbox-hint {
  position: relative;
  margin-top: 1rem;
  color: rgba(255,255,255,0.85);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  pointer-events: none;
  background: rgba(0,0,0,0.4);
  padding: 0.5rem 1.2rem;
  border-radius: 20px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  white-space: nowrap;
  z-index: 1000;
  animation: hintFlash 1s ease-in-out 3;
  opacity: 1;
  transition: opacity 1.5s ease;
}

.lightbox-hint.hidden {
  opacity: 0;
}

@keyframes hintFlash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

/* ====
   HEADER ELEMENTS
==== */
.header-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.monogram {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--fg);
  text-decoration: none;
  border: 1.5px solid var(--fg);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}

.monogram:hover {
  background: var(--fg);
  color: var(--bg);
}

/* ====
   FOOTER
==== */
footer {
  text-align: center;
  padding: 3rem 2rem;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.05em;
}

/* ====
   VIDEO THUMB
==== */
.video-thumb {
  position: relative;
  cursor: pointer;
  height: 100%;
}

.video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: #111;
  pointer-events: none;
  z-index: 2;
  transition: background 0.2s, transform 0.2s;
}

.video-thumb:hover .play-icon {
  background: #fff;
  transform: translate(-50%, -50%) scale(1.1);
}

/* ====
   SCROLL INDICATOR
==== */
.scroll-indicator {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: opacity 0.6s ease;
}

.scroll-indicator span {
  display: block;
  width: 20px;
  height: 20px;
  border-right: 2px solid rgba(255,255,255,0.7);
  border-bottom: 2px solid rgba(255,255,255,0.7);
  transform: rotate(45deg);
  animation: scrollBounce 1.4s ease-in-out infinite;
}

@keyframes scrollBounce {
  0%, 100% { transform: rotate(45deg) translateY(0); opacity: 0.4; }
  50% { transform: rotate(45deg) translateY(6px); opacity: 1; }
}

/* ====
   BACK TO TOP
==== */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 42px;
  height: 42px;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 50%;
  font-size: 1.1rem;
  color: #111;
  cursor: pointer;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
  text-decoration: none;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

.back-to-top:hover {
  transform: translateY(-3px);
}

/* ====
   ABOUT PAGE
==== */
.about {
  padding: 120px var(--pad) 60px;
  max-width: 1200px;
  margin: 0 auto;
}

.about-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 60px;
  align-items: start;
}

.about-photo img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
}

.about-text h1 {
  font-size: 2rem;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}

.about-text p {
  font-size: 1.05rem;
  line-height: 1.6;
  max-width: 60ch;
  margin-bottom: 1rem;
}

.about-meta {
  color: var(--muted);
  font-size: 0.95rem;
}

/* Link-based filter buttons */
a.filter-btn {
  text-decoration: none;
  display: inline-block;
}

/* About email link */
.about .contact-link {
  color: #007aff;
  border-bottom: none;
}

.about .contact-link:hover {
  opacity: 0.7;
}

/* ====
   MOBILE
==== */
@media (max-width: 768px) {
  .site-name {
    display: none;
  }

  .header-inner {
    justify-content: flex-start;
  }

  .header-left {
    width: 100%;
    justify-content: flex-start;
  }

  /* P4: prevent filter nav cramping on mobile */
  .filters {
    flex: 1;
    justify-content: center;
    gap: 0;
  }

  .filter-btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
  }

  .lightbox-prev,
  .lightbox-next {
    display: none;
  }

  .intro-text h1 {
  font-size: 2.2rem;
  }

  .intro-text p {
    font-size: 1rem;
  }

  .back-to-top {
    display: none;
  }

  /* P4: about photo spacing on mobile */
  .about-inner {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .about {
    padding-top: 80px;
  }

  .about-photo img {
    max-width: 280px;
    margin: 0 auto;
    display: block;
  }
}

@media (max-width: 600px) {
  .gallery {
    display: block;
    padding: 8px;
  }

  .gallery-row {
    display: block;
    margin-bottom: 8px;
    height: auto !important;
  }

  .gallery-item {
    width: 100% !important;
    height: auto !important;
    margin-bottom: 8px;
  }

  .gallery-item img {
    height: auto !important;
    width: 100%;
    object-fit: cover;
  }
}

/* ====
   P3: REDUCED MOTION
==== */
@media (prefers-reduced-motion: reduce) {
  .gallery-item,
  .gallery-item img,
  .intro-text,
  .lightbox-hint,
  .back-to-top {
    transition: none !important;
    animation: none !important;
  }

  .gallery-item,
  .gallery-item.show {
    opacity: 1;
    transform: none;
  }

  .gallery-item img,
  .gallery-item img.loaded {
    opacity: 1;
  }

  .intro-text {
    opacity: 1;
    transform: none;
  }
}

/* ====
   DARK MODE
==== */
body.dark {
  --bg: #111;
  --fg: #f0f0f0;
  --muted: #777;
}

body.dark header {
  background: rgba(17, 17, 17, 0.8);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

body.dark .back-to-top {
  background: rgba(30, 30, 30, 0.9);
  border-color: rgba(255,255,255,0.1);
  color: #f0f0f0;
}

body.dark .monogram {
  border-color: var(--fg);
  color: var(--fg);
}

body.dark .monogram:hover {
  background: var(--fg);
  color: var(--bg);
}

body.dark .about-text p {
  color: #ccc;
}

/* Toggle button */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.3rem;
  color: var(--muted);
  transition: color 0.2s;
  line-height: 1;
}

.theme-toggle:hover {
  color: var(--fg);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}