/* ============================================
   FILMOGRAPHY PAGE
   Builds on global.css tokens + parallax.css shell
   ============================================ */

/* The parallax content section is a centred flex column — break out for the filmography */
.fg {
  align-self: stretch;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  text-align: left;
}

/* ── Intro + stats ─────────────────────────── */
.fg-intro {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: clamp(2rem, 5vw, 5rem);
  align-items: end;
  padding: 1rem 0 4rem;
  border-bottom: 1px solid var(--color-border);
}

.fg-intro-lead {
  font-size: clamp(1.15rem, 2vw, 1.5rem);
  line-height: 1.45;
  letter-spacing: -0.02em;
  color: var(--color-text-primary);
  max-width: 34ch;
}

.fg-intro-lead em {
  font-style: normal;
  color: var(--color-text-muted);
}

.fg-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.fg-stat {
  border-left: 1px solid var(--color-border);
  padding-left: 1rem;
}

.fg-stat-num {
  display: block;
  font-size: clamp(2.25rem, 4.5vw, 3.5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
}

.fg-stat-label {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

/* ── Section heads ─────────────────────────── */
.fg-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

.fg-head h2 {
  font-size: clamp(1.75rem, 4vw, 3rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.04em;
  line-height: 0.95;
}

.fg-head-label {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* ── Featured: defining roles (dark band) ──── */
.fg-featured {
  margin: 5rem calc(-1 * clamp(1rem, 4vw, 4rem));
  padding: clamp(3rem, 6vw, 5rem) clamp(1.5rem, 5vw, 5rem);
  background: var(--color-black);
  color: #fff;
  border-radius: 40px;
}

.fg-featured .fg-head-label { color: var(--color-text-on-dark-muted); }

.fg-featured-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(1rem, 2vw, 1.75rem);
}

.fg-feature {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 18px;
  overflow: hidden;
  color: #fff;
  text-align: left;
  isolation: isolate;
}

.fg-feature img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.9s var(--ease-out), filter 0.6s var(--ease-out);
  filter: grayscale(0.35);
  z-index: -2;
}

.fg-feature::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 35%, rgba(0,0,0,0.92) 100%);
  z-index: -1;
}

.fg-feature:hover img,
.fg-feature:focus-visible img {
  transform: scale(1.06);
  filter: grayscale(0);
}

.fg-feature-index {
  position: absolute;
  top: 1rem;
  left: 1.1rem;
  font-size: 0.65rem;
  letter-spacing: 0.25em;
  color: rgba(255,255,255,0.75);
}

.fg-feature-body {
  position: absolute;
  left: 1.1rem;
  right: 1.1rem;
  bottom: 1.1rem;
}

.fg-feature-role {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
}

.fg-feature-title {
  margin-top: 0.35rem;
  font-size: clamp(1.1rem, 1.8vw, 1.45rem);
  font-weight: 800;
  text-transform: uppercase;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.fg-feature-note {
  margin-top: 0.6rem;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: 0;
  color: rgba(255,255,255,0.75);
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.5s var(--ease-out), opacity 0.4s var(--ease-out);
}

.fg-feature:hover .fg-feature-note,
.fg-feature:focus-visible .fg-feature-note {
  max-height: 6rem;
  opacity: 1;
}

/* ── Controls (sticky) ─────────────────────── */
.fg-controls {
  position: sticky;
  top: var(--nav-height);
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  padding: 1rem 0;
  margin-bottom: 2.5rem;
  background: rgba(252, 251, 246, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--color-border);
}

.fg-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.fg-pills + .fg-pills {
  padding-left: 1.25rem;
  border-left: 1px solid var(--color-border);
}

.fg-pill {
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-text-primary);
  transition: background 0.25s var(--ease-out), color 0.25s var(--ease-out), border-color 0.25s;
}

.fg-pill:hover { border-color: #000; }

.fg-pill[aria-pressed="true"] {
  background: #000;
  border-color: #000;
  color: #fff;
}

.fg-tools {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-left: auto;
}

.fg-search {
  position: relative;
}

.fg-search svg {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.5;
  pointer-events: none;
}

.fg-search input,
.fg-sort {
  height: 36px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: transparent;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-text-primary);
  transition: border-color 0.2s;
}

.fg-search input {
  width: 210px;
  padding: 0 1rem 0 2.2rem;
}

.fg-sort {
  padding: 0 2rem 0 1rem;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23000' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  cursor: pointer;
}

.fg-search input:focus,
.fg-sort:focus {
  outline: none;
  border-color: #000;
}

.fg-count {
  width: 100%;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* ── Poster grid ───────────────────────────── */
.fg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 2.75rem clamp(1rem, 2vw, 1.75rem);
}

.fg-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  text-align: left;
  color: inherit;
}

.fg-card-poster {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 12px;
  overflow: hidden;
  background: var(--color-cream-dark);
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
  transition: box-shadow 0.5s var(--ease-out), transform 0.5s var(--ease-out);
}

.fg-card-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s var(--ease-out);
}

.fg-card-poster::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 45%, rgba(0,0,0,0.85) 100%);
  opacity: 0;
  transition: opacity 0.45s var(--ease-out);
}

.fg-card-hover {
  position: absolute;
  left: 0.9rem;
  right: 0.9rem;
  bottom: 0.9rem;
  z-index: 2;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0;
  transform: translateY(12px);
  opacity: 0;
  transition: transform 0.45s var(--ease-out), opacity 0.45s var(--ease-out);
}

.fg-card-hover span {
  display: block;
  font-size: 0.55rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.65);
  margin-bottom: 0.2rem;
}

.fg-card:hover .fg-card-poster,
.fg-card:focus-visible .fg-card-poster {
  transform: translateY(-6px);
  box-shadow: 0 24px 40px -18px rgba(0,0,0,0.45);
}

.fg-card:hover .fg-card-poster img,
.fg-card:focus-visible .fg-card-poster img { transform: scale(1.06); }

.fg-card:hover .fg-card-poster::after,
.fg-card:focus-visible .fg-card-poster::after { opacity: 1; }

.fg-card:hover .fg-card-hover,
.fg-card:focus-visible .fg-card-hover {
  transform: translateY(0);
  opacity: 1;
}

.fg-card:focus-visible { outline: none; }
.fg-card:focus-visible .fg-card-poster { outline: 2px solid #000; outline-offset: 3px; }

/* Badges */
.fg-badges {
  position: absolute;
  top: 0.7rem;
  left: 0.7rem;
  right: 0.7rem;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.fg-badge {
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.fg-badge--upcoming {
  background: var(--color-cream);
  color: #000;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.fg-badge--upcoming::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #000;
  animation: fg-pulse 1.6s ease-in-out infinite;
}

@keyframes fg-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.25; transform: scale(0.7); }
}

/* Text under poster */
.fg-card-info { padding: 1rem 0.15rem 0; }

.fg-card-year {
  display: block;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: 0.35rem;
}

.fg-card-title {
  font-size: 1rem;
  font-weight: 800;
  text-transform: uppercase;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.fg-card-role {
  margin-top: 0.3rem;
  font-size: 0.8rem;
  font-weight: 500;
  font-style: italic;
  color: var(--color-text-secondary);
}

/* Typographic fallback (no poster available) */
.fg-fallback {
  position: absolute;
  inset: 0;
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.1rem;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(255,255,255,0.10), transparent 60%),
    linear-gradient(160deg, #1a1a1a 0%, #000 70%);
  color: #fff;
}

.fg-fallback::before {
  content: '';
  position: absolute;
  inset: 0.6rem;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 8px;
  pointer-events: none;
}

.fg-fallback-top {
  font-size: 0.55rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  padding-top: 1.6rem;
}

.fg-fallback-title {
  font-size: clamp(1rem, 11cqi, 2.4rem);
  font-weight: 800;
  text-transform: uppercase;
  line-height: 0.98;
  letter-spacing: -0.03em;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: manual;
  text-wrap: balance;
}

.fg-fallback-bottom {
  font-size: 0.55rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
}

/* Empty state */
.fg-empty {
  display: none;
  padding: 5rem 0;
  text-align: center;
  color: var(--color-text-muted);
}

.fg-empty.is-visible { display: block; }

.fg-empty strong {
  display: block;
  font-size: 1.5rem;
  color: var(--color-text-primary);
  margin-bottom: 0.5rem;
}

.fg-credit {
  margin-top: 4rem;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--color-text-muted);
  text-align: center;
}

/* ── Detail modal ──────────────────────────── */
.fg-modal {
  width: min(920px, calc(100% - 2rem));
  max-height: calc(100vh - 2rem);
  margin: auto;
  padding: 0;
  border: none;
  border-radius: 24px;
  background: var(--color-near-black);
  color: #fff;
  overflow: hidden;
  text-align: left;
}

.fg-modal::backdrop {
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.fg-modal[open] { animation: fg-modal-in 0.45s var(--ease-out); }
.fg-modal[open]::backdrop { animation: fg-fade 0.35s ease; }

@keyframes fg-modal-in {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

@keyframes fg-fade { from { opacity: 0; } to { opacity: 1; } }

.fg-modal-inner {
  display: grid;
  grid-template-columns: 340px 1fr;
  max-height: calc(100vh - 2rem);
}

.fg-modal-poster {
  position: relative;
  min-height: 510px;
  background: #000;
}

.fg-modal-poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fg-modal-body {
  position: relative;
  padding: clamp(1.75rem, 4vw, 3rem);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.fg-modal-close {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--color-border-light);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.3s var(--ease-out);
}

.fg-modal-close:hover {
  background: rgba(255,255,255,0.1);
  transform: rotate(90deg);
}

.fg-modal-kicker {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--color-text-on-dark-muted);
}

.fg-modal-title {
  margin-top: 0.75rem;
  padding-right: 2.5rem;
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800;
  text-transform: uppercase;
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.fg-modal-original {
  margin-top: 0.6rem;
  font-size: 0.9rem;
  font-weight: 500;
  font-style: italic;
  color: var(--color-text-on-dark-muted);
}

.fg-modal-meta {
  margin-top: 2rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border-light);
}

.fg-modal-meta dt {
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--color-text-on-dark-muted);
  padding-top: 0.2rem;
}

.fg-modal-meta dd {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.fg-modal-note {
  margin-top: 1.75rem;
  padding: 1rem 1.15rem;
  border-left: 2px solid #fff;
  background: rgba(255,255,255,0.05);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.55;
  letter-spacing: 0;
}

.fg-modal-actions {
  margin-top: auto;
  padding-top: 2rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.fg-modal-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.4rem;
  border: 1px solid #fff;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition: background 0.25s, color 0.25s;
}

.fg-modal-link:hover {
  background: #fff;
  color: #000;
}

/* ── Responsive ────────────────────────────── */
@media (max-width: 1024px) {
  .fg-featured-grid { grid-template-columns: repeat(2, 1fr); }
  .fg-tools { margin-left: 0; width: 100%; }
  .fg-search { flex: 1; }
  .fg-search input { width: 100%; }
}

@media (max-width: 768px) {
  .fg-intro { grid-template-columns: 1fr; padding-bottom: 3rem; }
  .fg-featured { border-radius: 28px; margin-left: -1rem; margin-right: -1rem; }
  .fg-controls {
    flex-wrap: nowrap;
    flex-direction: column;
    align-items: stretch;
    max-width: 100%;
    overflow: hidden;
  }
  .fg-pills {
    flex-wrap: nowrap;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .fg-pills::-webkit-scrollbar { display: none; }
  .fg-pills + .fg-pills { padding-left: 0; border-left: none; }
  .fg-pill { flex-shrink: 0; white-space: nowrap; }
  .fg-modal {
    width: 100%;
    max-width: 100%;
    margin-top: auto;
    margin-bottom: 0;
    border-radius: 24px 24px 0 0;
    max-height: 90vh;
    max-height: 90dvh;
  }
  .fg-search input {
    width: 100%;
    font-size: 16px; /* Prevents iOS Safari auto-zoom */
  }
  .fg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem 0.85rem; }
  .fg-card-title, .fg-card-role { overflow-wrap: anywhere; }
  .fg-modal-inner { grid-template-columns: 1fr; overflow-y: auto; max-height: 90dvh; }
  .fg-modal-poster { min-height: 0; aspect-ratio: 16 / 10; }
  .fg-modal-poster img { object-position: center 20%; }
  .fg-modal-body { overflow: visible; padding: 1.75rem 1.25rem 2.5rem; }
}

@media (max-width: 420px) {
  .fg-stats { grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
  .fg-featured-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  .fg-feature-note { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .fg-card-poster, .fg-card-poster img, .fg-feature img, .fg-card-hover { transition: none; }
  .fg-badge--upcoming::before { animation: none; }
  .fg-modal[open], .fg-modal[open]::backdrop { animation: none; }
}
