/* Project page (projects/*.html) — story and results panels plus an image gallery
   inside the big centred card. Sizes are design pixels × var(--u).
   Panels, tags, bullets and buttons are shared, see css/page.css. */

.project-page {
  --panel-fade-stop: 55.71%;

  justify-content: flex-start;
  align-items: stretch;
  gap: calc(108 * var(--u));
}

.project-page__back {
  font-size: calc(44 * var(--u));
  line-height: normal;
  color: var(--color-text);
  transition: color 0.3s ease;
}

.project-page__back:hover {
  color: rgba(255, 255, 255, 0.95);
}

.project-page__row {
  display: flex;
  flex: 1;
  gap: calc(12 * var(--u));
  min-height: 0;
}

.panel--story .panel__scroll {
  gap: calc(16 * var(--u));
}

.panel--story .panel__text p {
  margin-bottom: calc(12 * var(--u));
}

.panel--story .panel__text p:last-child {
  margin-bottom: 0;
}

/* ---------- Cover video (for now, in place of the gallery) ----------
   The same video as on the project's card; fitted by .media-cover (css/page.css). */

.project-page__media {
  position: relative;
  flex: 1;
  min-width: 0;
  background: var(--color-page);
  border-radius: calc(5 * var(--u));
}

/* Live 3D devices (.device-scene in css/page.css) on black, as on the project's card.
   They can be dragged to turn: on touch screens sideways swipes turn them, vertical ones scroll. */
.project-page__media--device {
  overflow: hidden;
  background: #000;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

/* Credits for the 3D models, small in the box's bottom-left corner */
.device-credit {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.35);
}

.device-credit a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Branding cases: the logo in the middle of the box, scaled with the card */
.project-page__media--logo {
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-page__logo {
  width: calc(var(--logo-width) * var(--u));
  height: auto;
  overflow: visible;
}

/* ---------- Gallery (not used yet) ---------- */

.gallery {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  background: var(--color-page);
  border-radius: calc(5 * var(--u));
}

.gallery__track {
  display: flex;
  height: 100%;
  transition: transform 0.9s var(--ease-out);
}

.gallery__slide {
  flex: 0 0 100%;
  height: 100%;
  margin: 0;
}

.gallery__slide img,
.gallery__slide video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Template only: stands in for an image */
.gallery__slide--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(16 * var(--u));
  font-weight: 300;
  color: var(--color-text-muted);
  background:
    repeating-conic-gradient(rgba(255, 255, 255, 0.03) 0 25%, transparent 0 50%)
    0 0 / calc(40 * var(--u)) calc(40 * var(--u));
}

.gallery__controls {
  position: absolute;
  right: 0;
  bottom: 0;
  display: flex;
  gap: calc(8 * var(--u));
  padding: calc(20 * var(--u));
}

/* One image: nothing to switch */
.gallery--single .gallery__controls {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .gallery__track {
    transition: none;
  }
}

/* ---------- Phones and tablets ----------
   The video leads (16:9, full width), the story and results follow. */

@media (max-width: 1099px) {
  .project-page {
    gap: 40px;
  }

  .project-page__back {
    font-size: var(--back-size);
  }

  .project-page__row {
    flex: none;
    flex-direction: column;
  }

  .project-page__media,
  .gallery {
    flex: none;
    order: -1;
    aspect-ratio: 16 / 9;
    /* Phones on their side: keep the story in sight */
    max-height: 70svh;
  }

  .project-page__logo {
    max-width: 64%;
  }
}
