/* Side Quests: an adventure map of the worlds Northstar opens to learners. */

.sidequests-page {
    background: var(--paper);
}

.sidequests-page .quest-hero__meta,
.sidequests-page .quest-map__head span,
.sidequests-page .quest-map__foot,
.sidequests-page .quest-card__top,
.sidequests-page .quest-card__kind,
.sidequests-page .quest-card__stats dt,
.sidequests-page .quest-card__action,
.sidequests-page .quest-panel span,
.sidequests-page .quest-panel small,
.sidequests-page .quest-note>span,
.sidequests-page .quest-cta span {
    font: 500 .55rem var(--mono);
    text-transform: uppercase;
}

/* ---------------------------------------------------------------- Hero */

.quest-hero {
    min-height: min(56rem, 92svh);
    padding: 7.4rem 1.4rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    overflow: hidden;
    color: var(--paper);
    background: var(--ink);
    border-bottom: 1px solid;
}

.quest-hero__meta {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    padding-bottom: .8rem;
    border-bottom: 1px solid rgba(246, 242, 233, .5);
}

.quest-hero__meta .page-breadcrumbs {
    color: inherit;
}

.quest-hero__stage {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(15rem, .6fr);
    gap: clamp(2rem, 5vw, 6rem);
    align-items: stretch;
}

.quest-hero__story {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.quest-hero__kicker {
    margin-bottom: clamp(2rem, 5vw, 5rem);
    font: 500 .55rem var(--mono);
    text-transform: uppercase;
}

/* The shared page-intro title rule wins on specificity, so restate it here. */
body .quest-hero.page-intro h1 {
    margin: 0;
    font-size: clamp(5rem, 9vw, 10rem);
    line-height: .78;
    letter-spacing: -.09em;
}

.quest-hero h1 span,
.quest-hero h1 em {
    display: block;
}

.quest-hero h1 em {
    margin-left: 6vw;
    color: var(--yellow);
    font-style: normal;
}

.quest-hero__story p {
    max-width: 38rem;
    margin: clamp(2rem, 4vw, 4rem) 0 0;
    padding-top: 1rem;
    border-top: 1px solid rgba(246, 242, 233, .5);
    font: .78rem/1.7 var(--mono);
}

.quest-panel {
    padding: 1.3rem;
    display: flex;
    flex-direction: column;
    color: var(--ink);
    background: var(--yellow);
    transform: rotate(3deg) scale(.92);
    box-shadow: 12px 12px 0 var(--orange);
}

.quest-panel>span {
    padding-bottom: .8rem;
    border-bottom: 1px solid;
}

.quest-panel strong {
    margin: auto 0;
    font-size: clamp(3.4rem, 5.4vw, 6.2rem);
    line-height: .84;
    letter-spacing: -.085em;
}

.quest-panel div {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .6rem;
    margin: 1rem 0;
    padding: 1rem 0;
    border-top: 1px solid;
    border-bottom: 1px solid;
}

.quest-panel small {
    line-height: 1.8;
}

.quest-hero__jump {
    width: max-content;
    min-height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 3rem;
    padding: .8rem 0 0;
    border-top: 1px solid;
    font: 500 .55rem var(--mono);
    text-transform: uppercase;
}

.quest-hero__jump:hover,
.quest-hero__jump:focus-visible {
    color: var(--yellow);
}

/* -------------------------------------------------------------- Ticker */

.quest-ticker {
    overflow: hidden;
    color: var(--ink);
    background: var(--yellow);
    border-bottom: 1px solid;
}

.quest-ticker__track {
    width: max-content;
    display: flex;
    animation: ticker 34s linear infinite;
}

.quest-ticker span {
    display: flex;
    align-items: center;
    gap: 1.6rem;
    padding: .7rem 0;
    white-space: nowrap;
    font: 500 .6rem var(--mono);
    text-transform: uppercase;
}

.quest-ticker b {
    font-weight: 500;
    color: var(--orange);
}

/* ----------------------------------------------------------------- Map */

.quest-map {
    padding: clamp(5rem, 8vw, 8rem) 1.4rem;
    background: var(--cream);
    background-image:
        repeating-radial-gradient(circle at 18% 22%, rgba(17, 18, 15, .07) 0 1px, transparent 1px 54px),
        repeating-radial-gradient(circle at 84% 78%, rgba(17, 18, 15, .06) 0 1px, transparent 1px 68px);
    border-bottom: 1px solid;
}

.quest-map__head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(17rem, .34fr);
    gap: 2rem;
    align-items: end;
    margin-bottom: clamp(2.5rem, 5vw, 4.5rem);
}

.quest-map__head h2 {
    max-width: 12ch;
    margin: 1.4rem 0 0;
    font-size: clamp(3.6rem, 6.6vw, 6.8rem);
    line-height: .86;
    letter-spacing: -.08em;
}

.quest-map__aside {
    display: grid;
    gap: 1.4rem;
    align-content: end;
}

.quest-map__aside>p {
    margin: 0;
    padding-top: 1rem;
    border-top: 1px solid;
    font: .7rem/1.7 var(--mono);
}

/* A field-notice strip that reports where the shuffle landed you. */
.quest-map__readout {
    min-width: 0;
    min-height: 2.6rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .6rem .8rem;
    color: var(--paper);
    background: var(--ink);
    font: 500 .55rem var(--mono);
    text-transform: uppercase;
}

.quest-map__readout b {
    color: var(--yellow);
    font-weight: 500;
}

.quest-dice {
    width: max-content;
    min-height: 2.75rem;
    display: flex;
    align-items: center;
    gap: 1.6rem;
    padding: .85rem 1.2rem;
    color: var(--ink);
    background: var(--yellow);
    border: 1px solid;
    box-shadow: 5px 5px 0 var(--orange);
    font: 500 .58rem var(--mono);
    text-transform: uppercase;
    cursor: pointer;
    transition: transform .2s var(--ease), box-shadow .2s var(--ease), background-color .2s var(--ease);
}

.quest-dice:hover,
.quest-dice:focus-visible {
    background: var(--orange);
    transform: translate(5px, 5px);
    box-shadow: none;
}

.quest-dice i {
    font-style: normal;
    font-size: 1rem;
    transition: transform .45s var(--ease);
}

.quest-dice:hover i,
.quest-dice:focus-visible i {
    transform: rotate(180deg);
}

/* ---------------------------------------------------------------- Paper */

.quest-map__paper {
    --pad: clamp(1rem, 2vw, 1.8rem);
    --field-h: clamp(6rem, 11vw, 11rem);
    --gap: 1rem;
    --spine: 3.4rem;
    position: relative;
    background: var(--paper);
    border: 1px solid;
    box-shadow: 10px 10px 0 rgba(17, 18, 15, .12);
}

.quest-map__toolbar {
    min-height: 3.5rem;
    padding: .55rem var(--pad);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid;
    font: 500 .58rem var(--mono);
    text-transform: uppercase;
}

.quest-map__controls {
    display: flex;
    gap: .4rem;
}

.quest-map__controls button {
    width: 2.75rem;
    height: 2.75rem;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid;
    font: 1.1rem var(--mono);
    cursor: pointer;
}

.quest-map__controls button:not(:disabled):hover,
.quest-map__controls button:not(:disabled):focus-visible {
    background: var(--yellow);
}

.quest-map__controls button:disabled {
    opacity: .3;
    cursor: default;
}

.quest-map__scroll {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: none;
    scrollbar-color: var(--orange) var(--cream);
}

.quest-map__scroll:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: -2px;
}

.quest-map__canvas {
    position: relative;
    min-width: max(100%, var(--quest-canvas-min));
    padding: var(--pad);
}

/* Corner pins make the map read as a paper object. */
.quest-map__paper::before,
.quest-map__paper::after {
    content: "";
    position: absolute;
    width: .7rem;
    aspect-ratio: 1;
    background: var(--orange);
    border-radius: 50%;
    box-shadow: 0 0 0 3px var(--paper);
}

.quest-map__paper::before {
    top: -.35rem;
    left: -.35rem;
}

.quest-map__paper::after {
    right: -.35rem;
    bottom: -.35rem;
}

/* ------------------------------------------------------- Trail furniture */

.quest-map__flag,
.quest-map__hoard {
    display: flex;
    align-items: center;
    gap: .5rem;
    font: 500 .5rem var(--mono);
    text-transform: uppercase;
}

.quest-map__flag::before {
    content: "";
    width: .5rem;
    aspect-ratio: 1;
    background: var(--orange);
    border-radius: 50%;
}

.quest-map__hoard b {
    color: var(--orange);
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1;
}

/* Wide layout: the trail runs above the cards, so the labels are anchored to the
   trail's own start (1%, 18%) and end (97%, 22%) rather than to the paper edge.
   The field is inset by --pad on every side, and its width is 100% - 2 * --pad. */
.quest-map__flag {
    position: absolute;
    left: calc(var(--pad) + (100% - 2 * var(--pad)) * .01);
    top: calc(var(--pad) + var(--field-h) * .18);
    padding: .3rem .6rem;
    background: var(--cream);
    border: 1px solid;
    /* Sits just above the start point instead of on top of it. */
    transform: translateY(calc(-100% - .6rem));
}

.quest-map__hoard {
    position: absolute;
    /* The cross sits on the end of the trail ("X marks the spot") with the label
       stacked above it. The trail climbs into this corner from the left, so a
       label beside the cross would run straight through the line. */
    flex-direction: column-reverse;
    align-items: flex-end;
    gap: .2rem;
    right: calc(var(--pad) + (100% - 2 * var(--pad)) * .01 - .55rem);
    top: calc(var(--pad) + var(--field-h) * .22);
    padding: .3rem .6rem;
    /* Lifts the box so the cross's centre (.85rem up from the bottom edge) lands
       on the trail's end point. */
    transform: translateY(calc(-100% + .85rem)) rotate(-4deg);
    transform-origin: right bottom;
}

/* -------------------------------------------------------- Wide trail */

.quest-map__field {
    position: relative;
    height: var(--field-h);
    /* The drifting cloud must not enlarge the map's scrollable width. */
    overflow: clip;
}

.quest-map__trail {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* Drawn by default so a failed script still leaves a complete map. */
.quest-map__walk {
    fill: none;
    stroke: var(--ink);
    stroke-width: 2.5;
    stroke-dasharray: 7 4;
    vector-effect: non-scaling-stroke;
}

.is-mapped .quest-map__walk {
    animation: quest-draw .6s var(--ease) both;
    animation-delay: calc(var(--trail-index) * .35s);
}

@keyframes quest-draw {
    from {
        stroke-dashoffset: 100
    }

    to {
        stroke-dashoffset: 0
    }
}

/* Drop lines share the card grid, so they land exactly on each card centre. */
.quest-map__stems {
    position: absolute;
    left: 0;
    right: 0;
    top: 44%;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(var(--quest-count), minmax(0, 1fr));
    gap: var(--gap);
}

.quest-map__stems i {
    position: relative;
    justify-self: center;
    width: 0;
    height: 100%;
    border-left: 1px dashed rgba(17, 18, 15, .45);
    transition: border-left-color .25s var(--ease);
}

/* The marker sits where the trail passes, so the pin below reads as the destination. */
.quest-map__stems i::after {
    content: "";
    position: absolute;
    left: -.3rem;
    top: -.3rem;
    width: .6rem;
    aspect-ratio: 1;
    background: var(--orange);
    transform: rotate(45deg);
}

.is-mapped .quest-map__stems i::after {
    animation: quest-pop .45s var(--ease) both;
    animation-delay: calc(.3s + var(--trail-index) * .35s);
}

@keyframes quest-pop {
    from {
        opacity: 0;
        transform: rotate(45deg) scale(0)
    }

    to {
        opacity: 1;
        transform: rotate(45deg) scale(1)
    }
}

/* Flush with the last card's right edge. The viewBox carries headroom above the ring
   so the "N" is never clipped. */
.quest-compass {
    position: absolute;
    right: 0;
    bottom: 4%;
    width: clamp(3.2rem, 5vw, 4.6rem);
    aspect-ratio: 1;
    overflow: visible;
    color: rgba(17, 18, 15, .35);
}

/* fill-box keeps the pivot on the needle's own centre; the default (view-box)
   would pivot around the middle of the offset viewBox instead. */
.quest-compass__needle {
    transform-box: fill-box;
    transform-origin: 50% 50%;
    animation: quest-needle 15s var(--ease) infinite alternate;
}

/* An uneven, unhurried wander reads as a compass being used, not a metronome. */
@keyframes quest-needle {
    0% {
        transform: rotate(-9deg)
    }

    22% {
        transform: rotate(4deg)
    }

    46% {
        transform: rotate(-5deg)
    }

    68% {
        transform: rotate(7deg)
    }

    84% {
        transform: rotate(-2deg)
    }

    100% {
        transform: rotate(6deg)
    }
}

/* The vertical leg of the trail, drawn downward one card at a time. */
@keyframes quest-spine {
    from {
        transform: scaleY(0)
    }

    to {
        transform: scaleY(1)
    }
}

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

.quest-grid {
    display: grid;
    grid-template-columns: repeat(var(--quest-count), minmax(0, 1fr));
    gap: var(--gap);
}

.quest-card {
    min-width: 0;
}

.quest-card a {
    --grain: repeating-linear-gradient(90deg, rgba(17, 18, 15, .022) 0 1px, transparent 1px 4px);
    position: relative;
    min-height: 26rem;
    height: 100%;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    color: var(--ink);
    background: var(--grain), var(--white);
    border: 1px solid;
    box-shadow: 5px 5px 0 transparent;
    transition: color .35s var(--ease), background-color .35s var(--ease), transform .35s var(--ease), box-shadow .35s var(--ease);
}

/* Lifting the card off the page, like picking up a printed sheet. */
.quest-card a:hover,
.quest-card a:focus-visible {
    transform: translate(-3px, -4px) rotate(-.5deg);
}

/* Perforated stub along the trailing edge, punched through to the paper the
   cards sit on (not the cream of the surrounding map). */
.quest-card a::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: .5rem;
    background: radial-gradient(circle at 100% 50%, var(--paper) 3.5px, transparent 3.6px) 0 0 / 100% 13px repeat-y;
    pointer-events: none;
}

.quest-card a:hover,
.quest-card a:focus-visible,
.quest-card.is-picked a {
    transform: translate(-6px, -6px);
    box-shadow: 8px 8px 0 var(--yellow);
    outline: 0;
}

/* The pin sits on the drop line so the trail visibly ends at the card. */
.quest-card__pin {
    position: absolute;
    top: -1.05rem;
    left: 50%;
    width: 2.1rem;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    color: var(--paper);
    background: var(--ink);
    border: 1px solid;
    font: 500 .62rem var(--mono);
    transform: translateX(-50%);
    transition: transform .35s var(--ease), background-color .35s var(--ease);
}

.quest-card a:hover .quest-card__pin,
.quest-card a:focus-visible .quest-card__pin,
.quest-card.is-picked .quest-card__pin {
    background: var(--orange);
    transform: translateX(-50%) rotate(45deg);
}

.quest-card__pin b {
    font-weight: 500;
    transition: transform .35s var(--ease);
}

.quest-card a:hover .quest-card__pin b,
.quest-card a:focus-visible .quest-card__pin b,
.quest-card.is-picked .quest-card__pin b {
    transform: rotate(-45deg);
}

.quest-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
    padding-bottom: .9rem;
    border-bottom: 1px solid;
}

.quest-card__top i {
    font-size: 1rem;
    font-style: normal;
    transition: transform .35s var(--ease);
}

.quest-card__marks {
    display: flex;
    align-items: center;
    gap: .6rem;
}

/* Stamped serial, the way a paper permit is numbered. */
.quest-card__serial {
    padding: .12rem .34rem;
    border: 1px dashed;
    opacity: .55;
    font-size: .5rem;
    letter-spacing: .04em;
}

/* A rubber stamp: slightly off-square, ink-thin, and sitting proud of the row. */
.quest-card__stamp {
    display: inline-block;
    padding: .1rem .4rem;
    border: 1px solid;
    border-radius: 1px;
    opacity: .48;
    transform: rotate(-2.5deg);
    font-weight: 500;
    font-size: .5rem;
    letter-spacing: .06em;
}

.quest-card--ink .quest-card__serial,
.quest-card--ink .quest-card__stamp {
    border-color: rgba(246, 242, 233, .6);
}

.quest-card a:hover .quest-card__top i,
.quest-card a:focus-visible .quest-card__top i {
    transform: rotate(45deg);
}

.quest-card__kind {
    margin-top: 1.4rem;
}

.quest-card h3 {
    max-width: 14ch;
    margin: .6rem 0 0;
    font-size: clamp(1.9rem, 2.6vw, 2.7rem);
    line-height: .9;
    letter-spacing: -.065em;
}

.quest-card p {
    margin: 1rem 0 1.6rem;
    font: .72rem/1.7 var(--mono);
}

.quest-card__stats {
    margin: auto 0 1.4rem;
    display: grid;
    gap: .5rem;
}

.quest-card__stats div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-top: .5rem;
    border-top: 1px dashed rgba(17, 18, 15, .35);
}

.quest-card__stats dt {
    opacity: .6;
}

.quest-card__stats dd {
    margin: 0;
    text-align: right;
    font: 500 .58rem var(--mono);
    text-transform: uppercase;
}

.quest-card__action {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-top: .9rem;
    border-top: 1px solid;
}

.quest-card__action span {
    font-size: 1rem;
}

/* Alternating surfaces keep the four landmarks distinct without new colours. */
.quest-card--cream a {
    background: var(--grain), var(--cream);
}

.quest-card--cream a:hover,
.quest-card--cream a:focus-visible,
.quest-card--cream.is-picked a {
    box-shadow: 8px 8px 0 var(--orange);
}

.quest-card--yellow a {
    background: var(--grain), var(--yellow);
}

.quest-card--yellow a:hover,
.quest-card--yellow a:focus-visible,
.quest-card--yellow.is-picked a {
    box-shadow: 8px 8px 0 var(--orange);
}

.quest-card--ink a {
    /* Lighter grain, since the surface is dark. */
    --grain: repeating-linear-gradient(90deg, rgba(246, 242, 233, .035) 0 1px, transparent 1px 4px);
    color: var(--paper);
    background: var(--grain), var(--ink);
}

.quest-card--ink a:hover,
.quest-card--ink a:focus-visible,
.quest-card--ink.is-picked a {
    color: var(--ink);
    background: var(--orange);
    box-shadow: 8px 8px 0 var(--yellow);
}

.quest-card--ink .quest-card__pin {
    color: var(--ink);
    background: var(--paper);
}

.quest-card--ink .quest-card__stats div {
    border-top-color: rgba(246, 242, 233, .35);
}

.quest-card__placeholder {
    position: relative;
    min-height: 26rem;
    height: 100%;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    color: var(--ink);
    background: repeating-linear-gradient(90deg, rgba(17, 18, 15, .02) 0 1px, transparent 1px 4px), var(--cream);
    border: 1px dashed var(--ink);
}

.quest-card--pending .quest-card__pin {
    background: var(--orange);
}

.quest-card__blank {
    display: block;
    width: 75%;
    height: 8rem;
    margin-top: 3.5rem;
    border-top: 1px solid rgba(17, 18, 15, .4);
    border-bottom: 1px solid rgba(17, 18, 15, .4);
    opacity: .6;
}

.quest-map__foot {
    margin: 0;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: .9rem var(--pad);
    border-top: 1px solid;
}

/* ----------------------------------------------------------------- Note */

.quest-note {
    padding: clamp(4rem, 7vw, 7rem) 1.4rem;
    display: grid;
    grid-template-columns: 12vw minmax(0, 1fr) minmax(16rem, .35fr);
    gap: 2rem;
    align-items: end;
    color: var(--paper);
    background: var(--ink);
    border-top: 1px solid;
}

.quest-note>span {
    align-self: start;
}

.quest-note h2 {
    margin: 0;
    font-size: clamp(3rem, 5.4vw, 6rem);
    line-height: .86;
    letter-spacing: -.08em;
}

.quest-note h2 em {
    color: var(--yellow);
    font-style: normal;
}

.quest-note__aside {
    min-width: 0;
    display: grid;
    justify-items: start;
    gap: 1rem;
}

.quest-note__aside p {
    margin: 0;
    padding-top: 1rem;
    border-top: 1px solid rgba(246, 242, 233, .5);
    font: .7rem/1.7 var(--mono);
}

.quest-note__aside a {
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1.1rem;
    color: var(--ink);
    background: var(--yellow);
    font: 500 .58rem var(--mono);
    text-transform: uppercase;
    transition: color .25s var(--ease), background-color .25s var(--ease);
}

.quest-note__aside a:hover,
.quest-note__aside a:focus-visible {
    background: var(--orange);
}

/* ------------------------------------------------------------------ CTA */

.quest-cta {
    padding: clamp(5rem, 8vw, 8rem) 1.4rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(16rem, .38fr);
    gap: 3rem;
    align-items: end;
    background: var(--orange);
    border-top: 1px solid;
}

.quest-cta h2 {
    max-width: 14ch;
    margin: 1.4rem 0 0;
    font-size: clamp(3.4rem, 6.4vw, 7rem);
    line-height: .85;
    letter-spacing: -.085em;
}

.quest-cta__action {
    display: grid;
    gap: 1.4rem;
}

.quest-cta__action p {
    margin: 0;
    padding-top: 1rem;
    border-top: 1px solid;
    font: .7rem/1.7 var(--mono);
}

.quest-cta .solid-button {
    width: max-content;
    min-height: 2.75rem;
    display: flex;
    gap: 2rem;
    padding: .9rem 1.2rem;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid;
    font: 500 .58rem var(--mono);
    text-transform: uppercase;
}

.quest-cta .solid-button:hover,
.quest-cta .solid-button:focus-visible {
    background: var(--yellow);
}

/* --------------------------------------------------- Living map details */

/* Cloud shade drifting across the ground. Painted above the trail so the
   walker passes in and out of it. */
.quest-map__field::after {
    content: "";
    position: absolute;
    inset: -12% -6%;
    background:
        radial-gradient(38% 46% at 26% 34%, rgba(17, 18, 15, .085), transparent 70%),
        radial-gradient(30% 40% at 74% 64%, rgba(17, 18, 15, .075), transparent 70%);
    mix-blend-mode: multiply;
    animation: quest-clouds 46s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes quest-clouds {
    from {
        transform: translate3d(-4%, 2%, 0) scale(1)
    }

    to {
        transform: translate3d(6%, -3%, 0) scale(1.14)
    }
}

/* The walker is a real element rather than an SVG circle: the trail viewBox is
   stretched with preserveAspectRatio="none", which would squash anything drawn
   inside it. Its position is set from the inline script in the page, which
   samples #quest-route and scales each point to the field's pixel size.
   (CSS offset-path cannot do this: it resolves in raw pixels, not viewBox units,
   which pinned the dot to the top-left corner.) It stays hidden until the
   script places it, so a failed script never leaves it stranded. */
.quest-walker {
    position: absolute;
    top: 0;
    left: 0;
    width: .55rem;
    height: .55rem;
    margin: -.275rem 0 0 -.275rem;
    background: var(--orange);
    border-radius: 50%;
    box-shadow: 0 0 0 1px var(--ink);
    opacity: 0;
    will-change: transform;
    pointer-events: none;
}

.quest-walker::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid var(--orange);
    border-radius: 50%;
    animation: quest-beacon 2.8s var(--ease) infinite;
}

/* The pin pulses like a beacon so each stop reads as a live destination. */
.quest-card__pin::after {
    content: "";
    position: absolute;
    inset: -1px;
    border: 1px solid var(--orange);
    animation: quest-beacon 3.2s var(--ease) infinite;
    pointer-events: none;
}

@keyframes quest-beacon {
    0% {
        opacity: .65;
        transform: scale(1)
    }

    70%,
    100% {
        opacity: 0;
        transform: scale(1.75)
    }
}

/* The treasure keeps a small fire going. Centred on the cross, which now sits
   at the trailing end of the label. */
.quest-map__hoard::after {
    content: "";
    position: absolute;
    right: .95rem;
    bottom: .85rem;
    width: 2.6rem;
    height: 2.6rem;
    transform: translate(50%, 50%);
    background: radial-gradient(circle, rgba(255, 122, 0, .5), transparent 70%);
    animation: quest-ember 3.4s ease-in-out infinite;
    pointer-events: none;
}

/* Opacity and the standalone `scale` property only, so the centring transform
   above is left alone. */
@keyframes quest-ember {

    0%,
    100% {
        opacity: .55;
        scale: .9
    }

    50% {
        opacity: 1;
        scale: 1.15
    }
}

/* ---------------------------------------------------------- Mid width */

/* On phones the horizontal map becomes one continuous vertical trail. */
@media (max-width: 700px) {
    .quest-map__controls {
        display: none;
    }

    .quest-map__toolbar > span span {
        display: inline-block;
        transform: rotate(90deg);
    }

    .quest-map__scroll {
        overflow: visible;
    }

    .quest-map__canvas {
        width: 100%;
        min-width: 0;
    }

    .quest-map__field {
        display: none;
    }

    /* The labels leave the trail and become ordinary blocks above and below the
       cards, so every wide-layout offset has to be cleared. */
    .quest-map__flag,
    .quest-map__hoard {
        position: relative;
        left: auto;
        right: auto;
        top: auto;
        width: max-content;
        max-width: 100%;
        padding: .35rem .6rem;
        background: var(--cream);
        border: 1px solid;
        transform: none;
    }

    .quest-map__flag {
        margin-bottom: 1.6rem;
    }

    .quest-map__hoard {
        flex-direction: row;
        align-items: center;
        gap: .5rem;
        margin-top: 1.6rem;
    }

    .quest-map__hoard::after {
        right: auto;
        bottom: auto;
        left: .95rem;
        top: 50%;
        transform: translate(-50%, -50%);
    }

    /* Cards stack in source order and the side spine connects all stops. */
    .quest-grid {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: none;
        grid-auto-flow: row;
        row-gap: 0;
        padding-left: var(--spine);
    }

    /* The spine runs in the grid's own padding, outside the card's border, so
       the card itself keeps its normal padding and loses no text width. */
    .quest-card a::before,
    .quest-card__placeholder::before {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        left: calc(var(--spine) * -.5);
        width: 0;
        border-left: 1px dashed rgba(17, 18, 15, .4);
        transform-origin: 50% 0;
        transition: border-left-color .25s var(--ease);
    }

    .is-mapped .quest-card a::before,
    .is-mapped .quest-card__placeholder::before {
        animation: quest-spine .5s var(--ease) both;
        animation-delay: calc(.05s + var(--trail-index) * .35s);
    }

    /* The pin lands on the spine, level with the card title. */
    .quest-card__pin {
        top: 1.4rem;
        left: calc(var(--spine) * -.5);
        transform: translateX(-50%);
    }

    .quest-card a:hover .quest-card__pin,
    .quest-card a:focus-visible .quest-card__pin,
    .quest-card.is-picked .quest-card__pin {
        background: var(--orange);
        transform: translateX(-50%) rotate(45deg);
    }

    .quest-card a:hover .quest-card__pin b,
    .quest-card a:focus-visible .quest-card__pin b,
    .quest-card.is-picked .quest-card__pin b {
        transform: rotate(-45deg);
    }

    .quest-card a:hover::before,
    .quest-card a:focus-visible::before {
        border-left-color: var(--orange);
    }
}

@media (max-width: 1000px) {
    .quest-hero__stage {
        grid-template-columns: minmax(0, 1fr) minmax(13rem, .45fr);
        gap: 2rem;
    }

    body .quest-hero.page-intro h1 {
        font-size: clamp(3.4rem, 7.6vw, 5.6rem);
    }

    /* The panel column narrows here, so its display figure has to come down
       with it or it clips. */
    .quest-panel strong {
        font-size: clamp(2.4rem, 4.4vw, 3.6rem);
    }

    .quest-map__head h2 {
        font-size: clamp(2.8rem, 5.6vw, 4.6rem);
    }

    .quest-map__head,
    .quest-note,
    .quest-cta {
        grid-template-columns: 1fr minmax(15rem, .4fr);
    }

    .quest-note {
        grid-template-columns: 8vw minmax(0, 1fr);
    }

    .quest-note h2 {
        font-size: clamp(2.4rem, 4.6vw, 3.6rem);
    }

    .quest-cta h2 {
        font-size: clamp(2.6rem, 5vw, 4rem);
    }

    .quest-note__aside {
        grid-column: 2;
    }
}

/* -------------------------------------------------------------- Phone */

/* One column, so each card carries its own stretch of trail. Stacked with
   no gap the segments read as one continuous line down the gutter. */
@media (max-width: 700px) {
    body .quest-hero.page-intro {
        min-height: 0;
        gap: 2rem;
        padding-top: 6.5rem;
    }

    .quest-hero__meta>span:last-child {
        display: none;
    }

    .quest-hero__stage {
        grid-template-columns: minmax(0, 1fr);
        gap: 3rem;
    }

    .quest-hero__kicker {
        margin: 2rem 0 3rem;
    }

    body .quest-hero.page-intro h1 {
        font-size: clamp(2.5rem, 11.5vw, 3.6rem);
        line-height: .84;
    }

    .quest-hero h1 em {
        margin-left: 0;
    }

    .quest-hero__story p {
        margin-top: 2.4rem;
    }

    .quest-panel {
        min-height: 15rem;
        transform: rotate(2deg) scale(.97);
    }

    .quest-panel strong {
        font-size: clamp(2.3rem, 11vw, 3.2rem);
    }

    .quest-hero__jump {
        min-height: 2.75rem;
        padding: 1rem 0;
    }

    .quest-map__head,
    .quest-cta {
        grid-template-columns: minmax(0, 1fr);
        gap: 1.5rem;
    }

    .quest-map__head h2 {
        font-size: clamp(2.1rem, 9.5vw, 3rem);
        line-height: .88;
    }

    /* A narrower spine and a smaller pin buy back card width, which a phone
       cannot spare: the trail only needs half a spine plus half a pin. */
    .quest-map__paper {
        --spine: 2.6rem;
    }

    .quest-card__pin {
        width: 1.7rem;
    }

    .quest-grid {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: none;
        grid-auto-flow: row;
    }

    .quest-card a {
        min-height: 18rem;
    }

    .quest-card__placeholder {
        min-height: 18rem;
    }

    .quest-card h3 {
        font-size: clamp(1.5rem, 6.6vw, 2rem);
        line-height: .94;
    }

    .quest-card p {
        font-size: .7rem;
    }

    .quest-note {
        grid-template-columns: minmax(0, 1fr);
        gap: 1.5rem;
    }

    .quest-note__aside {
        grid-column: 1;
    }

    .quest-note h2 {
        font-size: clamp(1.9rem, 8.4vw, 2.7rem);
        line-height: .9;
    }

    .quest-cta h2 {
        font-size: clamp(2rem, 8.8vw, 2.9rem);
        line-height: .9;
    }

    /* max-content buttons can outgrow a narrow screen. */
    .quest-cta .solid-button {
        width: 100%;
        justify-content: space-between;
        gap: 1rem;
    }
}

@media (max-width: 430px) {
    .quest-map {
        padding-right: .8rem;
        padding-left: .8rem;
    }

    .quest-map__paper {
        --pad: .75rem;
        --spine: 1.8rem;
    }
}

/* ---------------------------------------------------- Reduced motion */

@media (prefers-reduced-motion: reduce) {

    .is-mapped .quest-map__walk,
    .is-mapped .quest-map__stems i::after,
    .is-mapped .quest-card a::before,
    .is-mapped .quest-card__placeholder::before {
        animation: none;
    }

    .quest-ticker__track,
    .quest-compass__needle,
    .quest-map__field::after,
    .quest-card__pin::after,
    .quest-map__hoard::after,
    .quest-walker::after {
        animation: none;
    }

    /* The script parks the walker mid-trail instead of moving it. */
    .quest-card__pin::after {
        opacity: .5;
        transform: none;
    }

    .quest-map__hoard::after {
        opacity: .8;
    }

    .quest-dice i,
    .quest-card a,
    .quest-card__pin,
    .quest-card__pin b,
    .quest-card__top i {
        transition: none;
    }
}
