:root {
  --bg: #0b0b0b;
  --fg: #ededed;
  --muted: #8a8a8a;
  --line: #222;
  --gutter: 8px;
  --nav-h: 64px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { display: block; width: 100%; height: auto; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* ---------- Header / nav ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--nav-h);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(11, 11, 11, 0.82);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.brand strong { font-weight: 700; font-size: 16px; letter-spacing: 0.01em; }
.brand span { font-weight: 300; font-size: 14px; color: var(--muted); }

.nav { display: flex; gap: 32px; list-style: none; }
.nav > li { position: relative; }
.nav > li > a {
  display: block;
  padding: 20px 0;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--fg);
  opacity: 0.85;
  transition: opacity .2s;
}
.nav > li > a:hover, .nav a.active { opacity: 1; }
.nav .active { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 1px; }

.menu-toggle { display: none; width: 32px; height: 32px; position: relative; }
.menu-toggle span {
  position: absolute; left: 6px; right: 6px; height: 1.5px; background: var(--fg);
  transition: transform .3s, top .3s;
}
.menu-toggle span:nth-child(1) { top: 12px; }
.menu-toggle span:nth-child(2) { top: 19px; }
body.menu-open .menu-toggle span:nth-child(1) { top: 15.5px; transform: rotate(45deg); }
body.menu-open .menu-toggle span:nth-child(2) { top: 15.5px; transform: rotate(-45deg); }

/* ---------- Page ---------- */
main { padding-top: var(--nav-h); min-height: 100vh; }

/* ---------- Filters ---------- */
.filters {
  position: sticky;
  top: var(--nav-h);
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 12px 24px 16px;
  background: rgba(11, 11, 11, 0.82);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.filter-group { display: flex; gap: 6px; }
.filter-sep { width: 1px; height: 16px; background: #2a2a2a; }
.filters button {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 6px 14px;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--muted);
  border: 1px solid #2a2a2a;
  border-radius: 999px;
  white-space: nowrap;
  transition: color .2s, border-color .2s, background .2s;
}
.filters button sup { font-size: 10px; line-height: 0; opacity: .7; }
.filters button:hover { color: var(--fg); border-color: #555; }
.filters button.active { color: var(--bg); background: var(--fg); border-color: var(--fg); }
.filters button:disabled { opacity: .35; cursor: default; }
.filters button:disabled:hover { color: var(--muted); border-color: #2a2a2a; }

/* ---------- Project grid (home) ---------- */
.grid {
  display: flex;
  flex-direction: column;
  gap: var(--gutter);
  padding: 0 var(--gutter) var(--gutter);
}
.tile { position: relative; display: block; overflow: hidden; background: #151515; }
.tile img { transition: transform 1.2s cubic-bezier(.2,.7,.2,1), opacity .6s; opacity: 0; }
.tile img.loaded { opacity: 1; }
.tile[hidden] { display: none; }
/* home tiles share one height: 2.4:1, the widest frame (Lost Perspective) */
.tile-crop img { aspect-ratio: 2.4 / 1; object-fit: cover; }
/* home page: large image + two smaller stacked, alternating sides every group of three */
@media (min-width: 761px) {
  .grid-mixed { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-flow: dense; }
  .grid-mixed .tile:nth-child(6n+1) { grid-column: 1 / span 2; }
  .grid-mixed .tile:nth-child(6n+2), .grid-mixed .tile:nth-child(6n+3) { grid-column: 3; }
  .grid-mixed .tile:nth-child(6n+4) { grid-column: 2 / span 2; }
  .grid-mixed .tile:nth-child(6n+5), .grid-mixed .tile:nth-child(6n+6) { grid-column: 1; }
  .grid-mixed .tile:nth-child(3n+1) { grid-row: span 2; }
  /* a leftover pair: the large tile sets the row height, the small one stretches to match */
  .grid-mixed .tile:nth-child(3n+1):nth-last-child(2) { grid-row: auto; aspect-ratio: 16 / 9; }
  .grid-mixed .tile:nth-child(3n+1) img,
  .grid-mixed .tile:nth-child(3n+2):last-child img { position: absolute; inset: 0; height: 100%; aspect-ratio: auto; }
  .grid-mixed .tile:not(:nth-child(3n+1)) img { aspect-ratio: 16 / 9; }
  /* a leftover single project spans the full width */
  .grid-mixed .tile:nth-child(3n+1):last-child { grid-column: 1 / -1; grid-row: auto; }
  .grid-mixed .tile:nth-child(3n+1):last-child img { position: static; aspect-ratio: 2.4 / 1; height: auto; }
}
.tile.reveal { animation: reveal .5s ease both; }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.tile-info {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity .4s;
}
.tile-info h2 { font-size: clamp(20px, 2.4vw, 32px); font-weight: 500; letter-spacing: 0.01em; }
.tile-info p { font-size: 14px; font-weight: 300; color: #cfcfcf; }

@media (hover: hover) {
  .tile:hover .tile-info { opacity: 1; }
  .tile:hover img { transform: scale(1.015); }
}
.tile:focus-visible .tile-info { opacity: 1; }

.empty { padding: 40px 24px; color: var(--muted); }

/* ---------- Project page ---------- */
.project { padding: 32px var(--gutter) 64px; }
.video {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-fallback {
  display: block; position: relative; aspect-ratio: auto;
}
.video-fallback .play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.35); font-size: 14px; letter-spacing: .08em; text-transform: uppercase;
  transition: background .3s;
}
.video-fallback:hover .play { background: rgba(0,0,0,.55); }

.project-meta {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 32px;
  padding: 36px 16px 48px;
  max-width: 1200px;
}
.project-meta h1 { font-size: clamp(24px, 3vw, 36px); font-weight: 500; line-height: 1.15; }
.project-meta .sub { margin-top: 8px; color: var(--muted); font-size: 14px; font-weight: 300; }
.project-meta .desc { color: #cfcfcf; font-weight: 300; max-width: 60ch; }
.project-meta .desc a { border-bottom: 1px solid #555; }
.project-meta .subtitle { margin-top: 6px; font-size: 17px; font-weight: 300; color: #cfcfcf; }
.project-meta .desc > * + * { margin-top: 1.4em; }
.project-meta .awards span,
.credits dt {
  display: block;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}
.credits {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px 24px;
  padding-top: 1.4em;
  border-top: 1px solid var(--line);
}
.credits dd { color: var(--fg); font-weight: 400; }

/* project stills: small, uniformly cropped, five per row (two on phones) */
.stills { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--gutter); }
.stills img { aspect-ratio: 2 / 1; object-fit: cover; }

.project-nav {
  display: flex;
  justify-content: space-between;
  padding: 40px 16px 0;
  font-size: 14px;
  color: var(--muted);
}
.project-nav a:hover { color: var(--fg); }

/* ---------- About ---------- */
.about {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 48px;
  padding: 56px 24px 80px;
  max-width: 1200px;
}
.about h1 { font-size: clamp(24px, 3vw, 36px); font-weight: 500; }
.about .role { color: var(--muted); font-weight: 300; margin-top: 6px; }
.about .bio p { color: #cfcfcf; font-weight: 300; margin-bottom: 1em; max-width: 60ch; }
.about .contact { margin-top: 28px; display: flex; flex-direction: column; gap: 6px; }
.about .contact a { color: var(--fg); border-bottom: 1px solid #444; align-self: flex-start; }
.about .contact a:hover { border-color: var(--fg); }

footer {
  padding: 32px 24px 40px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}
footer a:hover { color: var(--fg); }

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  :root { --nav-h: 56px; --gutter: 4px; }
  .site-header { padding: 0 16px; }
  .brand { flex-direction: column; gap: 0; line-height: 1.2; }
  .brand strong { font-size: 15px; }
  .brand span { font-size: 12px; }

  .menu-toggle { display: block; z-index: 2; }

  .nav {
    /* header's backdrop-filter makes it the containing block, so size explicitly */
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    height: calc(100vh - var(--nav-h));
    height: calc(100dvh - var(--nav-h));
    flex-direction: column;
    gap: 0;
    padding: 24px 16px;
    background: var(--bg);
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s, visibility .3s;
    overflow-y: auto;
  }
  body.menu-open { overflow: hidden; }
  body.menu-open .nav { opacity: 1; visibility: visible; }
  .nav > li { border-bottom: 1px solid var(--line); }
  .nav > li > a {
    width: 100%; text-align: left; padding: 18px 0; font-size: 22px; font-weight: 400; opacity: 1;
  }
  .nav .active { text-decoration: none; color: var(--fg); }
  .filters { padding: 10px 12px 12px; gap: 8px; }
  .filter-sep { display: none; }
  .filters button { padding: 6px 12px; }

  /* no hover on touch: show caption under each image */
  .tile-info {
    position: static;
    opacity: 1;
    background: var(--bg);
    flex-direction: row;
    justify-content: space-between;
    align-items: baseline;
    padding: 10px 12px 14px;
  }
  .tile-info h2 { font-size: 15px; }
  .tile-info p { font-size: 13px; color: var(--muted); }

  .project { padding-top: 16px; }
  .stills { grid-template-columns: repeat(2, 1fr); }
  .project-meta, .about { grid-template-columns: 1fr; gap: 16px; }
  .project-meta { padding: 24px 12px 32px; }
  .about { padding: 32px 16px 48px; }
  .project-nav { padding: 32px 12px 0; }
  footer { padding: 24px 16px 32px; }
}

@media (hover: none) and (min-width: 761px) {
  .tile-info { opacity: 1; background: linear-gradient(transparent 55%, rgba(0,0,0,.6)); justify-content: flex-end; align-items: flex-start; padding: 24px; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Main page: slices ----------
   Every main-page still sits side by side as a thin vertical slice filling the screen.
   The hovered (or tapped) slice widens to most of the screen; the rest shrink to slivers. */
.grid.slices {
  display: flex;
  flex-direction: row;
  gap: 3px;
  height: calc(100vh - var(--nav-h) - 2 * var(--gutter));
  height: calc(100svh - var(--nav-h) - 2 * var(--gutter));
  min-height: 420px;
}
.slices .tile {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  transition: flex-grow .8s cubic-bezier(.2, .8, .2, 1);
}
.slices .tile img {
  position: absolute;
  inset: 0;
  height: 100%;
  aspect-ratio: auto;
}
.slices .tile-info {
  position: absolute;
  inset: auto 0 0 0;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 32px;
  text-align: left;
  white-space: nowrap;
  background: linear-gradient(transparent, rgba(0, 0, 0, .55));
  opacity: 0;
  transition: opacity .3s;
}
.slices .tile.active { flex-grow: 40; }
.slices .tile.active .tile-info { opacity: 1; transition-delay: .35s; }
@media (hover: hover) {
  .slices .tile:hover { flex-grow: 40; }
  .slices .tile:hover img { transform: none; }
  .slices .tile:hover .tile-info { opacity: 1; transition-delay: .35s; }
}

/* horizontal option: the same slices stacked as full-width bands on every screen size */
.grid.slices.slices-h { flex-direction: column; }
.slices-h .tile-info { padding: 24px 32px; }

/* phones: slices stack top to bottom as horizontal bands */
@media (max-width: 760px) {
  .grid.slices { flex-direction: column; gap: 2px; min-height: 0; }
  .slices .tile-info { padding: 16px; flex-direction: column; align-items: flex-start; }
  .slices .tile-info h2 { font-size: 20px; }
  .slices .tile-info p { color: #cfcfcf; }
}
