/* ============================================================
   MAX MEIER — CGI PORTFOLIO
   ============================================================ */

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

/* Applied by JS only on non-Safari browsers */
body.custom-cursor *, body.custom-cursor *::before, body.custom-cursor *::after {
  cursor: none !important;
}

/* ============================================================
   CUSTOM CURSOR
   ============================================================ */
#cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 16px;
  height: 16px;
  background: #EB5E28;
  border-radius: 50%;
  pointer-events: none;
  z-index: 99999;
  transition: width 0.15s, height 0.15s;
}

:root {
  --bg:     #0a0a0a;
  --text:   #e5e3de;
  --muted:  rgba(229, 227, 222, 0.28);
  --mid:    rgba(229, 227, 222, 0.50);
  --border: rgba(229, 227, 222, 0.08);
  --font:   'Montserrat', system-ui, sans-serif;
  --ease:   cubic-bezier(0.25, 0.46, 0.45, 0.94);

  --nav-h:     80px;
  --contact-h: 110px;
  --item-h:    200px;  /* must match ITEM_H in script.js */
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;           /* no page scroll — JS drives everything */
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: 300;
}

/* ============================================================
   NAV
   ============================================================ */
#nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.nav-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.63rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  line-height: 1.5;
}

/* ============================================================
   FILTER BAR — sits above the project drum
   ============================================================ */
.filter-bar {
  flex-shrink: 0;
  padding: 32px 48px 24px 88px;
}

.filter-separator {
  flex-shrink: 0;
  height: 1px;
  background: var(--border);
  margin: 0 48px 0 88px;
}

.filter-dropdown {
  position: relative;
}

.filter-trigger {
  display: flex;
  align-items: baseline;
  gap: 10px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 300;
  font-size: clamp(20px, 2.2vw, 34px);
  letter-spacing: -0.02em;
  color: var(--text);
  transition: opacity 0.3s;
}
.filter-trigger:hover { opacity: 0.7; }

.filter-arrow {
  font-size: 0.65em;
  transition: transform 0.3s var(--ease);
  display: inline-block;
  color: var(--mid);
}
.filter-dropdown.open .filter-arrow {
  transform: rotate(180deg);
}

.filter-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  list-style: none;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 8px 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
  z-index: 200;
  min-width: 160px;
}
.filter-dropdown.open .filter-menu {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.filter-option {
  padding: 10px 24px;
  font-size: clamp(14px, 1.4vw, 20px);
  font-weight: 300;
  letter-spacing: -0.01em;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s;
}
.filter-option:hover  { color: var(--text); }
.filter-option.active { color: var(--text); }

.nav-brand {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  font-kerning: none;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.nav-info {
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mid);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 300;
  transition: color 0.3s;
  padding: 0;
}
.nav-info:hover { color: var(--text); }

/* ============================================================
   SELECTED INDICATOR
   ============================================================ */
.selected-indicator {
  position: fixed;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  z-index: 50;
  pointer-events: none;
}

.selected-label {
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.selected-line {
  width: 1px;
  height: 72px;
  background: var(--border);
}

/* ============================================================
   SPLIT LAYOUT — fixed to viewport
   ============================================================ */
.split {
  position: fixed;
  inset: 0;
  display: flex;
}

/* ============================================================
   LEFT PANEL
   ============================================================ */
.left-panel {
  width: 50%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: var(--nav-h);
}

/* ============================================================
   PROJECT SCROLL AREA
   ============================================================ */
.project-scroll-area {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* fade items out at top and bottom edges */
.project-scroll-area::before,
.project-scroll-area::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 140px;
  z-index: 10;
  pointer-events: none;
}
.project-scroll-area::before {
  top: 0;
  background: linear-gradient(to bottom, var(--bg) 0%, transparent 100%);
}
.project-scroll-area::after {
  bottom: 0;
  background: linear-gradient(to top, var(--bg) 0%, transparent 100%);
}

/* ============================================================
   PROJECT LIST — JS translates this
   ============================================================ */
.project-list {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  list-style: none;
  padding-left: 88px;
  padding-right: 48px;
  will-change: transform;
}

.project-item {
  height: var(--item-h);
  display: flex;
  flex-direction: column;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}

.client {
  display: block;
  font-size: 0.63rem;
  letter-spacing: 0.12em;
  color: var(--text);
  margin-bottom: 10px;
}

.campaign {
  font-size: clamp(36px, 4.2vw, 68px);
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--text);
}

/* opacity on .project-item is set per-frame by JS */
.project-item { transition: opacity 0.1s linear; }

/* ============================================================
   REEL LIGHTBOX
   ============================================================ */
.reel-lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(8, 8, 8, 0.97);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease);
  backdrop-filter: blur(10px);
}
.reel-lightbox.active {
  opacity: 1;
  pointer-events: all;
}

.reel-close {
  position: fixed;
  top: 32px;
  right: 40px;
  background: none;
  border: none;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color 0.25s;
  z-index: 10;
}
.reel-close:hover { color: var(--text); }

/* Grid lines — full-screen, positioned by JS at video edges */
.reel-grid-h,
.reel-grid-v {
  position: fixed;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.5s var(--ease);
  background: rgba(229, 227, 222, 0.07);
}
.reel-grid-h { left: 0; right: 0; height: 1px; }
.reel-grid-v { top: 0; bottom: 0; width: 1px; }
.reel-lightbox.active .reel-grid-h,
.reel-lightbox.active .reel-grid-v { opacity: 1; }

/* Corner brackets */
.reel-video-wrap {
  position: relative;
  display: flex;
}

.reel-frame {
  position: absolute;
  inset: -10px;
  pointer-events: none;
  z-index: 2;
}

.rc {
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: rgba(229, 227, 222, 0.18);
  border-style: solid;
}
.rc.tl { top: 0; left: 0;  border-width: 1px 0 0 1px; }
.rc.tr { top: 0; right: 0; border-width: 1px 1px 0 0; }
.rc.bl { bottom: 0; left: 0;  border-width: 0 0 1px 1px; }
.rc.br { bottom: 0; right: 0; border-width: 0 1px 1px 0; }

/* Player — column: video on top, controls below */
.reel-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  position: relative;
  z-index: 2;
}

#reel-video {
  display: block;
  max-width: min(calc(90vw - 48px), 1280px);
  max-height: calc(88vh - 72px);
  width: auto;
  height: auto;
}

/* Controls bar */
.reel-controls {
  display: flex;
  align-items: center;
  gap: 18px;
}

.ctrl-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  opacity: 0.4;
  transition: opacity 0.2s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}
.ctrl-btn:hover { opacity: 1; }

.ctrl-time {
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

.ctrl-bar {
  flex: 1;
  min-width: 160px;
  height: 1px;
  background: rgba(229, 227, 222, 0.12);
  position: relative;
  cursor: pointer;
}
.ctrl-bar::before {
  content: '';
  position: absolute;
  inset: -8px 0;
}
.ctrl-bar:hover { background: rgba(229, 227, 222, 0.22); }

.ctrl-bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: var(--text);
  width: 0%;
  pointer-events: none;
}

/* ============================================================
   FULLSCREEN STATE
   Applies to reel-player, project-player, edit-cell —
   whichever container goes fullscreen keeps its controls visible.
   ============================================================ */
:fullscreen {
  background: #000 !important;
  display: flex !important;
  flex-direction: column !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 0 !important;
}
:-webkit-full-screen {
  background: #000;
  display: flex;
  flex-direction: column;
  max-width: none;
  margin: 0;
  padding: 0;
  gap: 0;
}

/* Video wrappers fill all available space */
:fullscreen .project-video-wrap,
:fullscreen .edit-video-portrait,
:fullscreen .reel-video-wrap {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  aspect-ratio: unset !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  background: #000 !important;
  position: static !important;
}
:-webkit-full-screen .project-video-wrap,
:-webkit-full-screen .edit-video-portrait,
:-webkit-full-screen .reel-video-wrap {
  flex: 1 1 auto;
  min-height: 0;
  aspect-ratio: unset;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: #000;
}

/* Video scales to fit without stretching */
:fullscreen video {
  width: auto !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  position: static !important;
  inset: unset !important;
}
:-webkit-full-screen video {
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  position: static;
}

/* Controls bar pinned to bottom */
:fullscreen .project-controls,
:fullscreen .reel-controls {
  flex-shrink: 0 !important;
  width: 100% !important;
  padding: 16px 32px !important;
  background: rgba(10, 10, 10, 0.9) !important;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  gap: 18px !important;
}
:-webkit-full-screen .project-controls,
:-webkit-full-screen .reel-controls {
  flex-shrink: 0;
  width: 100%;
  padding: 16px 32px;
  background: rgba(10, 10, 10, 0.9);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 18px;
}

/* Suppress decorative elements in fullscreen */
:fullscreen .reel-frame,
:fullscreen .reel-grid-h,
:fullscreen .reel-grid-v { display: none !important; }

/* ============================================================
   INFO OVERLAY — slides in from right, sits below nav
   ============================================================ */
#info-overlay {
  position: fixed;
  right: 0;
  top: var(--nav-h);
  bottom: 0;
  width: 50%;
  z-index: 200;
  background: rgba(10, 10, 10, 0.98);
  backdrop-filter: blur(16px);
  opacity: 0;
  pointer-events: none;
  transform: translateX(100%);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
  display: flex;
  overflow: hidden;
}
#info-overlay.active {
  opacity: 1;
  pointer-events: all;
  transform: translateX(0);
}

/* Left edge grid line */
#info-overlay::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(229, 227, 222, 0.07);
  pointer-events: none;
}

/* Corner bracket frame */
.info-frame {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}
.info-rc {
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: rgba(229, 227, 222, 0.4);
  border-style: solid;
}
.info-rc.tl { top: 0; left: 0;  border-width: 1px 0 0 1px; }
.info-rc.tr { top: 0; right: 0; border-width: 1px 1px 0 0; }
.info-rc.bl { bottom: 0; left: 0;  border-width: 0 0 1px 1px; }
.info-rc.br { bottom: 0; right: 0; border-width: 0 1px 1px 0; }

/* Photo column — left side, inset so it doesn't bleed edge to edge */
.info-photo-col {
  width: 42%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 14% 20px 14% 0;
}
.info-photo-col img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  object-position: center top;
  display: block;
}

/* Content column — right side */
.info-body {
  flex: 1;
  padding: 56px 48px 56px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow-y: auto;
  position: relative;
}

.info-close {
  position: absolute;
  top: 28px;
  right: 28px;
  background: none;
  border: none;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color 0.25s;
  z-index: 2;
}
.info-close:hover { color: var(--text); }

.info-name {
  font-size: clamp(22px, 2.4vw, 40px);
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--text);
  margin-bottom: 8px;
}

.info-role {
  font-size: 0.63rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 36px;
}

.info-bio {
  font-size: 0.78rem;
  line-height: 1.85;
  color: var(--mid);
  margin-bottom: 14px;
}

.info-meta {
  display: flex;
  gap: 32px;
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.info-meta-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.info-meta-col p {
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  color: var(--mid);
  line-height: 1.6;
}
.info-link {
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  color: var(--mid);
  line-height: 1.6;
  text-decoration: none;
  transition: color 0.25s;
}
.info-link:hover { color: var(--text); }

/* ============================================================
   CONTACT BLOCK — fixed at bottom of left panel
   ============================================================ */
.contact-block {
  flex-shrink: 0;
  height: var(--contact-h);
  display: flex;
  align-items: center;
  gap: 48px;
  padding: 0 48px 0 88px;
  border-top: 1px solid var(--border);
}

.contact-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.col-label {
  display: block;
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 6px;
}

.contact-col p {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--mid);
  line-height: 1.6;
}

/* ============================================================
   RIGHT PANEL
   ============================================================ */
.right-panel {
  width: 50%;
  height: 100vh;
  position: relative;
  background: #0f0f0f;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-strip {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  will-change: transform;
}

.media-slot {
  width: 100%;
  aspect-ratio: 1 / 1;
  position: relative;
  overflow: hidden;
}

.media-slot video,
.media-slot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-label {
  position: absolute;
  bottom: 28px;
  right: 28px;
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  pointer-events: none;
  z-index: 10;
}

/* ============================================================
   MOBILE — ≤ 768px
   ============================================================ */
@media (max-width: 768px) {

  /* No custom cursor on touch devices */
  #cursor { display: none; }
  *, *::before, *::after { cursor: auto !important; }

  /* Shorter nav */
  :root { --nav-h: 56px; }
  #nav { padding: 0 20px; }
  /* Hide nav-left entirely — back button is moved into hero by JS on project pages */
  .nav-left { display: none; }
  .selected-indicator { display: none; }

  /* MAX MEIER sits left in the flex row on mobile */
  .nav-brand {
    position: static;
    transform: none;
  }

  /* Back button inside project hero on mobile */
  .project-hero .nav-back {
    display: flex;
    margin-bottom: 20px;
  }

  /* Page itself stays fixed — feed handles scrolling internally */
  html, body {
    overflow: hidden;
    height: 100%;
  }

  /* Collapse split into a single column */
  .split {
    position: static;
    flex-direction: column;
    height: auto;
  }

  .left-panel {
    width: 100%;
    height: 100vh;
    padding-top: var(--nav-h);
    overflow: hidden;
  }

  /* Right filmstrip panel is hidden on mobile */
  .right-panel { display: none; }

  /* Filter */
  .filter-bar { padding: 24px 20px 16px; }
  .filter-separator { margin: 0 20px; }
  .filter-trigger { font-size: clamp(20px, 5.5vw, 30px); }
  .filter-option { font-size: 15px; }

  /* Scroll area becomes the feed container */
  .project-scroll-area {
    flex: 1;
    overflow: hidden;
    position: relative;
    height: auto;
  }
  .project-scroll-area::before,
  .project-scroll-area::after { display: none; }

  /* Original list hidden — feed replaces it */
  .project-list { display: none !important; }

  /* Contact block hidden on mobile — info overlay has contact */
  .contact-block { display: none; }

  /* ── Feed ── */
  .mobile-feed {
    height: 100%;
    overflow-y: scroll;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 12px 0 0;
  }

  .mobile-card {
    scroll-snap-align: start;
    width: calc(100% - 24px);
    margin: 0 12px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
  }

  /* Text above video */
  .mobile-card-header {
    padding: 14px 0 10px;
  }

  .mobile-card-client {
    display: block;
    font-size: 0.58rem;
    letter-spacing: 0.12em;
    color: var(--muted);
    margin-bottom: 4px;
  }

  .mobile-card-campaign {
    font-size: clamp(16px, 4.5vw, 24px);
    font-weight: 300;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: 1.1;
  }

  .mobile-card-media {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #0f0f0f;
  }

  .mobile-card-media video,
  .mobile-card-media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  /* Contact card at end of feed */
  .mobile-contact-card {
    scroll-snap-align: start;
    width: calc(100% - 24px);
    margin: 0 12px 12px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 28px;
    padding: 40px 24px;
    border-top: 1px solid var(--border);
  }

  .mobile-contact-card .contact-col { display: flex; flex-direction: column; gap: 4px; }

  /* Info overlay — full width, stacked vertically on mobile */
  #info-overlay {
    width: 100%;
    flex-direction: column;
  }
  .info-photo-col {
    width: 100%;
    height: 26vh;
    flex-shrink: 0;
    padding: 0;
    display: flex;
  }
  .info-photo-col img {
    width: 100%;
    height: 100%;
    max-width: none;
    aspect-ratio: unset;
    object-fit: cover;
    object-position: 50% 55%;
  }
  .info-body {
    flex: 1;
    padding: 32px 24px 40px;
    justify-content: flex-start;
    overflow-y: auto;
  }
  .info-name { font-size: clamp(28px, 8vw, 48px); }
  .info-meta { gap: 24px; flex-wrap: wrap; }

  /* Reel lightbox */
  #reel-video {
    max-width: calc(96vw - 32px) !important;
    max-height: 56vh !important;
  }
  .reel-controls { gap: 12px; }
  .reel-close { top: 16px; right: 20px; }
}
