/* ════════════════════════════════════════════════════════════════════════
   components.css — reusable UI primitives.
   Buttons, links, pill chrome. These appear in multiple sections.
   ════════════════════════════════════════════════════════════════════════ */

/* ──────────────── Buttons ──────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Touch targets: minimum 44×44px per Apple HIG / Material */
  min-height: 48px;
  padding: 14px 24px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.02em;
  text-align: center;
  border: 1px solid transparent;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.btn.primary {
  background: var(--c-accent);
  color: var(--c-bg);
}

.btn.primary:hover {
  background: var(--c-accent-strong);
}

.btn.ghost {
  border-color: var(--c-border-strong);
  color: var(--c-fg);
}

.btn.ghost:hover {
  border-color: var(--c-fg);
}

/* ──────────────── Reduced motion ──────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .site-header { transition: none; }
}

/* Desktop: re-enable btn hover transitions */
@media (min-width: 900px) {
  .btn {
    min-height: 44px;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  }
}

/* ════════════════════════════════════════════════════════════════════════
   FILM DETAIL MODAL (v3.11.0)
   Opens when a poster tile fires `tarek:film-open { filmId }`. Shows the
   film poster, title, year, type, Tarek's role on set, and the full
   crew list (production, director, DP/DoP, gaffer, sparks). Closes on
   X click, ESC, backdrop click, "← All projects" back link, or browser
   back. The `#film-modal` is hidden by default; `.film-modal--open`
   on the root flips it to a fixed full-viewport overlay.

   Structure:
     .film-modal                  (root, fixed, hidden by default)
       .film-modal__backdrop      (click-to-close, aria-hidden)
       .film-modal__content       (the actual card)
         .film-modal__close       (X button, top-right)
         .film-modal__poster      (left/top)
         .film-modal__info        (right/bottom)
           .film-modal__header    (title + year + type)
           .film-modal__role      ("Role on set: Gaffer")
           .film-modal__crew      (dl with dt/dd pairs)
           .film-modal__back      ("← All projects" link)
   ════════════════════════════════════════════════════════════════════════ */

.film-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: none;
  /* When open, fade the root in. The backdrop and content handle their
     own animations for a staggered reveal. */
}

.film-modal[aria-hidden="false"],
.film-modal--open {
  display: block;
}

.film-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 10, 0.85);
  /* Match the sticky-nav glassy feel: blur the page behind the modal
     so the user still feels the context (hero, posters) is right
     there. Backdrop-filter needs a fallback for browsers that
     don't support it — the dark overlay is the fallback. */
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.film-modal--open .film-modal__backdrop {
  opacity: 1;
}

.film-modal__content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -48%) scale(0.96);
  width: min(960px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  background: var(--c-bg-alt);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.film-modal--open .film-modal__content {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Lock body scroll while modal is open (set by JS on <html>) */
html.film-modal-open,
html.film-modal-open body {
  overflow: hidden;
  /* Prevent layout shift from the scrollbar disappearing */
  padding-right: var(--film-modal-scrollbar, 0px);
}

/* Close button — top-right, circular, glassy.
   v3.14.34: no longer absolute — sits inside .film-modal__chrome
   (the new top bar that also holds the back arrow and the position
   indicator). The absolute positioning was for the old layout
   where the X was overlaid on the poster; now it's a flex item. */
.film-modal__close {
  position: static;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--c-border);
  border-radius: 50%;
  color: var(--c-fg);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.film-modal__close:hover,
.film-modal__close:focus-visible {
  background: rgba(0, 0, 0, 0.75);
  border-color: var(--c-border-strong);
  outline: none;
}

/* v3.15.4: the chrome now only holds the close X. The position
   indicator lives inside .film-modal__header so it sits above the film
   title on desktop. On mobile it is absolutely positioned back at the
   top-left of the modal card. */
.film-modal__chrome {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 14px 18px;
  border-bottom: none;
  background: transparent;
}
.film-modal__position {
  display: block;
  font-size: 0.85rem;
  color: rgba(232, 232, 232, 0.75);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  user-select: none;
  margin-bottom: 6px;
}

/* v3.14.34: prev/next nav buttons, one on each side of the modal.
   Same circular glassy style as the chrome buttons. Hidden when
   there's no prev/next film to go to. */
.film-modal__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--c-border);
  border-radius: 50%;
  color: var(--c-fg);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}
.film-modal__nav:hover:not(:disabled),
.film-modal__nav:focus-visible:not(:disabled) {
  background: rgba(0, 0, 0, 0.85);
  border-color: var(--c-border-strong);
  outline: none;
  transform: translateY(-50%) scale(1.05);
}
.film-modal__nav:disabled {
  opacity: 0;
  pointer-events: none;
}
.film-modal__nav--prev { left: 16px; }
.film-modal__nav--next { right: 16px; }
@media (max-width: 700px) {
  /* On mobile, the modal is near-fullscreen — keep the nav buttons
     inside but closer to the edge so they don't cover the poster. */
  .film-modal__nav--prev { left: 8px; }
  .film-modal__nav--next { right: 8px; }

  /* The position indicator is inside the info header, but on mobile
     we pull it back up to the top-left corner so the layout matches
     the previous mobile chrome style. */
  .film-modal__position {
    position: absolute;
    top: 14px;
    left: 18px;
    z-index: 6;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    margin-bottom: 0;
  }
}
.film-modal__nav svg { width: 24px; height: 24px; }

.film-modal__close svg {
  width: 20px;
  height: 20px;
}

/* Poster — on mobile sits at the top of the card, on desktop floats
   to the left of the info. The aspect-ratio keeps it 2:3 (matching
   the poster wall ratio) without needing the image to be loaded. */
.film-modal__poster {
  flex: 0 0 auto;
  background: var(--c-surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.film-modal__poster img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 50vh;
  max-height: 50dvh;
  object-fit: cover;
}

/* Info — the right side on desktop, bottom on mobile. The card is
   column on mobile, row on desktop. The info panel scrolls if
   the content overflows. */
.film-modal__info {
  flex: 1 1 auto;
  padding: 24px 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  /* Subtle inner top border on mobile (where poster is above) */
  border-top: 1px solid var(--c-border);
}

.film-modal__header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.film-modal__title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.05;
  letter-spacing: 0.01em;
  color: var(--c-fg);
  margin: 0;
  /* Slight optical balance for display type at large sizes */
  text-wrap: balance;
}

.film-modal__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 14px;
  color: var(--c-fg-muted);
  margin: 0;
}

.film-modal__meta > span:not(:empty)::before {
  /* Separator dot between year and type — only render if both
     elements are non-empty. The `hidden` attribute (set by JS)
     hides the element when its text is empty, so :empty and
     [hidden] both suppress the separator. */
}

.film-modal__meta > span:not([hidden]) + span:not([hidden])::before {
  content: "·";
  margin-right: 12px;
  color: var(--c-fg-muted);
  opacity: 0.6;
}

.film-modal__role {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  margin: 0;
  padding: 10px 14px;
  background: var(--c-accent-soft);
  border: 1px solid rgba(232, 163, 61, 0.3);
  border-radius: 8px;
  font-size: 14px;
  color: var(--c-fg-dim);
}

.film-modal__role-label {
  color: var(--c-fg-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.film-modal__role strong {
  color: var(--c-accent);
  font-weight: 600;
}

/* Crew list — definition list. Each row is a dt (role) + dd (people).
   Stacked on mobile (role on top, people below). Side-by-side on
   desktop (role on left, people on right). */
.film-modal__crew {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
}

.film-modal__crew-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid var(--c-border);
}

.film-modal__crew-row:last-child {
  border-bottom: none;
}

.film-modal__crew-row dt {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--c-fg-muted);
  font-weight: 500;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
}

.film-modal__crew-abbr,
.film-modal__crew-subtitle {
  color: var(--c-fg-muted);
  opacity: 0.6;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: none;
}

.film-modal__crew-row dd {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--c-fg);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.film-modal__chip {
  display: inline-block;
  padding: 3px 10px;
  background: var(--c-card-bg);
  border: 1px solid var(--c-border);
  border-radius: 999px;
  font-size: 13px;
  color: var(--c-fg);
  /* Prevent very long company names from overflowing the chip */
  max-width: 100%;
  /* Only wrap at natural break points (spaces); avoid breaking a single
     word into a tall narrow stack on narrow viewports. */
  word-break: normal;
  overflow-wrap: anywhere;
}

.film-modal__no-credits {
  color: var(--c-fg-muted);
  font-style: italic;
  font-size: 14px;
}

/* Back link — sits at the bottom of the info panel */
.film-modal__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding: 10px 0 0;
  color: var(--c-fg-dim);
  font-size: 14px;
  text-decoration: none;
  border-top: 1px solid var(--c-border);
  transition: color 0.2s ease;
}

.film-modal__back:hover,
.film-modal__back:focus-visible {
  color: var(--c-accent);
  outline: none;
}

/* Desktop: side-by-side poster + info */
@media (min-width: 720px) {
  .film-modal__content {
    flex-direction: row;
    /* Wider card on large screens so the info panel can breathe. */
    width: min(1100px, calc(100vw - 64px));
    max-height: min(720px, calc(100vh - 64px));
    max-height: min(720px, calc(100dvh - 64px));
  }

  .film-modal__poster {
    /* Smaller poster share so the crew/info column gets most of the room. */
    flex: 0 0 32%;
    border-right: 1px solid var(--c-border);
  }

  .film-modal__poster img {
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: cover;
  }

  .film-modal__info {
    border-top: none;
    padding: 28px 36px 24px;
    flex: 1 1 68%;
    min-width: 0;
  }

  .film-modal__crew-row {
    /* Two-column grid keeps the label width predictable and lets the
       value column fill the rest without fighting flex shrink. */
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 20px;
    align-items: start;
    padding: 12px 0;
  }

  .film-modal__crew-row dt,
  .film-modal__crew-row dd {
    flex: none;
  }

  .film-modal__crew-row dd {
    min-width: 0;
  }

  /* v3.15.5: the close X floats at the top-right of the card. The
     position indicator sits inside the info header, aligned with the X
     on the same top line; the film title starts just below it. */
  .film-modal__chrome {
    position: absolute;
    top: 0;
    right: 0;
    padding: 14px 18px;
  }

  .film-modal__position {
    position: static;
    color: var(--c-fg-muted);
    text-shadow: none;
    margin-bottom: 10px;
  }

  .film-modal__info {
    padding-top: 14px;
  }
}

/* Reduced motion — no transforms, instant show/hide */
@media (prefers-reduced-motion: reduce) {
  .film-modal__backdrop,
  .film-modal__content {
    transition: none;
  }
  .film-modal--open .film-modal__content {
    transform: translate(-50%, -50%);
  }
}
/* ════════════════════════════════════════════════════════════════════════
   Partners section (v3.13.0)
   ────────────────────────────────────────────────────────────────────────
   Used by index.html at #partners (replaced the old Kit & Rental
   section). Layout is data-driven: partners.js renders the accordion
   from data/people.json + data/companies.json.

   Structure:
     <section id="partners">
       <header class="section-head">…</header>
       <div id="partners-content">
         <ul class="partners-accordion">
           <li class="partners-section">
             <button class="partners-section-toggle">…</button>
             <div class="partners-section-body">
               <ul class="partner-list">
                 <li><article class="partner-card">…</article></li>
               </ul>
             </div>
           </li>
         </ul>
       </div>
     </section>

   Each .partner-card is an IMDb-style list row: a 64px circular avatar
   on the left, name + description on the right. v3.12.3 moved away
   from photo-first cards because most portraits are still missing. */

.partners-content {
  max-width: 64rem;
  margin: 0 auto;
}
.partners-accordion {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--c-border, rgba(255,255,255,0.08));
}

/* ─── Category section (header + collapsible body) ─────────────── */
.partners-section {
  border-bottom: 1px solid var(--c-border, rgba(255,255,255,0.08));
}
.partners-section-toggle {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  background: transparent;
  border: none;
  padding: 1.1rem 0.4rem;
  text-align: left;
  cursor: pointer;
  color: var(--c-fg, #f4f4f4);
  font-family: inherit;
  transition: color 0.15s;
}
.partners-section-toggle:hover,
.partners-section-toggle:focus-visible {
  color: var(--c-accent, #E8A33D);
  outline: none;
}
.partners-section-toggle:focus-visible {
  outline: 2px solid var(--c-accent, #E8A33D);
  outline-offset: 2px;
  border-radius: 4px;
}
.partners-section-title {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0;
  color: inherit;
}
.partners-section-meta {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--c-fg-muted, #9b9b9e);
  text-transform: lowercase;
  font-weight: 400;
  white-space: nowrap;
}
.partners-section-chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-left: 0.2rem;
}
.partners-section-toggle[aria-expanded="true"] .partners-section-chevron {
  transform: rotate(-135deg);
}
.partners-section-body {
  padding: 0 0.4rem 1.6rem;
}
.partners-section-body[hidden] {
  display: none;
}

/* ─── Partner cards (IMDb-style list rows) ──────────────────────── */
.partner-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.9rem;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .partner-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
}
.partner-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  background: var(--c-surface, rgba(255,255,255,0.03));
  border: 1px solid var(--c-border, rgba(255,255,255,0.06));
  border-radius: 10px;
  transition: border-color 0.15s, transform 0.15s;
}
.partner-card:hover,
.partner-card:focus-within {
  border-color: var(--c-accent, #E8A33D);
  transform: translateY(-1px);
}
.partner-photo {
  flex-shrink: 0;
  align-self: flex-start;
  position: relative;
  width: 64px;
  height: 64px;
  /* v3.13.6: rounded square (was 50% circle). The Movie-men
     SVG wordmark + camera mark gets clipped on the edges of
     a 64px circle, and the squircle look reads more like a
     thumbnail card than a profile pic — which fits the
     IMDb-style "name + small visual identifier" layout. */
  border-radius: 10px;
  overflow: hidden;
  background: #0b0b0d;
}
.partner-photo img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  /* v3.13.9: switched from 'cover' to 'contain' so wide SVG
     wordmarks (Kinolux 250×87.4, Movie-men 139×128) display
     fully instead of being cropped on the sides. The 64×64
     photo container has a dark #0b0b0d background, so SVG
     letterboxing blends in. Square JPG/PNG portraits still
     fill the box (contain == cover for square content). */
  object-fit: contain;
  object-position: center;
  padding: 8px;
}
/* v3.12.2: black-bg + grey person-emoji fallback for missing portraits */
.partner-photo-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  line-height: 1;
  color: #7a7a7e;
  filter: grayscale(1) brightness(0.85);
  opacity: 0.55;
  pointer-events: none;
  user-select: none;
}
.partner-photo:has(> img) .partner-photo-fallback { display: none; }
.partner-body {
  flex: 1;
  min-width: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.partner-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.8rem;
}
.partner-name {
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--c-fg, #f4f4f4);
  line-height: 1.3;
}
a.partner-name:hover,
a.partner-name:focus {
  color: var(--c-accent, #E8A33D);
}
.partner-link-label {
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-fg-muted, #9b9b9e);
}
.partner-desc {
  margin: 0;
  font-size: 0.9rem;
  color: var(--c-fg-muted, #c8c8c8);
  line-height: 1.5;
}
.partner-empty {
  color: var(--c-fg-muted, #9b9b9e);
  font-style: italic;
  margin: 0;
  padding: 0.5rem 0;
}

/* ─── Partners logo carousel ────────────────────────────────────────
   v3.13.11: equipment houses moved out of the accordion into a
   dedicated logo strip below it. Continuous marquee animation,
   pauses on hover. The 3 logos are duplicated in JS so the
   track is 2× the content and the translateX(-50%) keyframe
   creates a seamless infinite loop. Fades at the edges via
   mask-image so logos don't snap in/out hard at the viewport
   boundaries.

   Sizing:
   - Each logo item is 120px wide on mobile, 160px on PC
   - Gap between items: 2.5rem (40px)
   - The track is width: max-content so it overflows the
     viewport naturally
   - On PC: 5 logos visible (5×160 + 4×40 = 960px → viewport
     expands to fit, centered in the section)
   - On mobile: 2-3 logos visible (2×120 + 1×40 = 280px →
     fits any phone width comfortably) */
.partners-logos {
  margin-top: 2.5rem;
  margin-bottom: 2.5rem;
  padding: 1.5rem 0;
  text-align: center;
}
.partners-logos__label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--c-fg-muted, #9b9b9e);
  margin: 0 0 1.25rem 0;
  font-weight: 500;
}
.partners-logos__viewport {
  position: relative;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 8%, #000 92%, transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, #000 8%, #000 92%, transparent 100%);
}
.partners-logos__track {
  display: flex;
  align-items: center;
  gap: 2.5rem;
  width: max-content;
  animation: partners-logos-scroll 30s linear infinite;
  will-change: transform;
}
.partners-logos:hover .partners-logos__track,
.partners-logos:focus-within .partners-logos__track {
  animation-play-state: paused;
}
.partners-logos__item {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 64px;
  border-radius: 8px;
  opacity: 0.7;
  transition: opacity 200ms ease, transform 200ms ease;
}
.partners-logos__item:hover,
.partners-logos__item:focus-visible {
  opacity: 1;
  transform: translateY(-2px);
  outline: none;
}
.partners-logos__item img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: grayscale(1) brightness(1.4);
  transition: filter 200ms ease;
}
.partners-logos__item:hover img,
.partners-logos__item:focus-visible img {
  filter: grayscale(0) brightness(1);
}
@keyframes partners-logos-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(calc(-50% - 1.25rem)); }
}
@media (prefers-reduced-motion: reduce) {
  .partners-logos__track {
    animation: none;
    transform: none;
  }
  .partners-logos__item:hover,
  .partners-logos__item:focus-visible {
    transform: none;
  }
}
@media (min-width: 900px) {
  .partners-logos__item {
    width: 160px;
    height: 80px;
  }
}
