/* Lore Archive story slideshow (lore-reel.js): card art in a pixel frame, with
   the story's current passage as its caption.
   --beat is the current beat's colour, set from lore-reel-data.js.
   The plaque uses the Silkscreen pixel font; add it to the page's Google Fonts
   link (family=Silkscreen), or it falls back to monospace.
   A page recolours the controls by setting --reel-ink, --reel-well and
   --reel-hover on its .lore-reel (Sky Striker uses blues). */

.lore-reel {
    --reel-ink: #d8b4fe;
    --reel-well: #2a1f3d;
    --reel-hover: #7f5af0;
    --beat: var(--reel-ink);
    padding-top: .5rem;
}

/* Gilded frame in 3px bands, the size of one "art pixel" */
.lore-reel-frame {
    position: relative;
    width: fit-content;
    margin: 0 auto;
    padding: 9px;
    background: #5a3414;
    box-shadow: 0 0 0 3px #1f1006, 0 9px 0 0 rgba(0, 0, 0, .35), inset 0 0 0 3px #ffe08a, inset 0 0 0 6px #d9a23a;
}

.lore-reel-art {
    display: block;
    padding: 0;
    border: 0;
    background: #0f0b18;
    cursor: zoom-in;
}

.lore-reel-art canvas {
    display: block;
}

.lore-reel-art:focus-visible {
    outline: 3px solid #fff;
    outline-offset: -3px;
}

.lore-reel-plaque {
    position: absolute;
    left: 50%;
    bottom: -15px;
    transform: translateX(-50%);
    max-width: calc(100% - 24px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 5px 9px 4px;
    background: #d9a23a;
    color: #2a1608;
    box-shadow: 0 0 0 3px #1f1006, inset 0 3px 0 #ffe08a;
    font: 8px/1 'Silkscreen', monospace;
    letter-spacing: .5px;
    text-transform: uppercase;
}

/* Phones: chapter label on one row, controls across the next. From 768px:
   label left, controls right, on one row whatever the label's length, so the
   page never jumps as the slides change. */
.lore-reel-bar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .9rem;
    margin-top: 1.9rem;
}

.lore-reel-chapter {
    display: flex;
    align-items: center;
    gap: .55rem;
    font: 700 .75rem/1 'Inter', sans-serif;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--beat);
    white-space: nowrap;
    transition: color .3s;
}

.lore-reel-chapter > span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.lore-reel-chapter::before {
    content: '';
    flex: none;
    width: 6px;
    height: 6px;
    background: var(--beat);
    box-shadow: 0 0 10px var(--beat);
    transition: background .3s, box-shadow .3s;
}

.lore-reel-num {
    font-weight: 800;
}

.lore-reel-ctrl {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.lore-reel-btn {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    background: var(--reel-well);
    color: var(--reel-ink);
    box-shadow: 0 0 0 3px #111;
    flex: none;
    cursor: pointer;
}

.lore-reel-btn svg {
    fill: currentColor;
}

.lore-reel-btn:hover {
    background: var(--reel-hover);
    color: #fff;
}

/* One pip per beat; the current one fills while its slide is shown. Pips shrink
   to fit a long story (to 3px wide on phones), and a gap marks each new act. */
.lore-reel-pips {
    flex: 0 1 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    padding: 0 3px;
}

.lore-reel-act-gap {
    flex: none;
    width: 6px;
}

.lore-reel-pip {
    position: relative;
    flex: 0 1 auto;
    width: var(--pip-w, 21px);    /* a width, not a flex-basis: the row's own size is measured from it; 15px for long reels (lore-reel.js) */
    min-width: 6px;
    height: 9px;
    padding: 0;
    border: 0;
    background: #0f0b18;
    box-shadow: 0 0 0 3px #111;
    cursor: pointer;
}

/* A bigger hit area than the 9px bar, meeting the next pip's halfway across the gap */
.lore-reel-pip::after {
    content: '';
    position: absolute;
    inset: -9px -3px;
}

.lore-reel-pip i {
    position: absolute;
    inset: 0;
    background: var(--beat);
    transform-origin: left;
    transform: scaleX(var(--fill, 0));
}

.lore-reel-pip:hover {
    background: var(--reel-well);
}

.lore-reel-btn:focus-visible,
.lore-reel-pip:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 4px;
}

/* The story, one <li> per slide. Without script it's a plain list. */
.lore-reel-story {
    margin: 1.1rem 0 0;
    padding: 0;
    list-style: none;
    font-size: 1rem;
    line-height: 1.7;
}

.lore-reel-story > li + li {
    margin-top: .6rem;
}

/* Captions: every passage sits in the same grid cell, so the box is as tall as
   the longest one and the page doesn't move as they change. */
.lore-reel-story.is-captions {
    display: grid;
    color: #e5e7eb;
}

.lore-reel-story.is-captions > li {
    grid-area: 1 / 1;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity .35s ease, visibility 0s linear .35s;
}

.lore-reel-story.is-captions > li.is-on {
    opacity: 1;
    visibility: visible;
    transition: opacity .35s ease .1s;
}

.lore-reel-story.is-switching > li,
.lore-reel-story.is-switching > li.is-on {
    transition: none;
}

/* The whole story: numbered like the pips, the current passage in white.
   Clicking a passage brings up its art. */
.lore-reel-story.is-full > li {
    position: relative;
    margin: 0;
    padding: .3rem 0 .3rem 3rem;
    color: #9ca3af;
    cursor: pointer;
    transition: color .2s;
}

.lore-reel-story.is-full > li::before {
    content: attr(data-numeral);
    position: absolute;
    left: 0;
    top: .3rem;
    width: 2.25rem;
    text-align: right;
    font: 700 .7rem/1.7rem 'Inter', sans-serif;
    letter-spacing: .08em;
    color: var(--beat);
    opacity: .6;
}

.lore-reel-story.is-full > li.is-act-start {
    margin-top: 1rem;
}

.lore-reel-story.is-full > li:hover {
    color: #d1d5db;
}

.lore-reel-story.is-full > li.is-on {
    color: #fff;
}

.lore-reel-story.is-full > li.is-on::before {
    opacity: 1;
    text-shadow: 0 0 10px var(--beat);
}

.lore-reel-toggle {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-top: 1rem;
    padding: 0;
    border: 0;
    background: none;
    font: 600 .72rem/1 'Inter', sans-serif;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--reel-ink);
    opacity: .75;
    cursor: pointer;
}

.lore-reel-toggle svg {
    fill: currentColor;
}

.lore-reel-toggle:hover {
    opacity: 1;
}

.lore-reel-toggle:hover span {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.lore-reel-toggle:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 4px;
}

@media (min-width: 768px) {
    .lore-reel-bar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 1.25rem;
    }

    .lore-reel-chapter {
        flex: 0 1 auto;
        min-width: 0;
    }

    .lore-reel-ctrl {
        flex: 0 1 auto;
        gap: 12px;
    }

    /* Too narrow for the longest title beside the controls (lore-reel.js): stack as on phones. */
    .lore-reel.is-stacked .lore-reel-bar {
        flex-direction: column;
        align-items: stretch;
        gap: .9rem;
    }

}

/* Who's who: one portrait per person, in the card they are at this chapter.
   The people named in the current passage are lit; the rest are dimmed. */
.lore-reel-cast {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.lore-reel-cast-label {
    margin-bottom: .9rem;
    font: 700 .68rem/1 'Inter', sans-serif;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #8b85a6;
}

.lore-reel-cast-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem .75rem;
}

.lore-reel-person {
    --ring: var(--reel-ink);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .45rem;
    width: 76px;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: zoom-in;
    opacity: .4;
    filter: grayscale(.75);
    transition: opacity .3s, filter .3s;
}

.lore-reel-person.is-lit,
.lore-reel-person:hover,
.lore-reel-person:focus-visible {
    opacity: 1;
    filter: none;
}

/* Square, hard-edged portraits, like the frame and the controls */
.lore-reel-face {
    width: 54px;
    height: 54px;
    background-color: #0f0b18;
    background-repeat: no-repeat;
    box-shadow: 0 0 0 3px #111, 0 0 0 6px var(--reel-well);
    transition: box-shadow .3s;
}

.lore-reel-person.is-lit .lore-reel-face {
    box-shadow: 0 0 0 3px #111, 0 0 0 6px var(--ring);
}

.lore-reel-person.is-changing .lore-reel-face {
    animation: lore-reel-form-change .5s steps(4) both;
}

@keyframes lore-reel-form-change {
    from {
        transform: scale(1.2);
        filter: brightness(2.2);
    }

    to {
        transform: none;
        filter: none;
    }
}

.lore-reel-person-name {
    margin-top: .2rem;
    font: 700 .66rem/1.2 'Inter', sans-serif;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ring);
}

/* A name too long for its 76px portrait stays inside it (lore-reel.js fitName shrinks one-word names first) */
.lore-reel-person .lore-reel-person-name {
    max-width: 100%;
    text-align: center;
    overflow-wrap: anywhere;
    hyphens: auto;
}

/* Always two lines tall, so a portrait doesn't grow when a longer form name comes in */
.lore-reel-person-as {
    min-height: 2.2em;
    margin-top: -.25rem;
    font: .66rem/1.1 'Inter', sans-serif;
    text-align: center;
    color: #9690b0;
}

.lore-reel-person:focus-visible {
    outline: none;
}

.lore-reel-person:focus-visible .lore-reel-person-name {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Roster (lore-reel.js, kind: 'roster'): the lore is profiles, not a story.
   Portraits to pick from above the frame; the chosen person's name, cards and
   profile under it. */
.lore-roster-intro {
    margin: 0 0 1.25rem;
    font-size: 1rem;
    line-height: 1.7;
    color: #d1d5db;
}

.lore-roster-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 1.1rem 2rem;
    margin-bottom: 2rem;
}

.lore-roster-group-label {
    margin-bottom: .8rem;
    font: 700 .66rem/1 'Inter', sans-serif;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #8b85a6;
}

.lore-roster-group-row {
    display: flex;
    flex-wrap: wrap;
    gap: .9rem .55rem;
}

/* A portrait picks, rather than opening a popup like Who's who */
.lore-roster-tab {
    width: 68px;
    cursor: pointer;
    opacity: .6;
    filter: grayscale(.5);
}

/* A long one-word name (Phospheroglacier) wraps inside its tab instead of running into the next */
.lore-roster-tab .lore-reel-person-name {
    max-width: 100%;
    text-align: center;
    letter-spacing: .04em;
    overflow-wrap: anywhere;
    hyphens: auto;
}

.lore-roster-tab[aria-pressed="true"] {
    opacity: 1;
    filter: none;
}

.lore-roster-tab[aria-pressed="true"] .lore-reel-face {
    box-shadow: 0 0 0 3px #111, 0 0 0 6px var(--ring);
}

.lore-roster-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem 1.25rem;
    margin-top: 1.9rem;
}

.lore-roster-name {
    display: flex;
    align-items: center;
    gap: .55rem;
    min-width: 0;
    font: 700 .8rem/1.3 'Inter', sans-serif;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--beat);
    transition: color .3s;
}

.lore-roster-name::before {
    content: '';
    flex: none;
    width: 6px;
    height: 6px;
    background: var(--beat);
    box-shadow: 0 0 10px var(--beat);
}

.lore-roster-tag {
    color: #9690b0;
}

/* Always one button tall, so one-card people don't make the page move */
.lore-roster-forms {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    min-height: 30px;
}

.lore-roster-form {
    height: 30px;
    padding: 0 11px;
    border: 0;
    background: var(--reel-well);
    color: var(--reel-ink);
    box-shadow: 0 0 0 3px #111;
    font: 8px/1 'Silkscreen', monospace;
    letter-spacing: .5px;
    text-transform: uppercase;
    cursor: pointer;
}

.lore-roster-form:hover {
    background: var(--reel-hover);
    color: #fff;
}

.lore-roster-form[aria-pressed="true"] {
    background: var(--beat);
    color: #111;
}

.lore-roster-form:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 4px;
}

.lore-roster-list {
    margin: 1.1rem 0 0;
    padding: 0;
    list-style: none;
    font-size: 1rem;
    line-height: 1.7;
}

.lore-roster-list > li + li {
    margin-top: .9rem;
}

.lore-roster-list p + p,
.lore-roster-notes {
    margin-top: .55rem;
}

/* Every profile in one grid cell, as tall as the longest: the page doesn't move as people change */
.lore-roster-list.is-captions {
    display: grid;
    color: #e5e7eb;
}

.lore-roster-list.is-captions > li {
    grid-area: 1 / 1;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity .35s ease, visibility 0s linear .35s;
}

.lore-roster-list.is-captions > li.is-on {
    opacity: 1;
    visibility: visible;
    transition: opacity .35s ease .1s;
}

.lore-roster-notes {
    display: grid;
    color: #c9c3e6;
}

.lore-roster-notes > p {
    grid-area: 1 / 1;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility 0s linear .3s;
}

.lore-roster-notes > p.is-on {
    opacity: 1;
    visibility: visible;
    transition: opacity .3s ease .1s;
}

/* Art trail (lore-reel.js, kind: 'trail'): a roster of artworks, one per stop, joined by a
   dotted pixel path. Stops already seen stay a little brighter; names in a note walk the trail. */
.lore-trail .lore-roster-group-row {
    gap: .9rem 0;
}

.lore-trail .lore-roster-tab {
    position: relative;
    width: 80px;
}

.lore-trail .lore-roster-tab + .lore-roster-tab::before {
    content: '';
    position: absolute;
    top: 25.5px;
    left: -7px;
    width: 14px;
    height: 3px;
    background: repeating-linear-gradient(90deg, var(--reel-ink) 0 3px, transparent 3px 6px);
    opacity: .45;
}

.lore-trail .lore-roster-tab.is-visited {
    opacity: .85;
    filter: grayscale(.2);
}

.lore-trail .lore-roster-tab[aria-pressed="true"] {
    opacity: 1;
    filter: none;
}

.lore-trail-nav {
    display: flex;
    align-items: center;
    gap: 9px;
}

.lore-trail-count {
    min-width: 4.5em;
    text-align: center;
    font: 8px/1 'Silkscreen', monospace;
    letter-spacing: .5px;
    color: var(--reel-ink);
}

.lore-trail-link {
    color: #fff;
    text-decoration: underline dotted;
    text-decoration-color: var(--beat);
    text-underline-offset: 3px;
    cursor: zoom-in;
}

.lore-trail-link.is-stop {
    text-decoration-style: solid;
    cursor: pointer;
}

.lore-trail-link.is-stop::after {
    content: '\203A';
    margin-left: .15em;
    color: var(--beat);
}

.lore-trail-link:hover {
    color: var(--beat);
}

.lore-trail-link:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Phones: a box as tall as the longest caption would leave most short ones
   floating in space, so each caption takes only the room it needs. */
@media (max-width: 639px) {
    .lore-reel-story.is-captions > li:not(.is-on),
    .lore-roster-list.is-captions > li:not(.is-on),
    .lore-roster-notes > p:not(.is-on) {
        display: none;
    }

    .lore-roster-strip {
        gap: 1rem 1.25rem;
    }
}

@media (max-width: 479px) {
    .lore-reel-pips {
        gap: 3px;
        padding: 0;
    }

    .lore-reel-act-gap {
        width: 3px;
    }

    .lore-reel-pip {
        min-width: 3px;
        box-shadow: 0 0 0 2px #111;
    }

    .lore-reel-pip::after {
        inset: -9px -1px;
    }

    .lore-reel-person {
        width: 72px;
    }
}

/* Music (lore-music.js): the speaker shows waves while the music is on and a cross while it's off,
   and blinks while the instruments load; a pixel note rises over the portrait whose theme is
   playing; the credit line sits under the reel while it plays. */
.lore-reel-sound[aria-pressed="false"] .lore-reel-sound-waves,
.lore-reel-sound[aria-pressed="true"] .lore-reel-sound-off {
    display: none;
}

.lore-reel-sound.is-live .lore-reel-sound-far {
    animation: lore-reel-blink 1.1s steps(1) infinite;
}

.lore-reel-sound.is-loading {
    animation: lore-reel-blink .5s steps(1) infinite;
}

@keyframes lore-reel-blink {
    50% {
        opacity: 0;
    }
}

.lore-reel-person.is-singing {
    position: relative;
    opacity: 1;
    filter: none;
}

.lore-reel-person.is-singing .lore-reel-face {
    box-shadow: 0 0 0 3px #111, 0 0 0 6px var(--ring), 0 0 22px 2px var(--ring);
}

.lore-reel-person.is-singing::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 6px;
    width: 10px;
    height: 10px;
    background: var(--ring);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 5 5'%3E%3Crect x='2' width='2' height='1'/%3E%3Crect x='4' y='1' width='1' height='1'/%3E%3Crect x='2' y='1' width='1' height='2'/%3E%3Crect y='3' width='3' height='2'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 5 5'%3E%3Crect x='2' width='2' height='1'/%3E%3Crect x='4' y='1' width='1' height='1'/%3E%3Crect x='2' y='1' width='1' height='2'/%3E%3Crect y='3' width='3' height='2'/%3E%3C/svg%3E") center / contain no-repeat;
    animation: lore-reel-note .9s steps(6) infinite;
}

@keyframes lore-reel-note {
    from {
        transform: translate(0, 10px);
        opacity: 0;
    }

    25% {
        opacity: 1;
    }

    to {
        transform: translate(6px, -12px);
        opacity: 0;
    }
}

.lore-reel-credit {
    margin: 1rem 0 0;
    font: .68rem/1.4 'Inter', sans-serif;
    color: #7d7799;
}

@media (prefers-reduced-motion: reduce) {
    .lore-reel-sound.is-live .lore-reel-sound-far,
    .lore-reel-sound.is-loading,
    .lore-reel-person.is-singing::before {
        animation: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lore-reel-chapter,
    .lore-reel-chapter::before,
    .lore-reel-story > li,
    .lore-reel-story.is-captions > li.is-on,
    .lore-reel-person,
    .lore-reel-face,
    .lore-roster-name,
    .lore-roster-list.is-captions > li,
    .lore-roster-list.is-captions > li.is-on,
    .lore-roster-notes > p,
    .lore-roster-notes > p.is-on {
        transition: none;
    }

    .lore-reel-person.is-changing .lore-reel-face {
        animation: none;
    }
}
