/* =========================================================
   JBRay.org — Collections
   Page-specific styles for collections.html
   Loaded after assets/css/styles.css
   ========================================================= */

/* ---------------------------------------------------------
   Collections page hero
   --------------------------------------------------------- */

body.page-collections .page-hero {
   padding: 58px 0 52px;
}

body.page-collections .page-hero p {
   max-width: none;
}

body.page-collections .site-footer {
   margin-top: 0;
}

/* ---------------------------------------------------------
   Collections introduction
   --------------------------------------------------------- */

.collection-catalogue {
   padding-top: 48px;
   background: var(--paper-deep);
}

.collection-intro {
   max-width: 820px;
   margin: 0 auto 42px;
   text-align: center;
}

.collection-intro .object-label {
   margin: 0 0 14px;
}

.collection-intro h2 {
   margin-bottom: 20px;
   font-size: clamp(36px, 4vw, 54px);
}

.collection-intro>p:last-child {
   max-width: 720px;
   margin: 0 auto;
   color: var(--muted);
   font-size: 19px;
   line-height: 1.65;
}


/* ---------------------------------------------------------
   Collection gateway grid

   The gateways are deliberately not conventional equal-image
   cards. Each historical object keeps its documentary shape.
   --------------------------------------------------------- */

.collection-gateway-grid {
   display: grid;
   grid-template-columns: repeat(2, minmax(0, 1fr));
   gap: 28px;
   align-items: stretch;
}


/* ---------------------------------------------------------
   Individual gateway
   --------------------------------------------------------- */

.collection-gateway {
   display: grid;
   grid-template-rows: 430px 1fr;
   min-width: 0;
   overflow: hidden;

   color: inherit;
   text-decoration: none;

   background: var(--paper);
   border: 1px solid var(--line);
   box-shadow: 0 14px 34px rgba(38, 30, 22, .07);

   transition:
      transform .2s ease,
      box-shadow .2s ease,
      border-color .2s ease;
}

.collection-gateway:hover {
   transform: translateY(-4px);
   border-color: rgba(154, 116, 65, .7);
   box-shadow: 0 22px 48px rgba(38, 30, 22, .12);
}

.collection-gateway:focus-visible {
   outline: 3px solid var(--bronze);
   outline-offset: 4px;
}


/* ---------------------------------------------------------
   Archival object field

   This is intentionally a display field rather than a cropped
   thumbnail box. Documentary proportions are preserved.
   --------------------------------------------------------- */

.collection-object-field {
   position: relative;

   display: grid;
   place-items: center;

   min-width: 0;
   padding: 28px;

   overflow: hidden;

   background:
      linear-gradient(rgba(236, 227, 211, .78),
         rgba(236, 227, 211, .78)),
      repeating-linear-gradient(0deg,
         rgba(99, 77, 48, .045) 0,
         rgba(99, 77, 48, .045) 1px,
         transparent 1px,
         transparent 5px);

   border-bottom: 1px solid var(--line);
}

.collection-object-field::before,
.collection-object-field::after {
   content: '';
   position: absolute;
   pointer-events: none;
}

.collection-object-field::before {
   inset: 15px;
   border: 1px solid rgba(154, 116, 65, .42);
}

.collection-object-field::after {
   inset: 20px;
   border: 1px solid rgba(111, 45, 45, .16);
}

.collection-object-field img {
   position: relative;
   z-index: 1;

   width: auto;
   height: auto;

   max-width: 100%;
   max-height: 100%;

   object-fit: contain;

   box-shadow: 0 12px 28px rgba(39, 31, 22, .16);
}


/* ---------------------------------------------------------
   Object-specific treatments

   These are intentionally different. Collections should feel
   curated rather than mechanically uniform.
   --------------------------------------------------------- */


/* Historical portrait */

.collection-object-field--portrait img {
   max-height: 360px;
}


/* President's letter */

.collection-object-field--document {
   background:
      linear-gradient(rgba(245, 240, 230, .9),
         rgba(245, 240, 230, .9)),
      repeating-linear-gradient(90deg,
         rgba(99, 77, 48, .035) 0,
         rgba(99, 77, 48, .035) 1px,
         transparent 1px,
         transparent 6px);
}

.collection-object-field--document img {
   max-height: 365px;
}


/* Publications */

.collection-object-field--book {
   background: #f1eadc;
}

.collection-object-field--book img {
   max-height: 365px;
}


/* College / hospital */

.collection-object-field--institution img {
   max-height: 365px;
}


/* Recognition */

.collection-object-field--recognition img {
   max-height: 365px;
}


/* ---------------------------------------------------------
   Newspaper gateway

   Full-width gateway because the four-panel Behar Herald object
   is a landscape documentary composition.
   --------------------------------------------------------- */

.collection-gateway--wide {
   grid-column: 1 / -1;
   grid-template-rows: auto 1fr;
}

.collection-gateway--wide .collection-object-field {
   min-height: 0;
   padding: 30px 72px;
   background: #f3ede2;
}

.collection-gateway--wide .collection-object-field img {
   width: min(100%, 860px);
   max-width: 860px;
   max-height: none;
   height: auto;
}


/* ---------------------------------------------------------
   Recognition gateway

   Six collections leave one final portal after the second pair.
   Centre it rather than leaving an accidental empty grid cell.
   --------------------------------------------------------- */

.collection-gateway-grid>.collection-gateway:last-child {
   grid-column: 1 / -1;
   width: calc((100% - 28px) / 2);
   justify-self: center;
}

.collection-gateway-grid>.collection-gateway:last-child .collection-object-field {
   background:
      linear-gradient(rgba(41, 62, 55, .94),
         rgba(41, 62, 55, .94)),
      repeating-linear-gradient(0deg,
         rgba(255, 255, 255, .025) 0,
         rgba(255, 255, 255, .025) 1px,
         transparent 1px,
         transparent 5px);
}

.collection-gateway-grid>.collection-gateway:last-child .collection-object-field::before {
   border-color: rgba(214, 182, 117, .62);
}

.collection-gateway-grid>.collection-gateway:last-child .collection-object-field::after {
   border-color: rgba(255, 255, 255, .12);
}

/* ---------------------------------------------------------
   Gateway text
   --------------------------------------------------------- */

.collection-gateway-copy {
   display: flex;
   flex-direction: column;
   padding: 27px 30px 29px;
}

.collection-gateway-copy .object-label {
   margin: 0 0 10px;
}

.collection-gateway-copy h3 {
   margin-bottom: 13px;
   font-size: 29px;
}

.collection-gateway-copy>p {
   margin: 0;
   color: var(--muted);
   font-size: 17px;
   line-height: 1.58;
}

.collection-enter {
   display: inline-flex;
   align-items: center;
   gap: 8px;

   margin-top: auto;
   padding-top: 25px;

   color: var(--forest);

   font: 700 11px/1.4 var(--sans);
   text-transform: uppercase;
   letter-spacing: .1em;
}

.collection-enter span {
   display: inline-block;
   color: var(--bronze);
   font-size: 18px;
   line-height: 1;

   transition: transform .18s ease;
}

.collection-gateway:hover .collection-enter span {
   transform: translateX(4px);
}


/* ---------------------------------------------------------
   Slight visual emphasis for the documentary-wide gateway
   --------------------------------------------------------- */

.collection-gateway--wide .collection-gateway-copy {
   padding-inline: 34px;
}

.collection-gateway--wide .collection-gateway-copy h3 {
   font-size: 32px;
}


/* ---------------------------------------------------------
   Intermediate widths
   --------------------------------------------------------- */

@media (max-width: 1000px) {

   .collection-gateway {
      grid-template-rows: 390px 1fr;
   }

   .collection-gateway--wide {
      grid-template-rows: auto 1fr;
   }

   .collection-object-field {
      padding: 24px;
   }

   .collection-gateway--wide .collection-object-field {
      min-height: 0;
      padding: 28px;
   }

}

/* ---------------------------------------------------------
   Tablet / narrow desktop

   Collapse before the gateways become cramped. The documentary
   objects should retain visual dignity rather than fill space
   merely because two columns technically fit.
   --------------------------------------------------------- */

@media (max-width: 820px) {

   .collection-intro {
      margin-bottom: 42px;
      text-align: left;
   }

   .collection-intro>p:last-child {
      margin-left: 0;
   }

   .collection-gateway-grid {
      grid-template-columns: 1fr;
      gap: 24px;
   }

   .collection-gateway,
   .collection-gateway--wide {
      grid-column: auto;
      grid-template-rows: auto 1fr;
   }

   .collection-gateway-grid>.collection-gateway:last-child {
      grid-column: auto;
      width: 100%;
   }

   .collection-object-field {
      min-height: 410px;
   }

   .collection-gateway--wide .collection-object-field {
      min-height: 0;
   }

   .collection-gateway--wide .collection-object-field img {
      width: 100%;
   }

}


/* ---------------------------------------------------------
   Mobile
   --------------------------------------------------------- */

@media (max-width: 680px) {

   .collection-catalogue {
      padding-top: 48px;
   }

   .collection-intro {
      margin-bottom: 34px;
   }

   .collection-intro h2 {
      font-size: 34px;
   }

   .collection-intro>p:last-child {
      font-size: 17px;
   }

   .collection-gateway {
      box-shadow: 0 10px 26px rgba(38, 30, 22, .07);
   }

   .collection-object-field {
      min-height: 0;
      padding: 22px;
   }

   .collection-object-field::before {
      inset: 10px;
   }

   .collection-object-field::after {
      inset: 15px;
   }

   .collection-object-field img {
      width: auto;
      height: auto;
      max-width: 100%;
      max-height: none;
   }

   .collection-object-field--portrait img,
   .collection-object-field--document img,
   .collection-object-field--book img,
   .collection-object-field--institution img,
   .collection-object-field--recognition img {
      max-height: 520px;
   }

   .collection-gateway--wide .collection-object-field {
      padding: 20px;
   }

   .collection-gateway-copy,
   .collection-gateway--wide .collection-gateway-copy {
      padding: 23px 22px 25px;
   }

   .collection-gateway-copy h3,
   .collection-gateway--wide .collection-gateway-copy h3 {
      font-size: 26px;
   }

   .collection-enter {
      padding-top: 20px;
   }

}


/* ---------------------------------------------------------
   Reduced motion
   --------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {

   .collection-gateway,
   .collection-enter span {
      transition: none;
   }

   .collection-gateway:hover {
      transform: none;
   }

   .collection-gateway:hover .collection-enter span {
      transform: none;
   }

}