/* ── Reset & base ─────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --color-bg: #150e20;
  --color-surface: #1e1530;
  --color-glow: rgba(90, 50, 140, 0.35);
  --color-text: #e8e8e8;
  --color-text-muted: #888;
  --color-accent: #ccc;
  --font-sans: "Noto Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 3rem;
  --radius: 6px;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ───────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg);
  border-bottom: 1px solid #2e2240;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-id {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.site-name {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: 0.02em;
}

.site-tagline {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--color-text-muted);
  letter-spacing: 0.04em;
}

.site-social {
  color: var(--color-text-muted);
  transition: color 0.2s;
}

.site-social:hover {
  color: var(--color-text);
}

.site-social svg {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
}

/* ── Gallery / project cards ──────────────────────── */
#gallery {
  padding: var(--space-md) 0 var(--space-lg);
}

.project {
  margin-bottom: var(--space-lg);
}

.project-text {
  padding: 0 var(--space-md) var(--space-sm);
}

.project-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.project-description {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-xs);
  max-width: 60ch;
}

/* ── Tags ─────────────────────────────────────────── */
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  list-style: none;
}

.project-tags li {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  border: 1px solid #333;
  border-radius: 999px;
  padding: 0.2em 0.65em;
}

/* ── Swiper / carousel ────────────────────────────── */
.project-carousel {
  width: 100%;
  overflow: hidden;
}

.project-carousel .swiper-slide {
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-carousel figure {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-surface);
  box-shadow: 0 0 24px 4px var(--color-glow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Base media sizing ────────────────────────────── */
.project-carousel img,
.project-carousel video {
  display: block;
  border-radius: var(--radius);
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 75vw;      /* cap height on mobile */
  object-fit: contain;
}

/* Portrait media */
.swiper-slide.is-portrait figure {
  background: transparent;
}

.swiper-slide.is-portrait img,
.swiper-slide.is-portrait video {
  max-height: 85vw;      /* portrait gets more vertical room */
}

/* Swiper overrides */
.project-carousel .swiper-pagination {
  position: relative;
  margin-top: var(--space-xs);
}

.project-carousel .swiper-pagination-bullet {
  width: 6px;
  height: 6px;
  background: var(--color-text-muted);
  opacity: 0.4;
  transition: opacity 0.2s, transform 0.2s;
}

.project-carousel .swiper-pagination-bullet-active {
  opacity: 1;
  background: var(--color-text);
  transform: scale(1.3);
}

/* ── Video play-state indicator ───────────────────── */
.project-carousel .swiper-slide figure:has(video)::after {
  content: "▶";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.15);
  pointer-events: none;
  transition: opacity 0.3s;
}

.project-carousel .swiper-slide figure.is-playing::after {
  opacity: 0;
}

/* ── Zoom overlay ─────────────────────────────────── */
/* display:none by default — only show via .is-open    */
.zoom-overlay {
  display: none;               /* truly hidden, no pointer capture */
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(10, 6, 16, 0.95);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;        /* safety: even if display glitches */
}

.zoom-overlay.is-open {
  display: flex;
  pointer-events: auto;
}

.zoom-overlay.is-visible {
  opacity: 1;
}

.zoom-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  z-index: 301;
  background: none;
  border: none;
  color: var(--color-text);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.zoom-close:hover {
  opacity: 1;
}

.zoom-body {
  max-width: 94vw;
  max-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.zoom-body img,
.zoom-body video {
  max-width: 94vw;
  max-height: 90vh;
  border-radius: var(--radius);
  object-fit: contain;
  box-shadow: 0 0 40px 8px var(--color-glow);
}

/* Make carousel images tappable for zoom */
.project-carousel img {
  cursor: zoom-in;
}

/* ── Tablet ───────────────────────────────────────── */
@media (min-width: 768px) {
  .site-header {
    padding: var(--space-sm) var(--space-lg);
  }

  .project-text {
    padding: 0 var(--space-lg) var(--space-sm);
  }

  .project-title {
    font-size: 1.5rem;
  }

  .project-carousel img,
  .project-carousel video {
    max-height: 55vw;
  }

  .swiper-slide.is-portrait img,
  .swiper-slide.is-portrait video {
    max-height: 65vw;
  }
}

/* ── Desktop ──────────────────────────────────────── */
@media (min-width: 1200px) {
  #gallery {
    max-width: 1400px;
    margin: 0 auto;
  }

  .project-text {
    padding: 0 var(--space-lg) var(--space-md);
  }

  .project-title {
    font-size: 1.75rem;
  }

  .project-carousel img,
  .project-carousel video {
    max-height: 38vw;
  }

  .swiper-slide.is-portrait img,
  .swiper-slide.is-portrait video {
    max-height: 45vw;
  }

  .project-carousel figure {
    transition: transform 0.2s ease;
  }

  .project-carousel figure:hover {
    transform: scale(1.01);
  }
}

/* ── Accessibility: reduced motion ────────────────── */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .project-carousel figure,
  .project-carousel .swiper-pagination-bullet {
    transition: none;
  }
}

/* ── Loading state ────────────────────────────────── */
#gallery:empty::after {
  content: "";
  display: block;
  width: 2rem;
  height: 2rem;
  margin: 4rem auto;
  border: 2px solid #333;
  border-top-color: var(--color-text);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
