/* Projects: filter bar, grid cards, detail dialog. Colours and fonts come from main.css tokens
   (ink, cream, white, bronze, brand red; Unbounded for headings, Montserrat for body). */

/* ---------- filter bar ---------- */
.pfilters {
  display: flex; gap: .625rem; overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; padding-bottom: .25rem;
}
.pfilters::-webkit-scrollbar { display: none; }
@media (min-width: 640px) { .pfilters { flex-wrap: wrap; overflow: visible; } }
.pfilter-btn {
  flex: 0 0 auto; min-height: 44px; padding: .6rem 1.1rem;
  font-family: var(--ff-body); font-weight: 500; font-size: .875rem; line-height: 1.2;
  white-space: nowrap; border-radius: var(--radius-pill);
  background: var(--cream); color: var(--ink-950); border: 1px solid var(--bronze);
  transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease;
}
.pfilter-btn:hover { border-color: var(--ink-950); }
.pfilter-btn[aria-pressed="true"] { background: var(--ink-950); color: var(--white); border-color: var(--ink-950); }
.pfilter-btn:focus-visible, .pcard:focus-visible, .pm-navbtn:focus-visible, .pm__close:focus-visible {
  outline: 2px solid var(--brand-red); outline-offset: 3px;
}
.pstatus { font-size: .875rem; color: var(--grey-700); }
.pnote { font-size: .9375rem; line-height: 1.7; color: var(--grey-700); }

/* ---------- grid ---------- */
.pgrid { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) and (max-width: 960px) { .pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 961px) { .pgrid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); } }
.pgrid > * { min-width: 0; }

/* ---------- card ---------- */
.pcard {
  position: relative; display: flex; flex-direction: column; cursor: pointer;
  background: var(--white); border: 1px solid var(--line-light); border-radius: 14px;
  box-shadow: none; overflow: hidden;
}
.pcard[hidden] { display: none !important; }
.pcard.is-out { opacity: 0; transition: opacity 200ms ease; }
.pcard.is-in { animation: pcard-in 200ms ease both; }
@keyframes pcard-in { from { opacity: 0; } to { opacity: 1; } }

.pcard__media { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--ink-900); }
.pcard__status {
  position: absolute; top: .75rem; left: .75rem; z-index: 2;
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .65rem; border-radius: var(--radius-pill);
  background: var(--white); color: var(--ink-950);
  font-family: var(--ff-body); font-weight: 500; font-size: .75rem; line-height: 1; letter-spacing: .08em; text-transform: uppercase;
}
/* Ongoing dot: soft red on the white pill (no check glyph) */
.pcard__dot { width: 8px; height: 8px; border-radius: 50%; background: #9C2A26; flex: 0 0 auto; }

.pcard__body { display: flex; flex-direction: column; flex: 1; padding: 1.25rem 1.25rem 1.4rem; }
.pcard__name {
  font-family: var(--ff-display); font-weight: 500; font-size: .9375rem; line-height: 1.35;
  color: var(--ink); margin: 0; overflow-wrap: anywhere;
}
.pcard__loc { margin: .4rem 0 0; font-size: .875rem; line-height: 1.5; color: var(--grey-700); }
.pcard__partner { margin: .75rem 0 0; }
.pcard__more {
  margin-top: auto; padding-top: 1rem; align-self: flex-start;
  display: inline-flex; align-items: center; gap: .4rem; min-height: 44px;
  font-family: var(--ff-body); font-weight: 500; font-size: .875rem; color: var(--ink-950);
  border-bottom: 1px solid var(--brand-red);
}
.pcard__arrow { width: 16px; height: 16px; flex: 0 0 auto; }

/* Photo and placeholder share one box; the photo fades over the placeholder.
   Placeholder: navy-900 with a navy-800 glow and faint bronze diagonal hairlines (CSS only). */
.pc-placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .45rem; padding: 1.25rem; text-align: center; color: #80A0C5;
  background:
    repeating-linear-gradient(135deg, rgba(198,171,149,.07) 0 1px, transparent 1px 18px),
    radial-gradient(120% 90% at 50% 40%, #1E3451 0%, rgba(30,52,81,0) 70%),
    #16283F;
}
.pc-placeholder__icon { display: block; width: 44px; height: 44px; color: #80A0C5; opacity: .4; margin-bottom: .2rem; }
.pc-placeholder__code { font-family: var(--ff-display); font-weight: 500; font-size: 1.35rem; line-height: 1.1; letter-spacing: .04em; color: #80A0C5; }
.pc-placeholder__name { font-family: var(--ff-display); font-weight: 500; font-size: 1.05rem; line-height: 1.3; color: #F6F3F2; max-width: 32ch; }
.pc-placeholder__note { font-family: var(--ff-body); font-weight: 400; font-size: .78rem; line-height: 1.4; color: rgba(128,160,197,.8); }
.pc-photo {
  position: absolute; inset: 0; width: 100%; height: 100%; max-width: none;
  object-fit: cover; opacity: 0; transition: opacity 300ms ease;
}
.pc-photo.is-loaded { opacity: 1; }

.chip {
  display: inline-flex; align-items: center; gap: .35rem; max-width: 100%;
  padding: .3rem .65rem; border-radius: var(--radius-pill);
  background: var(--cream); color: var(--ink-950); border: 1px solid var(--line-light);
  font-family: var(--ff-body); font-weight: 500; font-size: .8125rem; line-height: 1.3; overflow-wrap: anywhere;
}
.chip--icon svg { width: 14px; height: 14px; flex: 0 0 auto; color: var(--brand-red); }

/* Hover lift on desktop only; reveal runs only when motion is allowed */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .pcard { transition: transform 250ms ease, box-shadow 250ms ease; }
  .pcard:hover { transform: translateY(-4px); box-shadow: 0 14px 30px color-mix(in srgb, var(--ink-950) 14%, transparent); }
  .pcard:hover .pc-photo { transform: scale(1.03); }
  .pc-photo { transition: opacity 300ms ease, transform 250ms ease; }
}
@media (prefers-reduced-motion: no-preference) {
  .pcard.reveal-armed { opacity: 0; transform: translateY(12px); }
  .pcard.is-visible { opacity: 1; transform: none; transition: opacity 400ms ease-out var(--delay, 0ms), transform 400ms ease-out var(--delay, 0ms); }
}
@media (prefers-reduced-motion: reduce) {
  .pcard, .pc-photo, .pcard.is-out { transition: none !important; }
  .pcard.is-in { animation: none; }
}

/* ---------- detail dialog ---------- */
html.pm-lock { overflow: hidden; }
.pm { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.pm[hidden] { display: none; }
.pm__backdrop {
  position: absolute; inset: 0; background: color-mix(in srgb, var(--ink-950) 72%, transparent);
  opacity: 0;
}
.pm__panel {
  position: relative; width: 100%; max-width: 880px; max-height: 90vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--cream); color: var(--ink); border-radius: 14px; box-shadow: 0 30px 70px color-mix(in srgb, var(--ink-950) 40%, transparent);
  opacity: 0;
}
.pm.is-open .pm__backdrop, .pm.is-open .pm__panel { opacity: 1; }
.pm__top { position: sticky; top: 0; z-index: 3; display: flex; justify-content: flex-end; padding: .5rem .5rem 0; background: var(--cream); }
.pm__close {
  width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink-950); color: var(--white); border: 0; cursor: pointer;
}
.pm__close svg { width: 20px; height: 20px; }
.pm__body { padding: 0 1.25rem 2rem; font-size: 1rem; line-height: 1.7; }
@media (min-width: 640px) { .pm__body { padding: 0 2.25rem 2.5rem; } }

.pm-crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; list-style: none; margin: 0; padding: 0; font-size: .875rem; color: var(--grey-700); }
.pm-crumbs li + li::before { content: "/"; color: var(--bronze); margin: 0 .5rem; }
.pm-crumbs a { color: var(--ink-950); text-decoration: underline; text-underline-offset: 3px; min-height: 44px; display: inline-flex; align-items: center; }
.pm-crumbs li[aria-current] { color: var(--grey-700); }

.pm-band { position: relative; aspect-ratio: 16 / 9; margin-top: .5rem; border-radius: 10px; overflow: hidden; background: var(--ink-900); }
.pm-head { margin-top: 1.25rem; }
.pm-title {
  font-family: var(--ff-display); font-weight: 700; font-size: clamp(1.4rem, 3.4vw, 2rem); line-height: 1.2;
  color: var(--ink); margin: 0; overflow-wrap: anywhere;
}
.pm-title:focus { outline: none; }
.pm-loc { display: flex; align-items: center; gap: .5rem; margin: .5rem 0 0; color: var(--grey-700); }
.pm-loc svg { width: 18px; height: 18px; flex: 0 0 auto; color: var(--brand-red); }
.pm-tags { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .9rem 0 0; }
.pm-badge { position: static; }

.pm-meta { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; margin: 1.75rem 0 0; border-top: 1px solid var(--line-light); }
@media (min-width: 560px) { .pm-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1.5rem; } }
@media (min-width: 900px) { .pm-meta { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.pm-meta__item--wide { grid-column: 1 / -1; }
.pm-meta__item { padding: .95rem 0; border-bottom: 1px solid var(--line-light); min-width: 0; }
.pm-meta__label { font-family: var(--ff-body); font-weight: 500; font-size: .8125rem; letter-spacing: .08em; text-transform: uppercase; color: var(--grey-700); margin: 0; }
.pm-meta__value { font-family: var(--ff-body); font-weight: 500; font-size: 1rem; color: var(--ink); margin: .25rem 0 0; overflow-wrap: anywhere; }

.pm-block { margin-top: 2.25rem; }
.pm-h3 { font-family: var(--ff-display); font-weight: 700; font-size: 1.15rem; line-height: 1.3; color: var(--ink); margin: 0 0 .75rem; }
.pm-text { margin: 0; font-size: 1rem; line-height: 1.7; color: var(--ink); }
.pm-note { margin: .9rem 0 0; font-size: .9375rem; line-height: 1.6; color: var(--grey-700); }

.pm-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }

.pm-gallery__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: .75rem; }
@media (min-width: 560px) { .pm-gallery__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pm-gallery__item { position: relative; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: var(--ink-900); }

.pm-cta {
  margin-top: 2.5rem; padding: 1.5rem; border-radius: 12px;
  background: var(--white); border: 1px solid var(--line-light);
}
@media (min-width: 640px) { .pm-cta { padding: 2rem; } }
.pm-cta__row { display: flex; flex-direction: column; gap: .75rem; align-items: flex-start; margin-top: 1rem; }
@media (min-width: 560px) { .pm-cta__row { flex-direction: row; flex-wrap: wrap; align-items: center; } }
.pm-cta__row .btn { min-height: 44px; }
.pm-cta__link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 500; color: var(--ink-950); text-decoration: underline; text-underline-offset: 3px; }

.pm-nav { display: flex; flex-direction: column; gap: .75rem; margin-top: 2.25rem; }
@media (min-width: 560px) { .pm-nav { flex-direction: row; justify-content: space-between; } }
.pm-navbtn {
  flex: 1 1 0; min-height: 44px; min-width: 0; padding: .9rem 1rem; text-align: left;
  display: flex; flex-direction: column; gap: .25rem; border-radius: 10px;
  background: var(--white); color: var(--ink); border: 1px solid var(--line-light); cursor: pointer;
}
.pm-navbtn--next { text-align: right; align-items: flex-end; }
.pm-navbtn__dir { font-family: var(--ff-body); font-weight: 500; font-size: .8125rem; letter-spacing: .06em; text-transform: uppercase; color: var(--grey-700); }
.pm-navbtn__name { font-family: var(--ff-display); font-weight: 500; font-size: .9375rem; line-height: 1.35; overflow-wrap: anywhere; }

/* Dialog motion: backdrop fade 200ms, panel rise 260ms. Instant under reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  .pm__backdrop { transition: opacity 200ms ease; }
  .pm__panel { transform: translateY(16px); transition: opacity 260ms cubic-bezier(0.22, 1, 0.36, 1), transform 260ms cubic-bezier(0.22, 1, 0.36, 1); }
  .pm.is-open .pm__panel { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .pm__backdrop, .pm__panel { transition: none !important; transform: none !important; }
}

/* Phones: the dialog becomes a full-screen sheet with thumb-sized controls */
@media (max-width: 639.98px) {
  .pm { padding: 0; }
  .pm__panel { max-width: none; width: 100%; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; }
}

/* ============================================================
   Projects page only (body.page-projects, and the new banner and field classes).
   The featured cards on index.html share the card markup, so their look is unchanged.
   ============================================================ */

/* ---------- top banner ---------- */
.pbanner { position: relative; overflow: hidden; isolation: isolate; background: #122238; color: var(--cream); }
.pbanner__bg {
  position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; max-width: none;
  object-fit: cover; object-position: center 40%;
}
.pbanner__scrim {
  position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(100deg, rgba(18, 34, 56, .94) 0%, rgba(18, 34, 56, .82) 50%, rgba(18, 34, 56, .62) 100%);
}
.pbanner__inner { position: relative; padding-block: 6rem; }
@media (min-width: 640px) { .pbanner__inner { padding-block: 8rem; } }
.pbanner h1 { color: var(--white); }
.pbanner__sub { color: rgba(246, 243, 242, .92); max-width: 56ch; }

/* ---------- field operations (six photos) ---------- */
.pfield__head { max-width: 62ch; }
.pfield__grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .pfield__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; } }
.pfield__grid > li { min-width: 0; }
.pfield__card {
  margin: 0; height: 100%; display: flex; flex-direction: column; overflow: hidden;
  background: var(--white); border: 1px solid var(--line-light); border-radius: 14px;
}
.pfield__media { aspect-ratio: 4 / 3; overflow: hidden; background: var(--ink-900); }
.pfield__media img { display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; }
.pfield__caption {
  padding: .9rem 1rem 1.05rem; font-family: var(--ff-display); font-weight: 500; font-size: .875rem;
  line-height: 1.35; color: var(--ink); overflow-wrap: anywhere;
}
@media (min-width: 900px) { .pfield__caption { font-size: 1rem; padding: 1.05rem 1.25rem 1.2rem; } }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .pfield__card { transition: transform 250ms ease, box-shadow 250ms ease; }
  .pfield__card:hover { transform: translateY(-4px); box-shadow: 0 14px 30px color-mix(in srgb, var(--ink-950) 14%, transparent); }
  .pfield__media img { transition: transform 400ms ease; }
  .pfield__card:hover .pfield__media img { transform: scale(1.03); }
}

/* ---------- project grid: 4 across desktop, 2 tablet, 1 phone ---------- */
.page-projects .pgrid { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) and (max-width: 1099.98px) { .page-projects .pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .page-projects .pgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------- photo fallback: placeholder styles live with the card rules above ---------- */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .pc-placeholder { transition: transform 250ms ease; }
  .pcard:hover .pc-placeholder { transform: scale(1.03); }
}

/* ---------- small phones: keep the banner text and field captions comfortable ---------- */
@media (max-width: 359.98px) {
  .pfield__grid { gap: .75rem; }
  .pfield__caption { padding: .75rem .8rem .85rem; font-size: .8125rem; }
}
