:root {
    --bg: #0e1116;
    --panel: rgba(18, 22, 29, 0.86);
    --line: rgba(255, 255, 255, 0.1);
    --text: #e8eaee;
    --muted: #9099a8;
    --accent: #f2c14e;
    --water: #1d3a5c;
    --green: #17291f;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: "Barlow", system-ui, sans-serif;
    font-size: 14px;
    overflow: hidden;
}

#map {
    position: absolute;
    inset: 0;
}

button {
    font: inherit;
    color: inherit;
    cursor: pointer;
}

/* header */
.top {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    pointer-events: none;
    z-index: 2;
}

.top>* {
    pointer-events: auto;
}

.brand h1 {
    margin: 0;
    font-family: "Barlow Condensed", sans-serif;
    font-weight: 700;
    font-size: 40px;
    line-height: 1;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}

.brand h1 em {
    color: var(--accent);
    font-style: normal;
}

.brand p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.brand p strong {
    color: var(--text);
}

.controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.seg {
    display: flex;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 3px;
}

.seg button,
.toggle,
.plain {
    border: 0;
    background: transparent;
    padding: 7px 12px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 13px;
}

.seg button.on {
    background: var(--text);
    color: var(--bg);
}

.toggle,
.plain {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.toggle i {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 1.5px solid var(--muted);
}

.toggle.on i {
    background: var(--accent);
    border-color: var(--accent);
}

.seg button:focus-visible,
.toggle:focus-visible,
.plain:focus-visible,
.handle:focus-visible,
#play:focus-visible,
.legend li:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* legend */
.legend {
    position: absolute;
    left: 16px;
    top: 104px;
    width: 236px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 12px 10px;
    z-index: 2;
    backdrop-filter: blur(6px);
}

.legend h2 {
    margin: 0 0 8px;
    font-family: "Barlow Condensed", sans-serif;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
}

.ramp {
    height: 8px;
    border-radius: 4px;
    margin-bottom: 4px;
}

.ramp-axis {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--muted);
    margin-bottom: 8px;
}

.legend ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.legend li {
    display: grid;
    grid-template-columns: 14px 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 4px 4px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
}

.legend li:hover {
    background: rgba(255, 255, 255, 0.06);
}

.legend li.off {
    opacity: 0.35;
}

.legend li small {
    color: var(--muted);
    font-size: 11px;
    margin-left: 4px;
}

.legend li .n {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    font-size: 12px;
}

.swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    display: inline-block;
}

.swatch.muted {
    background: #6d6a5a;
    vertical-align: -3px;
    margin-right: 6px;
}

.legend-note {
    margin: 8px 0 0;
    padding-top: 8px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.4;
}

/* tooltip */
.tooltip {
    position: absolute;
    z-index: 4;
    pointer-events: none;
    background: rgba(10, 12, 16, 0.95);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 11px;
    max-width: 280px;
    font-size: 12.5px;
    line-height: 1.45;
}

.tooltip b {
    display: block;
    font-size: 13.5px;
    margin-bottom: 2px;
}

.tooltip .y {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 22px;
    font-weight: 600;
}

.tooltip .src {
    color: var(--muted);
}

.tooltip .tag {
    display: inline-block;
    margin-top: 4px;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(242, 193, 78, 0.16);
    color: var(--accent);
    font-size: 11px;
}

/* timeline */
.timeline {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0 16px 10px;
    z-index: 2;
    background: linear-gradient(to top, rgba(14, 17, 22, 0.96) 55%, rgba(14, 17, 22, 0));
}

.tl-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 6px;
}

#play {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--panel);
    display: grid;
    place-items: center;
    flex: none;
}

#play svg {
    width: 18px;
    height: 18px;
    fill: var(--accent);
}

.tl-year strong {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 34px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.tl-year span {
    color: var(--muted);
    margin-left: 4px;
}

.tl-note {
    margin: 0 0 0 auto;
    max-width: 420px;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.4;
    text-align: right;
}

.tl-track {
    position: relative;
    height: 96px;
}

#hist {
    position: absolute;
    left: 0;
    top: 22px;
    width: 100%;
    height: 56px;
}

.tl-range {
    position: absolute;
    top: 82px;
    height: 4px;
    background: var(--accent);
    border-radius: 2px;
}

.tl-track::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 82px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.12);
}

.handle {
    position: absolute;
    top: 76px;
    width: 16px;
    height: 16px;
    margin-left: -8px;
    border-radius: 50%;
    border: 2px solid var(--bg);
    background: var(--text);
    padding: 0;
    touch-action: none;
}

.tl-axis {
    position: absolute;
    left: 0;
    right: 0;
    top: 88px;
    height: 12px;
    font-size: 10.5px;
    color: var(--muted);
}

.tl-axis span {
    position: absolute;
    transform: translateX(-50%);
}

.tl-year {
    line-height: 1.1;
}

.tl-ruler {
    color: var(--accent);
    font-size: 12.5px;
    font-weight: 500;
    min-height: 15px;
}

.tl-rulers {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 16px;
}

.tl-reign {
    position: absolute;
    top: 2px;
    height: 14px;
    background: rgba(255, 255, 255, 0.07);
    border-left: 1px solid rgba(14, 17, 22, 0.9);
    color: var(--muted);
    font-size: 10px;
    line-height: 14px;
    padding-left: 4px;
    white-space: nowrap;
    overflow: hidden;
    border-radius: 2px;
}

.tl-reign.alt {
    background: rgba(255, 255, 255, 0.11);
}

.tl-reign.on {
    background: rgba(242, 193, 78, 0.28);
    color: var(--text);
}

.tl-chapter {
    position: absolute;
    top: -3px;
    width: 9px;
    height: 9px;
    margin-left: -4.5px;
    padding: 0;
    border-radius: 50%;
    border: 1.5px solid var(--bg);
    background: var(--accent);
    z-index: 1;
}

.tl-chapter.on {
    background: var(--text);
    transform: scale(1.35);
}

.tl-chapter:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* story */
.story {
    position: absolute;
    right: 16px;
    top: 104px;
    width: 340px;
    max-height: calc(100% - 290px);
    overflow: auto;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 16px 14px;
    z-index: 2;
    backdrop-filter: blur(6px);
    display: none;
}

body.story-on .story {
    display: block;
}

.story-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--muted);
    font-family: "Barlow Condensed", sans-serif;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 600;
}

.close-story {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 20px;
    line-height: 1;
    padding: 0 2px;
}

.story-year {
    margin: 6px 0 0;
    font-family: "Barlow Condensed", sans-serif;
    font-size: 30px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
}

.story h2 {
    margin: 4px 0 2px;
    font-family: "Barlow Condensed", sans-serif;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.15;
}

.story-ruler {
    margin: 0 0 8px;
    font-size: 12.5px;
    color: var(--muted);
}

.story-ruler:not(:empty)::before {
    content: "♛ ";
    color: var(--accent);
}

.story-text {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.55;
    color: #d3d8e0;
}

.story-nav {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 12px;
    /* stays reachable while the chapter scrolls on small screens */
    position: sticky;
    bottom: -14px;
    padding: 8px 0 14px;
    margin-bottom: -14px;
    background: linear-gradient(to top, rgb(18, 22, 29) 70%, rgba(18, 22, 29, 0));
}

.story-nav button {
    border: 1px solid var(--line);
    background: transparent;
    border-radius: 7px;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 500;
}

.story-nav button.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
    font-weight: 600;
}

.story-nav button:disabled {
    opacity: 0.35;
    cursor: default;
}

.story-nav button:focus-visible,
.close-story:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.tooltip .ruler {
    color: var(--accent);
    font-size: 11.5px;
    margin-bottom: 2px;
}

/* photos and links */
.story-photo,
.card-photo {
    margin: 8px 0 4px;
}

.story-photo[hidden] {
    display: none;
}

.story-photo img,
.card-photo img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.05);
}

.story-photo figcaption,
.card-photo figcaption {
    margin-top: 4px;
    font-size: 10.5px;
    line-height: 1.35;
    color: var(--muted);
}

.story-photo a,
.card-photo a,
.story-links a,
.card-links a,
dialog a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(242, 193, 78, 0.35);
}

.story-photo a:hover,
.card-photo a:hover,
.story-links a:hover,
.card-links a:hover,
dialog a:hover {
    border-bottom-color: var(--accent);
}

.story-links {
    margin-top: 10px;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--muted);
}

.story-links span:first-child {
    color: var(--text);
    font-weight: 500;
}

.lang-tag {
    font-size: 9.5px;
    padding: 0 3px;
    border: 1px solid var(--line);
    border-radius: 3px;
    color: var(--muted);
}

.tooltip .hint {
    margin-top: 5px;
    font-size: 11px;
    color: var(--muted);
    font-style: italic;
}

.card {
    position: absolute;
    left: 16px;
    top: 104px;
    width: 300px;
    max-height: calc(100% - 290px);
    overflow: auto;
    z-index: 3;
    background: rgba(12, 15, 20, 0.96);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 12.5px;
    line-height: 1.45;
}

.card[hidden] {
    display: none;
}

.card .close-story {
    float: right;
    margin: -4px -4px 0 6px;
}

.card b {
    display: block;
    font-size: 15px;
    margin-bottom: 2px;
}

.card .y {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 24px;
    font-weight: 600;
}

.card .ruler {
    color: var(--accent);
    font-size: 12px;
}

.card .src {
    color: var(--muted);
}

.card .tag {
    display: inline-block;
    margin-top: 4px;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(242, 193, 78, 0.16);
    color: var(--accent);
    font-size: 11px;
}

.card-links {
    margin: 8px 0 0;
}

.no-photo {
    margin: 0 0 6px;
    color: var(--muted);
    font-style: italic;
    font-size: 11.5px;
}

/* about */
dialog {
    max-width: 680px;
    width: calc(100% - 32px);
    max-height: calc(100% - 48px);
    background: #141820;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 24px 26px;
    line-height: 1.55;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
}

dialog h2 {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 28px;
    margin: 0 0 10px;
}

dialog h3 {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 18px;
    letter-spacing: 0.02em;
    margin: 20px 0 6px;
    color: var(--accent);
}

dialog p,
dialog li {
    color: #c9ced8;
}

dialog ul,
dialog ol {
    padding-left: 20px;
}

dialog li {
    margin-bottom: 6px;
}

dialog code {
    font-size: 12px;
    background: rgba(255, 255, 255, 0.07);
    padding: 1px 4px;
    border-radius: 3px;
}

dialog .small {
    font-size: 12px;
    color: var(--muted);
}

.close {
    float: right;
    border: 1px solid var(--line);
    background: transparent;
    border-radius: 6px;
    padding: 5px 10px;
}

.loading {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-family: "Barlow Condensed", sans-serif;
    font-size: 20px;
    color: var(--muted);
    z-index: 5;
    pointer-events: none;
}

.loading.done {
    display: none;
}

/* phone */
@media (max-width: 760px) {
    .card {
        left: 16px;
        right: 16px;
        width: auto;
        top: auto;
        bottom: 170px;
        max-height: 50vh;
        z-index: 4;
    }

    .story-photo img {
        aspect-ratio: 21 / 9;
    }

    .story {
        left: 16px;
        right: 16px;
        top: auto;
        bottom: 170px;
        width: auto;
        max-height: 42vh;
        z-index: 3;
    }

    body.story-on .legend {
        display: none;
    }

    .tl-reign {
        font-size: 0;
    }

    .top {
        flex-direction: column;
        gap: 10px;
    }

    .brand h1 {
        font-size: 30px;
    }

    .controls {
        justify-content: flex-start;
    }

    .legend {
        top: auto;
        bottom: 170px;
        width: auto;
        right: 16px;
        max-height: 34vh;
        overflow: auto;
        padding: 8px 10px;
    }

    .legend ul {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .legend li .n,
    .legend li small,
    .ramp,
    .ramp-axis {
        display: none;
    }

    .tl-note {
        display: none;
    }
}

@media (max-width: 1100px) and (min-width: 761px) {
    .brand h1 {
        font-size: 32px;
    }

    .story {
        width: 300px;
    }
}

/* dated events on the timeline */
.tl-events {
    position: absolute;
    left: 0;
    right: 0;
    top: 22px;
    height: 56px;
    pointer-events: none;
}

.tl-event {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 9px;
    margin-left: -4.5px;
    padding: 0;
    border: 0;
    background: transparent;
    pointer-events: auto;
    cursor: pointer;
}

.tl-event::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255, 255, 255, 0.22);
}

.tl-event::after {
    content: "";
    position: absolute;
    left: 2px;
    top: -2px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
}

.tl-event:hover::before,
.tl-event.on::before {
    background: var(--accent);
}

.tl-event.on::after {
    background: var(--accent);
    transform: scale(1.4);
}

.tl-event:focus-visible {
    outline: 2px solid var(--accent);
}

.tl-bubble {
    position: absolute;
    top: 24px;
    transform: translateX(-50%);
    max-width: min(340px, 80%);
    padding: 5px 10px;
    border-radius: 7px;
    background: rgba(12, 15, 20, 0.94);
    border: 1px solid rgba(242, 193, 78, 0.5);
    font-size: 12.5px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    z-index: 2;
}

.tl-bubble[hidden] {
    display: none;
}

.tl-bubble b {
    color: var(--accent);
    margin-right: 4px;
    font-family: "Barlow Condensed", sans-serif;
    font-size: 14px;
}

.tl-bubble.pop {
    animation: bubble-pop 0.45s ease-out;
}

@keyframes bubble-pop {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* opening: "Building the city 42 %" */
.building {
    position: absolute;
    left: 50%;
    top: 45%;
    transform: translate(-50%, -50%);
    font-family: "Barlow Condensed", sans-serif;
    font-size: 22px;
    letter-spacing: 0.04em;
    color: var(--text);
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 2;
    font-variant-numeric: tabular-nums;
}

.building[hidden] {
    display: none;
}

@media (max-width: 760px) {
    .tl-bubble {
        white-space: normal;
        max-width: 92%;
    }
}

/* use mode and occupants */
.use-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
}

.use-tag i,
.occ-list i {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex: none;
}

.occ {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--line);
    font-size: 12px;
}

.occ .more,
.card .more {
    color: var(--muted);
    font-size: 11px;
}

.card h4 {
    margin: 12px 0 6px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
    font-family: "Barlow Condensed", sans-serif;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.occ-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.occ-list li {
    display: flex;
    gap: 8px;
    align-items: baseline;
    padding: 3px 0;
}

.occ-list li small {
    display: block;
    color: var(--muted);
    font-size: 10.5px;
}

.occ-list a {
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--line);
}

.occ-list a:hover {
    border-bottom-color: var(--accent);
}

.legend li.static {
    cursor: default;
}

.legend li.static:hover {
    background: transparent;
}

.legend-use-note {
    margin: 8px 0 0;
    padding-top: 8px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.4;
}

/* timeline tooltip */
.tl-tip {
    position: absolute;
    bottom: calc(100% + 10px);
    transform: translateX(-50%);
    width: 330px;
    padding: 10px 12px;
    background: rgba(10, 12, 16, 0.97);
    border: 1px solid var(--line);
    border-radius: 9px;
    font-size: 12.5px;
    line-height: 1.45;
    pointer-events: none;
    z-index: 5;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.tl-tip[hidden],
.tl-guide[hidden] {
    display: none;
}

.tt-year {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
}

.tt-year span {
    margin-left: 8px;
    font-family: "Barlow", sans-serif;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--muted);
}

.tt-ruler {
    margin-top: 6px;
    color: var(--accent);
    font-weight: 600;
}

.tt-ruler span {
    margin-left: 4px;
    color: var(--muted);
    font-weight: 400;
    font-size: 11.5px;
}

.tt-bio {
    margin: 3px 0 0;
    color: #d3d8e0;
}

.tt-stat {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.tt-stat strong {
    color: var(--text);
}

.tt-events {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--line);
    font-size: 12px;
}

.tt-events b {
    display: block;
    color: var(--muted);
    font-size: 10.5px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.tt-events span {
    display: inline-block;
    min-width: 36px;
    color: var(--accent);
    font-family: "Barlow Condensed", sans-serif;
    font-weight: 600;
    font-size: 13px;
}

.tt-hint {
    margin-top: 6px;
    color: var(--muted);
    font-size: 10.5px;
    font-style: italic;
}

.tl-guide {
    position: absolute;
    top: 0;
    height: 86px;
    width: 1px;
    background: rgba(255, 255, 255, 0.5);
    pointer-events: none;
    z-index: 1;
}

/* details of the hovered bar */
.tl-tip {
    width: 360px;
}

.tt-bar {
    margin-top: 6px;
    padding: 6px 0 8px;
    border-bottom: 1px solid var(--line);
}

.tt-counts {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--muted);
}

.tt-counts b {
    color: var(--text);
    font-size: 13px;
}

.tt-counts .est b {
    color: var(--muted);
}

.tt-that {
    margin-top: 5px;
    color: var(--text);
}

.tt-that b,
.tt-notable b,
.tt-where b {
    display: inline-block;
    min-width: 62px;
    margin-right: 4px;
    color: var(--muted);
    font-size: 10.5px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 600;
}

.tt-that b {
    color: var(--accent);
}

.tt-notable {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.tt-notable img {
    width: 62px;
    height: 62px;
    object-fit: cover;
    border-radius: 5px;
    flex: none;
}

.tt-notable b {
    display: block;
}

.tt-notable i {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 2px;
    margin-right: 5px;
    vertical-align: 1px;
}

.tt-notable span,
.tt-where span {
    color: var(--muted);
    font-size: 11px;
}

.tt-where {
    margin-top: 4px;
    font-size: 12px;
}

.tt-spread {
    margin: 6px 0 0;
    font-size: 10.5px;
    color: var(--muted);
    font-style: italic;
}

/* landmark stories */
.card-story {
    margin: 8px 0 0;
    padding: 8px 10px;
    border-left: 2px solid var(--accent);
    background: rgba(242, 193, 78, 0.07);
    border-radius: 0 6px 6px 0;
    font-size: 13px;
    line-height: 1.55;
    color: #dfe3ea;
}

.tooltip .story-hint {
    color: var(--accent);
    font-style: normal;
}

.card-photo figcaption em {
    color: var(--text);
}

/* quarter card */
.card .q-name {
    display: block;
    font-family: "Barlow Condensed", sans-serif;
    font-size: 26px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.q-stats {
    margin: 8px 0 0;
    color: var(--muted);
}

.q-stats strong {
    color: var(--text);
}

.q-bar {
    display: flex;
    height: 10px;
    border-radius: 3px;
    overflow: hidden;
}

.q-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 3px 10px;
    margin-top: 6px;
    font-size: 11px;
    color: var(--muted);
}

.q-legend i {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 2px;
    margin-right: 4px;
}

.q-landmarks {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.q-landmarks button,
.q-zoom {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 11.5px;
    color: var(--text);
}

.q-landmarks button:hover,
.q-zoom:hover {
    border-color: var(--accent);
}

.q-zoom {
    color: var(--accent);
}

/* rotation tools */
.view-tools {
    position: absolute;
    right: 16px;
    bottom: 196px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 2;
}

.view-tools button {
    width: 40px;
    height: 40px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: var(--panel);
    font-size: 17px;
    line-height: 1;
    display: grid;
    place-items: center;
    padding: 0;
}

#spin,
#tilt {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 12px;
    font-weight: 700;
}

#spin.on {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}

#compass svg {
    width: 22px;
    height: 22px;
    transition: transform 0.1s linear;
}

.view-tools button:hover {
    border-color: var(--accent);
}

.view-tools button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

body.story-on .view-tools {
    right: 372px;
}

@media (max-width: 1100px) and (min-width: 761px) {
    body.story-on .view-tools {
        right: 332px;
    }
}

@media (max-width: 760px) {
    /* a row under the header, clear of the story panel */
    .view-tools {
        right: 16px;
        bottom: auto;
        top: 206px;
        flex-direction: row;
        z-index: 4;
    }

    .view-tools button {
        width: 36px;
        height: 36px;
    }

    body.story-on .view-tools {
        right: 16px;
    }
}

/* compact layout: phones, upright and sideways */
.menu-btn,
.story-more {
    display: none;
}

@media (max-width: 760px), (max-height: 500px) {
    .top {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        z-index: 5;
    }

    .brand {
        flex: 1;
        min-width: 0;
    }

    .menu-btn {
        display: inline-flex;
        margin-left: auto;
        min-height: 40px;
    }

    .menu-btn::before {
        content: "☰";
        font-size: 15px;
    }

    body.menu-open .menu-btn {
        background: var(--text);
        color: var(--bg);
    }

    .controls {
        display: none;
        width: 100%;
        justify-content: flex-start;
        padding: 10px;
        background: var(--panel);
        border: 1px solid var(--line);
        border-radius: 10px;
        backdrop-filter: blur(6px);
        max-height: calc(100vh - 90px);
        overflow: auto;
    }

    body.menu-open .controls {
        display: flex;
    }

    .seg button,
    .toggle,
    .plain {
        min-height: 40px;
    }

    .view-tools {
        top: 112px;
        bottom: auto;
        right: 16px;
        flex-direction: row;
    }

    body.story-on .view-tools {
        right: 16px;
    }

    /* the story shows its year, title and buttons; the rest on demand */
    .story-head {
        gap: 4px;
    }

    .story-more {
        display: inline-block;
        margin-left: auto;
        border: 0;
        background: transparent;
        color: var(--accent);
        font-size: 12.5px;
        font-weight: 600;
        padding: 10px 6px;
        text-transform: none;
        letter-spacing: 0;
        font-family: inherit;
    }

    .close-story {
        min-width: 40px;
        min-height: 40px;
    }

    body:not(.story-full) .story-photo,
    body:not(.story-full) .story-text,
    body:not(.story-full) .story-links {
        display: none;
    }

    .story-nav button {
        min-height: 40px;
    }
}

/* phone held sideways: little height, so panels go to the sides */
@media (max-height: 500px) {
    .top {
        top: 10px;
        left: 12px;
        right: 12px;
    }

    .brand h1 {
        font-size: 24px;
    }

    .brand p {
        display: none;
    }

    .view-tools {
        top: 58px;
        right: 12px;
    }

    .view-tools button {
        width: 36px;
        height: 36px;
    }

    body.story-on .view-tools {
        right: 344px;
    }

    .story,
    .card {
        top: 58px;
        bottom: 148px;
        left: auto;
        right: 12px;
        width: 320px;
        max-height: none;
    }

    .legend {
        top: 58px;
        bottom: 148px;
        left: 12px;
        right: auto;
        width: 230px;
        max-height: none;
        overflow: auto;
        padding: 8px 10px;
    }

    body.story-on .legend {
        display: none;
    }

    .legend li .n,
    .legend li small,
    .ramp,
    .ramp-axis {
        display: none;
    }

    .timeline {
        padding-bottom: 6px;
    }

    .tl-head {
        margin-bottom: 0;
    }

    .tl-year strong {
        font-size: 24px;
    }

    #play {
        width: 36px;
        height: 36px;
    }

    .tl-note {
        display: none;
    }
}

/* fingers need bigger targets than a mouse */
@media (pointer: coarse) {
    .tl-event {
        width: 24px;
        margin-left: -12px;
    }

    .tl-event::before {
        left: 11.5px;
    }

    .tl-event::after {
        left: 9.5px;
    }

    .handle {
        top: 72px;
        width: 24px;
        height: 24px;
        margin-left: -12px;
    }
}
