/* Project pages (site/projets/<slug>/, generated by scripts/pages.js).
   Every value comes from tokens.css. */

.icon {
  width: 1.1em;
  height: 1.1em;
  flex: none;
}

/* --- Header: name on the left, back to the projects on the right ----------- */

.project-page .site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
}

.site-header__back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--step--1);
  font-weight: 600;
  text-decoration: none;
}

.site-header__back:hover span {
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

/* --- Cover: full screen, title over its lower edge --------------------------- */

.project__cover {
  position: relative;
  display: flex;
  align-items: flex-end;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

.project__cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}

/* Readability: the bottom of the cover fades into the page background */
.project__cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 35%, color-mix(in srgb, var(--color-bg) 70%, transparent) 70%, var(--color-bg));
  pointer-events: none;
}

/* Title sizing as in the work slider: the design size, capped so the longest
   line fits (0.6em ≈ average glyph width of Inter Tight 800). */
.project__heading,
.project-next__link {
  --line-chars: var(--chars-split);
  --title-size: min(clamp(3rem, 1rem + 8vw, 9rem), calc((100vw - 2 * var(--gutter)) / (var(--line-chars) * 0.6)));
}

@media (min-width: 768px) {
  .project__heading,
  .project-next__link {
    --line-chars: var(--chars);
  }
}

.project__heading {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 0 var(--gutter) var(--space-7);
}

.project__title,
.project-next__title {
  font-size: var(--title-size);
  font-weight: 800;
  line-height: 0.9;
  white-space: nowrap;
}

/* Phones: the serif word on its own line */
.project__title .serif,
.project-next__title .serif {
  display: block;
}

@media (min-width: 768px) {
  .project__title .serif,
  .project-next__title .serif {
    display: inline;
  }
}

.project__meta {
  margin-top: var(--space-4);
  color: var(--color-text-muted);
}

/* --- Introduction: facts and summary ---------------------------------------------- */

.project__intro,
.project__blocks,
.project-next {
  width: 100%;
  max-width: 75rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.project__intro {
  display: grid;
  gap: var(--space-6);
  padding-block: var(--space-8) var(--space-9);
}

@media (min-width: 768px) {
  .project__intro {
    grid-template-columns: 1fr 2fr;
    gap: var(--space-8);
  }
}

.project__facts {
  display: grid;
  gap: var(--space-4);
  margin: 0;
}

.project__facts dt {
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-muted);
}

.project__facts dd {
  margin: 0;
  font-weight: 600;
}

.project__summary {
  display: grid;
  gap: var(--space-4);
  font-size: var(--step-2);
  line-height: var(--leading-snug);
}

.project__note {
  font-size: var(--step-0);
  line-height: var(--leading-body);
  color: var(--color-text-muted);
}

/* --- Blocks ------------------------------------------------------------------ */

.project__blocks {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-9) var(--space-5);
}

.block {
  flex: 1 1 100%;
  min-width: 0;
}

.block figcaption,
.block--video figcaption {
  margin-top: var(--space-3);
  font-size: var(--step--1);
  color: var(--color-text-muted);
}

.block--text > * {
  max-width: 65ch;
}

.block__heading {
  margin-bottom: var(--space-4);
  font-size: var(--step-4);
}

.block--text p {
  font-size: var(--step-1);
}

.block__frame {
  overflow: hidden;
  border-radius: var(--radius-l);
  background: var(--color-surface);
}

.block__frame img {
  width: 100%;
  height: auto;
}

/* Parallax (project.js, motion allowed): the image is a little larger than its
   frame so it can drift ±8 % without showing an edge. */
.is-parallax .block__frame img {
  scale: 1.2;
}

/* Galleries */
.gallery {
  margin: 0;
  padding: 0;
  list-style: none;
}

.gallery img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-m);
  background: var(--color-surface);
}

.gallery--grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

@media (min-width: 768px) {
  .gallery--grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-5);
  }
}

.gallery--row {
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  padding-bottom: var(--space-3);
}

.gallery--row li {
  flex: 0 0 min(85%, 45rem);
  scroll-snap-align: start;
}

/* Videos: portrait ones sit side by side (three on wide screens) */
.block--video:has(.video--portrait) {
  flex: 1 1 15rem;
  max-width: 22.5rem;
}

.video {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius-l);
  background: var(--color-surface);
}

.video--portrait { aspect-ratio: 9 / 16; }
.video--landscape { aspect-ratio: 16 / 9; }

.video--file {
  width: 100%;
  height: auto;
}

.video--file.video--portrait {
  object-fit: cover;
}

.video__poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}

.video__poster--empty {
  display: grid;
  place-items: center;
  font-size: var(--step-2);
  font-weight: 700;
  color: var(--color-line);
  background: linear-gradient(160deg, var(--color-indigo), var(--color-surface));
}

.video__play {
  position: relative;
  display: grid;
  place-items: center;
  width: 4.5rem;
  height: 4.5rem;
  border: 0;
  border-radius: 50%;
  background: var(--color-text);
  color: var(--color-bg);
  cursor: pointer;
  transition: transform 0.3s ease;
}

/* Without JS the button stays hidden (display: grid above would override [hidden]) */
.video__play[hidden] {
  display: none;
}

.video__play .icon {
  width: 1.75rem;
  height: 1.75rem;
  margin-left: 0.2rem; /* optical centre of the triangle */
}

.video__play:hover {
  transform: scale(1.08);
}

.video__fallback {
  position: absolute;
  left: var(--space-4);
  bottom: var(--space-4);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--color-bg);
  font-size: var(--step--1);
  font-weight: 600;
  text-decoration: none;
}

/* With JS, a facade's play button replaces the plain link */
.is-facade .video__fallback {
  display: none;
}

.video__soon {
  position: relative;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--color-bg);
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--color-text-muted);
}

.video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Links */
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a.pill:hover {
  background: var(--color-text);
  color: var(--color-bg);
}

.pill--soon {
  color: var(--color-text-muted);
}

/* --- Next project -------------------------------------------------------------- */

.project-next {
  padding-block: var(--space-9);
}

.project-next__link {
  display: grid;
  gap: var(--space-4);
  text-decoration: none;
}

.project-next__label {
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-muted);
}

.project-next__media {
  display: block;
  overflow: hidden;
  border-radius: var(--radius-l);
  aspect-ratio: 4 / 3;
  background: var(--color-surface);
}

@media (min-width: 768px) {
  .project-next__media {
    aspect-ratio: 21 / 9;
  }
}

.project-next__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-next__link:hover .project-next__media img {
  transform: scale(1.04);
}

/* Projects without JavaScript or with reduced motion: no hover zoom */
@media (prefers-reduced-motion: reduce) {
  .project-next__media img,
  .video__play,
  .pill {
    transition: none;
  }
}
