/* ── Custom Properties ─────────────────────────────────────────────────────── */
:root {
  --bg: #080808;
  --surface: #111010;
  --text: #e8e4dc;
  --text-muted: rgba(232, 228, 220, 0.35);
  --accent: #c9a96e;
  --border: rgba(232, 228, 220, 0.08);
}

/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
}

body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.is-home {
  height: 100%;
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
  touch-action: manipulation;
}

button {
  font-family: inherit;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  touch-action: manipulation;
}

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

/* ── Nav ───────────────────────────────────────────────────────────────────── */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2rem 2.5rem;
}

.nav-logo {
  font-family: 'Space Mono', monospace;
  font-size: 0.9375rem;
  letter-spacing: 0.08em;
  color: var(--text);
  transition: color 200ms ease;
}

.nav-logo:hover {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-link {
  font-family: 'Space Mono', monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color 200ms ease;
  padding: 0;
}

.nav-link:hover {
  color: var(--text);
}

/* ── About Overlay ─────────────────────────────────────────────────────────── */
.about-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 400ms ease;
}

.about-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.about-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 8, 0.88);
}

.about-overlay-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 100%;
  max-width: 680px;
  padding: 7.5rem 2.5rem 5rem;
  overflow-y: auto;
}

.about-overlay-close {
  position: fixed;
  top: 2rem;
  right: 2.5rem;
  z-index: 1;
  font-family: 'Space Mono', monospace;
  font-size: 0.625rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color 200ms ease;
}

.about-overlay-close:hover {
  color: var(--text);
}

/* ── Home Page ─────────────────────────────────────────────────────────────── */
.home-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 300ms ease;
  will-change: opacity;
}

.bg-video.active {
  opacity: 1;
}

.bg-overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 8, 0.4);
}

.home-content {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  height: 100%;
  padding: 0 2.5rem 10vh;
}

.project-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4em;
}

.project-item a {
  display: block;
  font-size: clamp(0.875rem, 1.3vw, 1.1875rem);
  font-weight: 300;
  line-height: 1.6;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  transition: color 200ms ease;
}

.project-item a:hover {
  color: var(--text);
}

/* ── Case Pages ────────────────────────────────────────────────────────────── */
.case-page {
  padding-top: 7.5rem;
  padding-bottom: 7rem;
  max-width: 1200px;
  margin: 0 auto;
  padding-left: 2.5rem;
  padding-right: 2.5rem;
}

.case-back {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-family: 'Space Mono', monospace;
  font-size: 0.625rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color 200ms ease;
  margin-bottom: 3.5rem;
}

.case-back::before {
  content: '←';
  font-size: 0.875rem;
  transition: transform 200ms ease;
}

.case-back:hover {
  color: var(--text);
}

.case-back:hover::before {
  transform: translateX(-3px);
}

/* Video section */
.video-section {
  margin-bottom: 4.5rem;
}

/* 16:9 horizontal */
.video-horizontal {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--surface);
}

.video-horizontal iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* 9:16 vertical — row of up to 3 */
.video-row-vertical {
  display: flex;
  gap: 1rem;
  justify-content: center;
  align-items: flex-start;
}

.video-vertical {
  position: relative;
  flex: 1;
  max-width: 320px;
  aspect-ratio: 9 / 16;
  background: var(--surface);
}

.video-vertical iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Case body: text + optional frames */
.case-body {
  display: grid;
  gap: 3.5rem;
}

.case-body.has-frames {
  grid-template-columns: 1fr 1fr;
  align-items: start;
}

.case-client {
  font-family: 'Space Mono', monospace;
  font-size: 0.625rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.125rem;
}

.case-title {
  font-size: clamp(1.875rem, 3.5vw, 3.25rem);
  font-weight: 300;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--text);
  margin-bottom: 2rem;
}

.case-description {
  font-size: 0.9375rem;
  line-height: 1.8;
  color: var(--text-muted);
  max-width: 44ch;
}

/* Frames grid */
.frames-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.625rem;
}

.frames-grid img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--surface);
}

/* ── About Page ────────────────────────────────────────────────────────────── */
.about-page {
  padding-top: 7.5rem;
  padding-bottom: 7rem;
  max-width: 680px;
  margin: 0 auto;
  padding-left: 2.5rem;
  padding-right: 2.5rem;
}

.about-eyebrow {
  font-family: 'Space Mono', monospace;
  font-size: 0.625rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 3rem;
}

.about-text {
  font-size: 1.125rem;
  font-weight: 300;
  line-height: 1.85;
  color: var(--text);
  letter-spacing: 0.005em;
}

/* About contact section */
.about-contact {
  margin-top: 4rem;
}

.about-contact-link {
  display: inline;
  font-size: 1.125rem;
  font-weight: 300;
  line-height: 1.85;
  letter-spacing: 0.005em;
  color: var(--text-muted);
  transition: color 200ms ease;
}

.about-contact-link + .about-contact-link::before {
  content: '·';
  margin: 0 0.75rem;
  color: var(--accent);
  pointer-events: none;
}

.about-contact-link:hover {
  color: var(--text);
}

/* PLACEHOLDER: about image — uncomment .about-image when photo is ready */
.about-image {
  display: none;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: var(--surface);
  margin-top: 4rem;
}

/* ── Grain overlay ─────────────────────────────────────────────────────────── */
.grain {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 320px 320px;
  animation: grain 0.5s steps(1) infinite;
}

@keyframes grain {
  0%   { background-position:   0%   0%; }
  10%  { background-position:  -5% -10%; }
  20%  { background-position: -15%   5%; }
  30%  { background-position:   7% -25%; }
  40%  { background-position:  -5%  25%; }
  50%  { background-position: -15%  10%; }
  60%  { background-position:  15%   0%; }
  70%  { background-position:   0%  15%; }
  80%  { background-position:   3%  35%; }
  90%  { background-position: -10%  10%; }
  100% { background-position:   0%   0%; }
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  nav {
    padding: 1.5rem;
  }

  .nav-links {
    gap: 1.5rem;
  }

  .about-overlay-close {
    top: 1.5rem;
    right: 1.5rem;
  }

  .about-overlay-panel {
    padding: 5rem 1.5rem 3rem;
    max-width: 100%;
  }

  .home-content {
    padding: 0 1.5rem 8vh;
  }

  .project-item a {
    font-size: clamp(1rem, 4.5vw, 1.25rem);
    line-height: 1.9;
    padding: 0.1em 0;
  }

  .case-page,
  .about-page {
    padding-top: 5.5rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .case-back {
    margin-bottom: 2.5rem;
  }

  .case-description {
    max-width: 100%;
  }

  .video-section {
    margin-bottom: 3rem;
  }

  .case-body.has-frames {
    grid-template-columns: 1fr;
  }

  .video-row-vertical {
    flex-direction: column;
    align-items: center;
  }

  .video-vertical {
    max-width: 260px;
    width: 100%;
  }

  .frames-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .project-item a {
    font-size: 1.0625rem;
  }

  .case-title {
    font-size: clamp(1.75rem, 9vw, 2.5rem);
  }
}

/* Respect reduced-motion — pause grain animation */
@media (prefers-reduced-motion: reduce) {
  .grain {
    animation: none;
  }

  .bg-video {
    transition: none;
  }
}
