:root {
  --bg: #0e0e10;
  --bg-soft: #17171a;
  --ink: #f4f2ee;
  --ink-dim: #9a978f;
  --accent: #d98aa8;
  --panel-gap: 10px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --rotate-ms: 5000ms;
}

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

html,
body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 300;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ---------- Header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px clamp(20px, 5vw, 56px);
}

.mark {
  font-family: "Fraunces", serif;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.site-nav {
  display: flex;
  gap: 28px;
}

.site-nav a {
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.3s var(--ease);
}

.site-nav a:hover {
  color: var(--ink);
}

/* ---------- Nav dropdown ---------- */
.nav-drop {
  position: relative;
}

.nav-drop__toggle {
  background: none;
  border: none;
  padding: 0;
  color: var(--ink-dim);
  font: inherit;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.3s var(--ease);
}

.nav-drop__toggle:hover,
.nav-drop.is-open .nav-drop__toggle {
  color: var(--ink);
}

.nav-drop__menu {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 240px;
  list-style: none;
  padding: 10px 0;
  margin: 14px 0 0; /* visual gap only — hitbox stays continuous via ::before */

  background: var(--bg-soft);
  border-radius: 10px;
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  z-index: 50;
}

.nav-drop.is-open .nav-drop__menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Invisible hover bridge so moving the cursor from the toggle into the menu
   doesn't cross empty space and trigger mouseleave. */
.nav-drop__menu::before {
  content: "";
  position: absolute;
  top: -14px;
  left: 0;
  right: 0;
  height: 14px;
}

.nav-drop__group {
  padding: 8px 18px;
}

.nav-drop__group + .nav-drop__group {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-drop__cat {
  display: block;
  color: var(--ink);
  font-family: "Fraunces", serif;
  font-size: 0.98rem;
  letter-spacing: 0.01em;
  text-transform: none;
  text-decoration: none;
  transition: color 0.25s var(--ease);
}

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

.nav-drop__sub {
  display: block;
  margin-top: 3px;
  color: var(--ink-dim);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-decoration: none;
  transition: color 0.25s var(--ease);
}

.nav-drop__sub::before {
  content: "↳ ";
  opacity: 0.6;
}

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

/* ---------- Category page sub-link ---------- */
.category__sub {
  margin-top: clamp(28px, 5vw, 46px);
}

.category__sub-link {
  display: inline-block;
  color: var(--accent);
  font-family: "Fraunces", serif;
  font-size: 1.15rem;
  text-decoration: none;
  border-bottom: 1px dotted rgba(217, 138, 168, 0.4);
  padding-bottom: 2px;
  transition: color 0.25s var(--ease);
}

.category__sub-link:hover {
  color: #eaa9c2;
}

/* ---------- Intro ---------- */
.intro {
  padding: clamp(18px, 4vw, 40px) clamp(20px, 5vw, 56px) 22px;
}

.intro-title {
  font-family: "Fraunces", serif;
  font-weight: 400;
  font-size: clamp(2.2rem, 6vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.01em;
}

.intro-sub {
  margin-top: 12px;
  color: var(--ink-dim);
  font-size: 0.95rem;
  max-width: 46ch;
}

/* ---------- Gallery ---------- */
.gallery {
  flex: 1;
  display: flex;
  gap: var(--panel-gap);
  padding: 0 clamp(20px, 5vw, 56px) clamp(16px, 3vw, 32px);
  min-height: 0;
}

.panel {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  background: var(--bg-soft);
  transition: flex-grow 1.1s var(--ease), filter 1.1s var(--ease);
  filter: grayscale(0.55) brightness(0.62);
}

.panel::after {
  /* subtle vignette so text stays legible */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 40%,
    rgba(0, 0, 0, 0.75) 100%
  );
  opacity: 0.85;
  transition: opacity 1.1s var(--ease);
}

.panel__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.panel__meta {
  position: absolute;
  left: 22px;
  bottom: 22px;
  right: 22px;
  z-index: 2;
  transform: translateY(8px);
  opacity: 0;
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.panel__index {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: var(--accent);
  text-transform: uppercase;
}

.panel__title {
  font-family: "Fraunces", serif;
  font-weight: 400;
  font-size: clamp(1.3rem, 2.4vw, 2rem);
  line-height: 1.05;
  margin-top: 6px;
  white-space: nowrap;
}

.panel__tag {
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--ink-dim);
  white-space: nowrap;
}

/* Active panel: expanded + full colour */
.panel.is-active {
  flex-grow: 5;
  filter: grayscale(0) brightness(1);
}

.panel.is-active::after {
  opacity: 1;
}

.panel.is-active .panel__meta {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.15s;
}

/* Hover lifts the highlight to whatever the pointer is on */
.gallery:hover .panel.is-active:not(:hover) {
  flex-grow: 1;
  filter: grayscale(0.55) brightness(0.62);
}

.gallery:hover .panel.is-active:not(:hover) .panel__meta {
  opacity: 0;
}

.panel:hover {
  flex-grow: 5;
  filter: grayscale(0) brightness(1);
}

.panel:hover::after {
  opacity: 1;
}

.panel:hover .panel__meta {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Footer ---------- */
.site-footer {
  display: flex;
  justify-content: space-between;
  padding: 18px clamp(20px, 5vw, 56px) 24px;
  font-size: 0.78rem;
  color: var(--ink-dim);
  letter-spacing: 0.04em;
}

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

/* ---------- Project page ---------- */
.project {
  display: block; /* override the global flex-column main used on the homepage */
  flex: 1 0 auto; /* grow to fit content, never shrink it below its size */
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
  padding: clamp(10px, 3vw, 30px) clamp(20px, 5vw, 56px) 60px;
}

.project__back {
  display: inline-block;
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  margin-bottom: 34px;
  transition: color 0.3s var(--ease);
}

.project__back:hover {
  color: var(--ink);
}

.project__tag {
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

.project__title {
  font-family: "Fraunces", serif;
  font-weight: 400;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.03;
  letter-spacing: -0.01em;
  margin-bottom: 30px;
}

/* Two-column layout: story on the left, hover-driven photo on the right. */
.project__split {
  display: grid;
  grid-template-columns: 1.9fr 1.1fr;
  gap: clamp(28px, 5vw, 64px);
  align-items: start;
  margin-top: 8px;
}

.project__story {
  font-size: 1.08rem;
  line-height: 1.75;
  color: #d9d6cf;
}

.project__story p + p {
  margin-top: 1.1em;
}

.accent-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted rgba(217, 138, 168, 0.4);
  transition: color 0.25s var(--ease);
}

.accent-link:hover {
  color: #eaa9c2;
}

/* Marked words in the text */
.hotword {
  color: #d98aa8;
  cursor: pointer;
  border-bottom: 1px dotted rgba(217, 138, 168, 0.35);
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease);
}

.hotword:hover {
  color: #eaa9c2;
  border-bottom-color: rgba(217, 138, 168, 0.7);
}

/* The photo pane sticks in view while the text scrolls past it. */
.project__pane {
  position: sticky;
  top: 28px;
}

.pane-figure {
  margin: 0;
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-soft);
  aspect-ratio: 3 / 4;
}

.pane-figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  animation: paneFade 0.45s var(--ease);
}

@keyframes paneFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Album: collage of all designated photos, after the text. */
.project__album {
  columns: 3 220px;
  column-gap: 14px;
  margin-top: clamp(48px, 8vw, 90px);
}

.album-item {
  position: relative;
  margin: 0 0 14px;
  break-inside: avoid;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-soft);
  cursor: pointer;
}

.album-item--plain {
  cursor: default;
}

.album-num {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 2;
  font-family: "Fraunces", serif;
  font-size: 0.95rem;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.55);
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 10, 12, 0.94);
  display: none;
  align-items: center;
  justify-content: center;
}

.lightbox.is-open {
  display: flex;
}

.lightbox__img {
  max-width: 88vw;
  max-height: 86vh;
  object-fit: contain;
  border-radius: 8px;
  animation: paneFade 0.35s var(--ease);
}

.lightbox__close,
.lightbox__nav {
  position: absolute;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--ink);
  cursor: pointer;
  font-family: "Fraunces", serif;
  transition: background 0.25s var(--ease);
}

.lightbox__close:hover,
.lightbox__nav:hover {
  background: rgba(255, 255, 255, 0.18);
}

.lightbox__close {
  top: 20px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.6rem;
  line-height: 1;
}

.lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
  width: 54px;
  height: 54px;
  border-radius: 50%;
  font-size: 2rem;
  line-height: 1;
}

.lightbox__nav--prev { left: 24px; }
.lightbox__nav--next { right: 24px; }

.lightbox__counter {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--ink-dim);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
}

.album-item img {
  width: 100%;
  display: block;
  transition: transform 0.6s var(--ease), filter 0.6s var(--ease);
  filter: grayscale(0.15);
}

.album-item:hover img {
  transform: scale(1.03);
  filter: grayscale(0);
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .project__album {
    columns: 2 140px;
  }
  .project__split {
    grid-template-columns: 1fr;
  }
  .project__pane {
    position: static;
    order: -1; /* show the photo above the text on narrow screens */
    margin-bottom: 24px;
  }
  .pane-figure {
    aspect-ratio: 3 / 2;
  }
  .gallery {
    flex-direction: column;
  }
  .panel {
    min-height: 64px;
  }
  .panel.is-active,
  .panel:hover {
    flex-grow: 6;
  }
  .panel__title {
    white-space: normal;
  }
  .site-nav {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .panel,
  .panel__img,
  .panel__meta {
    transition-duration: 0.001ms;
  }
}
