/* Illahi Rayani — portfolio styles. Edit variables below for global palette & type scale. */

:root {
  --bg: #0a0a0a;
  --bg-elevated: #111111;
  --fg: #e8e6e1;
  --fg-muted: #9a9690;
  --fg-dim: #5c5955;
  --border: #2a2826;
  --accent: #e8e6e1;

  --font-body: "Fira Code", ui-monospace, monospace;
  /* Brand + page titles: DM Sans (Google Fonts); everything else uses --font-body */
  --font-brand-name: "DM Sans", system-ui, sans-serif;

  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.75rem;
  --space-lg: 3rem;
  --space-xl: 5rem;
  --space-2xl: clamp(4rem, 12vw, 9rem);

  --text-step--1: clamp(0.85rem, 0.82rem + 0.15vw, 0.95rem);
  --text-step-0: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-step-1: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
  --line-tight: 1.1;
  --line-body: 1.65;
  --max-read: 38rem;
}

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

html {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  height: 100%;
  min-height: 100dvh;
  min-height: 100svh;
  overflow: hidden;
  overscroll-behavior: none;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: var(--text-step-0);
  line-height: var(--line-body);
  color: var(--fg);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--fg);
  text-decoration: none;
  transition: color 0.2s ease, opacity 0.2s ease;
}

a:hover {
  color: var(--fg-muted);
}

a:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Film grain overlay — fixed, subtle */
.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Header — fixed height row; #main scrolls when page content is taller than the viewport */
.site-header {
  position: relative;
  z-index: 40;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: max(var(--space-sm), env(safe-area-inset-top)) max(var(--space-md), env(safe-area-inset-right)) var(--space-sm) max(var(--space-md), env(safe-area-inset-left));
  background: linear-gradient(to bottom, rgba(10, 10, 10, 0.94), rgba(10, 10, 10, 0.65));
  border-bottom: 1px solid var(--border);
}

#main {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
}

.site-header__brand {
  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 0.65rem 1rem;
  margin: 0;
  min-width: 0;
  flex-shrink: 1;
  text-decoration: none;
  color: inherit;
}

.site-header__brand:hover {
  color: inherit;
}

.site-header__brand:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}

.site-header__name {
  font-family: var(--font-brand-name);
  font-size: clamp(1.125rem, 2.8vw, 1.35rem);
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--fg);
  white-space: nowrap;
}

.site-header__role {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-step--1);
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-muted);
  white-space: nowrap;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  width: 2.75rem;
  height: 2.75rem;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  touch-action: manipulation;
}

.nav-toggle:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

.nav-toggle__bar {
  display: block;
  width: 1.25rem;
  height: 1px;
  margin: 0 auto;
  background: currentColor;
}

.site-nav__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  font-size: var(--text-step--1);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--fg-muted);
}

.site-nav a:hover {
  color: var(--fg);
}

.site-nav a[aria-current="page"] {
  color: #fff;
  font-weight: 600;
}

@media (max-width: 640px) {
  .nav-toggle {
    display: flex;
  }

  .site-nav {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 45;
    width: min(100%, 16rem);
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    padding: max(5rem, calc(env(safe-area-inset-top) + 3.5rem)) max(var(--space-md), env(safe-area-inset-right)) max(var(--space-md), env(safe-area-inset-bottom)) var(--space-md);
    background: var(--bg-elevated);
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform 0.25s ease;
  }

  body.nav-open .site-nav {
    transform: translateX(0);
  }

  body.nav-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 35;
  }

  body.nav-open #main {
    overflow: hidden;
  }

  .site-nav__list {
    flex-direction: column;
    gap: var(--space-lg);
  }

  .site-header__brand {
    flex-wrap: wrap;
    row-gap: 0.25rem;
  }

  .site-header__name {
    font-size: clamp(1rem, 4.2vw, 1.35rem);
  }

  .site-header__role {
    font-size: clamp(0.75rem, 2.8vw, 0.95rem);
    letter-spacing: 0.14em;
  }

  .site-header {
    gap: var(--space-sm);
  }

  .site-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0.35rem 0;
  }
}

/* Home — full-viewport hero photo */
.home-hero {
  flex: 1 1 auto;
  min-height: max(50vh, calc(100svh - 5.5rem));
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  background-color: var(--bg);
}

.home-hero__media {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
}

.home-hero__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
  filter: grayscale(100%) contrast(1.06);
}

.home-hero__scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(to top,
      rgba(10, 10, 10, 0.94) 0%,
      rgba(10, 10, 10, 0.35) 38%,
      transparent 62%);
}

.home-hero__content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2;
  padding: var(--space-lg) var(--space-md);
  max-width: 72rem;
  margin: 0 auto;
  width: 100%;
}

.home-hero__line {
  margin: 0;
  max-width: 22rem;
  font-family: var(--font-body);
  font-size: var(--text-step-0);
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: var(--line-body);
  color: var(--fg-muted);
}

@media (min-width: 900px) {
  .home-hero__content {
    padding-left: max(var(--space-md), 4vw);
  }
}

/* Sections — scroll with #main when content is taller than the viewport */
.section {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: visible;
  display: flex;
  flex-direction: column;
  padding: var(--space-md) var(--space-md) max(var(--space-lg), env(safe-area-inset-bottom));
}

.section--page {
  flex: 0 0 auto;
  min-height: min-content;
  padding-top: var(--space-md);
}

@media (max-width: 480px) {
  .section {
    padding-left: max(var(--space-sm), env(safe-area-inset-left));
    padding-right: max(var(--space-sm), env(safe-area-inset-right));
  }

  .photo-grid {
    gap: var(--space-sm);
  }
}

.section__inner {
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: visible;
  display: flex;
  flex-direction: column;
  max-width: 72rem;
  width: 100%;
  margin: 0 auto;
}

/* Reel: iframe is position:absolute — give the frame a real box (aspect ratio) so it never collapses to 0 height */
.section--reel .section__inner {
  justify-content: flex-start;
}

.section__inner--split {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  align-items: start;
}

@media (min-width: 768px) {
  .section__inner--split {
    grid-template-columns: 1fr minmax(200px, 38%);
    gap: var(--space-lg);
    align-items: stretch;
  }

  .bio__copy {
    padding-right: var(--space-md);
    min-height: 0;
    overflow: hidden;
  }

  .bio__photo {
    min-height: 0;
    align-self: start;
    display: block;
  }

  /* Bio image height matches copy column via --bio-photo-max (script.js); img uses object-fit: cover */
  .section--bio .bio__photo {
    height: var(--bio-photo-max, auto);
    max-height: var(--bio-photo-max, none);
  }

  .section--bio .bio__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 22%;
  }
}

.section__inner--narrow {
  max-width: var(--max-read);
  justify-content: center;
}

.section--reel .section__header,
.section--bio .bio__copy .section__header {
  flex-shrink: 0;
}

.section__header {
  margin-bottom: var(--space-sm);
  flex-shrink: 0;
}

.section__title {
  margin: 0;
  font-family: var(--font-brand-name);
  font-size: clamp(1.85rem, 6.5vw + 0.5rem, 4.5rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: var(--line-tight);
  color: var(--fg);
  word-break: break-word;
}

.section__lede {
  margin: var(--space-xs) 0 0;
  font-size: var(--text-step--1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

/* Reel — 16:9 box so the embed always has non-zero height (flex + absolute iframe alone can collapse) */
.reel__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  flex: 0 0 auto;
  background: #000;
  border: 1px solid var(--border);
}

.reel__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Bio page */
.bio__copy {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.bio__text {
  margin: 0;
  max-width: var(--max-read);
  color: var(--fg-muted);
  overflow-wrap: break-word;
}

.bio__text+.bio__text {
  margin-top: var(--space-sm);
}

.bio__resume {
  margin: var(--space-md) 0 0;
  flex-shrink: 0;
}

.bio__photo {
  margin: 0;
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--bg-elevated);
  min-height: 0;
}

@media (max-width: 767px) {
  .section--bio .section__inner--split {
    min-height: auto;
    overflow: visible;
  }

  .section--bio .bio__copy {
    min-height: auto;
    overflow: visible;
  }

  .section--bio .bio__photo {
    width: 100%;
  }
}

.bio__photo img {
  width: 100%;
  height: auto;
  display: block;
  filter: grayscale(100%) contrast(1.05);
}

/* Resume download (on Bio page) */
.resume__download {
  display: inline-block;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border);
  font-size: var(--text-step--1);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--fg);
  background: transparent;
}

.resume__download:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--fg);
}

.resume__download:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}

@media (max-width: 640px) {
  .resume__download {
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* Photos — grid scrolls with #main; tap opens in-page gallery */
.section--photos {
  overflow-x: hidden;
  overflow-y: visible;
}

.section--photos .section__inner {
  flex: 0 1 auto;
  min-height: min-content;
  overflow: visible;
}

.photo-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
}

@media (min-width: 768px) {
  .photo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.photo-grid__item {
  margin: 0;
  min-width: 0;
}

.photo-grid__figure {
  margin: 0;
  height: 100%;
}

.photo-grid__link {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  overflow: hidden;
  cursor: pointer;
  touch-action: manipulation;
}

.photo-grid__link:hover {
  color: inherit;
}

.photo-grid__link:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

.photo-grid__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* Photo gallery (modal carousel) */
.photo-gallery {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: 100vw;
  height: 100%;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--fg);
  z-index: 100;
}

.photo-gallery::backdrop {
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(10, 10, 10, 0.58);
}

.photo-gallery__scrim {
  position: absolute;
  inset: 0;
  z-index: 0;
  cursor: pointer;
}

.photo-gallery__chrome {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100%;
  padding: max(3.5rem, env(safe-area-inset-top)) max(var(--space-sm), env(safe-area-inset-right)) max(4.5rem, env(safe-area-inset-bottom)) max(var(--space-sm), env(safe-area-inset-left));
  pointer-events: none;
}

.photo-gallery__chrome>* {
  pointer-events: auto;
}

.photo-gallery__close {
  position: absolute;
  top: max(0.65rem, env(safe-area-inset-top));
  right: max(0.65rem, env(safe-area-inset-right));
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0;
  background: rgba(17, 17, 17, 0.85);
  color: var(--fg);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

.photo-gallery__close:hover {
  background: rgba(255, 255, 255, 0.06);
}

.photo-gallery__close:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

.photo-gallery__dir {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(3rem, 11vw);
  height: min(4.5rem, 18vh);
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0;
  border: 1px solid var(--border);
  background: rgba(17, 17, 17, 0.75);
  color: var(--fg);
  font-size: clamp(1.75rem, 6vw, 2.5rem);
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

.photo-gallery__dir:hover {
  background: rgba(255, 255, 255, 0.06);
}

.photo-gallery__dir:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

.photo-gallery__dir--prev {
  left: max(0.35rem, env(safe-area-inset-left));
}

.photo-gallery__dir--next {
  right: max(0.35rem, env(safe-area-inset-right));
}

.photo-gallery__frame {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: min(calc(100vw - 5.5rem), 72rem);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: pan-y pinch-zoom;
}

.photo-gallery__img {
  max-width: 100%;
  max-height: min(78dvh, 78vh);
  width: auto;
  height: auto;
  object-fit: contain;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.photo-gallery__counter {
  position: absolute;
  bottom: max(0.75rem, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  margin: 0;
  font-size: var(--text-step--1);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-muted);
  pointer-events: none;
}

@media (max-width: 480px) {
  .photo-gallery__frame {
    max-width: calc(100vw - 4.25rem);
  }

  .photo-gallery__dir {
    width: 2.75rem;
    min-width: 2.75rem;
  }
}

.section--contact .section__inner--narrow {
  align-items: center;
  text-align: center;
}

.section--contact .section__title {
  width: 100%;
}

.section--contact .section__header {
  margin-bottom: var(--space-lg);
}

.contact__representation {
  margin: 0;
  width: 100%;
  max-width: var(--max-read);
  align-self: center;
  font-family: var(--font-body);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-xs);
}

.contact__agency-name {
  margin: 0;
  font-size: var(--text-step-1);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: var(--line-tight);
  color: var(--fg);
}

.contact__agency-name a {
  color: inherit;
  text-decoration: none;
}

.contact__agency-name a:hover {
  color: var(--fg-muted);
}

.contact__agency-name a:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}

.contact__agent,
.contact__agent-email {
  margin: 0;
  font-size: var(--text-step-0);
  font-weight: 400;
  color: var(--fg-muted);
}

.contact__agent-email {
  margin-top: -0.65rem;
}

.contact__agent-email a {
  color: inherit;
}

.contact__agent-email a:hover {
  color: var(--fg-muted);
}

.contact__social-divider {
  width: min(5.5rem, 48%);
  height: 1px;
  margin: var(--space-md) auto;
  background: var(--fg);
  opacity: 0.55;
  align-self: center;
}

.contact__external {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: var(--space-xs);
  margin-top: 0;
  font-family: var(--font-body);
}

.contact__external-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  text-decoration: none;
  color: inherit;
}

.contact__external-link:hover {
  opacity: 0.82;
}

.contact__external-link:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 4px;
}

.contact__external-link img {
  display: block;
  width: clamp(0.95rem, 3.75vw, 1.45rem);
  height: auto;
}

@media (max-width: 640px) {

  .contact__external-link,
  .contact__agency-name a,
  .contact__agent-email a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0.4rem 0.75rem;
  }
}

/* Scroll fade-in */
.fade-in {
  opacity: 0;
  transform: translateY(1.25rem);
  transition:
    opacity 0.7s ease,
    transform 0.7s ease;
}

.fade-in.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .fade-in {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .site-nav {
    transition: none;
  }
}