@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;1,300;1,400&family=JetBrains+Mono:wght@300;400&display=swap");

/* ─── RESET ─────────────────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #070707;
  --surface: #0d0d0d;
  --red: #8a1a1a;
  --red-dim: rgba(138, 26, 26, 0.45);
  --text: #c8c4bc;
  --text-dim: rgba(200, 196, 188, 0.38);
  --text-muted: rgba(200, 196, 188, 0.18);
  --border: rgba(255, 255, 255, 0.055);
  --border-red: rgba(138, 26, 26, 0.4);
  --font-serif: "Cormorant Garamond", "Georgia", serif;
  --font-mono: "JetBrains Mono", monospace;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* scrollbar — thin red to match theme */
html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #3a0808 #070707;
}

::-webkit-scrollbar {
  width: 3px;
}
::-webkit-scrollbar-track {
  background: #070707;
}
::-webkit-scrollbar-thumb {
  background: #3a0808;
  border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover {
  background: #8a1a1a;
}

.modal-open {
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  min-height: 100vh;
  overflow-x: hidden;
}

img {
  display: block;
  max-width: 100%;
}

/* ─── HEADER ────────────────────────────────────────────── */
.site-header {
  text-align: center;
  padding: 5rem 2rem 3rem;
  position: relative;
}

.site-header::after {
  content: "";
  display: block;
  width: 32px;
  height: 1px;
  background: var(--red);
  margin: 1.5rem auto 0;
}

.header-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 300;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.header-title {
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 7vw, 4.5rem);
  font-weight: 300;
  letter-spacing: 6px;
  color: var(--text);
  line-height: 1;
}

.header-sub {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 300;
  letter-spacing: 3px;
  color: var(--text-muted);
  font-style: normal;
  margin-top: 2.5rem;
  min-height: 1em;
  transition: color 0.6s var(--ease);
}

.header-sub.has-poem {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  color: var(--text-dim);
}

/* ─── GALLERY WRAP ──────────────────────────────────────── */
.gallery-wrap {
  padding: 2rem 3vw 6rem;
  background-image: url("pics/dark.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
}

.gallery-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(7, 7, 7, 0.72);
  pointer-events: none;
}

/* ─── GALLERY GRID ──────────────────────────────────────── */
.gallery {
  position: relative;
  columns: 3;
  column-gap: 8px;
  max-width: 1100px;
  margin: 0 auto;
}

/* ─── GALLERY ITEM ──────────────────────────────────────── */
.gallery-item {
  break-inside: avoid;
  margin-bottom: 8px;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  border-radius: 2px;
  border: 0.5px solid var(--border);
  transition: border-color 0.35s var(--ease);
  list-style: none;
}

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  filter: brightness(10%) saturate(0.2);
  transition:
    filter 0.55s var(--ease),
    transform 0.55s var(--ease);
  will-change: filter, transform;
}

.gallery-item:hover {
  border-color: var(--border-red);
}

.gallery-item:hover img {
  filter: brightness(82%) saturate(0.65);
  transform: scale(1.025);
}

/* subtle red glow on hover */
.gallery-item::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(138, 26, 26, 0.08) 0%,
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.5s var(--ease);
  z-index: 1;
  pointer-events: none;
}
.gallery-item:hover::before {
  opacity: 1;
}

/* ─── MODAL ─────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  pointer-events: none;
}

.modal.open {
  visibility: visible;
  pointer-events: all;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.45s var(--ease);
}

.modal.open .modal-backdrop {
  background: rgba(0, 0, 0, 0.92);
}

.modal-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 2rem;
}

/* ─── MODAL IMAGE ───────────────────────────────────────── */
.modal-image-wrap {
  position: relative;
}

.modal-image-wrap img {
  max-width: min(460px, 88vw);
  max-height: 58vh;
  width: auto;
  height: auto;
  border: 0.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  display: block;
  opacity: 0;
  transform: scale(0.93) translateY(6px);
  transition:
    opacity 0.5s var(--ease),
    transform 0.5s var(--ease);
}

.modal.open .modal-image-wrap img {
  opacity: 1;
  transform: scale(1) translateY(0);
  transition-delay: 0.06s;
}

/* ─── MODAL CLOSE ───────────────────────────────────────── */
.modal-close {
  position: absolute;
  top: -13px;
  right: -13px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface);
  border: 0.5px solid rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 2;
}
.modal-close:hover {
  border-color: var(--border-red);
  color: var(--text);
}

/* ─── MODAL POEM ────────────────────────────────────────── */
.modal-poem-wrap {
  margin-top: 1.75rem;
  text-align: center;
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 0.55s var(--ease),
    transform 0.55s var(--ease);
  transition-delay: 0s;
}

.modal.open .modal-poem-wrap {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.25s;
}

.modal-line {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 300;
  font-size: 1.15rem;
  color: rgba(200, 196, 188, 0.7);
  letter-spacing: 0.3px;
  line-height: 1.6;
  max-width: min(440px, 85vw);
}

.modal-line.is-title {
  font-style: normal;
  font-size: 0.62rem;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-weight: 300;
}

/* progress dots */
.modal-progress {
  display: flex;
  gap: 5px;
  justify-content: center;
  margin-top: 1.25rem;
}

.modal-progress span {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.3s;
}

.modal-progress span.done {
  background: var(--red-dim);
}
.modal-progress span.current {
  background: var(--red);
}

/* ─── RESPONSIVE ────────────────────────────────────────── */
@media (max-width: 768px) {
  .gallery {
    columns: 2;
  }
  .gallery-wrap {
    padding: 1.5rem 1.25rem 5rem;
  }
  .site-header {
    padding: 3.5rem 1.5rem 2rem;
  }
}

@media (max-width: 480px) {
  .gallery {
    columns: 1;
  }
  .modal-image-wrap img {
    max-height: 50vh;
  }
  .header-title {
    font-size: 2.25rem;
  }
}
