/* ============================================
   SAMER IMAM — Partizan-inspired Portfolio
   Black canvas, video-first, minimal typography
   ============================================ */

:root {
  --bg: #ffffff;
  --bg-elevated: #f5f5f5;
  --fg: #000000;
  --fg-muted: rgba(0,0,0,0.5);
  --fg-dim: rgba(0,0,0,0.3);
  --accent: #000000;
  --hairline: rgba(0,0,0,0.12);
  --hairline-hover: rgba(0,0,0,0.25);
  
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-smooth: cubic-bezier(0.65, 0, 0.35, 1);
  
  --header-h: 64px;
  --container-pad: 24px;
  --grid-gap: 8px;
  --radius: 10px;
}

@media (min-width: 768px) {
  :root {
    --container-pad: 32px;
    --grid-gap: 10px;
  }
}

@media (min-width: 1200px) {
  :root {
    --container-pad: 40px;
    --grid-gap: 12px;
  }
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  font-weight: 400;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
}

img, video {
  display: block;
  max-width: 100%;
}

::selection {
  background: var(--fg);
  color: var(--bg);
}

/* ============================================
   HEADER
   ============================================ */
.site-header {
  position: fixed;
  top: 8px;
  left: 8px;
  right: 8px;
  z-index: 100;
  height: var(--header-h);
}

.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 100%;
  padding: 0 24px;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.header-nav--left {
  justify-self: start;
}

.header-nav--right {
  justify-self: end;
}

.header-link {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
  transition: color 0.3s var(--ease-out);
  position: relative;
  overflow: hidden;
}

.header-link:hover {
  color: var(--fg);
}

.header-brand {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 22px;
  letter-spacing: -0.02em;
  text-transform: none;
  line-height: 1;
  justify-self: center;
}

.menu-toggle {
  display: none;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.menu-toggle__close {
  display: none;
}

/* Mobile menu */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 99;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 32px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease-out);
}

.mobile-menu.is-open {
  opacity: 1;
  pointer-events: auto;
}

.mobile-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.mobile-link {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--fg);
  transition: opacity 0.3s var(--ease-out);
}

.mobile-link:hover {
  opacity: 0.5;
}

.mobile-socials {
  display: flex;
  gap: 24px;
  margin-top: 48px;
}

.mobile-socials a {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

/* ============================================
   HERO
   ============================================ */
.hero {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: calc(var(--header-h) + 48px) var(--container-pad) 60px;
}

.hero-video-wrap {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0,0,0,0.7) 0%,
    rgba(0,0,0,0.2) 40%,
    rgba(0,0,0,0.1) 100%
  );
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

.hero-eyebrow {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 24px;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(48px, 10vw, 140px);
  line-height: 0.95;
  letter-spacing: -0.035em;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.hero-line {
  display: block;
}

.hero-sub {
  font-size: 14px;
  font-weight: 400;
  color: var(--fg-muted);
  letter-spacing: 0.02em;
}

.hero-sub .num {
  font-variant-numeric: tabular-nums;
}

/* ============================================
   CATEGORY BAR
   ============================================ */
.work-section {
  padding-top: calc(var(--header-h) + 24px);
}

.catbar {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  z-index: 90;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  margin: 0 8px 16px;
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.catbar::-webkit-scrollbar {
  display: none;
}

.catbar__item {
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: 6px 12px;
  border-radius: 999px;
  transition: color 0.3s var(--ease-out), background 0.3s var(--ease-out);
}

.catbar__item:hover {
  color: var(--fg);
}

.catbar__item.is-active {
  color: var(--fg);
  background: var(--hairline);
}

.catbar__sep {
  color: var(--fg-dim);
  user-select: none;
  font-size: 10px;
}

/* ============================================
   WORK GRID — Tetris Interlock v5.1
   ============================================ */
.work-grid {
  display: grid;
  /* 3-column base: vertical(1col) + horizontal(2col) = 3 — perfect fit */
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 180px;
  gap: var(--grid-gap);
  padding: 0 8px 80px;
  /* dense packing fills holes like Tetris */
  grid-auto-flow: dense;
}

@media (min-width: 1400px) {
  .work-grid {
    /* On very wide screens, 4 cols with wide horizontals */
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 900px) {
  .work-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 150px;
  }
}

@media (max-width: 600px) {
  .work-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
    grid-auto-flow: row;
  }
}

/* Work card — horizontal (16:9) */
.work-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
  cursor: pointer;
  grid-column: span 2;
  grid-row: span 2;
}

/* Work card — vertical (9:16) — tall enough to not crop */
.work-card--tall {
  grid-column: span 1;
  grid-row: span 5;
}

/* Tetris interlock: tall card offset to col 2 on 3-col grid */
.work-card--tall.work-card--offset {
  grid-column: 2 / span 1;
}

/* Wide horizontal — spans 3 cols (full width on 3-col grid) */
.work-card--wide {
  grid-column: span 3;
  grid-row: span 2;
}

/* On 4-col screens, wide spans 4 */
@media (min-width: 1400px) {
  .work-card--wide {
    grid-column: span 4;
  }
  .work-card--tall.work-card--offset {
    grid-column: 2 / span 1;
  }
}

@media (max-width: 900px) {
  .work-card,
  .work-card--wide {
    grid-column: span 2;
    grid-row: span 2;
  }
  .work-card--tall {
    grid-column: span 1;
    grid-row: span 4;
  }
  .work-card--tall.work-card--offset {
    grid-column: 2 / span 1;
  }
}

@media (max-width: 600px) {
  .work-card,
  .work-card--wide,
  .work-card--tall {
    grid-column: span 1 !important;
    grid-row: span 2;
    aspect-ratio: 16 / 10;
  }

  .work-card--tall {
    aspect-ratio: 9 / 16;
    grid-row: span 3;
  }
}

.work-card__media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.work-card__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.2s var(--ease-smooth), opacity 0.6s ease;
  position: absolute;
  inset: 0;
}

.work-card:hover .work-card__video {
  transform: scale(1.03);
}

.work-card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0,0,0,0.7) 0%,
    rgba(0,0,0,0.1) 40%,
    rgba(0,0,0,0) 60%
  );
  opacity: 0;
  transition: opacity 0.6s var(--ease-out);
}

.work-card:hover .work-card__overlay {
  opacity: 1;
}

.work-card__info {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 20px;
  color: #fff;
  z-index: 2;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
}

.work-card:hover .work-card__info {
  opacity: 1;
  transform: translateY(0);
}

.work-card__director {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin-bottom: 6px;
  display: block;
  color: #fff;
}

.work-card__meta {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
}

.work-card__meta span + span::before {
  content: "•";
  margin: 0 8px;
  opacity: 0.5;
}

/* ============================================
   SECTION HEADERS
   ============================================ */
.section-head {
  padding: 100px var(--container-pad) 64px;
  max-width: 1600px;
  margin: 0 auto;
}

.section-num {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 24px;
}

.section-num::before {
  content: "";
  display: inline-block;
  width: 32px;
  height: 1px;
  background: var(--fg-muted);
}

.section-title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(44px, 6.5vw, 96px);
  line-height: 0.95;
  letter-spacing: -0.035em;
}

.section-title em {
  font-style: italic;
  font-weight: 300;
  color: var(--fg-muted);
}

/* ============================================
   AWARDS
   ============================================ */
.awards {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 var(--container-pad);
}

.awards-list {
  border-top: 1px solid var(--hairline);
}

.award-row {
  display: grid;
  grid-template-columns: 1.2fr 1.6fr 1fr 0.3fr;
  gap: 24px;
  align-items: center;
  padding: 28px 16px;
  border-bottom: 1px solid var(--hairline);
  transition: background 0.25s ease;
}

.award-row:hover {
  background: rgba(0,0,0,0.03);
}

.award-name {
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.015em;
}

.award-project {
  font-weight: 400;
  font-size: 18px;
  color: var(--fg);
}

.award-category {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  text-align: right;
}

.award-year {
  font-size: 13px;
  font-weight: 400;
  color: var(--fg-muted);
  text-align: right;
}

@media (max-width: 800px) {
  .award-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px 24px;
  }
  .award-name { font-size: 18px; }
  .award-project { font-size: 16px; }
  .award-category { text-align: left; }
  .award-year { text-align: right; }
}

/* ============================================
   ABOUT
   ============================================ */
.about {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 var(--container-pad) 100px;
}

.about-body {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 80px;
  align-items: start;
}

@media (max-width: 900px) {
  .about-body {
    grid-template-columns: 1fr;
    gap: 40px;
  }
}

.about-portrait {
  position: relative;
  aspect-ratio: 4 / 5;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  overflow: hidden;
  background-image: url('images/portrait.jpg');
  background-size: cover;
  background-position: center;
}

.about-portrait-label {
  position: absolute;
  bottom: 16px;
  left: 16px;
  font-size: 13px;
  color: var(--fg-muted);
  background: rgba(0,0,0,0.6);
  padding: 8px 16px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
}

.about-copy p {
  font-weight: 300;
  font-size: 22px;
  line-height: 1.45;
  letter-spacing: -0.005em;
  margin-bottom: 24px;
}

.about-copy em {
  font-style: italic;
  color: var(--fg-muted);
}

.about-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--hairline);
}

.stat-num {
  font-weight: 300;
  font-size: clamp(36px, 4vw, 56px);
  line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
  display: block;
}

.stat-label {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.about-footer {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--hairline);
  font-size: 14px;
  color: var(--fg-muted);
  max-width: 56ch;
  line-height: 1.6;
}

.imdb-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
  padding: 14px 24px;
  border: 1px solid var(--fg);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: background 0.25s ease, color 0.25s ease;
}

.imdb-link:hover {
  background: var(--fg);
  color: var(--bg);
}

.imdb-arrow {
  transition: transform 0.25s ease;
}

.imdb-link:hover .imdb-arrow {
  transform: translateX(4px);
}

/* ============================================
   CONTACT
   ============================================ */
.contact {
  max-width: 1600px;
  margin: 0 auto;
  padding: 100px var(--container-pad);
}

.contact-list {
  border-top: 1px solid var(--hairline);
  margin-top: 48px;
}

.contact-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  padding: 28px 0;
  border-bottom: 1px solid var(--hairline);
  transition: opacity 0.3s var(--ease-out);
}

.contact-row:hover {
  opacity: 0.6;
}

.contact-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.contact-value {
  font-weight: 300;
  font-size: clamp(22px, 2.4vw, 32px);
  letter-spacing: -0.01em;
  text-align: right;
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  max-width: 1600px;
  margin: 0 auto;
  padding: 60px var(--container-pad) 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
  border-top: 1px solid var(--hairline);
}

@media (max-width: 600px) {
  .site-footer {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
}

/* ============================================
   LIGHTBOX
   ============================================ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(255,255,255,0.97);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease-out);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 40px 120px;
}

.lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}

body.lightbox-open {
  overflow: hidden;
}

.lightbox__stage {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 1600px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0.96);
  transition: transform 0.5s var(--ease-out);
}

.lightbox.is-open .lightbox__stage {
  transform: scale(1);
}

.lightbox__video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  border-radius: var(--radius);
}

.lightbox__close {
  position: absolute;
  top: 24px;
  right: 32px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  z-index: 10;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(0,0,0,0.3);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.lightbox__close:hover {
  background: rgba(0,0,0,0.8);
  border-color: rgba(0,0,0,0.5);
}

.lightbox__close-icon {
  width: 12px;
  height: 12px;
  position: relative;
}

.lightbox__close-icon::before,
.lightbox__close-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 1.5px;
  background: currentColor;
}

.lightbox__close-icon::before {
  transform: rotate(45deg);
}

.lightbox__close-icon::after {
  transform: rotate(-45deg);
}

.lightbox__info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 24px;
  padding: 0 32px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  color: #fff;
  gap: 24px;
}

.lightbox__info-left {
  max-width: 70%;
}

.lightbox__title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(22px, 3vw, 36px);
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin-bottom: 6px;
}

.lightbox__meta {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.6;
}

.lightbox__meta span + span::before {
  content: "•";
  margin: 0 10px;
  opacity: 0.5;
}

.lightbox__sound {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(0,0,0,0.3);
  transition: background 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}

.lightbox__sound:hover {
  background: rgba(0,0,0,0.8);
  border-color: rgba(0,0,0,0.5);
}

@media (max-width: 700px) {
  .lightbox {
    padding: 60px 12px 100px;
  }
  .lightbox__close {
    top: 14px;
    right: 14px;
  }
  .lightbox__info {
    flex-direction: column;
    align-items: flex-start;
    padding: 0 16px;
    bottom: 16px;
  }
  .lightbox__info-left {
    max-width: 100%;
  }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1200px) {
  .header-nav--left a:nth-child(n+4),
  .header-nav--right {
    display: none;
  }
  
  .header-inner {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .header-nav--left {
    flex: 0 0 auto;
  }
  
  .header-brand {
    font-size: 18px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
  }
  
  .menu-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    margin-left: auto;
  }
}

@media (max-width: 768px) {
  .header-inner {
    padding: 0 16px;
    position: relative;
  }
  
  .header-brand {
    font-size: 16px;
    letter-spacing: -0.01em;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }
  
  .header-nav--left {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: auto;
    width: 200px;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--bg);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    padding: 8px 0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 99;
  }
  
  .header-nav--left.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }
  
  .header-nav--left .header-link {
    display: block;
    padding: 12px 20px;
    width: 100%;
    font-size: 14px;
    border-bottom: 1px solid var(--hairline);
  }
  
  .header-nav--left .header-link:last-child {
    border-bottom: none;
  }
  
  .menu-toggle {
    margin-left: auto;
    position: relative;
    z-index: 101;
  }
}

@media (max-width: 768px) {
  .hero-title {
    font-size: clamp(36px, 12vw, 72px);
  }
  
  .section-title {
    font-size: clamp(32px, 8vw, 56px);
  }
  
  .about-copy p {
    font-size: 18px;
  }
  
  .about-stats {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  
  .contact-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .contact-value {
    text-align: left;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
