/* Project pages (/projects/<slug>), generated by scripts/build-projects.js. Builds on css/trade.css; pd- prefix.
   Cover photo edge to edge with the job name over it, the summary beside the job facts, every photo at mixed
   sizes (each opens the full-screen viewer from js/projects.js), then the next job as a photo band. */


/* Hero */
.pd-hero-media { display: block; width: 100%; padding: 0; border: 0; background: var(--charcoal); cursor: zoom-in; position: relative; overflow: hidden; }
.pd-hero-media img { display: block; width: 100%; height: min(74vh, 720px); object-fit: cover; transition: scale 1.4s ease; }
.pd-hero-media:hover img { scale: 1.03; }
.pd-hero-media::after { content: ""; position: absolute; inset: 45% 0 0; background: linear-gradient(180deg, transparent, var(--ink)); pointer-events: none; }
.pd-hero-body { position: relative; margin-top: -150px; padding-bottom: 8px; pointer-events: none; }
.pd-hero-body h1 { margin: 0; color: #fff; font-size: clamp(3.2rem, 10vw, 9rem); line-height: .86; }

/* Summary + facts */
.pd-about { padding-top: clamp(28px, 4vw, 48px); }
.pd-about-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
.pd-wall { margin: 0 0 14px; font: 700 1.1rem/1.3 var(--font-head); letter-spacing: .12em; text-transform: uppercase; color: var(--orange); }
.pd-summary { margin: 0 0 28px; font-size: clamp(1.25rem, 2.1vw, 1.7rem); line-height: 1.45; color: #fff; max-width: 34em; }
.pd-quote { margin: 0 0 28px; padding-left: 20px; border-left: 4px solid var(--orange); color: #fff; font-size: 1.15rem; }
.pd-quote p { margin: 0 0 8px; }
.pd-quote footer { font-size: .92rem; color: #a9a59c; }
.pd-quote footer strong { margin-right: 8px; color: #fff; }
.pd-facts { margin: 0; border-top: 3px solid var(--orange); }
.pd-facts > div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 4px 20px; padding: 14px 0; border-bottom: 1px solid rgba(255,255,255,.14); }
.pd-facts dt { font: 700 .8rem/1.5 var(--font-head); letter-spacing: .18em; text-transform: uppercase; color: #8d897f; }
.pd-facts dd { margin: 0; font: 700 1.15rem/1.25 var(--font-head); letter-spacing: .03em; text-transform: uppercase; color: #fff; }

.pd-story .project-h2 { margin: 1.4em 0 .4em; }
.pd-story .project-h2:first-child { margin-top: 0; }

/* Gallery: six columns, photos at mixed spans in a repeating run of five */
.pd-gallery { padding-block: clamp(40px, 6vw, 80px) 6px; border-top: 1px solid rgba(255,255,255,.1); }
.pd-gallery-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 32px; flex-wrap: wrap; margin-bottom: 28px; }
.pd-gallery-head h2 { margin: 0; color: #fff; }
.pd-gallery-head h2 span { color: transparent; -webkit-text-stroke: 1.5px var(--orange); margin-left: 10px; }
.pd-gallery-head p { margin: 0; color: #a9a59c; }
.pd-photos { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; padding-inline: 6px; }
.pd-photo { position: relative; grid-column: span 3; height: clamp(240px, 30vw, 440px); padding: 0; border: 0; overflow: hidden; background: var(--charcoal); cursor: zoom-in; }
.pd-photo:nth-child(5n+1) { grid-column: span 6; height: clamp(300px, 46vw, 640px); }
.pd-photo:nth-child(5n+4) { grid-column: span 2; }
.pd-photo:nth-child(5n) { grid-column: span 4; }
/* A last row that would otherwise be left short fills the full width */
.pd-n2 .pd-photo:last-child, .pd-n4 .pd-photo:last-child { grid-column: span 6; }
.pd-photo img { display: block; width: 100%; height: 100%; object-fit: cover; transition: scale .9s ease, filter .3s ease; }
.pd-photo:hover img, .pd-photo:focus-visible img { scale: 1.04; filter: brightness(1.08); }
.pd-photo:focus-visible, .pd-hero-media:focus-visible { outline: 3px solid var(--orange); outline-offset: -3px; }
.pd-cap { position: absolute; left: 0; top: 0; padding: 9px 14px; background: var(--orange); color: #1a0d06; font: 700 .85rem/1 var(--font-head); letter-spacing: .14em; text-transform: uppercase; }
.pd-num { position: absolute; right: 0; bottom: 0; padding: 8px 12px; background: var(--ink); color: #fff; font: 700 .8rem/1 var(--font-head); letter-spacing: .14em; opacity: 0; translate: 0 6px; transition: opacity .2s, translate .2s; }
.pd-photo:hover .pd-num, .pd-photo:focus-visible .pd-num { opacity: 1; translate: 0 0; }

/* Next project */
.pd-next { background: var(--ink); }
.pd-next-main { position: relative; display: block; overflow: hidden; color: #fff; text-decoration: none; }
.pd-next-main img { display: block; width: 100%; height: clamp(260px, 36vw, 460px); object-fit: cover; filter: brightness(.55); transition: scale 1.2s ease, filter .4s ease; }
.pd-next-main:hover img { scale: 1.04; filter: brightness(.75); }
.pd-next-body { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; padding-inline: max(24px, calc((100vw - var(--wrap)) / 2 + 24px)); }
.pd-next-k { font: 700 .9rem/1 var(--font-head); letter-spacing: .24em; text-transform: uppercase; color: var(--orange); }
.pd-next-k::after { content: "\2192"; display: inline-block; margin-left: 12px; transition: translate .2s ease; }
.pd-next-main:hover .pd-next-k::after { translate: 8px 0; }
.pd-next-body strong { margin: 10px 0 8px; font: 800 clamp(2.8rem, 8vw, 7rem)/.9 var(--font-head); text-transform: uppercase; }
.pd-next-wall { font: 700 1rem/1.3 var(--font-head); letter-spacing: .1em; text-transform: uppercase; color: #d8d4cb; }
.pd-next-links { display: flex; justify-content: space-between; gap: 16px; padding-block: 20px; }
.pd-next-links a { font: 700 .95rem/1 var(--font-head); letter-spacing: .12em; text-transform: uppercase; color: #a9a59c; text-decoration: none; }
.pd-next-links a:hover { color: var(--orange); }

@media (max-width: 900px) {
  .pd-about-grid { grid-template-columns: minmax(0, 1fr); }
  .pd-hero-media img { height: 52vh; }
  .pd-hero-body { margin-top: -80px; }
  .pd-photos { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding-inline: 4px; }
  .pd-photo { grid-column: span 1; height: 46vw; }
  /* Run of five on phones: one wide, two side by side, two wide. No gaps. */
  .pd-photo:nth-child(5n+1), .pd-photo:nth-child(5n+4), .pd-photo:nth-child(5n) { grid-column: span 2; height: 62vw; }
  .pd-n2 .pd-photo:last-child { height: 62vw; }
  .pd-n2 .pd-photo:last-child, .pd-n4 .pd-photo:last-child { grid-column: span 2; }
  .pd-num { opacity: 1; translate: 0 0; }
  .pd-facts > div { grid-template-columns: 110px minmax(0, 1fr); }
}

/* Second pass: calmer gallery. Photos sit inside the page width as an even grid of smaller tiles, the first one a
   little larger. Open any of them in the full-screen viewer to see it big. */
.pd-hero-media img { height: min(58vh, 540px); }
.pd-hero-body { margin-top: -120px; }
.pd-hero-body h1 { font-size: clamp(3rem, 8vw, 7rem); }
.pd-gallery { padding-bottom: clamp(48px, 6vw, 88px); }
.pd-photos { max-width: var(--wrap); margin-inline: auto; padding-inline: 24px; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pd-photo, .pd-photo:nth-child(5n+1), .pd-photo:nth-child(5n+4), .pd-photo:nth-child(5n),
.pd-n2 .pd-photo:last-child, .pd-n4 .pd-photo:last-child { grid-column: span 1; height: auto; aspect-ratio: 4 / 3; }
.pd-photo:first-child { grid-column: span 2; grid-row: span 2; aspect-ratio: auto; height: 100%; }
/* Two or three photos: an even row, no large tile */
.pd-photos:has(> .pd-photo:nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pd-photos:has(> .pd-photo:nth-child(2):last-child) .pd-photo:first-child,
.pd-photos:has(> .pd-photo:nth-child(3):last-child) .pd-photo:first-child { grid-column: span 1; grid-row: span 1; aspect-ratio: 4 / 3; height: auto; }
.pd-next-main img { height: clamp(200px, 24vw, 300px); }
.pd-next-body strong { font-size: clamp(2.2rem, 5vw, 4.2rem); }
@media (max-width: 900px) {
  .pd-hero-media img { height: 42vh; }
  .pd-hero-body { margin-top: -64px; }
  .pd-photos { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding-inline: 16px; }
  .pd-photo, .pd-photo:nth-child(5n+1), .pd-photo:nth-child(5n+4), .pd-photo:nth-child(5n),
  .pd-n2 .pd-photo:last-child, .pd-n4 .pd-photo:last-child { grid-column: span 1; height: auto; aspect-ratio: 4 / 3; }
  .pd-photo:first-child { grid-column: span 2; grid-row: span 1; aspect-ratio: 16 / 10; height: auto; }
  .pd-photos:has(> .pd-photo:nth-child(2):last-child) .pd-photo:first-child,
  .pd-photos:has(> .pd-photo:nth-child(3):last-child) .pd-photo:first-child { grid-column: span 2; aspect-ratio: 16 / 10; }
}

/* Every tile the same size: no large tile at all on desktop. */
@media (min-width: 901px) {
  .pd-photo:first-child { grid-column: span 1; grid-row: span 1; aspect-ratio: 4 / 3; height: auto; }
}
