/* ─────────────────────────────────────────────
   Page layouts
───────────────────────────────────────────── */

:root {
  --content-max: 56rem; /* 700px, scaled project/story column */
}

/* ---- Homepage ---- */

.home {
  position: relative;
  min-height: 100svh;
  background: var(--color-ink);
  overflow: hidden;
}

/* Desktop: the video is a full-bleed background across the whole
   page, with the sidebar floating on top of it as an overlay panel. */
.home__stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.home__stage-video {
  position: absolute;
  inset: 0;
  z-index: -1; /* stay under the .grain overlay so multiply blend reads correctly */
  overflow: hidden;
  pointer-events: none;
}

.home__stage-video iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100vw;
  height: 56.25vw; /* 16 / 9 */
  min-width: 177.78vh; /* 16 / 9 */
  min-height: 100%;
  transform: translate(-50%, -50%) scale(1.2); /* slight zoom to avoid letterboxing */
  border: 0;
}

.home__sidebar {
  position: relative;
  z-index: 1;
  width: clamp(380px, 18vw, 18rem);
  height: calc(100svh - var(--space-5) * 2);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-5);
  margin: var(--space-5) 0 var(--space-5) var(--space-5);
  padding: var(--space-5) var(--space-5) var(--space-3);
  color: var(--color-ink);
  background: var(--sidebar-tint, var(--color-videos));
  overflow-y: auto;
}

.home__sidebar-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-7);
  min-height: 0;
}

.home__menu-heading {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.1;
  font-size: 2rem; /* 32px */
  text-align: center;
}

.home__menu-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
}

.mode-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--text-mono-s);
  letter-spacing: -0.02em;
  text-transform: uppercase;
  opacity: 0.85;
}

.mode-toggle a {
  position: relative;
  transition: opacity var(--duration-fast) var(--ease-editorial);
}

.mode-toggle a:hover {
  opacity: 0.6;
}

.mode-toggle a[aria-current="page"] {
  opacity: 1;
}

.mode-toggle a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 1px;
  background: currentColor;
}

.mode-toggle__divider {
  opacity: 0.4;
}

@media (max-width: 1023px) {
  /* Back to normal stacked flow: video as a small strip on top,
     sidebar filling the rest below it (no more full-bleed overlay). */
  .home {
    display: flex;
    flex-direction: column;
    overflow: visible;
  }
  .home__stage {
    position: relative;
    inset: auto;
    flex: 0 0 42vh;
    min-height: 260px;
  }
  .home__sidebar {
    width: auto;
    height: auto;
    flex: 1 1 auto;
    margin: 0 var(--space-5) var(--space-5);
    padding: var(--space-6) var(--space-5) var(--space-5);
  }
}

@media (max-width: 640px) {
  /* Mobile: no background video at all — the sidebar/menu is the
     entire page. */
  .home__stage {
    display: none;
  }
  .home__sidebar {
    margin: 0;
    min-height: 100svh;
    padding: var(--space-5) var(--space-4) var(--space-4);
    gap: var(--space-4);
  }
  .home__sidebar-body {
    gap: var(--space-6);
  }
}

/* ---- Project template ---- */

.project-page {
  min-height: 100svh;
  background: var(--color-paper);
  color: var(--color-ink);
}

.project-page__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-8) var(--space-5) var(--space-9);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-9);
}

.project-page__intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
  width: 100%;
}

.project-page__description {
  font-family: var(--font-editorial);
  font-size: var(--text-editorial-m);
  line-height: 1.5;
  text-align: center;
  max-width: 60ch;
}

.project-page__video {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
  width: 100%;
}

.project-page__cover {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9; /* fallback; overridden by JS once a loaded video's real ratio is known */
  border: 6px solid var(--color-ink);
  overflow: hidden;
  background: var(--color-ink);
}

.project-page__cover img,
.project-page__cover iframe {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.project-page__cover img {
  object-fit: cover;
}

.project-page__gallery {
  width: 100%;
}

@media (max-width: 1023px) {
  .project-page__inner {
    padding: var(--space-7) var(--space-5) var(--space-8);
    gap: var(--space-8);
  }
}

@media (max-width: 640px) {
  .project-page__inner {
    padding: var(--space-6) var(--space-4) var(--space-7);
    gap: var(--space-7);
  }
  .project-page__cover {
    border-width: 3px;
  }
  .gallery {
    column-gap: var(--space-5);
  }
}

/* ---- Story page ---- */

.story-page {
  min-height: 100svh;
  background: var(--color-story);
  color: var(--color-paper);
}

.story-page__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-8) var(--space-5) var(--space-9);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-9);
}

.story-page__portrait {
  width: 100%;
  aspect-ratio: 3000 / 2160;
  overflow: hidden;
}

.story-page__portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.story-page__copy {
  font-family: var(--font-editorial);
  font-size: var(--text-editorial-body);
  line-height: 1.4;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.story-page__soundtrack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  text-align: center;
}

.story-page__soundtrack-label {
  font-family: var(--font-editorial);
  font-size: var(--text-editorial-m);
  color: var(--color-paper-muted);
}

.story-page__soundtrack-heading {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.15;
  font-size: var(--text-display-l);
}

.story-page__spotify {
  width: 100%;
  max-width: 44rem;
  margin-top: var(--space-3);
}

.story-page__spotify iframe {
  display: block;
  width: 100%;
  height: 480px;
  border: 0;
  border-radius: 12px;
}

@media (max-width: 640px) {
  .story-page__spotify iframe {
    height: 320px;
  }
}

@media (max-width: 1023px) {
  .story-page__inner {
    padding: var(--space-7) var(--space-5) var(--space-8);
    gap: var(--space-8);
  }
}

@media (max-width: 640px) {
  .story-page__inner {
    padding: var(--space-6) var(--space-4) var(--space-7);
    gap: var(--space-7);
  }
}

/* ---- Empty / loading states ---- */

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40vh;
  font-family: var(--font-mono);
  font-size: var(--text-mono-m);
  letter-spacing: -0.02em;
  text-align: center;
  opacity: 0.6;
}
