/*  The public application portal.

    Its own stylesheet rather than additions to the theme: this is the only part of the
    system a stranger sees, it is the only place with no sidebar or topbar, and it is the
    one page that has to work on a cheap phone on mobile data. Keeping it separate means
    a change to the staff theme cannot quietly reshape the front door.

    Built mobile-first. Every layout rule starts from the narrow case and widens at a
    breakpoint, because that is the order most applicants will actually meet it in.
*/

:root {
    --apply-navy: #043C7B;
    --apply-navy-deep: #022A57;
    --apply-blue: #036CC4;
    --apply-green: #7ABC1B;
    --apply-ink: #1a2436;
    --apply-muted: #5b6779;
    --apply-line: #e4e8ef;
    --apply-surface: #ffffff;
    --apply-bg: #f4f6fa;
    --apply-radius: 18px;
    --apply-shadow: 0 10px 30px rgba(4, 60, 123, .08);
    --apply-shadow-lift: 0 18px 44px rgba(4, 60, 123, .16);
}

body.apply-body {
    background: var(--apply-bg);
    color: var(--apply-ink);
    -webkit-font-smoothing: antialiased;
}

.apply-shell { max-width: 1080px; margin: 0 auto; padding: 0 1.1rem; }
.apply-shell--narrow { max-width: 780px; }

/* ---------------------------------------------------------------- header */

.apply-topbar {
    background: var(--apply-navy);
    color: #fff;
    padding: .85rem 0;
    position: sticky;
    top: 0;
    z-index: 30;
    /* Sticky so "Apply now" is always one tap away however far down the page
       someone has read. */
    box-shadow: 0 2px 14px rgba(0, 0, 0, .18);
}
.apply-topbar a { color: #fff; text-decoration: none; }
.apply-topbar .apply-brand { color: #fff; display: flex; align-items: center; gap: .6rem; font-weight: 700; letter-spacing: -.01em; }
.apply-topbar .apply-nav { display: flex; align-items: center; gap: 1rem; font-size: .9rem; }
.apply-topbar .apply-nav a { opacity: .85; }
.apply-topbar .apply-nav a:hover { opacity: 1; }

/* ---------------------------------------------------------------- hero */

.apply-hero {
    background:
        radial-gradient(1100px 460px at 88% -10%, rgba(122, 188, 27, .30), transparent 60%),
        linear-gradient(140deg, var(--apply-navy) 0%, var(--apply-navy-deep) 55%, #01203f 100%);
    color: #fff;
    padding: 3rem 0 3.25rem;
    position: relative;
    overflow: hidden;
}
.apply-hero h1 {
    /*  Colour stated explicitly, not inherited. Bootstrap 5.3 sets
        h1-h6 { color: var(--bs-heading-color) }, which beats the white inherited from
        .apply-hero and renders the headline near-black on a navy background. */
    color: #fff;
    font-size: clamp(1.9rem, 5vw, 3.1rem);
    line-height: 1.08;
    font-weight: 800;
    letter-spacing: -.025em;
    margin-bottom: .85rem;
}
.apply-hero p.lead { color: rgba(255, 255, 255, .84); font-size: clamp(1rem, 2.2vw, 1.15rem); max-width: 34rem; }

.apply-eyebrow {
    display: inline-flex; align-items: center; gap: .45rem;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .2);
    color: #fff;
    padding: .35rem .8rem;
    border-radius: 999px;
    font-size: .78rem; font-weight: 600; letter-spacing: .02em;
    margin-bottom: 1.1rem;
}

.apply-cta { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.6rem; }
.btn-apply-primary {
    background: var(--apply-green); border: none; color: #10240a;
    font-weight: 700; padding: .8rem 1.6rem; border-radius: 12px;
    box-shadow: 0 10px 24px rgba(122, 188, 27, .34);
    transition: transform .12s ease, box-shadow .12s ease;
}
.btn-apply-primary:hover { color: #10240a; transform: translateY(-2px); box-shadow: 0 14px 30px rgba(122, 188, 27, .42); }
.btn-apply-ghost {
    background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .32); color: #fff;
    font-weight: 600; padding: .8rem 1.4rem; border-radius: 12px;
}
.btn-apply-ghost:hover { background: rgba(255, 255, 255, .18); color: #fff; }

/* --- the photo cluster ---------------------------------------------------
   A staggered set rather than one big photograph: it reads as a group of people
   rather than a single model, and it degrades to a neat 2x2 on a phone instead
   of one enormous face. */
.apply-faces { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; }
.apply-faces img {
    width: 100%; aspect-ratio: 1 / 1; object-fit: cover;
    border-radius: 16px;
    border: 3px solid rgba(255, 255, 255, .22);
    box-shadow: 0 14px 30px rgba(0, 0, 0, .28);
    background: #dfe6f1;
}
@media (min-width: 992px) {
    .apply-faces { grid-template-columns: repeat(2, 1fr); gap: .9rem; }
    /* Offset the second column so the cluster is not a rigid grid. */
    .apply-faces img:nth-child(2), .apply-faces img:nth-child(4) { transform: translateY(26px); }
}

/* ---------------------------------------------------------------- sections */

.apply-section { padding: 3rem 0; }
.apply-section h2 {
    color: var(--apply-ink);
    font-size: clamp(1.4rem, 3.4vw, 2rem); font-weight: 800;
    letter-spacing: -.02em; margin-bottom: .5rem;
}
.apply-section .section-sub { color: var(--apply-muted); max-width: 42rem; margin-bottom: 1.8rem; }

.apply-card {
    background: var(--apply-surface);
    border: 1px solid var(--apply-line);
    border-radius: var(--apply-radius);
    box-shadow: var(--apply-shadow);
    padding: 1.4rem;
    height: 100%;
    transition: transform .14s ease, box-shadow .14s ease;
}
.apply-card:hover { transform: translateY(-3px); box-shadow: var(--apply-shadow-lift); }

.apply-step-num {
    width: 40px; height: 40px; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(3, 108, 196, .1); color: var(--apply-blue);
    font-weight: 800; margin-bottom: .8rem;
}

.apply-icon {
    width: 44px; height: 44px; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.35rem; margin-bottom: .8rem;
}
.apply-icon--blue  { background: rgba(3, 108, 196, .1);  color: var(--apply-blue); }
.apply-icon--green { background: rgba(122, 188, 27, .14); color: #5d9110; }
.apply-icon--navy  { background: rgba(4, 60, 123, .09);   color: var(--apply-navy); }

/* --- programme cards ----------------------------------------------------- */

.programme-card { display: flex; flex-direction: column; gap: .55rem; }
.programme-card .programme-name { font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; }
.programme-card .programme-meta { color: var(--apply-muted); font-size: .875rem; }
.programme-card .programme-foot { margin-top: auto; padding-top: .9rem; }

.pill {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .25rem .65rem; border-radius: 999px;
    font-size: .76rem; font-weight: 600;
}
.pill--open   { background: rgba(122, 188, 27, .16); color: #4c7a0b; }
.pill--wait   { background: rgba(255, 171, 0, .16);  color: #a06d00; }
.pill--closing{ background: rgba(220, 53, 69, .1);   color: #b02a37; }

/* --- funding ------------------------------------------------------------- */

.funding-card { border-left: 4px solid var(--apply-line); }
.funding-card.is-seta   { border-left-color: var(--apply-blue); }
.funding-card.is-nsfas  { border-left-color: var(--apply-green); }
.funding-card.is-industry { border-left-color: #7c5cff; }
.funding-card.is-self   { border-left-color: #ffab00; }

/* --- band of photographs ------------------------------------------------- */

.apply-band {
    display: grid; gap: .6rem;
    grid-template-columns: repeat(3, 1fr);
}
@media (min-width: 768px) { .apply-band { grid-template-columns: repeat(6, 1fr); } }
.apply-band img {
    width: 100%; aspect-ratio: 1 / 1; object-fit: cover;
    border-radius: 14px; background: #dfe6f1;
    filter: saturate(1.02);
}

/* --- FAQ ----------------------------------------------------------------- */

.apply-faq .accordion-item { border: 1px solid var(--apply-line); border-radius: 14px !important; margin-bottom: .6rem; overflow: hidden; }
.apply-faq .accordion-button { font-weight: 600; }
.apply-faq .accordion-button:not(.collapsed) { background: rgba(3, 108, 196, .06); color: var(--apply-navy); box-shadow: none; }
.apply-faq .accordion-button:focus { box-shadow: none; border-color: var(--apply-line); }

/* --- closing call to action ---------------------------------------------- */

.apply-final {
    background: linear-gradient(135deg, var(--apply-navy) 0%, var(--apply-blue) 100%);
    border-radius: 22px; color: #fff; padding: 2.4rem 1.6rem; text-align: center;
}
.apply-final h2 { color: #fff; font-weight: 800; letter-spacing: -.02em; }

.apply-footer { color: var(--apply-muted); font-size: .85rem; padding: 2rem 0 2.5rem; }

/* The honeypot: positioned off-screen rather than display:none, because some bots
   skip hidden fields but happily fill positioned ones. Never shown to a person. */
.hp-field { position: absolute; left: -5000px; top: -5000px; width: 1px; height: 1px; overflow: hidden; }

/* Respect a reduced-motion preference - the lifts and transforms are decoration. */
@media (prefers-reduced-motion: reduce) {
    .apply-card, .btn-apply-primary { transition: none; }
    .apply-card:hover, .btn-apply-primary:hover { transform: none; }
    .apply-faces img:nth-child(2), .apply-faces img:nth-child(4) { transform: none; }
}

/* ================================================================= the form
   The application form itself. It shares the landing page's language - same
   navy, same radius, same shadow - so that arriving here does not feel like
   leaving the site. */

.apply-formhead {
    background: linear-gradient(140deg, var(--apply-navy) 0%, var(--apply-navy-deep) 100%);
    color: #fff;
    padding: 2rem 0 3.6rem;
}
.apply-formhead h1 {
    color: #fff;                 /* explicit: Bootstrap sets h1-h6 colour and would win */
    font-size: clamp(1.4rem, 3.4vw, 2.05rem);
    font-weight: 800; letter-spacing: -.02em; margin: .35rem 0 .4rem;
}
.apply-formhead .formhead-meta { color: rgba(255, 255, 255, .78); font-size: .92rem; }
.apply-formhead a { color: rgba(255, 255, 255, .8); text-decoration: none; font-size: .875rem; }
.apply-formhead a:hover { color: #fff; }

/* Lift the card up over the header band so the two read as one unit. */
.apply-formcard {
    background: var(--apply-surface);
    border: 1px solid var(--apply-line);
    border-radius: var(--apply-radius);
    box-shadow: var(--apply-shadow-lift);
    padding: 1.6rem;
    margin-top: -2.4rem;
}
@media (min-width: 768px) { .apply-formcard { padding: 2rem 2.2rem; } }

.form-section { padding-top: 1.6rem; }
.form-section:first-of-type { padding-top: .4rem; }
.form-section-title {
    display: flex; align-items: center; gap: .6rem;
    font-weight: 700; font-size: 1.02rem; letter-spacing: -.01em;
    margin-bottom: .2rem;
}
.form-section-title .step-dot {
    width: 26px; height: 26px; border-radius: 8px;
    background: rgba(3, 108, 196, .1); color: var(--apply-blue);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .8rem; font-weight: 800; flex: 0 0 auto;
}
.form-section-note { color: var(--apply-muted); font-size: .875rem; margin-bottom: 1rem; }

.apply-formcard .form-label { font-weight: 600; font-size: .875rem; margin-bottom: .35rem; }
.apply-formcard .form-control,
.apply-formcard .form-select {
    border-radius: 11px;
    border-color: #d8dee9;
    padding: .68rem .85rem;
    font-size: .97rem;
}
.apply-formcard .form-control:focus,
.apply-formcard .form-select:focus {
    border-color: var(--apply-blue);
    box-shadow: 0 0 0 .2rem rgba(3, 108, 196, .14);
}
.apply-formcard .form-text { font-size: .8rem; }

/* --- funding choices as selectable cards ---------------------------------
   The whole card is the target, not just the 12px radio. On a phone that is the
   difference between choosing first time and missing. */
.fund-option { position: relative; height: 100%; }
.fund-option input {
    position: absolute; opacity: 0; pointer-events: none;
}
.fund-option label {
    display: block; height: 100%; cursor: pointer;
    border: 2px solid var(--apply-line); border-radius: 14px;
    padding: .95rem 1rem .95rem 2.7rem;
    transition: border-color .12s ease, background-color .12s ease, box-shadow .12s ease;
}
.fund-option label::before {
    content: ""; position: absolute; left: 1rem; top: 1.15rem;
    width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid #c3ccda; background: #fff;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.fund-option label:hover { border-color: #c3d3e6; background: #fbfcfe; }
.fund-option input:checked + label {
    border-color: var(--apply-blue);
    background: rgba(3, 108, 196, .05);
    box-shadow: 0 6px 18px rgba(3, 108, 196, .12);
}
.fund-option input:checked + label::before {
    border-color: var(--apply-blue);
    box-shadow: inset 0 0 0 4px var(--apply-blue);
}
/* Keyboard users must be able to see where they are. */
.fund-option input:focus-visible + label { outline: 3px solid rgba(3, 108, 196, .35); outline-offset: 2px; }

.fund-option .fund-name { font-weight: 700; display: block; margin-bottom: .15rem; }
.fund-option .fund-note { color: var(--apply-muted); font-size: .84rem; display: block; }

/* --- submit --------------------------------------------------------------- */

.apply-submitbar {
    display: flex; flex-wrap: wrap; gap: .7rem; align-items: center;
    border-top: 1px solid var(--apply-line);
    margin-top: 1.8rem; padding-top: 1.3rem;
}
.apply-submitbar .btn-apply-primary { padding: .8rem 1.8rem; }
.apply-reassure { color: var(--apply-muted); font-size: .82rem; }

/* --- the confirmation ----------------------------------------------------- */

.apply-done { text-align: center; padding: 1.5rem .5rem 1rem; }
.apply-done .done-mark {
    width: 76px; height: 76px; border-radius: 50%;
    background: rgba(122, 188, 27, .14); color: #5d9110;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 2.4rem; margin-bottom: 1rem;
}
.apply-ref {
    display: inline-block;
    background: var(--apply-bg); border: 1px dashed #b9c4d6;
    border-radius: 12px; padding: .7rem 1.4rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 1.35rem; font-weight: 700; letter-spacing: .04em;
    color: var(--apply-navy);
}
.apply-warnbox {
    background: rgba(255, 171, 0, .1);
    border: 1px solid rgba(255, 171, 0, .3);
    border-radius: 12px; padding: .8rem 1rem;
    font-size: .875rem; color: #7a5200; text-align: left;
}
