/* ==========================================================================
   Single project page
   Requires theme.css and projects.css (banner, breadcrumbs and the status
   pill are shared with the projects grid).
   ========================================================================== */

.ps-page {
  padding: var(--ims-section) 0;
  background: var(--ims-surface);
}

/* ---- Lead image --------------------------------------------------------- */

.ps-lead {
  margin: 0 0 40px;
}

.ps-lead__link {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--ims-surface-2);
}

.ps-lead__link img {
  display: block;
  width: 100%;
  height: 440px;
  object-fit: cover;
}

.ps-zoom {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  font-size: 16px;
  color: var(--ims-ink-invert);
  background: var(--ims-brand);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 200ms ease, transform 200ms ease;
}

.ps-lead__link:hover .ps-zoom,
.ps-lead__link:focus-visible .ps-zoom {
  opacity: 1;
  transform: none;
}

.ps-lead__caption {
  padding: 12px 2px 0;
  font-size: 13px;
  color: var(--ims-ink-soft);
}

/* ---- Thumbnails --------------------------------------------------------- */

.ps-subhead {
  margin: 0 0 18px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ims-ink);
}

.ps-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ps-thumbs__cell {
  margin: 0;
}

.ps-thumb {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--ims-surface-2);
  border: 1px solid var(--ims-rule);
}

.ps-thumb img {
  display: block;
  width: 100%;
  height: 140px;
  object-fit: cover;
  transition: transform 400ms ease;
}

.ps-thumb:hover img {
  transform: scale(1.06);
}

.ps-thumb__caption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 20px 10px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ims-ink-invert);
  background: linear-gradient(to top, rgba(15, 28, 38, 0.85), rgba(15, 28, 38, 0));
}

.ps-thumb:focus-visible,
.ps-lead__link:focus-visible {
  outline: 2px solid var(--ims-brand);
  outline-offset: -2px;
}

/* ---- Sidebar ------------------------------------------------------------ */

.ps-aside {
  padding: 28px 26px 30px;
  background: var(--ims-paper);
  border: 1px solid var(--ims-rule);
  border-top: 3px solid var(--ims-brand);
}

.ps-aside__status {
  margin: 0 0 16px;
}

.ps-aside__summary {
  margin: 0 0 22px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--ims-ink-soft);
}

/* Facts — rows only render when there is a value, so the list is never
   padded out with blanks. */

.ps-facts {
  margin: 0 0 26px;
}

.ps-facts__row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--ims-rule);
}

.ps-facts__row:last-child {
  border-bottom: 1px solid var(--ims-rule);
}

.ps-facts__label {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ims-ink-soft);
}

.ps-facts__value {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  text-align: right;
  color: var(--ims-ink);
}

.ps-aside__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}

.ps-aside__actions .ims-btn {
  text-align: center;
}

/* ---- Prev / next -------------------------------------------------------- */

.ps-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  margin-top: 60px;
  padding-top: 26px;
  border-top: 1px solid var(--ims-rule);
}

.ps-nav__link {
  max-width: 46%;
}

.ps-nav__link--next {
  text-align: right;
}

.ps-nav__dir {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ims-brand);
}

.ps-nav__name {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: var(--ims-ink);
}

.ps-nav__link:hover .ps-nav__name,
.ps-nav__link:focus .ps-nav__name {
  color: var(--ims-brand);
}

.ps-nav__link:hover,
.ps-nav__link:focus {
  text-decoration: none;
}

/* ---- Breakpoints -------------------------------------------------------- */

@media (max-width: 991px) {
  .ps-aside { margin-top: 40px; }
}

@media (max-width: 767px) {
  .ps-page { padding: var(--ims-section-sm) 0; }
  .ps-lead__link img { height: 260px; }
  .ps-thumbs { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .ps-thumb img { height: 110px; }

  /* No hover on touch */
  .ps-zoom { opacity: 1; transform: none; }

  .ps-nav__link { max-width: 100%; }
  .ps-nav__link--next { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .ps-zoom,
  .ps-thumb img {
    transition: none;
  }

  .ps-thumb:hover img { transform: none; }
}
