/*
   ASAP v2 - the network: UK map, directory, society pages
   Layered on dir-c.css, so it inherits the print-room language:
   newsprint stock, heavy rules, Anton display, Space Mono body.
*/

/* Sub hero */
.hero--sub { padding-block: clamp(var(--space-5), 6vw, var(--space-7)) var(--space-6); }
.hero--sub h1 {
    font-size: clamp(2.6rem, 9vw, 6.5rem);
    max-width: 16ch;
}

/* UK map
   A real coastline, not a sketch: Natural Earth 50m, projected
   equidistant cylindrical at 54.5N and simplified. The simplification
   is deliberate as well as practical, since a cut-paper coastline is
   what a screenprinted map looks like.
*/
.soc-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-6);
    align-items: start;
}
.ukmap {
    margin: 0;
    border: 3px solid var(--c-ink);
    background: var(--c-bg);
    padding: var(--space-3);
    position: relative;          /* the campus chooser is placed against this */
}

/*
   Desktop: map on the left, sticky; directory scrolling past it.

   This block MUST stay below the base .ukmap rule. It used to sit
   above it, and when `position: relative` was later added to the base
   rule for the chooser anchor, the two rules tied on specificity and
   the later one won: the map stopped being sticky, and `top: 104px`
   silently became a 104px downward nudge on a relative element. The
   symptom was a 4,000px column of empty page beside the directory,
   because the map scrolled away at the top and nothing replaced it.

   The directory takes the larger share. At an even split the campus
   cards were 277px wide and "City St George's, University of London"
   wrapped over four lines.
*/
@media (min-width: 1000px) {
    .soc-layout {
        grid-template-columns: minmax(320px, 0.82fr) 1.18fr;
        gap: var(--space-6);
    }
    .ukmap {
        position: sticky;
        top: 104px;
    }
    /* The map has to fit the viewport while it is stuck. At full width it
       renders about 890px tall, so on a 800px laptop window the southern
       half of the country, London included, sat permanently below the fold
       and could not be scrolled to: the sticky element does not move. That
       is why the map could not be used. Capping the height costs nothing now
       that pin size no longer follows the map. */
    .ukmap svg {
        max-height: calc(100vh - 200px);
        width: auto;
        margin-inline: auto;
    }
}
.ukmap svg { width: 100%; height: auto; display: block; }

.ukmap__land {
    fill: var(--c-bg-2);
    stroke: var(--c-ink);
    stroke-width: 2;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.ukmap__hit { fill: transparent; }

/* The map prints in behind its frame.

   The shared .wipe class cannot be used here. It clips the element to zero
   width, and an element clipped to zero area is never reported as
   intersecting, so the observer watching it to add .is-in never fires and
   the map stays invisible for good. Verified in the browser: with the clip
   removed the observer reports isIntersecting true immediately, with it in
   place the intersection rectangle is 0x0. So the frame stays unclipped and
   observable, and the drawing inside it is what wipes. */
.ukmap--wipe .ukmap__landg,
.ukmap--wipe .ukmap__labels {
    clip-path: inset(0 100% 0 0);
    transition: clip-path 0.9s var(--e-out);
}
.ukmap--wipe.is-in .ukmap__landg,
.ukmap--wipe.is-in .ukmap__labels { clip-path: inset(0 0 0 0); }
@media (prefers-reduced-motion: reduce) {
    .ukmap--wipe .ukmap__landg,
    .ukmap--wipe .ukmap__labels { transition: none; clip-path: inset(0 0 0 0); }
}

/* The pins
   A teardrop pin. It is drawn in
   its own local space and placed by a transform, so map.js can hold it
   at a constant size on screen however small the map renders. The old
   dots scaled with the map, fell under the 24px target floor on a
   normal laptop window, and switched themselves off, which is why the
   map was not selectable.
*/
.ukmap__pin {
    transform-box: view-box;
    cursor: pointer;
}
.ukmap__pin a { cursor: pointer; }

.ukmap__pin-shadow { fill: rgba(56, 0, 0, 0.3); }
.ukmap__pin-body {
    fill: var(--c-accent);
    stroke: var(--c-ink);
    stroke-width: 1.5;
    vector-effect: non-scaling-stroke;
}
.ukmap__pin-head {
    fill: var(--c-bg);
    stroke: var(--c-ink);
    stroke-width: 1.2;
    vector-effect: non-scaling-stroke;
}
/* More than one campus: the head fills in with ink, so the difference
   is not carried by size alone. Ink, not the second plate: both plates
   are reds, and a Dark Red head on a Vivid Red pin is 2.13:1, too close
   to read. Maroon against it is 3.01:1 and Cream 5.51:1. */
.ukmap__pin--major .ukmap__pin-head { fill: var(--c-ink); }

/* Hover and focus lift the pin off the map. The art is
   what moves, not the group, because the group carries the placement
   transform that map.js owns. */
.ukmap__pin-body,
.ukmap__pin-head {
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-box: fill-box;
    transform-origin: 50% 100%;
}
.ukmap__pin a:hover .ukmap__pin-body,
.ukmap__pin a:focus-visible .ukmap__pin-body,
.ukmap__pin.is-active .ukmap__pin-body { transform: scale(1.28); }
.ukmap__pin a:hover .ukmap__pin-head,
.ukmap__pin a:focus-visible .ukmap__pin-head,
.ukmap__pin.is-active .ukmap__pin-head { transform: translateY(-3px); }
.ukmap__pin a:hover .ukmap__pin-body,
.ukmap__pin.is-active .ukmap__pin-body { fill: var(--c-plate-2); }
.ukmap__pin a:focus-visible .ukmap__pin-body {
    fill: var(--c-plate-2);
    stroke-width: 3;
}

/* The pins print in as a pass, rather than each dot scaling up: the
   placement transform is script-owned now, so nothing may animate it. */
.ukmap__pins { opacity: 0; transition: opacity 0.5s var(--e-out); }
.ukmap.is-in .ukmap__pins { opacity: 1; }

.ukmap__labels text {
    /* Labels are read, not clicked. Hatfield's label crosses London's
       pin, and while it took pointer events it swallowed clicks meant
       for the biggest pin on the map. */
    pointer-events: none;
    fill: var(--c-ink);
    font-family: var(--f-body);
    font-size: 15px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    paint-order: stroke fill;
    stroke: var(--c-bg);
    stroke-width: 4px;
}
.ukmap__labels { pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
    .ukmap__pin-body, .ukmap__pin-head { transition: none; }
    .ukmap__pins { transition: none; }
}

/* Zoom controls
   Two cities can sit closer together than a 26px pin allows, so zoom
   is not a nicety: it is how a crowded cluster becomes selectable.
   Buttons carry the same job as the wheel and the drag, for touch and
   keyboard.
*/
.ukmap__zoom {
    position: absolute;
    top: calc(var(--space-3) + 8px);
    right: calc(var(--space-3) + 8px);
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 6;
}
.ukmap__zbtn {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    background: var(--c-bg);
    color: var(--c-ink);
    border: 2px solid var(--c-ink);
    font-family: var(--f-body);
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
}
.ukmap__zbtn--wide { font-size: 0.6rem; letter-spacing: 0.1em; text-transform: uppercase; }
.ukmap__zbtn:hover { background: var(--c-accent); border-color: var(--c-accent); color: #fff; }

.ukmap svg { touch-action: none; }
.ukmap.is-dragging svg { cursor: grabbing; }
.ukmap.is-zoomed .ukmap__zbtn--wide {
    background: var(--c-accent);
    border-color: var(--c-accent);
    color: #fff;
}

/* The campus chooser panel */
.ukmap__pop {
    position: absolute;
    z-index: 8;
    width: min(252px, calc(100% - 16px));
    background: var(--c-bg);
    border: 3px solid var(--c-ink);
    /* The offset accent block is the second plate, out of register */
    box-shadow: 6px 6px 0 var(--c-accent);
    /* Direction C's motion is plates printing in discrete passes, so the
       panel stamps: the key plate lands, the accent plate slides into its
       offset. No spring, and nothing overshoots. */
    animation: pop-stamp 0.18s var(--e-out) both;
}
@keyframes pop-stamp {
    from { transform: translate(-3px, -3px); box-shadow: 0 0 0 var(--c-accent); }
    to   { transform: none; box-shadow: 6px 6px 0 var(--c-accent); }
}
@media (prefers-reduced-motion: reduce) {
    .ukmap__pop { animation: none; }
}
.ukmap__pop-in { padding: 14px 16px 16px; }
.ukmap__pop-h {
    font-family: var(--f-display);
    font-size: 1.15rem;
    line-height: 1.1;
    text-transform: uppercase;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 2px solid var(--c-ink);
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}
.ukmap__pop-h span {
    font-family: var(--f-body);
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    color: var(--c-ink-soft);
    white-space: nowrap;
}
.ukmap__pop ul { list-style: none; margin: 0; padding: 0; }
.ukmap__pop li + li { border-top: 1px solid var(--c-line); }
.ukmap__pop li a {
    display: block;
    min-height: 44px;
    padding: 10px 2px;
    font-size: 0.82rem;
    line-height: 1.3;
}
.ukmap__pop li a:hover { color: var(--c-accent-ink); }
.ukmap__pop li a span {
    display: block;
    font-family: var(--f-body);
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    color: var(--c-ink-soft);
    margin-top: 2px;
}
.ukmap__pop-filter {
    display: block;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px solid var(--c-ink);
    font-family: var(--f-body);
    font-size: 0.66rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    min-height: 44px;
}
.ukmap__pop-close {
    margin-top: 10px;
    width: 100%;
    min-height: 44px;
    background: var(--c-ink);
    color: var(--c-bg);
    border: 0;
    font-family: var(--f-body);
    font-size: 0.66rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    cursor: pointer;
}
.ukmap__pop-close:hover { background: var(--c-accent); }

/* Directory */
.soc-list__head { margin-bottom: var(--space-5); }
.soc-list__head h2 { font-size: clamp(1.9rem, 5vw, 3.2rem); margin-bottom: var(--space-3); }

.soc-note {
    font-size: 0.8rem;
    line-height: 1.65;
    color: var(--c-ink-soft);
    max-width: 62ch;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: baseline;
}

.soc-clear {
    margin-top: var(--space-3);
    min-height: 44px;
    padding: 10px 18px;
    background: var(--c-ink);
    color: var(--c-bg);
    border: 3px solid var(--c-ink);
    font-family: var(--f-body);
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.soc-clear:hover { background: var(--c-accent); border-color: var(--c-accent); color: #fff; }

.soc-region { margin-bottom: var(--space-5); }
.soc-region__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    font-family: var(--f-body);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--c-ink-soft);
    padding-bottom: 8px;
    margin-bottom: var(--space-2);
    border-bottom: 3px solid var(--c-ink);
}
.soc-region__n {
    background: var(--c-ink);
    color: var(--c-bg);
    padding: 2px 8px;
    font-size: 0.64rem;
}

.soc-grid { display: grid; gap: 10px; }
@media (min-width: 560px) { .soc-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) and (max-width: 1279px) { .soc-grid { grid-template-columns: 1fr; } }

.soc-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: var(--space-2);
    align-items: center;
    padding: 14px;
    border: 3px solid var(--c-ink);
    background: var(--c-bg);
    transition: transform 0.14s var(--e-out), box-shadow 0.14s var(--e-out), background 0.14s linear;
}
.soc-card:hover {
    transform: translate(-3px, -3px);
    box-shadow: 6px 6px 0 var(--c-accent);
}
.soc-card__logo {
    width: 54px; height: 54px;
    flex: none;
    display: grid;
    place-items: center;
    border: 2px solid var(--c-ink);
    background: var(--c-bg-2);
    overflow: hidden;
}
.soc-card__logo img { width: 100%; height: 100%; object-fit: contain; }
.soc-card__initials {
    font-family: var(--f-display);
    font-size: 1.25rem;
    /* accent red on the tile measured just under 4.5:1 */
    color: var(--c-accent-ink);
}
.soc-card__body { display: grid; gap: 3px; min-width: 0; }
.soc-card__name { font-weight: 700; font-size: 0.92rem; line-height: 1.3; }
.soc-card__meta { font-size: 0.72rem; color: var(--c-ink-soft); line-height: 1.4; }
.soc-card__where {
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--c-accent-ink);
}
.soc-card__go { font-size: 1.1rem; color: var(--c-ink-soft); }
.soc-card:hover .soc-card__go { color: var(--c-accent-ink); }

.soc-empty {
    padding: var(--space-4);
    border: 3px dashed var(--c-line);
    text-align: center;
    color: var(--c-ink-soft);
    font-size: 0.9rem;
}

/* Society page */
.soc-hero {
    padding-block: var(--space-5) var(--space-6);
    border-bottom: 3px solid var(--c-ink);
}
.soc-back {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--c-accent-ink);
    padding: 12px 0;
    margin-bottom: var(--space-3);
    border-bottom: 2px solid transparent;
}
.soc-back:hover { border-bottom-color: var(--c-accent); }

.soc-hero__in {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
    align-items: center;
}
@media (min-width: 720px) { .soc-hero__in { grid-template-columns: auto 1fr; gap: var(--space-5); } }

.soc-hero__logo {
    width: clamp(96px, 14vw, 150px);
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    border: 3px solid var(--c-ink);
    background: var(--c-bg-2);
    overflow: hidden;
}
.soc-hero__logo img { width: 100%; height: 100%; object-fit: contain; }
.soc-hero__initials {
    font-family: var(--f-display);
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    color: var(--c-accent-ink);
}
.soc-hero h1 {
    font-size: clamp(2.1rem, 6.5vw, 4.6rem);
    margin: 10px 0 12px;
}
.soc-hero__meta {
    font-size: 0.85rem;
    color: var(--c-ink-soft);
    letter-spacing: 0.04em;
}
.soc-hero .hero__actions { margin-top: var(--space-3); }

.soc-intro {
    max-width: 68ch;
    font-size: 1.02rem;
    line-height: 1.75;
}
.soc-intro p + p { margin-top: var(--space-3); }
.soc-intro--empty {
    border-left: 6px solid var(--c-accent);
    padding: var(--space-3) 0 var(--space-3) var(--space-3);
    color: var(--c-ink-soft);
}
.soc-intro--empty strong { color: var(--c-ink); }

/* Stat strip
   Achievements.html's headline numbers. Four figures, never a chart:
   a KPI row is the correct form for a handful of counts, per the
   dataviz house rule. No colour encodes anything here, so none of
   the categorical palette work applies. */
.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-3);
}
.stat {
    padding: var(--space-3);
    border: 3px solid var(--c-ink);
    background: var(--c-bg);
    text-align: center;
}
.stat__n {
    display: block;
    font-family: var(--f-display);
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    line-height: 1;
    color: var(--c-accent-ink);
    font-variant-numeric: tabular-nums;
}
.stat__label {
    display: block;
    margin-top: 8px;
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--c-ink-soft);
}

/* Achievements */
.ach-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: var(--space-3);
}
.ach {
    display: grid;
    align-content: start;
    border: 3px solid var(--c-ink);
    background: var(--c-bg);
    padding: 0 0 var(--space-3);
    transition: transform 0.16s var(--e-out), box-shadow 0.16s var(--e-out);
}
.ach:hover { transform: translate(-3px, -3px); box-shadow: 7px 7px 0 var(--c-plate-2); }
.ach__media {
    display: block;
    border-bottom: 3px solid var(--c-ink);
    background: var(--c-bg-2);
    aspect-ratio: 4 / 3;
    overflow: hidden;
}
.ach__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ach__date {
    display: block;
    padding: var(--space-3) var(--space-3) 0;
    font-size: 0.62rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--c-accent-ink);
}
.ach h3 {
    font-size: 1.3rem;
    padding: 10px var(--space-3) 0;
    line-height: 1.02;
}
.ach p {
    padding: 12px var(--space-3) 0;
    font-size: 0.88rem;
    line-height: 1.65;
    color: var(--c-ink-soft);
}
.ach__credit {
    display: block;
    padding: 10px var(--space-3) 0;
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--c-ink-soft);
}

.soc-empty-block {
    border: 3px dashed var(--c-line);
    padding: var(--space-5);
    max-width: 68ch;
    color: var(--c-ink-soft);
    font-size: 0.95rem;
    line-height: 1.7;
}
.soc-empty-block strong { color: var(--c-ink); }
.soc-empty-block p + p { margin-top: var(--space-2); }
.soc-empty-block a { color: var(--c-accent-ink); border-bottom: 1px solid currentColor; }


/* City chips
   The primary filter control. Real buttons, always at least 44px, so
   the directory can be filtered whatever size the map renders at.
   The map pins do the same job but are switched off below the scale
   at which they would be an undersized target.
*/
.soc-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: var(--space-3);
}
.soc-chip {
    min-height: 44px;
    padding: 10px 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 2px solid var(--c-ink);
    font-family: var(--f-body);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--c-ink);
    transition: background 0.14s linear, color 0.14s linear;
}
.soc-chip span {
    font-size: 0.62rem;
    padding: 1px 6px;
    background: var(--c-bg-2);
    color: var(--c-ink-soft);
}
.soc-chip:hover { background: var(--c-ink); color: var(--c-bg); }
.soc-chip:hover span { background: var(--c-bg); color: var(--c-ink); }
.soc-chip[aria-pressed="true"] {
    background: var(--c-accent);
    border-color: var(--c-accent);
    color: #fff;
}
.soc-chip[aria-pressed="true"] span { background: #fff; color: #ca0013; }

/* There is no longer a size at which the map stops being a control. The
   pins are held at a constant size on screen, so they meet the target
   floor at every viewport, and the gate that used to switch them off is
   gone. It was the reason the map was not selectable on a normal window. */


/* Compact map (home page)
   The marketing page gets the same interactive map, without the text
   labels, because the city list beside it carries the names. Capping
   the SVG by height rather than width is what keeps it in proportion:
   the outline is roughly twice as tall as it is wide, so a width cap
   still produced a map that filled the page.
*/
.ukmap--compact { border-width: 3px; }
.ukmap--compact svg {
    /* Height is a design choice now, not a constraint: pin size no longer
       depends on it. Allowed past the viewport because this map is not
       sticky, so the reader can simply scroll to the south coast. Being
       capped to the viewport made it only 318px wide on a laptop, which is a
       thin map for the centrepiece of the section. */
    max-height: min(115vh, 980px);
    min-height: 420px;
    width: auto;
    margin-inline: auto;
}
@media (min-width: 1000px) {
    /* Not sticky, unlike the directory map. A sticky element taller than the
       viewport can never show its lower half, and this one is deliberately
       taller than the viewport. */
    .ukmap--compact { position: static; }
    .ukmap--compact svg { max-height: min(115vh, 980px); }
}

/* The city list carries the names the compact map does not label */
.soc-teaser { display: grid; gap: var(--space-4); align-content: start; }
.soc-teaser .soc-note { font-size: 0.88rem; }

.soc-cities__head {
    font-family: var(--f-body);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--c-ink-soft);
    padding-bottom: 10px;
    margin-bottom: var(--space-2);
    border-bottom: 3px solid var(--c-ink);
}
.soc-cities__list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 2px;
}
.soc-cities__list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 44px;
    padding: 10px 12px;
    border: 2px solid transparent;
    font-size: 0.82rem;
    transition: border-color 0.14s linear, background 0.14s linear;
}
.soc-cities__list a:hover { border-color: var(--c-ink); background: var(--c-bg); }

/* A city with more than one campus opens in place. A details element, so it
   works with no script at the sizes where the map pins switch off. */
.soc-cities__more > summary {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-height: 44px;
    padding: 10px 12px;
    border: 2px solid transparent;
    font-size: 0.82rem;
    cursor: pointer;
    list-style: none;
}
.soc-cities__more > summary::-webkit-details-marker { display: none; }
/* The count is an element, the city name is a bare text node, so the count is
   what pushes the pair to the right edge. */
.soc-cities__more > summary > span { margin-left: auto; }
.soc-cities__more > summary::after {
    content: "+";
    font-family: var(--f-body);
    color: var(--c-ink-soft);
    order: 3;
}
.soc-cities__more[open] > summary::after { content: "\2212"; }
.soc-cities__more > summary:hover { border-color: var(--c-ink); background: var(--c-bg); }
.soc-cities__more > ul {
    list-style: none;
    margin: 0 0 6px;
    padding: 0 0 0 12px;
    border-left: 2px solid var(--c-accent);
}
.soc-cities__more > ul a {
    min-height: 40px;
    font-size: 0.76rem;
    padding: 8px 10px;
    justify-content: flex-start;
}
.soc-cities__note {
    margin-top: var(--space-2);
    font-size: 0.7rem;
    line-height: 1.6;
    color: var(--c-ink-soft);
    max-width: 46ch;
}

.soc-cities__list span {
    font-family: var(--f-body);
    font-size: 0.68rem;
    min-width: 26px;
    text-align: center;
    padding: 2px 6px;
    background: var(--c-accent);
    color: #fff;
}
