/* Ongoing Projects. Every colour here resolves to a token from style.css:
   --primary-color for the eyebrow/number/dot, --logo-color for headings, and two mixes
   of --secondary-color for the panel fill and hairline. */
.ongoing-page {
    /* style.css gives .full-page a left-only pad under 767px, which would knock the
       full-bleed rows off centre. */
    padding-left: 0;

    /* Each pair is a plain fallback followed by the mix, so a browser without
       color-mix still lands on an established colour. */
    --ongoing-panel: var(--secondary-color);
    --ongoing-panel: color-mix(in srgb, var(--secondary-color) 55%, #fff);
    --ongoing-line: var(--secondary-color);
    --ongoing-line: color-mix(in srgb, var(--secondary-color) 70%, #fff);
}

/* ---------- header ---------- */
.ongoing-header {
    padding: 3.5rem 3rem 3rem;
}

.ongoing-eyebrow {
    margin: 0 0 1rem;
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--primary-color);
}

/* Stated explicitly because style.css sets a global h2 { font-weight: 400 }. */
.ongoing-title {
    margin: 0;
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -.01em;
    color: var(--logo-color);
}

.ongoing-intro {
    margin: 1.25rem 0 0;
    max-width: 46ch;
    font-size: 1.05rem;
    font-weight: 300;
    line-height: 1.6;
    color: #6c757d;
}

/* ---------- row ---------- */
.ongoing-row {
    display: grid;
    grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
    align-items: stretch;
    border-top: 1px solid var(--ongoing-line);
}

/* The image always sits on the right, so text and media keep a fixed column each.
   Stated rather than left to auto placement because the mobile rules below invert
   the pair, and an explicit start is easier to override than an implicit one. */
.ongoing-body {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2.75rem 3rem;
}

.ongoing-index {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: 0 0 1rem;
}

.ongoing-num {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--primary-color);
    opacity: .65;
}

.ongoing-rule {
    width: 32px;
    height: 2px;
    background-color: var(--secondary-color);
}

.ongoing-name {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1.3;
    color: var(--logo-color);
}

.ongoing-meta {
    margin-top: 1.25rem;
}

.ongoing-client {
    margin: 0;
    font-size: .95rem;
    font-weight: 600;
    color: var(--logo-color);
}

.ongoing-loc {
    margin: .4rem 0 0;
    font-size: .9rem;
    font-weight: 300;
    color: #6c757d;
}

.ongoing-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: .55rem;
    border-radius: 50%;
    vertical-align: middle;
    background-color: var(--primary-color);
    opacity: .7;
}

/* ---------- media panel ---------- */
.ongoing-media {
    grid-column: 2;
    grid-row: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 260px;
    overflow: hidden;
    background-color: var(--ongoing-panel);
}

/* Landscape runs edge to edge, so it is taken out of flow and told to fill the
   panel however tall the text half happens to make it. */
.ongoing-row--landscape .ongoing-media picture {
    position: absolute;
    inset: 0;
    display: block;
}

.ongoing-row--landscape .ongoing-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Portrait and logo float on the panel instead of filling it. The panel floor is
   the image cap plus both pads, so a tall cover is never squeezed by its own frame. */
.ongoing-row--portrait .ongoing-media {
    min-height: 340px;
    padding: 2.5rem;
}

.ongoing-row--portrait .ongoing-media img {
    max-width: 100%;
    max-height: 260px;
    width: auto;
    object-fit: contain;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .12);
}

.ongoing-row--logo .ongoing-media {
    padding: 2rem;
    background-color: var(--secondary-color);
    background-color: color-mix(in srgb, var(--secondary-color) 28%, #fff);
}

.ongoing-row--logo .ongoing-media img {
    max-width: 180px;
    max-height: 90px;
    object-fit: contain;
}

/* ---------- click to zoom ---------- */
.ongoing-media.is-zoomable img {
    cursor: zoom-in;
}

/* Sits above the slide but below the chevrons' hit areas, which run down both edges. */
.ongoing-zoom {
    position: absolute;
    top: .75rem;
    right: .75rem;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    font-size: .8rem;
    color: var(--logo-color);
    background-color: rgba(255, 255, 255, .85);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
    opacity: 0;
    transition: opacity var(--dur-base) var(--ease-standard),
                background-color var(--dur-fast) var(--ease-standard);
}

/* Hidden until the panel is approached, so a column of rows is not peppered with badges.
   :focus-within covers the keyboard route -- the button is the only focusable thing in the
   panel, so tabbing to it has to be what reveals it. */
.ongoing-media:hover .ongoing-zoom,
.ongoing-media:focus-within .ongoing-zoom {
    opacity: 1;
}

.ongoing-zoom:hover,
.ongoing-zoom:focus-visible {
    background-color: #fff;
    color: var(--primary-color);
}

/* Touch has no hover to reveal it, and the tap target needs to be a real one. */
@media (hover: none) {
    .ongoing-zoom {
        width: 2.4rem;
        height: 2.4rem;
        opacity: 1;
    }
}

/* ---------- carousel (two or more images) ---------- */
/* A row with one image renders the bare <picture>/<img> and none of this applies. The
   rules below only re-establish the panel geometry through the extra Bootstrap wrappers,
   so a carousel sits in exactly the box a lone image would have. */
.ongoing-carousel {
    width: 100%;
}

/* Landscape fills the panel, so the whole chain has to inherit its height or the
   absolutely positioned <picture> above collapses the item to nothing. */
.ongoing-row--landscape .ongoing-media .ongoing-carousel {
    position: absolute;
    inset: 0;
}

.ongoing-row--landscape .ongoing-media .carousel-inner,
.ongoing-row--landscape .ongoing-media .carousel-item {
    height: 100%;
}

/* Portrait floats its cover on the panel instead. Bootstrap sets display:block on the
   three slides it keeps visible, so all three are re-centred -- covering only .active
   would drop the outgoing and incoming slides to the left edge mid-transition. */
.ongoing-row--portrait .ongoing-carousel .carousel-item.active,
.ongoing-row--portrait .ongoing-carousel .carousel-item-next,
.ongoing-row--portrait .ongoing-carousel .carousel-item-prev {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Matches the image cap below, so a short cover does not shrink the panel the taller
   slide beside it just filled. */
.ongoing-row--portrait .ongoing-carousel .carousel-item {
    min-height: 260px;
}

/* ---------- carousel controls ---------- */
/* Bootstrap's carousel-control-*-icon is a white SVG and the panel behind it is pale, so
   the template swaps in bi chevrons and they are coloured here. */
.ongoing-carousel-nav {
    width: 3rem;
    opacity: .55;
    font-size: 1.6rem;
    color: var(--logo-color);
    transition: opacity var(--dur-base) var(--ease-standard);
}

.ongoing-carousel-nav:hover,
.ongoing-carousel-nav:focus-visible {
    opacity: 1;
    color: var(--logo-color);
}

/* Landscape covers the panel edge to edge, so the chevrons sit on the photo rather than
   the panel fill and need their own backing to stay legible on a light image. */
.ongoing-row--landscape .ongoing-carousel-nav {
    color: #fff;
    text-shadow: 0 1px 6px rgba(0, 0, 0, .55);
}

.ongoing-carousel-dots {
    margin-bottom: .75rem;
}

.ongoing-carousel-dots button {
    width: 8px;
    height: 8px;
    margin: 0 4px;
    border: 0;
    border-radius: 50%;
    background-color: var(--logo-color);
    opacity: .35;
    transition: opacity var(--dur-fast) var(--ease-standard);
}

.ongoing-carousel-dots button.active {
    opacity: 1;
    background-color: var(--primary-color);
}

.ongoing-row--landscape .ongoing-carousel-dots button {
    background-color: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
}

.ongoing-row--landscape .ongoing-carousel-dots button.active {
    background-color: var(--secondary-color);
}

/* Sits inside the panel rather than over the row, and clears the dots below it. */
.ongoing-slide-caption {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    margin: 0;
    padding: 2.25rem 1.25rem 2rem;
    font-size: .85rem;
    font-weight: 300;
    line-height: 1.4;
    text-align: center;
    color: #fff;
    background: linear-gradient(to top, rgba(0, 0, 0, .65), rgba(0, 0, 0, 0));
}

/* A caption on a floating portrait cover has no photo under it to darken, so it reads as
   plain text on the panel instead of a gradient over nothing. */
.ongoing-row--portrait .ongoing-slide-caption {
    padding: 0 1.25rem 1.75rem;
    color: var(--logo-color);
    background: none;
}

/* The slide transition is decoration; the dots and chevrons still work without it. */
@media (prefers-reduced-motion: reduce) {
    .ongoing-carousel .carousel-item {
        transition: none;
    }
}

/* ---------- plain row (no image) ---------- */
/* A normal row minus the media panel, and nothing else: it keeps the same hairline and
   inherits every colour from the base rules above, so it reads as one more entry in the
   list rather than a slab interrupting it. Only the layout differs, because the text has
   the full width to itself and the meta moves out to the right. */
.ongoing-row--plain {
    grid-template-columns: minmax(0, 1fr);
}

.ongoing-row--plain .ongoing-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 2.5rem;
    align-items: center;
}

.ongoing-row--plain .ongoing-index {
    grid-column: 1;
    grid-row: 1;
}

/* Smaller than a row that has an image: there is nothing beside it for a full size title
   to balance against. */
.ongoing-row--plain .ongoing-name {
    grid-column: 1;
    grid-row: 2;
    font-size: 1.1rem;
}

.ongoing-row--plain .ongoing-meta {
    grid-column: 2;
    grid-row: 1 / span 2;
    margin-top: 0;
    text-align: right;
}

/* ---------- tablet: alternation kept, proportions tightened ---------- */
@media (max-width: 991px) {
    .ongoing-header {
        padding: 2.5rem 2rem 2rem;
    }

    .ongoing-title {
        font-size: 2.5rem;
    }

    .ongoing-intro {
        font-size: .95rem;
    }

    .ongoing-body {
        padding: 1.75rem 1.5rem;
    }

    .ongoing-name {
        font-size: 1.15rem;
    }

    .ongoing-row--plain .ongoing-name {
        font-size: 1rem;
    }

    .ongoing-media {
        min-height: 220px;
    }

    .ongoing-row--portrait .ongoing-media {
        min-height: 280px;
        padding: 1.75rem;
    }

    .ongoing-row--portrait .ongoing-media img {
        max-height: 200px;
    }

    /* Tracks the image cap above, for the same reason as at full width. */
    .ongoing-row--portrait .ongoing-carousel .carousel-item {
        min-height: 200px;
    }

    .ongoing-row--logo .ongoing-media img {
        max-width: 140px;
        max-height: 70px;
    }
}

/* ---------- mobile: one column, image above the text ---------- */
@media (max-width: 767px) {
    .ongoing-header {
        padding: 2rem 1.25rem 1.75rem;
    }

    .ongoing-row,
    .ongoing-row--plain .ongoing-body {
        grid-template-columns: minmax(0, 1fr);
    }

    /* Overrides both side modifiers at once, so every row reads top down. The
       imageless row is excluded: it has no media child and would otherwise be pushed
       into a second track behind an empty first one. */
    .ongoing-row:not(.ongoing-row--plain) .ongoing-media {
        grid-column: 1;
        grid-row: 1;
    }

    .ongoing-row:not(.ongoing-row--plain) .ongoing-body {
        grid-column: 1;
        grid-row: 2;
    }

    .ongoing-row .ongoing-body {
        padding: 1.5rem 1.25rem;
    }

    .ongoing-media {
        min-height: 0;
    }

    .ongoing-row--landscape .ongoing-media {
        aspect-ratio: 16 / 9;
    }

    .ongoing-row--portrait .ongoing-media,
    .ongoing-row--logo .ongoing-media {
        min-height: 0;
        padding: 1.5rem;
    }

    .ongoing-row--portrait .ongoing-media img {
        max-height: 160px;
    }

    .ongoing-row--portrait .ongoing-carousel .carousel-item {
        min-height: 160px;
    }

    /* Narrow panels give the chevrons less to sit beside, so they are pulled in and the
       caption's padding comes down with them. */
    .ongoing-carousel-nav {
        width: 2.25rem;
        font-size: 1.25rem;
        opacity: .8;
    }

    .ongoing-slide-caption {
        padding: 1.75rem .75rem 1.5rem;
        font-size: .78rem;
    }

    .ongoing-row--portrait .ongoing-slide-caption {
        padding: 0 .75rem 1.25rem;
    }

    /* The band loses its second column with everything else. */
    .ongoing-row--plain .ongoing-index,
    .ongoing-row--plain .ongoing-name,
    .ongoing-row--plain .ongoing-meta {
        grid-column: 1;
        grid-row: auto;
        text-align: left;
    }

    .ongoing-row--plain .ongoing-meta {
        margin-top: 1rem;
    }
}

@media (max-width: 560px) {
    .ongoing-title {
        font-size: 2rem;
    }

    .ongoing-intro {
        font-size: small;
    }

    .ongoing-name {
        font-size: 1.05rem;
    }

    .ongoing-row--plain .ongoing-name {
        font-size: .95rem;
    }

    .ongoing-client {
        font-size: small;
    }

    .ongoing-loc {
        font-size: smaller;
    }

    .ongoing-slide-caption {
        font-size: smaller;
    }
}
