/* ==========================================================================
   Our Outstanding Department  (views/index.hbs, section.depts)

   Six programme cards on a cream band with the site's faint lattice. Each card:
   photo with an angled bottom edge, a navy number tab on its corner, a round
   icon badge sitting on the slant, serif title, teaser and a "Read more" link.
   The whole card is the link. Photos are only 370px wide, so they are shown at
   about that size (3 columns) and not stretched larger.
   ========================================================================== */

.depts {
    --navy: #111d42;
    --gold: #d1a24f;
    --gold-text: #8a6217;       /* gold dark enough to read as text on cream/white */
    --ink-soft: #4b5472;
    --cream: #f6f1e6;

    position: relative;
    padding: 100px 0 112px;
    overflow: hidden;
    background: var(--cream);
    font-family: 'Raleway', 'PT Sans', Arial, sans-serif;
}

/* faint lattice, strongest at the edges */
.depts::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%23d1a24f' stroke-opacity='.3'%3E%3Crect x='18' y='18' width='36' height='36'/%3E%3Crect x='18' y='18' width='36' height='36' transform='rotate(45 36 36)'/%3E%3Cpath d='M0 0l18 18M72 0L54 18M0 72l18-18M72 72L54 54'/%3E%3C/g%3E%3C/svg%3E");
    -webkit-mask-image: radial-gradient(ellipse at 50% 50%, transparent 35%, #000 100%);
    mask-image: radial-gradient(ellipse at 50% 50%, transparent 35%, #000 100%);
    opacity: .6;
    pointer-events: none;
}

.depts > .auto-container {
    position: relative;
}

.depts h2,
.depts h3,
.depts p {
    margin: 0;
    text-transform: none;
}


/* --------------------------------------------------------------------------
   Heading
   -------------------------------------------------------------------------- */

.depts__head {
    margin-bottom: 68px;
    text-align: center;
}

.depts__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .3em;
    text-transform: uppercase;
    color: var(--gold-text);
}

.depts__eyebrow::before,
.depts__eyebrow::after {
    content: "";
    flex: none;
    width: 7px;
    height: 7px;
    background: var(--gold);
    transform: rotate(45deg);
}

.depts__title {
    margin-top: 14px !important;
    font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
    font-size: clamp(30px, 3.4vw, 44px);
    font-weight: 700;
    line-height: 1.15;
    color: var(--navy);
}


/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */

.depts__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 44px 32px;
    counter-reset: dept;
}

.dept {
    position: relative;         /* anchors the whole-card link */
    display: flex;
    flex-direction: column;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 18px 40px rgba(17, 29, 66, .09);
    counter-increment: dept;
    transition: transform .35s ease, box-shadow .35s ease;
}

.dept__top {
    position: relative;
}

/* photo, its bottom edge sloping up to the right */
.dept__media {
    position: relative;
    overflow: hidden;
    aspect-ratio: 37 / 25;      /* the photos are 370 x 250 */
    border-radius: 6px 6px 0 0;
    background: #e6dec9;
    -webkit-clip-path: polygon(0 0, 100% 0, 100% calc(100% - 30px), 0 100%);
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 30px), 0 100%);
}

.dept__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .8s ease;
}

/* number tab on the photo's top-left corner */
.dept__no {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    padding: 10px 16px 9px;
    border-radius: 6px 0 6px 0;
    background: var(--navy);
    color: var(--gold);
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: .14em;
}

.dept__no::before {
    content: counter(dept, decimal-leading-zero);
}

/* round icon badge on the slant */
.dept__badge {
    position: absolute;
    right: 26px;
    bottom: -32px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: var(--navy);
    color: var(--gold);
    font-size: 24px;
    box-shadow: 0 10px 24px rgba(17, 29, 66, .25);
    pointer-events: none;       /* clicks go to the card link */
    transition: background-color .3s ease, color .3s ease;
}

.dept__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 34px 28px 30px;
}

.dept__title {
    margin-bottom: 12px !important;
    padding-right: 52px;        /* keep clear of the badge above */
    font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.28;
    color: var(--navy);
}

.dept__text {
    margin-bottom: 22px !important;
    font-size: 15px;
    line-height: 1.75;
    color: var(--ink-soft);
}

.dept__link {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;           /* links line up along the bottom of each row */
    padding-bottom: 5px;
    border-bottom: 2px solid var(--gold);
    color: var(--navy);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
    text-decoration: none;
    transition: gap .25s ease;
}

.dept__link:hover,
.dept__link:focus {
    color: var(--navy);
    text-decoration: none;
}

/* stretches the link over the whole card */
.dept__link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: 6px;
}

.dept__link:focus-visible {
    outline: none;
}

.dept__link:focus-visible::after {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
}

@media (hover: hover) {
    .dept:hover {
        transform: translateY(-8px);
        box-shadow: 0 30px 58px rgba(17, 29, 66, .16);
    }

    .dept:hover .dept__media img {
        transform: scale(1.06);
    }

    .dept:hover .dept__badge {
        background: var(--gold);
        color: var(--navy);
    }

    .dept:hover .dept__link {
        gap: 16px;
    }
}


/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 991px) {
    .depts {
        padding: 76px 0 84px;
    }

    .depts__head {
        margin-bottom: 52px;
    }

    .depts__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 40px 26px;
    }
}

@media (max-width: 575px) {
    .depts {
        padding: 60px 0 68px;
    }

    .depts__eyebrow {
        font-size: 11px;
        letter-spacing: .22em;
    }

    .depts__grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 40px;
        max-width: 440px;
        margin: 0 auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dept,
    .dept__media img,
    .dept__badge,
    .dept__link {
        transition: none;
    }
}
