/* ========================================
   PROJECT PAGES (generated from content/projects/*.md)
   Each page sets --pp-primary, --pp-primary-text, --pp-secondary and
   --pp-secondary-text; everything else is shared.

   Breakpoints (same everywhere):
     phone    < 768px   stacked, sections collapse into accordions
     tablet   768–1023  stacked hero, open sections
     desktop  ≥ 1024    hero image beside the text
   ======================================== */

.pp-page {
  --pp-content-width: min(100%, 864px);
  --pp-header-height: 64px;
  background-color: var(--pp-primary);
}

.pp-page .site-wrapper {
  background-color: var(--pp-primary);
}

/* Colour bands */
.pp-primary {
  background-color: var(--pp-primary);
  color: var(--pp-primary-text);
}

.pp-secondary {
  background-color: var(--pp-secondary);
  color: var(--pp-secondary-text);
}

.pp-primary a,
.pp-secondary a {
  color: inherit;
  text-decoration: underline;
  font-style: italic;
}

/* ========================================
   HEADER
   ======================================== */

.pp-header {
  background-color: var(--pp-primary);
}

.pp-header a,
.pp-header .header-nav a {
  color: var(--pp-primary-text);
}

/* ========================================
   HERO
   ======================================== */

.pp-hero {
  padding: calc(var(--pp-header-height) + var(--spacing-2xl)) var(--spacing-lg) var(--spacing-3xl);
}

.pp-hero-inner {
  display: grid;
  gap: var(--spacing-xl);
  max-width: 640px;
  margin: 0 auto;
}

.pp-hero-media {
  aspect-ratio: 1;
  overflow: hidden;
}

.pp-hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pp-title {
  font-size: var(--font-size-xlarge);
  margin-bottom: var(--spacing-sm);
}

.pp-subtitle,
.pp-venue {
  margin-bottom: var(--spacing-xs);
}

.pp-tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
  margin: var(--spacing-md) 0;
  padding: 0;
}

.pp-tags .tag {
  padding: 2px 10px;
  font-size: var(--font-size-small);
  border: 1px solid currentColor;
  border-radius: 16px;
}

.pp-intro {
  line-height: 1.7;
  margin-bottom: var(--spacing-md);
}

.pp-links {
  margin-top: var(--spacing-lg);
}

/* ========================================
   SECTIONS
   ======================================== */

.pp-section {
  padding: var(--spacing-3xl) var(--spacing-lg);
}

.pp-section-title,
.pp-text,
.pp-embed {
  width: var(--pp-content-width);
  margin-left: auto;
  margin-right: auto;
}

.pp-section-title {
  font-size: var(--font-size-xlarge);
  margin-bottom: var(--spacing-md);
}

/* The title is a button so it can open/close on phones; on larger screens it's disabled and reads as a plain heading */
.pp-toggle {
  all: unset;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  font: inherit;
  color: inherit;
}

.pp-toggle:disabled {
  cursor: text;
}

.pp-section-body > * + * {
  margin-top: var(--spacing-xl);
}

.pp-text p,
.pp-text li {
  line-height: 1.7;
}

.pp-text p + p,
.pp-text p + ul,
.pp-text ul + p {
  margin-top: var(--spacing-md);
}

.pp-text ul {
  padding-left: 1.2em;
}

/* Section whose title only shows on phones (where it labels the accordion) */
.pp-title-mobile-only .pp-section-title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Credits: small two-column list */
.pp-credits .pp-section-title {
  font-size: var(--font-size-small);
  margin-bottom: var(--spacing-sm);
}

.pp-credits .pp-text ul {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-sm) var(--spacing-2xl);
  font-size: var(--font-size-xsmall);
}

.pp-section.pp-credits {
  padding-top: var(--spacing-xl);
  padding-bottom: var(--spacing-xl);
}

/* ========================================
   MEDIA BLOCKS
   ======================================== */

/* Gallery: full-bleed strip of images at their natural proportions */
.pp-gallery {
  margin-left: calc(-1 * var(--spacing-lg));
  margin-right: calc(-1 * var(--spacing-lg));
  padding-bottom: var(--spacing-xl);
}

.pp-gallery .swiper-slide {
  width: auto;
}

.pp-gallery .swiper-slide img {
  display: block;
  height: 400px;
  width: auto;
}

.pp-gallery .swiper-button-prev,
.pp-gallery .swiper-button-next {
  color: #000;
  background: rgba(255, 255, 255, 0.7);
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.pp-gallery .swiper-button-prev::after,
.pp-gallery .swiper-button-next::after {
  font-size: 16px;
  font-weight: bold;
}

.pp-gallery .swiper-pagination {
  bottom: 0;
}

.pp-gallery .swiper-pagination-bullet {
  background: currentColor;
}

.pp-figure img {
  display: block;
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  height: auto;
  margin: 0 auto;
}

.pp-zoom figcaption {
  margin-top: var(--spacing-sm);
  font-size: 0.85em;
  text-align: center;
  opacity: 0.8;
}

@media (min-width: 768px) {
  .pp-zoom figcaption { display: none; }
}

/* [image full …]: fill the section width, no height cap (tall infographics) */
.pp-full img {
  width: 100%;
  max-height: none;
}

.pp-embed {
  aspect-ratio: 16 / 9;
}

.pp-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.pp-video video {
  display: block;
  width: 100%;
  max-height: 80vh;
  object-fit: contain;
}

/* ========================================
   FOOTER
   ======================================== */

.pp-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--spacing-lg);
  padding: var(--spacing-lg);
}

.pp-footer .acknowledgment {
  margin: 0;
  text-align: center;
  color: inherit;
}

.pp-footer .footer-link {
  justify-self: end;
  color: inherit;
}

/* ========================================
   TABLET + DESKTOP
   ======================================== */

@media (min-width: 768px) {
  .pp-section {
    padding-left: var(--spacing-2xl);
    padding-right: var(--spacing-2xl);
  }

  .pp-gallery {
    margin-left: calc(-1 * var(--spacing-2xl));
    margin-right: calc(-1 * var(--spacing-2xl));
  }

  .pp-embed {
    width: min(100%, 720px);
  }
}

@media (min-width: 768px) and (max-width: 1023.98px) {
  .pp-gallery .swiper-slide img {
    height: 320px;
  }
}

@media (min-width: 1024px) {
  /* Hero stays shorter than the screen so the next section peeks in, hinting the page continues */
  /* Same square position as the home and category pages (.main-content + .category-layout in styles.css),
     so the image doesn't jump when you click into a project */
  .pp-hero {
    padding-top: calc(80px + 10vh);
    padding-bottom: 6vh;
  }

  .pp-hero-inner {
    grid-template-columns: var(--carousel-size) minmax(0, 400px);
    gap: var(--spacing-2xl);
    max-width: var(--max-width);
    padding: 0 var(--spacing-lg);
    justify-content: start;
    align-items: start;
  }
}

/* ========================================
   PHONE
   ======================================== */

@media (max-width: 767.98px) {
  .pp-page {
    --pp-header-height: 76px;
  }

  /* Header stacks: name on top, sections below; Contact lives in the footer */
  .pp-header .header-inner {
    flex-direction: column;
    gap: var(--spacing-sm);
  }

  .pp-header .header-nav {
    position: static;
    transform: none;
    gap: var(--spacing-lg);
  }

  .pp-header .header-contact {
    display: none;
  }

  .pp-hero {
    padding: calc(var(--pp-header-height) + var(--spacing-md)) var(--spacing-md) var(--spacing-lg);
  }

  /* Sections become accordions */
  .pp-section,
  .pp-section.pp-credits {
    padding: 0 var(--spacing-md);
  }

  .pp-section-title,
  .pp-credits .pp-section-title {
    font-size: var(--font-size-large);
    margin: 0;
  }

  .pp-title-mobile-only .pp-section-title {
    position: static;
    width: auto;
    height: auto;
    clip: auto;
    white-space: normal;
  }

  .pp-toggle {
    padding: var(--spacing-lg) 0;
    cursor: pointer;
  }

  .pp-toggle::after {
    content: '+';
    font-size: 24px;
    transition: transform var(--transition-speed) var(--transition-ease);
  }

  .pp-toggle[aria-expanded="true"]::after {
    transform: rotate(45deg);
  }

  .pp-toggle:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
  }

  .pp-section-body {
    padding-bottom: var(--spacing-lg);
  }

  .pp-section-body[hidden] {
    display: none;
  }

  /* One image at a time, cropped to a fixed height */
  .pp-gallery {
    margin-left: 0;
    margin-right: 0;
  }

  .pp-gallery .swiper-slide {
    width: 100%;
  }

  .pp-gallery .swiper-slide img {
    width: 100%;
    height: 250px;
    object-fit: cover;
  }

  .pp-gallery .swiper-button-prev,
  .pp-gallery .swiper-button-next {
    display: none;
  }

  .pp-credits .pp-text ul {
    grid-template-columns: 1fr;
    font-size: var(--font-size-small);
  }

  .pp-footer {
    grid-template-columns: 1fr;
    text-align: center;
    gap: var(--spacing-sm);
  }

  .pp-footer .footer-link {
    justify-self: center;
  }
}

/* ========================================
   MORE BLOCKS: grid, videos, audio, buttons
   ======================================== */

.pp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(200px, 40vw), 1fr));
  gap: var(--spacing-sm);
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
}

/* Grid images are cropped square so rows line up */
.pp-grid img,
.pp-grid video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
}

.pp-lightbox-link {
  display: block;
  cursor: zoom-in;
}

/* Lightbox (project.js) */
.pp-lightbox {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.92);
  color: #fff;
}

.pp-lightbox::backdrop {
  background: transparent;
}

.pp-lightbox[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.pp-lightbox-img {
  max-width: calc(100vw - 2 * 72px);
  max-height: calc(100dvh - 2 * 56px);
  object-fit: contain;
}

.pp-lightbox-count {
  position: absolute;
  bottom: var(--spacing-md);
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.85em;
  opacity: 0.8;
}

.pp-lightbox-btn {
  position: absolute;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font: inherit;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.pp-lightbox-btn:hover,
.pp-lightbox-btn:focus-visible {
  background: rgba(255, 255, 255, 0.25);
}

.pp-lightbox-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.pp-lightbox-close { top: var(--spacing-md); right: var(--spacing-md); }
.pp-lightbox-prev { left: var(--spacing-md); top: 50%; transform: translateY(-50%); }
.pp-lightbox-next { right: var(--spacing-md); top: 50%; transform: translateY(-50%); }

@media (max-width: 767.98px) {
  /* Phones: image uses the full width; arrows sit at the bottom beside the counter, swipe also works */
  .pp-lightbox-img {
    max-width: 100vw;
    max-height: calc(100dvh - 2 * 72px);
  }

  .pp-lightbox-prev,
  .pp-lightbox-next {
    top: auto;
    bottom: var(--spacing-sm);
    transform: none;
  }
}

/* Videos stack at reading width */
.pp-videos {
  display: grid;
  gap: var(--spacing-lg);
  width: min(100%, 800px);
  margin-left: auto;
  margin-right: auto;
}

.pp-videos video,
.pp-videos img {
  display: block;
  width: 100%;
  height: auto;
}

.pp-audio {
  width: var(--pp-content-width);
  margin-left: auto;
  margin-right: auto;
}

.pp-audio figcaption {
  margin-bottom: var(--spacing-sm);
}

.pp-audio audio {
  width: 100%;
}

.pp-buttons {
  width: var(--pp-content-width);
  margin-left: auto;
  margin-right: auto;
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.pp-primary a.pp-button,
.pp-secondary a.pp-button {
  display: inline-block;
  padding: var(--spacing-xs) var(--spacing-md);
  border: 1px solid currentColor;
  text-decoration: none;
  font-style: normal;
}

.pp-primary a.pp-button:hover {
  background: var(--pp-primary-text);
  color: var(--pp-primary);
}

.pp-secondary a.pp-button:hover {
  background: var(--pp-secondary-text);
  color: var(--pp-secondary);
}

.pp-hero-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Hero images that fade into each other */
.pp-hero-fade {
  position: relative;
  width: 100%;
  height: 100%;
}

.pp-hero-fade img {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1s ease-in-out;
}

.pp-hero-fade img.is-active {
  opacity: 1;
}

/* Sections that stay open on phones: plain heading, no + sign */
@media (max-width: 767.98px) {
  .pp-always-open .pp-toggle {
    cursor: default;
  }

  .pp-always-open .pp-toggle::after {
    content: none;
  }
}

/* {.split}: first block (usually an image) beside the rest of the section on desktop */
@media (min-width: 1024px) {
  .pp-split .pp-section-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    column-gap: var(--spacing-2xl);
    align-items: start;
    width: min(100%, var(--max-width));
    margin: 0 auto;
  }

  .pp-split .pp-section-body > :first-child {
    grid-column: 1;
    grid-row: 1 / span 20;
  }

  .pp-split .pp-section-body > :not(:first-child) {
    grid-column: 2;
    width: auto;
    margin: 0;
  }

  .pp-split .pp-section-body > :not(:first-child) + * {
    margin-top: var(--spacing-md);
  }

  .pp-split .pp-section-title {
    width: min(100%, var(--max-width));
  }
}

/* Interactive sections that stay open: their phone-only title isn't needed either */
@media (max-width: 767.98px) {
  .pp-always-open.pp-title-mobile-only .pp-section-title {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}
