/*
 * Public pages: the landing page, the applicant guide and the eligibility
 * self-check.
 *
 * Photographs carry a navy scrim wherever text sits over them, so white
 * text keeps a contrast ratio above 7:1 whatever the image behind it. The
 * palette and its limits are set out in portal.css.
 */

/* ------------------------------------------------------------ figures */

.figure { margin: 0; }
.figure img { display: block; width: 100%; height: auto; }
.figure__caption {
  font-size: 0.84rem;
  color: var(--ink-muted);
  padding: 8px 2px 0;
  max-width: none;
}
.figure__credit { display: block; font-size: 0.78rem; opacity: 0.8; }

/* --------------------------------------------------------------- hero */

.hero {
  position: relative;
  background: var(--navy);
  color: #fff;
  overflow: hidden;
}
.hero__media { position: absolute; inset: 0; }
.hero__media picture,
.hero__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/*
 * A graded scrim: dense navy where the headline sits, clearing toward the
 * far edge so the photograph is still legible as a photograph.
 */
.hero__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    rgba(15, 22, 54, 0.94) 0%,
    rgba(15, 22, 54, 0.86) 36%,
    rgba(15, 22, 54, 0.44) 66%,
    rgba(15, 22, 54, 0.22) 100%
  );
}
.hero__inner {
  position: relative;
  /* Block padding only: the inline gutter comes from .shell. */
  padding-block: 72px 80px;
}
.hero__content { max-width: 36rem; }
.hero__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--yellow);
  margin: 0 0 12px;
}
.hero h1 {
  color: #fff;
  font-size: clamp(1.9rem, 5vw, 3rem);
  line-height: 1.12;
  margin: 0 0 16px;
  max-width: 20ch;
}
.hero__lede {
  font-size: 1.1rem;
  color: #e5e9f8;
  margin-bottom: 28px;
}
.hero .btn--primary { background: var(--yellow); color: var(--navy); }
.hero .btn--primary:hover { background: #e4c003; color: var(--navy); }
.hero .btn--secondary {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.65);
}
.hero .btn--secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: #fff;
  color: #fff;
}
.hero__note { margin-top: 22px; font-size: 0.92rem; color: #c7cfe8; }
.hero__credit {
  position: absolute;
  right: 10px;
  /*
   * Clear of the deadline strip, which is pulled up 28px over the foot of
   * the hero and was covering all but the last few letters of this.
   * Attribution that cannot be read is not attribution.
   */
  bottom: 38px;
  margin: 0;
  font-size: 0.7rem;
  color: #fff;
  background: rgba(15, 22, 54, 0.6);
  padding: 3px 8px;
  border-radius: 3px;
}

@media (max-width: 719px) {
  .hero__inner { padding-block: 44px 48px; }
  /*
   * In the flow rather than pinned to the corner. The deadline strip
   * below pulls up over the foot of the hero, and an absolutely
   * positioned credit sat underneath it, half covered and unreadable.
   * Attribution has to stay with the photograph, so it moves rather
   * than being hidden.
   */
  .hero__credit {
    /* Relative, not static: the scrim is absolutely positioned, so it
     * paints above anything unpositioned however late that comes in the
     * markup, and the credit would vanish underneath it. The gutter is
     * set here because this element sits outside .hero__inner, which is
     * what normally supplies it. */
    position: relative;
    z-index: 1;
    inset: auto;
    background: none;
    padding: 0 var(--gutter);
    margin-top: 16px;
    padding-bottom: 14px;
    opacity: 0.8;
  }
  .hero__scrim {
    background: linear-gradient(
      180deg,
      rgba(15, 22, 54, 0.8) 0%,
      rgba(15, 22, 54, 0.93) 55%,
      rgba(15, 22, 54, 0.96) 100%
    );
  }
}

/* --------------------------------------------------------------- tabs */
/*
 * The landing page has eleven sections' worth of content and most of its
 * readers are on a phone, where that is several minutes of scrolling
 * before reaching anything actionable. The sections are grouped into
 * tabs, so a visitor scrolls one group rather than the whole page.
 *
 * The strip is sticky, because the point of tabs is being able to switch
 * at any moment, and on a phone the top of the page is a long way back.
 *
 * It is hidden until ui.js unhides it. Without the script every panel is
 * visible and the page reads as one long document, which is worse but
 * complete; a strip of tabs that cannot be switched would be worse still.
 */

.tabs {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(24, 34, 81, 0.04);
}
.tabs__inner {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  /* Hide the scrollbar on the strip itself: it is a short row and the
   * bar steals vertical space on a phone. */
  scrollbar-width: none;
}
.tabs__inner::-webkit-scrollbar { display: none; }

.tabs button {
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--ink-muted);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  /* 48px, comfortably above the 44px minimum touch target. */
  min-height: 48px;
  padding: 0 16px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.tabs button:hover { color: var(--navy); background: var(--surface-sunken); }
.tabs button[aria-selected="true"] {
  color: var(--navy);
  border-bottom-color: var(--blue);
}
.tabs button:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: -3px;
}

/*
 * A panel's first section already carries top padding, so the join to the
 * tab strip would otherwise be a double gap.
 */
.tab-panel > .section:first-child { padding-top: 36px; }

/* ----------------------------------------------------------- sections */

.section { padding: 56px 0; }
.section--white { background: #fff; border-block: 1px solid var(--line-soft); }
.section__head { max-width: 44rem; margin-bottom: 32px; }
.section__head h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
.section__head p { color: var(--ink-muted); margin-bottom: 0; }
/* A short rule under the heading, for a section head that wants to stand
 * out a little more than the plain ones, such as the fact strip below. */
.section__head--accent h2 {
  position: relative;
  padding-bottom: 14px;
}
.section__head--accent h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 46px;
  height: 3px;
  border-radius: 2px;
  background: var(--blue);
}

/* --------------------------------------------------------- fact strip */

.facts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  text-align: center;
}
.fact {
  display: flex;
  flex-direction: column;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.fact:first-child { padding-top: 0; border-top: none; }
@media (min-width: 620px) {
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 24px; }
  .fact { border-top: none; padding-top: 0; }
  .fact:nth-child(n + 3) { border-top: 1px solid var(--line); padding-top: 28px; }
}
@media (min-width: 980px) {
  /* minmax(0, 1fr), not a bare 1fr: a 1fr track still won't shrink
   * narrower than its content's natural width, so one long figure would
   * otherwise widen its column at the other three columns' expense. */
  .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
  .fact {
    border-top: none;
    padding: 0 24px;
    border-left: 1px solid var(--line);
  }
  .fact:first-child { border-left: none; }
}
.fact__icon {
  display: block;
  width: 76px;
  height: 76px;
  margin: 0 auto 14px;
}
.fact__icon img { display: block; width: 100%; height: 100%; object-fit: contain; }
.fact__kicker {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 6px;
}
.fact__kicker::after { content: ":"; }
.fact__value {
  /* A fixed minimum height, long enough for the two-line funding range,
   * so every label below starts at the same height whether its own
   * value wraps or not. Without it the row above ran ragged and the
   * whole strip looked out of step rather than four equal columns.
   *
   * Block, not flex: flex turns each text run between the js-count spans
   * into its own anonymous box, and the whitespace at each box's edge
   * collapses away, which swallowed the space before "to" and "years"
   * and ran the numbers together into one unbreakable word wide enough
   * to blow out its grid column. */
  display: block;
  min-height: 2.2em;
  font-size: clamp(1.25rem, 2.6vw, 1.75rem);
  font-weight: 800;
  color: var(--navy);
  line-height: 1.15;
  text-align: center;
}
.fact__sub {
  display: block;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--navy);
  margin-top: 2px;
}
.fact__label {
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin: 8px 0 0;
  max-width: 26ch;
}

/* ------------------------------------------------------ media and text */

.media-row { display: grid; gap: 28px; align-items: center; }
@media (min-width: 820px) {
  .media-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .media-row--flip .media-row__media { order: 2; }
}
.media-row + .media-row { margin-top: 48px; }
/* Same gap as between two media rows, for a section head that follows one. */
.media-row + .section__head--gallery { margin-top: 48px; }
.media-row__media img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-lg);
  display: block;
}
.media-row__body h3 { font-size: 1.3rem; }

/* ---------------------------------------------------------- step cards */

.steps { display: grid; gap: 20px; }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .steps { grid-template-columns: repeat(3, 1fr); } }

.step {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}
.step__media { position: relative; }
.step__media img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}
.step__number {
  position: absolute;
  left: 12px;
  bottom: 12px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--navy);
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.step__body { padding: 18px 20px 22px; flex: 1; }
.step__body h3 { margin-bottom: 8px; font-size: 1.08rem; }
.step__body p { font-size: 0.94rem; margin-bottom: 0; max-width: none; }
.step__gate {
  display: inline-block;
  font-size: 0.74rem;
  color: var(--ink-muted);
  margin-top: 10px;
}

/* ------------------------------------------------------ facility cards */

.facility {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.facility__media img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  display: block;
}
.facility__body { padding: 22px; flex: 1; display: flex; flex-direction: column; }
.facility__body h3 { margin-bottom: 4px; }
.facility__operator {
  font-size: 0.86rem;
  color: var(--ink-muted);
  margin-bottom: 14px;
}
.facility .keyvalue { margin-bottom: 18px; }
.facility .btn-row { margin-top: auto; }

/* ----------------------------------------------------------- checklist */

.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.checklist li {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-width: none;
}
.checklist li::before {
  content: "";
  width: 14px;
  height: 14px;
  margin-top: 5px;
  border-radius: 3px;
  background: var(--teal);
}
.checklist li.is-exclusion::before { background: var(--coral); }
.checklist__title { font-weight: 600; color: var(--navy); display: block; }
.checklist__note { font-size: 0.88rem; color: var(--ink-muted); }

/* ----------------------------------------------------------------- faq */

.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); background: #fff; }
.faq summary {
  cursor: pointer;
  padding: 16px 44px 16px 16px;
  font-weight: 600;
  color: var(--navy);
  position: relative;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--blue);
}
.faq details[open] summary::after { content: "\2212"; }
.faq summary:hover { background: var(--surface-sunken); }
.faq__answer { padding: 0 16px 18px; }
.faq__answer p { margin-bottom: 0; }

/* ------------------------------------------------------------- callout */

.callout {
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 28px;
}
.callout h2, .callout h3 { color: #fff; margin-top: 0; }
.callout p { color: #dce1f3; }
/*
 * Scoped to plain links. Unscoped, this also coloured the text of a
 * .btn--secondary inside a callout, which has a white background, so the
 * button rendered as an empty white rectangle. The same mistake was made
 * once in the masthead; both are fixed the same way.
 */
.callout a:not(.btn) { color: #fff; }
.callout .btn--secondary {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.65);
}
.callout .btn--secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: #fff;
  color: #fff;
}
.callout--warn {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--coral);
  border-left: 5px solid var(--coral);
}
.callout--warn h2, .callout--warn h3 { color: var(--navy); }
.callout--warn p { color: var(--ink); }
.callout--warn a:not(.btn) { color: var(--blue); }
/* This variant is on white, so a button keeps its ordinary colours. */
.callout--warn .btn--secondary {
  background: #fff;
  color: var(--blue);
  border-color: var(--line);
}

/* ------------------------------------------------------------- gallery */

.gallery { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px) { .gallery { grid-template-columns: repeat(4, 1fr); } }
.gallery figure { margin: 0; }
.gallery img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius);
  display: block;
}
.gallery figcaption {
  font-size: 0.8rem;
  color: var(--ink-muted);
  padding-top: 6px;
  max-width: none;
}

/* ------------------------------------------------------------ deadline */

.deadline {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  justify-content: space-between;
  background: #fff6c2;
  border: 1px solid #d9b703;
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  color: var(--navy);
}
.deadline strong { font-size: 1.05rem; }
.deadline p { margin: 0; color: var(--navy); max-width: none; }

/*
 * The strip overlaps the hero above it. Was an inline style on the
 * element, which put a layout decision in the template where no stylesheet
 * reader would find it.
 */
.deadline-wrap { position: relative; z-index: 2; margin-top: -28px; }
/*
 * No overlap on a phone. The photograph credit moves into the flow at the
 * foot of the hero there, and pulling the strip up sat it on top of the
 * credit. The overlap is a wide-screen flourish, not worth a collision.
 */
@media (max-width: 719px) { .deadline-wrap { margin-top: 14px; } }

/* --------------------------------------------- closing call to action */

.closing {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
}
.closing__text { flex: 1 1 20rem; }
.closing .btn-row { margin: 0; }

/* ------------------------------------------------ sticky action bar */
/*
 * On a phone the primary action scrolls away within a screen or two and
 * does not come back until the end of the page. This keeps it reachable.
 * Only on narrow screens, where the problem exists: on a wide screen the
 * hero buttons and the closing block are both usually in view.
 */

.action-bar { display: none; }

@media (max-width: 719px) {
  .action-bar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    gap: 10px;
    padding: 10px var(--gutter);
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid var(--line);
    box-shadow: 0 -2px 12px rgba(24, 34, 81, 0.1);
  }
  .action-bar .btn {
    flex: 1;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 12px;
  }
  /* Room for the bar, so it never covers the last line of the page. */
  .has-action-bar main { padding-bottom: 84px; }
  /* The drawer sits above everything; a floating bar over its backdrop
   * looks like part of the drawer and is not reachable anyway. */
  .drawer-open .action-bar { display: none; }
}

/* ------------------------------------------------- mobile refinements */

@media (max-width: 719px) {
  /* 56px top and bottom per section is a lot of empty screen on a phone,
   * and with eleven sections it was most of the scrolling. */
  .section { padding: 36px 0; }
  .section__head { margin-bottom: 22px; }

  .hero h1 { max-width: none; }
  .hero__lede { font-size: 1.02rem; margin-bottom: 22px; }
  /* Full-width stacked buttons: two half-width buttons side by side end
   * up with wrapped labels and small targets. */
  .hero .btn-row { display: grid; gap: 10px; }
  .hero .btn-row .btn {
    width: 100%;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* A four-by-two grid of square photographs is two screens of scrolling
   * for decoration. A swipe strip costs one row and says "there is more"
   * by cutting the next image off. */
  .gallery {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    /* Let the strip run to both edges rather than stopping at the
     * gutter, which reads as a deliberate strip rather than a clipped
     * grid. */
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
    padding-bottom: 6px;
  }
  .gallery figure {
    flex: 0 0 62%;
    scroll-snap-align: start;
  }
  .gallery img { aspect-ratio: 4 / 3; }

  .media-row + .media-row { margin-top: 32px; }
  .callout { padding: 20px; }
  .deadline { padding: 14px 16px; }
  .facility__body { padding: 18px; }
}

/* The gallery strip is a scroll container, so it needs to be reachable
 * and announced as one for anyone navigating by keyboard. */
.gallery:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* ------------------------------------------- split layout, sign-in etc */

.split { display: grid; gap: 0; }
@media (min-width: 900px) {
  .split { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 40px; }
}
.split__media {
  position: relative;
  display: none;
  min-height: 420px;
  border-radius: var(--radius-lg);
  overflow: hidden;
}
@media (min-width: 900px) { .split__media { display: block; } }
.split__media picture, .split__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.split__caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 20px;
  background: linear-gradient(
    180deg, rgba(15, 22, 54, 0) 0%, rgba(15, 22, 54, 0.92) 72%);
  color: #fff;
  font-size: 0.9rem;
}
.split__caption span { display: block; opacity: 0.8; font-size: 0.78rem; }

/* --------------------------------------------- banner on inside pages */

.page-banner {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
  background: var(--navy);
}
.page-banner picture, .page-banner img {
  width: 100%;
  height: 170px;
  object-fit: cover;
  display: block;
  opacity: 0.5;
}
.page-banner__text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 24px;
  color: #fff;
}
.page-banner__text h1 { color: #fff; margin: 0; font-size: 1.6rem; }
.page-banner__text p { color: #dde2f4; margin: 4px 0 0; max-width: 46ch; }

/* ------------------------------------------------- eligibility checker */

.check-question {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.check-question + .check-question { margin-top: 14px; }
.check-question__text { font-weight: 600; color: var(--navy); }
.check-question__guidance {
  font-size: 0.9rem;
  color: var(--ink-muted);
  margin: 6px 0 12px;
}
.check-options { display: flex; gap: 10px; flex-wrap: wrap; }
.check-options label {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  min-height: 44px;
}
.check-options label:hover { border-color: var(--blue); }
.check-options input:checked + span { font-weight: 700; color: var(--navy); }
