/* ---------- Font ----------
   Add the font files to /assets/fonts/ and uncomment.


}
*/

/* ---------- Tokens ---------- */
:root {
  --font: "Bahnschrift", Helvetica, Arial, sans-serif;
  --edge: 24px;
  --gap: 8px;
  --text: 0.9375rem;
  --text-lg: 1.375rem;
  --fade: 400ms ease-out;
  --hover-delay: 00ms;
  --peek: 12vh;
}

@media (min-width: 768px) {
  :root { --edge: 40px; }
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: #000;
  color: #fff;
  font-family: var(--font);
  font-weight: 700;
  font-size: 20(--text);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
  transition: opacity 200ms ease-out;
}
a:hover { opacity: 0.6; }

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: var(--edge);
}
.nav-left  { justify-self: start; font-size: var(--text-lg); }
.nav-right { justify-self: end;  font-size: var(--text-lg); }
.name {
  margin: 0;
  font: inherit;
  font-size: var(--text-lg);
}

/* ---------- Hero (fixed, covered by .content) ---------- */
.hero {
  position: fixed;
  inset: 0;
  z-index: 0;
  height: calc(100vh - var(--peek, 12vh));
  height: calc(100dvh - var(--peek, 12vh));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
  background: #000;
}
.hero > * { grid-area: 1 / 1; }
.hero video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.hero-shade { background: rgba(0, 0, 0, 0.2); }
.hero-tagline {
  align-self: end;
  justify-self: start;
  margin: 0;
  padding: var(--edge);
}

.hero-spacer {
  height: calc(100vh - var(--peek, 12vh));
  height: calc(100dvh - var(--peek, 12vh));
}

/* ---------- Content (slides over the hero) ---------- */
.content {
  position: relative;
  z-index: 1;
  background: #000;
}

.work { padding: var(--edge); 
  container-type: inline-size;   /* add */
}


/* ---------- Grid ----------
   Rows are built in JS (see main.js). Thumb height is derived from the
   grid's own width so rows keep a fixed 16:9 height while widths flex. */
.grid {
  --cols: 3;
  
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.row {
  display: flex;
  align-items: flex-start;
  gap: var(--gap);
}

.item {
  flex: 1 1 0;
  min-width: 0;
  transition: flex-grow var(--fade);
}

.thumb {
  display: grid;           /* image, title strip and Info label stack in one cell */
    grid-template-columns: minmax(0, 1fr);   /* add */
  grid-template-rows: minmax(0, 1fr);      /* add */
  height: calc((100cqw - (var(--cols) - 1) * var(--gap)) / var(--cols) * 0.5625);
  overflow: hidden;
  background: #111;
}
.thumb > * { grid-area: 1 / 1; }

.thumb-open {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: #111;
}
.thumb-open img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.title-strip {
  display: none;
  align-self: end;
  justify-self: start;
  max-width: 80%;
  margin: 14px;
  text-shadow:
    0 0 6px rgba(0, 0, 0, 0.9),
    0 0 16px rgba(0, 0, 0, 0.8),
    0 0 32px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

.info {
  align-self: end;
  justify-self: end;
  margin: 10px;
  padding: 0.3em 0.6em;
  border: 0;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  transition: opacity 200ms ease-out;
}
.info:hover { opacity: 0.6; }

.caption {
  margin: 0.6em 0 0;
}

/* Desktop / pointer devices only */
@media (hover: hover) and (pointer: fine) {
  .grid {
    height: calc(
      var(--rows) * ((100cqw - (var(--cols) - 1) * var(--gap)) / var(--cols) * 0.5625)
      + (var(--rows) - 1) * var(--gap)
    );
  }

  .row {
    flex: 1 1 0;
    min-height: 0;
    align-items: stretch;
    transition: flex-grow var(--fade);
  }
  .row:has(.item:hover) {
    flex-grow: 1.3;
    transition-delay: var(--hover-delay);
  }
  .row:has(:focus-visible) { flex-grow: 1.3; }

  .item {
    display: flex;
    flex-direction: column;
  }
  .item:hover {
    flex-grow: 1.3;
    transition-delay: var(--hover-delay);
  }
  .item:has(:focus-visible) { flex-grow: 1.3; }

  .thumb {
    flex: 1 1 0;
    height: auto;
    min-height: 0;
  }

  .caption { display: none; }

  .title-strip {
    display: block;
    opacity: 0;
    transition: opacity var(--fade);
  }
  .item:hover .title-strip {
    opacity: 1;
    transition-delay: var(--hover-delay);
  }
  .item:has(:focus-visible) .title-strip { opacity: 1; }
}
/* ---------- Project panel ---------- */
.grid.is-open { height: auto; }

.grid.is-open .row { flex: none; }

.grid.is-open .thumb {
  flex: none;
  height: calc((100cqw - (var(--cols) - 1) * var(--gap)) / var(--cols) * 0.5625 * 0.5);
}

.panel {
  display: grid;
  grid-template-columns: minmax(0, 65fr) minmax(0, 35fr);
  gap: var(--edge);
  align-items: start;
  margin: var(--gap) 0;
}

.panel-video {
  aspect-ratio: 16 / 9;
  background: #111;
}
.panel-video iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.panel-info {
  display: flex;
  flex-direction: column;
  gap: 0.9em;
  min-width: 0;
}
.panel-info p { margin: 0; }
.panel-title {
  margin: 0;
  font: inherit;
  font-size: var(--text-lg);
}
.panel-label {
  margin-right: 0.6em;
  opacity: 0.6;
}
.panel-link { text-decoration: underline; }

.panel-close {
  align-self: flex-end;
  padding: 0;
  border: 0;
  background: none;
  transition: opacity 200ms ease-out;
}
.panel-close:hover { opacity: 0.6; }

@media (max-width: 767px) {
  .panel {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--gap);
  }
}
/* ---------- Contact (placeholder until pass 2) ---------- */
.contact {
  padding: var(--edge);
  padding-bottom: calc(var(--edge) * 2);
}

#contact-form {
  display: grid;
  gap: 16px;
  max-width: 640px;
}

.field {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}
.field span {
  padding-top: 0.7em;
  opacity: 0.6;
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.7em 0.8em;
  border: 1px solid #fff;
  border-radius: 0;
  background: #000;
  color: #fff;
  font: inherit;
  -webkit-appearance: none;
  appearance: none;
  resize: none;
}
.field input:focus-visible,
.field textarea:focus-visible {
  outline: 1px solid #fff;
  outline-offset: 3px;
}

.trap { display: none; }

.send {
  justify-self: start;
  margin-left: calc(7rem + 16px);
  padding: 0;
  border: 0;
  background: none;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  transition: opacity 200ms ease-out;
}
.send:hover { opacity: 0.6; }
.send:disabled { opacity: 0.4; cursor: default; }

#form-status {
  margin: 0 0 0 calc(7rem + 16px);
  min-height: 1.4em;
}

.contact-details {
  display: grid;
  gap: 6px;
  margin-top: 56px;
}
.contact-details p {
  margin: 0;
  opacity: 0.6;
}

@media (max-width: 479px) {
  .field {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }
  .field span { padding-top: 0; }
  .send, #form-status { margin-left: 0; }
}

/* ---------- Focus ---------- */
a:focus-visible,
button:focus-visible {
  outline: 1px solid #fff;
  outline-offset: 3px;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .item, .title-strip, a, .info { transition: none; }
}

/* ---------- GRAIN (optional) ----------
   Delete this whole block to remove the film grain. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* Phones and small screens: simple 16:9 thumbnails, no shrinking */
@media (max-width: 767px) {
  .thumb,
  .grid.is-open .thumb {
    flex: none;
    height: auto;
    aspect-ratio: 16 / 9;
  }
}