/* =========================================
   HP School Grid — Mobile-first (Option B)
   ========================================= */

/* Heading */
.hp-school-heading {
  font-size: 2rem;
  font-weight: 700;
  color: var(--almost-black);
  margin: 0 0 1rem;
  text-align: left;
}

/* Grid wrapper */
.school-links-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 1.75rem 0;
}

/* Card (mobile/tablet default) */
.school-link {
  display: grid;
  grid-template-columns: 94px 1fr; /* image | content */
  align-items: center;
  min-height: 94px;
  height: auto;
  padding: 0;
  background: var(--bg-color);
  border-radius: 0.5rem;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  contain: layout;
}

/* Media (picture) */
.school-link-media {
  display: block;
  grid-column: 1;
  line-height: 0;
  width: 94px;
  aspect-ratio: 1; /* <-- square on mobile */
  overflow: hidden;
}

.school-link-media .school-link-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  flex-shrink: 0;
  border-radius: 0.5rem 0 0 0.5rem;
  display: block;
}

/* Content (to right of image on mobile) */
.school-link-content {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 0 1rem;
  padding-right: 1rem;
  padding-left: 1rem;
}

.school-link-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
  height: 100%;
}

.school-link-inner h3 {
  font-size: 1.2rem;
  margin: 0;
  font-weight: 600;
}

/* Hide long text & button on mobile as before */
.school-link-inner p,
.school-link .btn {
  display: none;
}

.school-link-inner p {
  font-weight: 400;
}

/* ------------------------------
   Themed button styles (global)
   ------------------------------ */
.school-link.theme-green .btn {
  background: var(--white);
  border: 3px solid var(--green);
  color: var(--almost-black);
}
.school-link.theme-green .btn:hover,
.school-link.theme-green .btn:focus-visible {
  background: var(--green);
  color: var(--white) !important;
}

.school-link.theme-turquoise .btn {
  background: var(--white);
  border: 3px solid var(--turquoise);
  color: var(--almost-black);
}
.school-link.theme-turquoise .btn:hover,
.school-link.theme-turquoise .btn:focus-visible {
  background: var(--turquoise);
  color: var(--white) !important;
}

.school-link.theme-brick .btn {
  background: var(--white);
  border: 3px solid var(--brick);
  color: var(--almost-black);
}
.school-link.theme-brick .btn:hover,
.school-link.theme-brick .btn:focus-visible {
  background: var(--brick);
  color: var(--white) !important;
}

.school-link.theme-claret .btn {
  background: var(--white);
  border: 3px solid var(--claret);
  color: var(--almost-black);
}
.school-link.theme-claret .btn:hover,
.school-link.theme-claret .btn:focus-visible {
  background: var(--claret);
  color: var(--white) !important;
}

.school-link.theme-deep-blue .btn {
  background: var(--white);
  border: 3px solid var(--deep-blue);
  color: var(--almost-black);
}
.school-link.theme-deep-blue .btn:hover,
.school-link.theme-deep-blue .btn:focus-visible {
  background: var(--deep-blue);
  color: var(--white) !important;
}

.hp-school-helper {
  max-width: 100%;
  margin: 0 auto 2rem;
  text-align: left;
}

/* ---------------------------------------------
 * Two-column layout for medium screens (768–1180px)
 * --------------------------------------------- */
@media (min-width: 48rem) and (max-width: 73.749rem) {
  .school-links-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    align-items: stretch;
  }

  .school-link {
    min-height: 94px;
    height: auto; /* allow wrapping if titles get long */
  }
}

/* ---------------------------------------------
 * Compact-desktop spacing (1024–1180px)
 * --------------------------------------------- */
@media (min-width: 64rem) and (max-width: 73.749rem) {
  .hp-school-heading {
    margin: 1.5rem 0 1rem;
  }
}

/* ---------------------------------------------
 * Mobile/Tablet themed image borders (keep)
 * --------------------------------------------- */
@media (max-width: 73.749rem) {
  .school-link.theme-green .school-link-img {
    border-right: 5px solid var(--green);
  }
  .school-link.theme-turquoise .school-link-img {
    border-right: 5px solid var(--turquoise);
  }
  .school-link.theme-brick .school-link-img {
    border-right: 5px solid var(--brick);
  }
  .school-link.theme-claret .school-link-img {
    border-right: 5px solid var(--claret);
  }
  .school-link.theme-deep-blue .school-link-img {
    border-right: 5px solid var(--deep-blue);
  }
}

/* =========================================
   Desktop (≥ 1180px)
   ========================================= */
@media (min-width: 73.749rem) {
  /* Heading */
  .hp-school-heading {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--almost-black);
    margin: 4rem 0 1.2rem;
    text-align: center;
  }
  /* Grid: three columns, equal heights */
  .school-links-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin: 0 0 4rem;
    align-items: stretch; /* equal card heights per row */
  }

  /* Card becomes vertical stack */
  .school-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-color);
    border: 2px solid transparent;
    border-radius: 1rem;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition:
      background 0.3s ease,
      border-color 0.3s ease;
  }

  /* 16:9 media area */
  .school-link-media {
    display: block;
    position: relative;
    z-index: 0;
    line-height: 0;
    width: 100%;
    aspect-ratio: 16 / 9; /* <-- guarantees 16:9 */
    overflow: hidden; /* ensures clean crop */
    flex-shrink: 0; /* don't collapse when text is tall */
  }

  /* Image fills the 16:9 box and crops nicely */
  .school-link-media .school-link-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%; /* overrides the mobile 94px */
    object-fit: cover;
    display: block;
    border-radius: 1rem 1rem 0 0;
  }

  /* Content fills remainder, button pins to bottom */
  .school-link-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    position: relative;
    z-index: 1;
    flex: 1; /* fill remaining card height */
    margin-top: 0; /* kill old 200px hack */
  }

  .school-link-inner {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 0.5rem 0 1.2rem;
  }

  .school-link-inner h3 {
    font-size: 1.75rem;
    margin: 0 0 0.75rem;
    padding-left: 10px;
    line-height: 1.4;
    font-weight: 700;
    text-align: left;
  }

  /* Re-enable description + button on desktop */
  .school-link-inner p,
  .school-link .btn {
    display: block;
  }

  .school-link-inner p {
    margin: 0 0 1.25rem;
    font-weight: 400;
    flex-grow: 1; /* push button to bottom */
  }

  .school-link .btn {
    margin-top: auto;
    width: fit-content;
    align-self: flex-start;
    display: inline-block;
  }

  .hp-school-helper {
    max-width: 80ch;
    margin: 0 auto 3rem;
    text-align: center;
  }

  /* Theme left stripe on headings */
  .school-link.theme-green h3 {
    border-left: 5px solid var(--green);
  }
  .school-link.theme-turquoise h3 {
    border-left: 5px solid var(--turquoise);
  }
  .school-link.theme-brick h3 {
    border-left: 5px solid var(--brick);
  }
  .school-link.theme-claret h3 {
    border-left: 5px solid var(--claret);
  }
  .school-link.theme-deep-blue h3 {
    border-left: 5px solid var(--deep-blue);
  }

  /* Focus state */
  .school-link:focus-visible {
    outline: 3px solid var(--pink) !important;
    background: var(--white) !important;
    border-radius: 1.2rem;
    outline-offset: -2px;
  }
}
