:root {
  --ink: #0b0b0c;
  --panel: #111112;
  --paper: #e9e4da;
  --muted: #8d877d;
  --hairline: rgba(233, 228, 218, 0.2);
  --hairline-strong: rgba(233, 228, 218, 0.55);
  --serif: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Jost", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --gutter: clamp(0.75rem, 3vw, 2.5rem);
  --gap: clamp(0.5rem, 1vw, 0.875rem);
  color-scheme: dark;
}

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

html {
  background: var(--ink);
  -webkit-text-size-adjust: 100%;
}

html:has(dialog[open]) {
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

:focus-visible {
  outline: 1px solid var(--paper);
  outline-offset: 4px;
}

/* ── Masthead ─────────────────────────────────────────────────────────── */

.masthead {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(3.5rem, 11vh, 7.5rem) var(--gutter) clamp(2.75rem, 8vh, 5rem);
  text-align: center;
}

.name {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.75rem, 8vw, 5.75rem);
  font-weight: 300;
  line-height: 1;
  letter-spacing: 0.015em;
}

.role {
  margin: clamp(1rem, 2.4vw, 1.5rem) 0 0;
  /* The tracking adds trailing space; pull the text back to true centre. */
  padding-left: 0.36em;
  color: var(--muted);
  font-size: clamp(0.6875rem, 1.6vw, 0.8125rem);
  font-weight: 400;
  letter-spacing: 0.36em;
  text-transform: uppercase;
}

.contact-button {
  margin-top: clamp(1.75rem, 4.5vw, 2.75rem);
  padding: 0.85rem 2rem 0.85rem 2.3rem;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--paper);
  font: inherit;
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    background-color 0.25s ease,
    color 0.25s ease,
    border-color 0.25s ease;
}

.contact-button:hover,
.contact-button--solid {
  border-color: var(--paper);
  background: var(--paper);
  color: var(--ink);
}

.contact-button--solid:hover {
  background: transparent;
  color: var(--paper);
}

.contact-button:disabled {
  opacity: 0.5;
  cursor: default;
}

.profiles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 2rem;
  margin-top: clamp(1.5rem, 3.5vw, 2rem);
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.profiles a {
  padding: 0.5rem 0;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.25s ease;
}

.profiles a:hover {
  color: var(--paper);
}

/* ── Moodboard────────────────────────────────────────────────────────── */

.moodboard {
  max-width: 100rem;
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(2.5rem, 7vh, 4.5rem);
  columns: 2;
  column-gap: var(--gap);
}

@media (min-width: 48rem) {
  .moodboard {
    columns: 3;
  }
}

@media (min-width: 90rem) {
  .moodboard {
    columns: 4;
  }
}

.frame {
  position: relative;
  display: block;
  margin: 0 0 var(--gap);
  overflow: hidden;
  break-inside: avoid;
  background: #141415;
}

.frame img {
  display: block;
  width: 100%;
  height: auto;
}

@media (prefers-reduced-motion: no-preference) {
  /* On the board, not each frame: one element, so nothing can be left hidden. */
  .moodboard {
    animation: develop 1.6s ease;
  }
}

@keyframes develop {
  from {
    opacity: 0;
  }
}

/* Placeholder frames: abstract stand-ins until real stills are dropped into
   public/moodboard/. Grain on ::before, vignette on ::after. */

.frame--placeholder::before,
.frame--placeholder::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.frame--placeholder::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
  opacity: 0.55;
}

.frame--placeholder::after {
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, 0.5) 100%);
}

.ratio-scope {
  aspect-ratio: 2.39 / 1;
}
.ratio-wide {
  aspect-ratio: 16 / 9;
}
.ratio-square {
  aspect-ratio: 1;
}
.ratio-portrait {
  aspect-ratio: 4 / 5;
}
.ratio-tall {
  aspect-ratio: 2 / 3;
}

/* Last light over a flat horizon. */
.tone-dusk {
  background:
    radial-gradient(ellipse 60% 22% at 62% 57%, rgba(226, 142, 88, 0.75), transparent 70%),
    linear-gradient(to bottom, #131a2b 0%, #2d2c47 38%, #7a4a48 54%, #15110f 58.5%, #0a0909 100%);
}

/* A single lamp in a dark room. */
.tone-ember {
  background:
    radial-gradient(circle at 68% 34%, #e9a04f 0%, #9a4519 14%, rgba(72, 28, 12, 0.6) 34%, transparent 62%),
    linear-gradient(200deg, #1c0f0a, #090605 70%);
}

/* Morning fog. */
.tone-fog {
  background:
    radial-gradient(ellipse 70% 40% at 35% 40%, rgba(206, 212, 210, 0.55), transparent 70%),
    linear-gradient(to bottom, #7f8b90 0%, #56646a 48%, #252d31 100%);
}

/* Sodium streetlight against a teal night. */
.tone-sodium {
  background:
    radial-gradient(circle at 27% 20%, #f4ae5c 0%, rgba(196, 104, 38, 0.7) 12%, transparent 46%),
    linear-gradient(165deg, #103238 0%, #0a1a1e 55%, #050708 100%);
}

/* Forest interior. */
.tone-pine {
  background:
    radial-gradient(ellipse 45% 30% at 24% 78%, rgba(132, 160, 120, 0.5), transparent 70%),
    linear-gradient(165deg, #0c1711 0%, #23412f 55%, #080d0a 100%);
}

/* Close on a face, out of focus. */
.tone-rose {
  background:
    radial-gradient(ellipse 48% 58% at 48% 42%, #c79080 0%, #7c4442 42%, transparent 78%),
    linear-gradient(to bottom, #241416, #0e0809);
}

/* A shaft of light through a doorway. */
.tone-noir {
  background:
    linear-gradient(104deg, transparent 38%, rgba(226, 222, 212, 0.16) 44%, rgba(236, 232, 222, 0.8) 50%, rgba(226, 222, 212, 0.12) 57%, transparent 64%),
    linear-gradient(to bottom, #161616, #060606);
}

/* Overcast sea. */
.tone-tide {
  background:
    linear-gradient(to bottom, #a3b5b8 0%, #7896a0 38%, #1f414c 41%, #0b1d23 100%);
}

/* ── Contact dialog ───────────────────────────────────────────────────── */

.contact {
  width: min(35rem, calc(100vw - 1.5rem));
  max-height: calc(100dvh - 1.5rem);
  padding: clamp(1.75rem, 5vw, 3rem);
  border: 1px solid var(--hairline);
  background: var(--panel);
  color: var(--paper);
  overflow-y: auto;
}

/* The dialog itself takes focus on open; the ring belongs on its controls. */
.contact:focus-visible {
  outline: none;
}

.contact::backdrop {
  background: rgba(5, 5, 6, 0.78);
  backdrop-filter: blur(6px);
}

@media (prefers-reduced-motion: no-preference) {
  .contact[open] {
    animation: rise 0.35s ease both;
  }
  .contact[open]::backdrop {
    animation: develop 0.35s ease both;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(0.75rem);
  }
}

.contact__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.25s ease;
}

.contact__close:hover {
  color: var(--paper);
}

.contact__close svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1;
}

.contact__title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2rem, 6vw, 2.75rem);
  font-weight: 300;
  line-height: 1.1;
}

.contact__title:focus {
  outline: none;
}

.contact__lede {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.contact__form {
  display: grid;
  gap: 1.5rem;
  margin-top: 2rem;
}

.field-row {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 34rem) {
  .field-row {
    grid-template-columns: 1fr 1fr;
  }
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field__label {
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.5rem 0;
  border: 0;
  border-bottom: 1px solid var(--hairline);
  border-radius: 0;
  background: transparent;
  color: var(--paper);
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.25s ease;
}

.field textarea {
  min-height: 8rem;
  resize: vertical;
}

.field input:hover,
.field textarea:hover {
  border-bottom-color: var(--hairline-strong);
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-bottom-color: var(--paper);
}

/* Keep browser autofill from painting the fields white. */
.field input:-webkit-autofill {
  -webkit-text-fill-color: var(--paper);
  box-shadow: 0 0 0 100px var(--panel) inset;
  caret-color: var(--paper);
}

.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.contact__actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.contact__actions .contact-button {
  flex: none;
  margin-top: 0;
}

.contact__feedback {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.contact__sent-view .contact-button {
  margin-top: 2rem;
}

/* ── Header blocks ────────────────────────────────────────────────────── */

.identity,
.actions {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* The profile links are pinned to the top-right corner while scrolling, but
   only where the screen is wide enough for the corner to be clear of the
   name; on narrower screens they stay in the page, under the Contact button. */
@media (min-width: 64rem) {
  .profiles {
    position: fixed;
    top: 1rem;
    right: max(0rem, calc(var(--gutter) - 1rem));
    z-index: 5;
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
    margin-top: 0;
    padding: 0.35rem 1rem;
    background: rgba(11, 11, 12, 0.82);
    backdrop-filter: blur(8px);
  }
}

/* ── Image credits ──────────────────────────────────────────────────────
   An image with credits is a card: it turns over on the spot to show them.
   Where they would not fit on its back (small screens, shallow images) the
   image opens enlarged in the viewer instead and turns over there. */

.frame--credited {
  overflow: visible;
  background: none;
}

.card {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  /* No coloured flash on tap: the turn itself is the feedback. */
  -webkit-tap-highlight-color: transparent;
}

/* Each face turns by itself, carrying its own perspective. (One turning
   parent would need preserve-3d, which column layouts flatten.) */
.card__front,
.viewer__front {
  transform: perspective(75rem) rotateY(0deg);
}
.card__back,
.viewer__back {
  transform: perspective(75rem) rotateY(-180deg);
}
.is-flipped > .card__front,
.is-flipped > .viewer__front {
  transform: perspective(75rem) rotateY(180deg);
}
.is-flipped > .card__back,
.is-flipped > .viewer__back {
  transform: perspective(75rem) rotateY(0deg);
}

.card:focus-visible {
  outline: 1px solid var(--hairline-strong);
  outline-offset: 3px;
}

.card__front,
.card__back,
.viewer__front,
.viewer__back {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.card__front {
  display: block;
  background: #141415;
}

.card__back,
.viewer__back {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--hairline);
  background: #101011;
}

.card__back {
  overflow: hidden;
  padding: 0.75rem 1rem;
}

/* Two columns meeting at the centre: the role ends there, the name starts
   there. The title and the festivals run across both. */
.credits {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3em 0.9em;
  width: 100%;
  font-size: 0.6875rem;
  line-height: 1.45;
  letter-spacing: 0.04em;
}

.credits__title {
  grid-column: 1 / -1;
  margin-bottom: 0.35em;
  font-family: var(--serif);
  font-size: 1.7em;
  font-weight: 300;
  line-height: 1.15;
  letter-spacing: 0.01em;
  text-align: center;
}

.credits__year {
  color: var(--muted);
  font-size: 0.7em;
}

.credits__line {
  display: contents;
}

.credits__label {
  align-self: baseline;
  color: var(--muted);
  font-size: 0.9em;
  letter-spacing: 0.16em;
  text-align: right;
  text-transform: uppercase;
}

.credits__value {
  align-self: baseline;
  text-align: left;
}

.viewer {
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 3.75rem 1rem 1.5rem;
  border: 0;
  background: rgba(11, 11, 12, 0.97);
  color: var(--paper);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.viewer[open] {
  display: grid;
  place-items: center;
}

.viewer::backdrop {
  background: var(--ink);
}

.viewer__close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.viewer__close svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1;
}

.viewer__card {
  position: relative;
  width: min(100%, 36rem);
  height: min(100%, 40rem);
}

.viewer__front {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}

.viewer__front img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.viewer__back {
  overflow: hidden;
}

.viewer__credits {
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 1.5rem;
}

.viewer__back .credits {
  margin: auto;
  row-gap: 0.55em;
  font-size: 0.875rem;
}

@media (prefers-reduced-motion: no-preference) {
  .card__front,
  .card__back,
  .viewer__front,
  .viewer__back {
    transition: transform 0.7s cubic-bezier(0.3, 0, 0.2, 1);
  }
}

/* Festivals and awards run on as one left-aligned paragraph, a small dot
   between entries. */
.credits__festivals {
  grid-column: 1 / -1;
  justify-self: center;
  display: block;
  margin-top: 0.9em;
  line-height: 1.5;
  text-align: left;
}

.credits__heading {
  display: block;
  text-align: center;
  margin-bottom: 0.3em;
  color: var(--muted);
  font-size: 0.9em;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.credits__festival + .credits__festival::before {
  content: "\00b7";
  margin: 0 0.5em;
  font-weight: 700;
  opacity: 0.7;
}

/* The image itself, dimmed, behind its credits. */
.card__ghost {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.18;
}

.card__back .credits {
  position: relative;
}

.credits {
  text-shadow: 0 0 0.6em rgba(11, 11, 12, 0.9);
}

/* Several people in one role: one name to a line. */
.credits__name {
  display: block;
}
