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

:root {
  --bg:        #0d0d0d;
  --surface:   #161616;
  --border:    #252525;
  --text:      #f0f0f0;
  --muted:     #777;
  --accent:    #e8e8e8;
  --font:      'Inter', system-ui, -apple-system, sans-serif;
  --nav-h:     64px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* ─── NAV ────────────────────────────────────────────────────── */
#nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  transition: background 0.3s, backdrop-filter 0.3s;
}

#nav.scrolled {
  background: rgba(13, 13, 13, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-name {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  font-size: 14px;
}

.nav-links a { color: var(--muted); transition: color 0.2s; }
.nav-links a:hover { color: var(--text); }

.btn-contact {
  color: var(--text) !important;
  border: 1px solid var(--border);
  padding: 8px 18px;
  border-radius: 100px;
  transition: border-color 0.2s, background 0.2s !important;
}
.btn-contact:hover {
  background: var(--surface);
  border-color: #444 !important;
}

/* ─── HERO ───────────────────────────────────────────────────── */
#hero {
  /* escape the shared section limit — the reel bleeds full width */
  max-width: none;
  margin: 0;
  padding: calc(var(--nav-h) + 28px) 0 0;
}

.hero-intro {
  max-width: 1720px;
  margin: 0 auto;
  padding: 0 clamp(24px, 4vw, 72px) 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 3vw, 48px);
  text-align: left;
}

.hero-intro h1 {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.05;
  white-space: nowrap;
}

.hero-desc {
  flex-shrink: 0;
  max-width: 360px;
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

/* stack the header on smaller screens */
@media (max-width: 768px) {
  .hero-intro {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .hero-intro h1 { white-space: normal; font-size: clamp(2rem, 9vw, 3rem); }
  .hero-desc { max-width: 100%; }
}

.reel-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
}

.reel-wrapper video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;   /* 16:9 reel fills the 16:9 frame, no bars */
  pointer-events: none;
}

/* ─── CUSTOM CURSOR (small circle) ───────────────────────────── */
/* only on devices with a real mouse — touch keeps its native behaviour */
@media (hover: hover) and (pointer: fine) {
  * { cursor: none !important; }

  .cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;          /* centre on the pointer */
    border-radius: 50%;
    background: #fff;
    /* difference blend keeps it visible on dark UI AND white slides */
    mix-blend-mode: difference;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    /* note: NO transition on transform, so position tracks the mouse exactly */
    transition: width 0.2s ease, height 0.2s ease, margin 0.2s ease,
                opacity 0.25s ease;
  }

  /* grows into a bigger solid circle over clickable things —
     stays filled white so the difference blend keeps inverting what's below */
  .cursor.is-hover {
    width: 38px;
    height: 38px;
    margin: -19px 0 0 -19px;
  }
}

/* ─── SECTION SHARED ─────────────────────────────────────────── */
section {
  padding: 100px clamp(24px, 4vw, 72px);
  max-width: 1720px;
  margin: 0 auto;
}

/* make contact full-width background */
#contact {
  max-width: 100%;
  padding: 120px 40px;
  text-align: center;
  background: var(--surface);
}

.section-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 48px;
}

/* ─── WORK GRID ──────────────────────────────────────────────── */
/* a touch wider than other sections + generous gaps so projects
   spread across the screen without reaching the edges */
#work {
  max-width: 1960px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  column-gap: 24px;
  row-gap: 4px;
}

.card { cursor: pointer; }

.card-thumb {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--surface);
}

.card-thumb img {
  transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.card:hover .card-thumb img { transform: scale(1.05); }

.card-overlay {
  position: absolute;
  inset: 0;
  /* light wash only — a heavy 50% overlay over a light preview mixed to
     mid-gray, where the difference-blend cursor becomes invisible */
  background: rgba(13, 13, 13, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 13px;
  letter-spacing: 0.04em;
  /* keep "View Project" legible without darkening the whole preview */
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.9), 0 0 2px rgba(0, 0, 0, 0.7);
}

.card:hover .card-overlay { opacity: 1; }

/* hover video preview: fades in over the thumbnail while it plays */
.card-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.card:hover .card-preview { opacity: 1; }

.card-info {
  padding: 16px 0 24px;
}

.card-info h3 {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 4px;
}

.card-info p {
  font-size: 13px;
  color: var(--muted);
}

/* ─── EXPANDING CASE STUDY PANEL ─────────────────────────────── */
.case-expander {
  grid-column: 1 / -1;
  overflow: hidden;
  height: 0;
  opacity: 1;
  transition: height 0.5s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s;
  background: var(--surface);
  border-radius: 4px;
}

.case-inner {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.case-close {
  align-self: flex-end;
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font: 13px var(--font);
  letter-spacing: 0.04em;
  padding: 8px 18px;
  border-radius: 100px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.case-close:hover { color: var(--text); border-color: #555; }

.card.open .card-thumb { outline: 1px solid #444; }

/* carousel: media blocks become slides with ‹ › arrows */
.case-carousel {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface);
}

.case-track {
  display: flex;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.case-slide {
  position: relative;
  flex: 0 0 100%;
  min-width: 100%;
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--surface);
}

/* caption overlay, bottom-left of a slide */
.case-caption {
  position: absolute;
  left: 20px;
  bottom: 20px;
  z-index: 2;
  max-width: 400px;
  padding: 12px 16px;
  background: rgba(13, 13, 13, 0.55);
  backdrop-filter: blur(8px);
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.85);
}
.case-caption strong {
  display: block;
  font-weight: 500;
  color: #fff;
  margin-bottom: 2px;
}

.case-slide .cs-player,
.case-slide .cs-loop,
.case-slide .cs-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 0;
  /* fill the object-fit:contain letterbox with the slide's own
     background (gray by default, white on #fff slides) instead of
     the browser's default black video letterbox */
  background-color: inherit;
}

.case-slide .cs-video,
.case-slide .cs-row {
  width: 100%;
  height: 100%;
}

/* grids size themselves to their aspect ratio and sit centered,
   so side margins are always symmetric */
.case-slide .cs-grid {
  height: 100%;
  max-width: 100%;
  margin: 0 auto;
  aspect-ratio: 16/9;
}

.case-slide .cs-row > *,
.case-slide .cs-grid > * {
  width: 100%;
  height: 100%;
  object-fit: contain;
  min-height: 0;
  min-width: 0;
  border-radius: 0;
}

/* grid cells are shaped to match their content's aspect ratio,
   so cover fills each cell edge-to-edge (absorbing gap rounding) */
.case-slide .cs-grid > * { object-fit: cover; }

/* stacked rows inside one slide: a .cs-stack sizes itself to its
   aspect ratio and holds .cs-brow rows, each with its own
   proportional columns, so every cell shows its content uncropped */
.case-slide .cs-stack {
  height: 100%;
  max-width: 100%;
  margin: 0 auto;
  display: grid;
  gap: 4px;
}
.case-slide .cs-brow {
  display: grid;
  gap: 4px;
  min-height: 0;
}
.case-slide .cs-brow > * {
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-width: 0;
  min-height: 0;
  border-radius: 0;
}

/* scroll mode: a fixed 16:9 window framing a long page that
   scrolls vertically inside (data-expand="scroll" on the card) */
.case-scrollport {
  width: 100%;
  aspect-ratio: 16/9;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #fff;
}
.case-scrollport img,
.case-scrollport video {
  width: 100%;
  display: block;
  border-radius: 0;
}
.case-scrollport .cs-brow {
  display: grid;
  gap: 4px;
  margin-top: 4px;
}
.case-scrollport .cs-brow + .cs-brow { margin-top: 4px; }

.case-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(13, 13, 13, 0.55);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 4px;
  transition: background 0.2s, border-color 0.2s;
}
.case-arrow:hover { background: rgba(13, 13, 13, 0.85); border-color: #555; }
.case-arrow.prev { left: 14px; }
.case-arrow.next { right: 14px; }

.case-dots {
  display: flex;
  justify-content: center;
  gap: 9px;
}
.case-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: #4a4a4a;
  cursor: pointer;
  transition: background 0.2s;
}
.case-dot.active { background: var(--text); }

/* media blocks inside a case study */
.cs-video {
  position: relative;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 4px;
  overflow: hidden;
}
.cs-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.cs-player, .cs-loop, .cs-img {
  width: 100%;
  border-radius: 4px;
  display: block;
  background: #000;
}

.cs-row {
  display: grid;
  grid-auto-flow: column;   /* one row, equal column per item */
  grid-auto-columns: 1fr;
  gap: 8px;
}

.cs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 1fr;
  gap: 8px;
}

.cs-text { max-width: 1100px; }
.cs-text h4 { font-size: 20px; font-weight: 500; margin-bottom: 10px; }
.cs-text p { color: var(--muted); line-height: 1.7; }

/* temporary gray boxes until real media goes in */
.cs-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16/9;
  background: #1e1e1e;
  border: 1px dashed #3a3a3a;
  border-radius: 4px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.04em;
}

@media (max-width: 600px) {
  .case-inner { padding: 20px; }
  .cs-row { grid-template-columns: 1fr; }
}

/* ─── ABOUT ──────────────────────────────────────────────────── */
#about {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 64px;
  align-items: start;
}

.about-photo {
  width: 200px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;        /* round mask */
  overflow: hidden;
  background: var(--surface);
  position: sticky;
  top: calc(var(--nav-h) + 40px);
}

.about-text h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 300;
  letter-spacing: -0.02em;
  margin-bottom: 28px;
}

.about-text p {
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.8;
  font-size: 16px;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 36px;
}

.social-links a {
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 100px;
  transition: border-color 0.2s, color 0.2s;
}

.social-links a:hover {
  border-color: #555;
  color: var(--text);
}

/* ─── CONTACT ────────────────────────────────────────────────── */
#contact h2 {
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 300;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.contact-sub {
  font-size: 16px;
  color: var(--muted);
  margin-bottom: 40px;
}

.btn-cta {
  display: inline-block;
  font-size: 15px;
  letter-spacing: 0.04em;
  padding: 16px 36px;
  border: 1px solid var(--border);
  border-radius: 100px;
  transition: background 0.2s, border-color 0.2s;
}

.btn-cta:hover {
  background: var(--surface);
  border-color: #555;
}

/* visible email fallback under the button (works even with no mail app) */
.contact-email {
  margin-top: 20px;
  font-size: 14px;
  color: var(--muted);
}
.contact-email a {
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: border-color 0.2s;
}
.contact-email a:hover { border-color: var(--text); }

/* ─── FOOTER ─────────────────────────────────────────────────── */
footer {
  display: flex;
  justify-content: space-between;
  padding: 28px 40px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  letter-spacing: 0.04em;
}

/* ─── FADE-IN ON SCROLL ──────────────────────────────────────── */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  #about { grid-template-columns: 1fr; gap: 40px; }
  .about-photo { position: static; aspect-ratio: 1/1; }
}

@media (max-width: 600px) {
  #nav { padding: 0 20px; }
  .nav-links { gap: 20px; }
  section { padding: 72px 20px; }
  .grid { grid-template-columns: 1fr; }
  footer { padding: 24px 20px; }
}
