/* Movements page (/movements + /movements/<region>).
 *
 * Server-rendered replacement for the legacy ?screen=atlas SPA. The .atlas-*
 * rules here are copied from static/css/pages/home.css (Phase 4); the originals
 * stay in home.css until the homepage atlas screen retires in Phase 6.
 *
 * Difference from home.css: the SSR page has no JS to toggle `.active`, so
 * `.atlas-screen` renders as flex unconditionally here, and region expansion is
 * driven by the server-set `.expanded` class (active region) rather than hover.
 */

/* Dark-surface token overrides. base/global.css renders a light (cream) page;
 * the atlas surface is cream-on-black, so the cream-* / border / gray tokens
 * are re-pointed to their dark-mode values here (mirrors the :root block in
 * home.css that the homepage atlas screen relied on). Scoped to the page so it
 * never bleeds into the shared light surfaces. */
.movements-page {
  --border: rgba(227, 218, 201, 0.1);
  --border-strong: rgba(227, 218, 201, 0.22);
  --cream-mid: rgba(227, 218, 201, 0.6);
  --cream-dim: rgba(227, 218, 201, 0.55);
  --cream-hover: rgba(227, 218, 201, 0.06);
  --gray-mid: rgba(227, 218, 201, 0.55);
  background: var(--color-primary);
}

.atlas-screen {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 52px);
}
.atlas-header {
  background: var(--black);
  padding: 24px 32px 20px;
  border-bottom: 2px solid var(--red);
}
.atlas-header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.atlas-eyebrow {
  font-size: 0.75rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 6px;
  font-weight: 700;
}
.atlas-title {
  font-family: "Playfair Display", serif;
  font-size: 2rem;
  font-weight: 400;
  color: var(--off-white);
  letter-spacing: -0.5px;
  line-height: 1.05;
}
.atlas-title em {
  font-style: italic;
}

.atlas-body {
  display: grid;
  grid-template-columns: 280px 1fr;
  flex: 1;
}
.atlas-sidebar {
  border-right: 1px solid var(--border-strong);
  background: #181818;
  overflow-y: auto;
}
.sidebar-head {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
}
.sidebar-head-label {
  font-size: 0.75rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--cream-dim);
}

/* Region -> movement hierarchy. The active region carries a 2px red rail on its
 * left edge and shows its featured movements (server-set `.expanded`). */
.region-block {
  border-bottom: 1px solid var(--border);
  position: relative;
}
.region-block::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: transparent;
  transition: background 0.2s;
}
.region-block.expanded::before {
  background: var(--red);
}
.region-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px 12px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
  min-height: 44px;
  text-decoration: none;
}
.region-header:hover {
  background: var(--cream-hover);
}
.region-name {
  font-size: 0.75rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(227, 218, 201, 0.82);
  line-height: 1.2;
}
.region-mv-count {
  font-size: 0.875rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--cream-dim);
  margin-top: 3px;
}
.region-block.expanded .region-name {
  color: var(--color-base);
}
.region-toggle {
  font-size: 0.75rem;
  color: var(--cream-dim);
  transition:
    transform 0.2s,
    color 0.15s;
  line-height: 1;
}
.region-block.expanded .region-toggle {
  transform: rotate(90deg);
  color: var(--red);
}
.region-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s ease;
}
.region-block.expanded .region-panel {
  max-height: 2000px;
}
.mv-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 10px 16px 10px 34px;
  min-height: 44px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
}
.mv-item:hover {
  background: rgba(227, 218, 201, 0.06);
  border-left-color: var(--cream-mid);
}
.mv-name {
  font-family: "Playfair Display", serif;
  font-style: normal;
  font-size: 0.9375rem;
  color: var(--color-base);
  line-height: 1.25;
}
.mv-meta {
  font-size: 0.875rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--cream-dim);
  margin-top: 3px;
}
.film-item {
  font-family: "Inter", sans-serif;
  font-size: 0.875rem;
  color: #8c8678;
  padding: 4px 0;
  line-height: 1.4;
}
.region-more {
  display: block;
  padding: 8px 22px 14px 34px;
  font-size: 0.75rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--cream-dim);
  cursor: pointer;
  transition: color 0.15s;
  text-decoration: none;
}
.region-more:hover {
  color: var(--red);
}

.atlas-main {
  background: var(--color-primary);
  overflow-y: auto;
}

/* Region main panel (panel == 'region') reuses the movement-detail typography. */
.mv-region-panel {
  padding: 36px 44px;
  max-width: 880px;
}
.mv-detail-eyebrow {
  font-size: 0.75rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--red);
  font-weight: 700;
  margin-bottom: 8px;
}
.mv-detail-rule {
  width: 48px;
  height: 2px;
  background: var(--red);
  margin-bottom: 16px;
}
.mv-region-panel h1 {
  font-family: "Playfair Display", serif;
  font-size: 2rem;
  font-weight: 600;
  color: var(--color-base);
  line-height: 1.1;
  margin: 0 0 6px;
}
.mv-detail-years {
  font-size: 0.875rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--cream-dim);
  margin-bottom: 28px;
}
.mv-detail-section {
  margin-top: 24px;
}
.mv-detail-section-label {
  font-size: 0.75rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--cream-dim);
  margin-bottom: 14px;
}
.mv-detail-related {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.mv-detail-related-card {
  display: block;
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  padding: 14px 16px;
  text-decoration: none;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.mv-detail-related-card:hover {
  border-color: var(--red);
  background: rgba(227, 218, 201, 0.04);
}
.mv-detail-related-name {
  font-family: "Playfair Display", serif;
  font-size: 1rem;
  color: var(--color-base);
  line-height: 1.2;
  margin-bottom: 4px;
}
.mv-detail-related-years {
  font-size: 0.75rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--cream-dim);
}

/* Welcome / featured-movements grid (panel == 'welcome'). */
.mv-featured {
  padding: 32px 36px 48px;
}
.mv-featured-eyebrow {
  font-size: 0.75rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--red);
  font-weight: 700;
  margin-bottom: 6px;
}
.mv-featured-intro {
  font-family: "Playfair Display", serif;
  font-size: 0.875rem;
  font-style: italic;
  color: var(--cream-dim);
  margin-bottom: 28px;
}
.mv-featured-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.mv-feat-card {
  display: block;
  background: var(--color-primary);
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}
.mv-feat-card:hover {
  border-color: var(--red);
  background: rgba(227, 218, 201, 0.04);
}
.mv-feat-poster-strip {
  display: flex;
  height: 150px;
  gap: 2px;
}
.mv-feat-poster {
  position: relative;
  overflow: hidden;
  flex: 1;
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
}
.mv-feat-poster-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  padding: 16px 6px 6px;
  font-size: 0.75rem;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: 0.02em;
}
.mv-feat-body {
  padding: 14px 18px 16px;
}
.mv-feat-region {
  font-size: 0.75rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--red);
  font-weight: 700;
  margin-bottom: 5px;
}
.mv-feat-name {
  font-family: "Playfair Display", serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--color-base);
  line-height: 1.15;
  margin-bottom: 4px;
}
.mv-feat-years {
  font-size: 0.875rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--cream-dim);
  margin-bottom: 10px;
}
.mv-feat-directors {
  font-family: "Lora", serif;
  font-size: 0.875rem;
  font-style: italic;
  color: var(--gray-mid);
  line-height: 1.5;
  margin-bottom: 12px;
}
.mv-feat-thread {
  font-size: 0.75rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-base);
  border-bottom: 1px solid var(--border-strong);
  display: inline-block;
  padding-bottom: 1px;
  transition:
    color 0.15s,
    border-color 0.15s;
}
.mv-feat-card:hover .mv-feat-thread {
  color: var(--red);
  border-bottom-color: var(--red);
}

/* Mobile: single column (mirrors home.css's atlas responsive block). */
@media (max-width: 768px) {
  .atlas-body {
    grid-template-columns: 1fr;
  }
  .atlas-sidebar {
    width: 100%;
    max-width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .atlas-main {
    width: 100%;
    max-width: 100%;
  }
  .atlas-header {
    padding: 24px 16px 20px;
  }
  .mv-featured {
    padding: 20px 16px 32px;
  }
  .mv-featured-grid {
    grid-template-columns: 1fr;
  }
  .mv-feat-poster-strip {
    height: 130px;
  }
  .mv-region-panel {
    padding: 24px 16px 32px;
  }
  .mv-detail-related {
    grid-template-columns: 1fr;
  }
}
