/* ==========================================================================
   Library & Laboratories (campus-facilities.html, #library-labs only).
   Layout from the design: two large cards on the first row (Sports, Science Lab),
   three cards on the second row (Library, Art & Music, Computer Lab). Each card
   has a rounded white frame, a rounded photo and the title and text beneath.
   Content and images are unchanged. "Experiment" uses index.html's orange script.
   ========================================================================== */

#library-labs .space-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(16px, 2vw, 24px);
}

#library-labs .space {
  min-height: 0;
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  padding: 16px 16px 22px;
  background: #fff;
  border: 1px solid #e6e2d8;
  border-radius: 22px;
  box-shadow: 0 10px 30px rgba(14, 42, 71, .05);
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), box-shadow .35s ease;
}

/* first row: two larger cards */
#library-labs .space.s-sports,
#library-labs .space.s-chem {
  grid-column: span 3;
}

#library-labs .space:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(14, 42, 71, .10);
}

#library-labs .space .ph {
  display: block;
  position: relative;
  overflow: hidden;
  border: 0;
  clip-path: none;
  -webkit-mask: none;
  mask: none;
  border-radius: 16px;
  aspect-ratio: 16 / 10;
  margin: 0 0 18px;
  background: #eee9dd;
}

#library-labs .space.s-sports .ph,
#library-labs .space.s-chem .ph {
  aspect-ratio: 16 / 9;
}

#library-labs .space .ph img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  clip-path: none;
  -webkit-mask: none;
  mask: none;
  border-radius: 0;
  transition: transform .7s cubic-bezier(.2, .8, .2, 1);
}

#library-labs .space:hover .ph img {
  transform: scale(1.04);
}

#library-labs .space h3 {
  font-family: var(--hp-serif);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--hp-navy);
  margin: 0 0 8px;
  padding: 0 6px;
}

#library-labs .space p {
  font-family: var(--hp-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--hp-ink);
  margin: 0;
  padding: 0 6px;
}

/* ---------- heading block ---------- */
#library-labs .sec-head {
  text-align: left;
  margin-bottom: clamp(36px, 4vw, 56px);
}

#library-labs .sec-head .kicker {
  font-size: 12px;
}

#library-labs .sec-head .h2 {
  font-family: var(--hp-serif);
  font-size: clamp(34px, 3.6vw, 50px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.01em;
  color: var(--hp-navy);
  margin: 0;
}

#library-labs .sec-head .hp-script {
  font-size: 1.1em;
  letter-spacing: 0;
  white-space: normal;
}

/* ---------- tablet: two per row ---------- */
@media (max-width: 1024px) {
  #library-labs .space-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #library-labs .space,
  #library-labs .space.s-sports,
  #library-labs .space.s-chem {
    grid-column: auto;
  }
  #library-labs .space:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    max-width: 50%;
    justify-self: center;
    width: 100%;
  }
}

/* ---------- phone: one per row ---------- */
@media (max-width: 640px) {
  #library-labs .space-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
  #library-labs .space:last-child:nth-child(odd) {
    max-width: none;
  }
  #library-labs .space {
    padding: 12px 12px 18px;
    border-radius: 18px;
  }
  #library-labs .space .ph {
    border-radius: 14px;
    aspect-ratio: 16 / 10;
  }
  #library-labs .space h3 {
    font-size: 21px;
  }
  #library-labs .sec-head .h2 {
    font-size: clamp(30px, 8.6vw, 38px);
  }
}

@media (prefers-reduced-motion: reduce) {
  #library-labs .space,
  #library-labs .space .ph img {
    transition: none;
  }
  #library-labs .space:hover,
  #library-labs .space:hover .ph img {
    transform: none;
  }
}
