/*
MRings: Blocks
Custom sections from blocks/, the break-out utilities they share, and the core block overrides.
Loaded everywhere, after style.css.
*/

/* Break-outs. A section escapes .page-content or .page-xl to the viewport edge; html clips the scrollbar overflow. */
.full-bleed,
.page-content .alignfull,
.page-xl .alignfull {
    width: 100vw;
    max-width: none;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

.page-content .alignwide,
.page-xl .alignwide {
    width: min(100vw - 2 * var(--mr-gutter), var(--mr-wide));
    max-width: none;
    margin-left: calc(50% - min(50vw - var(--mr-gutter), var(--mr-wide) / 2));
    margin-right: calc(50% - min(50vw - var(--mr-gutter), var(--mr-wide) / 2));
}

/* Core blocks: square, flat, on the theme's lines. */
.wp-block-image img,
.wp-block-cover,
.wp-block-cover__image-background,
.wp-block-media-text__media img,
.wp-block-group,
.wp-block-columns {
    border-radius: 0;
}

.wp-block-separator {
    border: none;
    border-top: 1px solid var(--mr-line-color);
    margin: 2.5rem auto;
}

.wp-block-separator:not(.is-style-wide):not(.is-style-dots) {
    width: 6rem;
}

.wp-block-quote,
.page-content .wp-block-quote {
    margin: 2rem 0;
    padding-left: 1.25rem;
    border-left: 3px solid var(--mr-accent-color);
    font-style: italic;
}

.wp-block-quote cite {
    display: block;
    margin-top: 0.75rem;
    font-family: var(--mr-font-heading);
    font-weight: 700;
    font-size: 0.75rem;
    font-style: normal;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--mr-muted-color);
}

.wp-block-pullquote {
    border-top: 3px solid var(--mr-accent-color);
    border-bottom: 3px solid var(--mr-accent-color);
    padding: 2rem 0;
}

.wp-block-table td,
.wp-block-table th {
    border: 1px solid var(--mr-line-color);
    padding: 0.6rem 0.8rem;
}

.wp-block-table th {
    font-family: var(--mr-font-heading);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-align: left;
}

/* The core Search block borrows the theme's form frame. */
.wp-block-search__input {
    border: 3px solid var(--mr-accent-color);
    border-radius: 0;
    padding: 0.6rem 0.9rem;
}

.wp-block-search__button {
    border-radius: 0;
}

/* blocks/cta.php. */
/* Placed last from the editor, the panel runs flush into the footer rather than floating above it. */
.page-main:has(> .page-content > .cta:last-child),
.page-main:has(> .canvas > .cta:last-child) {
    padding-bottom: 0;
}

.cta {
    padding-block: clamp(3rem, 6vw, 5rem);
    background-color: var(--mr-panel-color);
}

.cta-inner {
    text-align: center;
}

.page-content .cta-heading,
.cta-heading {
    font-size: clamp(1.6rem, 3.4vw, 2.5rem);
    line-height: 1.08;
    margin: 0 0 1rem;
}

.page-content .cta-body,
.cta-body {
    max-width: 46ch;
    margin: 0 auto 2rem;
    line-height: 1.7;
}

.cta-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.75rem;
}

.page-content .cta-meta,
.cta-meta {
    margin: 0;
    font-size: 0.8rem;
    color: var(--mr-muted-color);
}

/* Measured: a call and an email button need 437px, so they wrap below a 485px viewport inside .page-l. */
@media (max-width: 30.5rem) {
    .cta-actions .btn {
        width: 100%;
        box-sizing: border-box;
    }
}

/* blocks/feature.php. */
.feature {
    padding-block: clamp(3rem, 6vw, 5rem);
}

.feature-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
}

.feature-content,
.feature-visual {
    flex: 1 1 50%;
    min-width: 0;
    width: 100%;
}

.page-content .feature-heading,
.feature-heading {
    font-size: clamp(1.6rem, 3.4vw, 2.5rem);
    line-height: 1.08;
    margin: 0 0 1.25rem;
}

.feature-body {
    max-width: 52ch;
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.feature-body > :last-child {
    margin-bottom: 0;
}

.feature-link {
    display: inline-block;
    font-family: var(--mr-font-heading);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.8rem;
}

.feature-img {
    display: block;
    width: 100%;
    height: auto;
}

/* Holds the space until an image is chosen; it reads as a gap, not a broken image. */
.feature-placeholder {
    aspect-ratio: 4 / 3;
    border: 3px dashed var(--mr-line-color);
    background-color: var(--mr-bg-color);
}

@media (min-width: 48rem) {
    .feature-grid {
        flex-direction: row;
        gap: 4rem;
    }

    .feature--right .feature-grid {
        flex-direction: row-reverse;
    }
}

/* blocks/posts.php. */
.posts-section {
    padding-block: clamp(2rem, 4vw, 3rem);
}

.posts-section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem 2rem;
    margin-bottom: 2rem;
}

.posts-section-heading {
    font-size: clamp(1.6rem, 3.4vw, 2.5rem);
    line-height: 1.1;
}

.posts-section-more {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    font-family: var(--mr-font-heading);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-decoration: none;
}

.posts-section-empty {
    padding: 2rem;
    border: 1px solid var(--mr-line-color);
    color: var(--mr-muted-color);
}

/* blocks/litter-map.php. */
.litter-map {
    padding-block: clamp(1rem, 3vw, 2rem) clamp(3rem, 6vw, 5rem);
}

/* The figure first in the DOM for screen readers ("Shifts: 2"), the numeral on top visually. */
.litter-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    margin: 0 0 clamp(1.5rem, 3vw, 2.5rem);
    border-top: 1px solid var(--mr-line-color);
    border-left: 1px solid var(--mr-line-color);
}

.litter-stat {
    display: flex;
    flex-direction: column-reverse;
    justify-content: flex-end;
    gap: 0.35rem;
    padding: 1.25rem 1.25rem 1.1rem;
    border-right: 1px solid var(--mr-line-color);
    border-bottom: 1px solid var(--mr-line-color);
}

.litter-stat dt {
    font-family: var(--mr-font-heading);
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--mr-muted-color);
}

.litter-stat dd {
    margin: 0;
    font-family: var(--mr-font-heading);
    font-weight: 900;
    font-size: clamp(2rem, 5vw, 3.25rem);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.litter-map-figure {
    margin: 0;
}

/* Portrait on phones, where the campus is taller than it is wide; landscape from tablet up. */
.litter-map-frame {
    position: relative;
    aspect-ratio: 4 / 5;
    background-color: var(--mr-map-land-color);
    border: 1px solid var(--mr-line-color);
    overflow: hidden;
}

/* Routes over the campus basemap. The SVG is clipped by its box, not its viewBox, so the basemap fills
   whatever room the frame's shape leaves around the routes. */
.litter-map-svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--mr-map-land-color);
}

.litter-map-route path {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
    transition: stroke-opacity 250ms ease, stroke-width 250ms ease;
}

/* A wide blurred stroke under each route: the same bleed the heatmap has on the live map. */
.litter-map-bleed .litter-map-route path {
    stroke: var(--mr-heat-3-color);
    stroke-width: 9;
    stroke-opacity: 0.4;
}

.litter-map-line .litter-map-route path {
    stroke: var(--mr-heat-4-color);
    stroke-width: 2;
    stroke-opacity: 0.95;
}

.litter-map-svg.has-active .litter-map-route path {
    stroke-opacity: 0.08;
}

.litter-map-svg.has-active .litter-map-line .litter-map-route.is-active path {
    stroke-opacity: 1;
    stroke-width: 3.5;
}

.litter-map-svg.has-active .litter-map-bleed .litter-map-route.is-active path {
    stroke-opacity: 0.45;
}

/* The heat key: the scale from one shift to ten or more, labelled in words at each end. */
.heat-legend {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--mr-font-heading);
    font-weight: 700;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--mr-muted-color);
    white-space: nowrap;
}

.heat-legend-bar {
    width: 7rem;
    height: 0.5rem;
    background: linear-gradient(to right, var(--mr-heat-2-color), var(--mr-heat-3-color), var(--mr-heat-4-color), var(--mr-heat-5-color));
}

.basemap-credit {
    margin: 0;
    font-size: 0.75rem;
    color: var(--mr-muted-color);
}

.basemap-credit a {
    color: inherit;
}

/* Google credits its own map; ours is only needed while the cached basemap is what shows. */
.litter-map-figure:has(.litter-map-frame.is-live) .basemap-credit {
    display: none;
}

.litter-map-canvas {
    position: absolute;
    inset: 0;
}

/* Laid out from the start but shown only once its tiles have arrived; the SVG holds the space until then. */
.litter-map-frame:not(.is-live) .litter-map-canvas {
    visibility: hidden;
}

.litter-map-frame.is-live .litter-map-svg {
    visibility: hidden;
}

.litter-map-heat {
    position: absolute;
    pointer-events: none;
}

.litter-map-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem 2rem;
    padding-top: 1rem;
}

.litter-map-caption {
    max-width: 38rem;
    margin: 0;
    font-size: 0.9rem;
    color: var(--mr-muted-color);
}

.litter-map-bar .heat-legend {
    align-self: center;
}

.litter-map-modes {
    display: flex;
    gap: 0.75rem;
}

.litter-map-modes[hidden] {
    display: none;
}

/* The pressed view reads filled, the other outlined: state shown by more than colour, via aria-pressed. */
.litter-map-modes .btn[aria-pressed="true"] {
    background-color: var(--mr-accent-color);
    color: var(--mr-bg-color);
}

/* The global button inverts on focus, which would make both views look pressed after a click. */
.litter-map-modes .btn[aria-pressed="false"]:focus {
    background-color: var(--mr-bg-color);
    color: var(--mr-text-color);
}

.shift-log {
    margin-top: clamp(3rem, 6vw, 4.5rem);
}

.shift-log-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem 2rem;
    margin-bottom: 1.5rem;
}

.shift-log-heading {
    font-size: clamp(1.6rem, 3.4vw, 2.5rem);
    line-height: 1.1;
}

.shift-log-follow,
.shift-log-list,
.shift-entry-photos {
    list-style: none;
    margin: 0;
    padding: 0;
}

.shift-log-follow {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.shift-entry {
    display: grid;
    gap: 1rem 3rem;
    padding-block: 1.75rem;
    border-top: 1px solid var(--mr-line-color);
    scroll-margin-top: 6rem;
}

.shift-entry:last-child {
    border-bottom: 1px solid var(--mr-line-color);
}

.shift-entry-title {
    font-size: 1.25rem;
    line-height: 1.2;
}

.shift-entry-meta {
    margin: 0.5rem 0 0;
    font-family: var(--mr-font-heading);
    font-weight: 500;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    color: var(--mr-muted-color);
}

.shift-entry-items,
.shift-entry-note {
    margin: 0 0 1rem;
    max-width: 60ch;
}

.shift-entry-photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.shift-entry-photos a {
    display: block;
}

.shift-entry-photos img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

/* Equal tracks, so however the row breaks every button is the same size; one full-width column when narrow. */
.shift-entry-actions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 1fr));
    gap: 0.5rem;
}

.shift-entry-actions > * {
    justify-content: center;
    text-align: center;
}

@media (max-width: 767px) {
    .shift-entry-actions {
        grid-template-columns: 1fr;
    }
}

/* Secondary chips: the 2px line frame of the blog filter, at the 44px target. */
.shift-entry-show,
.shift-entry-link,
.shift-log-follow a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0.35rem 1rem;
    box-sizing: border-box;
    font-family: var(--mr-font-heading);
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-decoration: none;
    color: var(--mr-text-color);
    background-color: var(--mr-bg-color);
    border: 2px solid var(--mr-line-color);
    transition:
        background-color 200ms ease,
        border-color 200ms ease,
        color 200ms ease;
}

.shift-entry-show:hover,
.shift-entry-show:focus,
.shift-entry-link:hover,
.shift-log-follow a:hover {
    background-color: var(--mr-bg-color);
    color: var(--mr-text-color);
    border-color: var(--mr-accent-color);
}

.shift-entry-show[aria-pressed="true"] {
    background-color: var(--mr-accent-color);
    color: var(--mr-bg-color);
    border-color: var(--mr-accent-color);
}

/* Highlighting needs the script; without it the button would do nothing. */
html:not(.js) .shift-entry-show {
    display: none;
}

@media (max-width: 47.99rem) {
    .litter-stats {
        grid-template-columns: 1fr 1fr;
    }

    .litter-stat:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }
}

@media (min-width: 48rem) {
    .litter-map-frame {
        aspect-ratio: 16 / 10;
    }

    .shift-entry {
        grid-template-columns: minmax(14rem, 1fr) 2fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .litter-map-route path {
        transition: none;
    }
}

/* blocks/shifts.php. */
/* The season's totals in one row under the heading: plain figures, no frame. */
.shift-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem clamp(2rem, 5vw, 4rem);
    margin: -0.5rem 0 2rem;
}

.shift-stat {
    display: flex;
    flex-direction: column-reverse;
    gap: 0.3rem;
}

.shift-stat dt {
    font-family: var(--mr-font-heading);
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--mr-muted-color);
}

.shift-stat dd {
    margin: 0;
    font-family: var(--mr-font-heading);
    font-weight: 900;
    font-size: clamp(1.8rem, 3.6vw, 2.5rem);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

/* Three across on phones, so five figures wrap three over two and never leave one stranded. */
@media (max-width: 30rem) {
    .shift-stats {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        column-gap: 1rem;
    }
}

/* One column on phones, three from tablets up, so the home page's three cards fill one row. */
.shift-cards {
    display: grid;
    margin-bottom: 0.75rem;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 48rem) {
    .shift-cards {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.shift-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--mr-line-color);
}

.shift-card-visual {
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-bottom: 1px solid var(--mr-line-color);
}

.shift-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 1.25rem 1.25rem 1.5rem;
}

.shift-card-title {
    font-size: 1.15rem;
    line-height: 1.2;
}

.shift-card-items,
.shift-card-note {
    margin: 0.75rem 0 0;
}

.shift-card .shift-entry-actions {
    margin-top: auto;
    padding-top: 1.25rem;
}

/* Home page groups, set from the editor's Additional CSS class field. */
.home-intro {
    max-width: 46rem;
    padding-block: clamp(3rem, 8vw, 6.5rem) clamp(1.5rem, 4vw, 3rem);
}

.home-intro h1 {
    font-size: clamp(2.4rem, 7vw, 5rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.01em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

.home-intro p {
    font-size: 1.125rem;
    line-height: 1.6;
    max-width: 38rem;
}

.home-about {
    max-width: 46rem;
    padding-block: clamp(2.5rem, 5vw, 4rem) clamp(3rem, 6vw, 5rem);
    border-top: 1px solid var(--mr-line-color);
}

.home-about h2 {
    font-size: clamp(1.6rem, 3.4vw, 2.5rem);
    margin-bottom: 1rem;
}
