.portfolio {
  position: relative;
  z-index: 1;
  background: var(--paper);
  padding: 132px var(--gutter) 56px;
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 44px;
  margin-bottom: 32px;
}
.section-heading h2 {
  font-size: clamp(48px, 6vw, 80px);
  line-height: 1;
}
.section-heading h2 span {
  color: var(--clay);
}
.portfolio-intro {
  max-width: 380px;
  padding-bottom: 4px;
}
.portfolio-intro p {
  font-size: 15px;
}
.work-filters {
  display: flex;
  gap: 24px;
  margin-top: 30px;
  border-bottom: var(--rule);
}
.work-filters button {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  font-size: 13px;
  padding: 12px 0;
  white-space: nowrap;
}
.work-filters button[aria-pressed="true"] {
  border-bottom-color: var(--clay);
  color: var(--clay);
  font-weight: 600;
}
.project-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: start;
  gap: 80px 6vw;
}
.project-wide {
  grid-column: span 8;
}
.project-portrait {
  grid-column: span 4;
}
.project-portrait:first-of-type {
  margin-top: 60px;
}
.project-offset {
  margin-top: -80px;
}
.project-wide.project-offset {
  margin-top: 100px;
}
.portfolio[data-active-filter="film"] .project-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 900px;
  margin-inline: auto;
}
.portfolio[data-active-filter="film"] .project {
  grid-column: span 1;
  margin-top: 0;
}
.portfolio[data-active-filter="web"] .project-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.portfolio[data-active-filter="web"] .project {
  grid-column: span 1;
  margin-top: 0;
}
.project-media {
  position: relative;
  aspect-ratio: var(--media-ratio);
  background: var(--bone);
  overflow: hidden;
}
.project-open {
  display: block;
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.project-media img,
.project-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}
.project-media video {
  opacity: 0;
}
.project-media.is-playing video {
  opacity: 1;
}
.project-open::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid #22201f14;
  pointer-events: none;
}
.open-indicator {
  position: absolute;
  bottom: 18px;
  inset-inline-end: 18px;
  padding: 10px 16px;
  background: var(--paper);
  color: var(--ink);
  font-size: 12px;
  transition: transform 0.2s var(--ease);
}
.preview-toggle {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
  min-height: 44px;
  padding: 8px 12px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid #c9c3bb;
  font-size: 11px !important;
  z-index: 2;
}
.project-caption {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-top: 20px;
}
.project-caption p {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 7px;
}
.project-caption h3 {
  font-size: clamp(28px, 3.1vw, 46px);
  line-height: 1.08;
}
.project-caption h3[dir="ltr"] {
  text-align: right;
  letter-spacing: -0.04em;
  font-family: var(--sans);
  font-weight: 600;
}
.case-link {
  font-size: 12px;
  white-space: nowrap;
  display: flex;
  gap: 20px;
  text-decoration: none;
  min-height: 44px;
  align-items: center;
  border-bottom: 1px solid #998c85;
}
.project-format {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding-bottom: 5px;
}
.portfolio-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-top: 80px;
  padding-top: 26px;
  border-top: var(--rule);
  font-size: 13px;
}
.portfolio-foot a {
  font-weight: 600;
  text-decoration: none;
}
@media (hover: hover) {
  .project-open:hover .open-indicator {
    transform: translate(-4px, -4px);
  }
  .case-link:hover {
    color: var(--clay);
  }
}
.film-dialog {
  border: 0;
  padding: 22px;
  background: #241c1e;
  color: var(--paper);
  width: min(90vw, 900px);
  max-width: 960px;
  max-height: 94svh;
  margin: auto;
}
.film-dialog::backdrop {
  background: #110e11e8;
}
.film-dialog-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}
.film-dialog-bar h2 {
  font-size: 24px;
}
.film-dialog-bar button {
  background: none;
  border: 1px solid #a99594;
  padding: 8px 18px;
  min-height: 44px;
}
.film-dialog video {
  display: block;
  margin: auto;
  width: auto;
  max-width: 100%;
  height: min(68svh, 720px);
  background: #171314;
}
.film-dialog p,
.film-dialog > a {
  font-size: 12px;
  margin-top: 10px;
}
body.film-open {
  overflow: hidden;
}
@media (max-width: 900px) {
  .project-grid {
    gap: 54px 5vw;
  }
  .project-offset {
    margin-top: 0;
  }
  .project-wide.project-offset {
    margin-top: 60px;
  }
  .project-caption {
    align-items: start;
    flex-wrap: wrap;
    gap: 8px;
  }
}
@media (max-width: 720px) {
  .portfolio[data-active-filter="web"] .project-grid {
    grid-template-columns: 1fr;
  }
  .portfolio {
    padding-top: 112px;
    padding-bottom: 42px;
  }
  .section-heading {
    align-items: start;
    flex-direction: column;
    gap: 18px;
    margin-bottom: 28px;
  }
  .section-heading h2 {
    font-size: 48px;
  }
  .portfolio-intro {
    max-width: none;
    width: 100%;
  }
  .portfolio-intro p {
    font-size: 16px;
  }
  .work-filters {
    margin-top: 16px;
    gap: 24px;
  }
  .project-grid {
    grid-template-columns: 1fr 1fr;
    gap: 38px 16px;
  }
  .project-wide {
    grid-column: span 2;
  }
  .project-portrait {
    grid-column: span 1;
    min-width: 0;
  }
  .project-wide.project-offset {
    margin-top: 0;
  }
  .project-caption {
    margin-top: 12px;
  }
  .project-caption p {
    font-size: 10px;
    line-height: 1.6;
  }
  .project-caption h3 {
    font-size: 23px;
    letter-spacing: -0.025em;
  }
  .project-wide .project-caption {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .project-wide h3 {
    font-size: 32px;
  }
  .project-format {
    display: none;
  }
  .case-link {
    font-size: 11px;
    gap: 10px;
  }
  .open-indicator {
    font-size: 10px;
    bottom: 10px;
    inset-inline-end: 10px;
    padding: 7px 10px;
  }
  .preview-toggle {
    font-size: 9px !important;
    padding: 5px 7px;
    top: 6px;
    inset-inline-end: 6px;
  }
  .portfolio-foot {
    margin-top: 40px;
    gap: 12px;
    font-size: 12px;
  }
  .film-dialog {
    padding: 16px;
    width: 94vw;
  }
}

/* Own AI films: a calm grid of portrait cards under the main portfolio. */
.film-strip {
  margin-top: 128px;
}
.film-strip-title {
  font: 900 clamp(30px, 3.2vw, 48px) / 1.05 var(--serif);
  margin-bottom: 32px;
}
.film-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 64px 4vw;
}
.film-grid .project-caption h3 {
  font-size: clamp(22px, 2vw, 32px);
}
.portfolio[data-active-filter="web"] .film-strip {
  display: none;
}
@media (max-width: 720px) {
  .film-strip {
    margin-top: 80px;
  }
  .film-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 36px 14px;
  }
  .film-grid .project-caption {
    margin-top: 12px;
  }
  .film-grid .project-caption h3 {
    font-size: 18px;
  }
  .film-grid .open-indicator {
    display: none;
  }
}

/* Home: one quiet link to the full film collection instead of six more players. */
.more-films {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 24px;
  margin-top: 96px;
  padding: 28px 0;
  border-top: var(--rule);
  text-decoration: none;
  font: 900 clamp(26px, 2.6vw, 40px) / 1.1 var(--serif);
}
.more-films-note {
  font: 400 14px/1.5 var(--sans);
  color: var(--muted);
}
.more-films:hover span:first-child {
  color: var(--clay);
}
.films-page {
  padding-top: calc(var(--header-h) + 80px);
}
.films-page .section-heading h1 {
  font-size: clamp(48px, 6vw, 80px);
  line-height: 1;
}
@media (max-width: 720px) {
  .more-films {
    grid-template-columns: 1fr auto;
    margin-top: 64px;
  }
  .more-films-note {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .films-page {
    padding-top: calc(var(--header-h) + 44px);
  }
}

/* --- Design review 24.10: chrome must not sit on the works --------------------------- */
/* Icon-only preview control in the lower corner; 44px touch area via ::before. */
.preview-toggle,
.project-media .preview-toggle {
  top: auto;
  bottom: 12px;
  inset-inline-end: auto;
  inset-inline-start: 12px;
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border: 0;
  background: rgba(34, 32, 31, 0.55);
  color: #f3f1eb;
  display: grid;
  place-items: center;
  font-size: 0 !important;
}
.preview-toggle::before {
  content: "";
  position: absolute;
  inset: -4px;
}
.preview-toggle::after {
  content: "";
  box-sizing: border-box;
  width: 11px;
  height: 13px;
  border-inline: 3.5px solid currentColor;
}
.preview-toggle[data-state="paused"]::after {
  width: 0;
  height: 0;
  border: 0;
  border-block: 7px solid transparent;
  border-left: 11px solid currentColor;
  margin-left: 3px;
}
.preview-toggle[data-state="failed"] {
  display: none;
}
/* Asymmetry comes from the media ratios, not from arbitrary offsets that read as holes. */
.project-grid {
  align-items: end;
  row-gap: 120px;
}
.project-portrait:first-of-type,
.project-offset,
.project-wide.project-offset {
  margin-top: 0;
}
.project-caption h3[dir="ltr"] {
  font-family: var(--serif);
  font-weight: 900;
  letter-spacing: -0.02em;
}
/* /films: a portrait crop that fits with its caption on one screen; full 9:16 in the viewer. */
.film-grid .project-media {
  aspect-ratio: 4 / 5;
}
/* Home: three small posters make the link to /films a preview, not a bare line. */
.more-films {
  grid-template-columns: auto auto 1fr auto;
}
.more-films-thumbs {
  display: flex;
  gap: 8px;
}
.more-films-thumbs img {
  width: 68px;
  height: 120px;
  object-fit: cover;
}
@media (max-width: 720px) {
  .project-grid {
    row-gap: 64px;
  }
  .preview-toggle,
  .project-media .preview-toggle {
    bottom: 8px;
    inset-inline-start: 8px;
  }
  .more-films {
    grid-template-columns: 1fr auto;
  }
  .more-films-thumbs {
    grid-column: 1 / -1;
    grid-row: 3;
  }
  .more-films-thumbs img {
    width: 56px;
    height: 100px;
  }
}
@media (min-width: 721px) {
  .more-films {
    grid-template-columns: repeat(4, auto);
    justify-content: start;
    gap: 32px;
  }
}

/* Float frame (25.10): a real gallery frame, not a hairline. 12px of ink around the
   work with a 3px paper reveal inside it, the way a canvas floats in a shadow-gap frame.
   Flat, no bevel, no gold, no glow; the palette's own ink and paper. */
.project-media {
  border: 12px solid var(--ink);
  outline: 3px solid var(--paper);
  outline-offset: -15px;
}
@media (max-width: 720px) {
  .project-media {
    border-width: 8px;
    outline-width: 2px;
    outline-offset: -10px;
  }
}

/* /films: a 4:3 series gets its own row, two wide cards, instead of a 4:5 crop. */
.film-series {
  margin-top: 120px;
}
.film-series-head h2 {
  font-size: clamp(34px, 4vw, 56px);
}
.film-grid-wide {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.film-grid-wide .project-media {
  aspect-ratio: 4 / 3;
}
@media (max-width: 720px) {
  .film-series {
    margin-top: 72px;
  }
  .film-series-head {
    display: block;
  }
  .film-series-head .portfolio-intro {
    margin-top: 12px;
  }
  .film-grid-wide {
    grid-template-columns: 1fr;
  }
}
