/* Shared layout for the digital project pages, on top of the site's ../style.css */

:root {
    --paper: #ffffff;
    --paper-edge: #e2ddd3;
    --border-strong: #b9ad98;
    --oxblood: #7a1f1f;
    /* border around the maps, the same grey as their coastlines */
    --map-frame: #8a969c;
}

.back-link {
    display: inline-block;
    font-family: var(--sans);
    font-size: 0.85rem;
    color: var(--muted);
    text-decoration: none;
    margin-bottom: 2rem;
}

.back-link:hover {
    color: var(--accent);
}

.project-header {
    max-width: var(--measure);
    margin-bottom: 2.5rem;
}

.project-kicker {
    font-family: var(--sans);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.9rem;
}

.project-header h1 {
    font-family: var(--serif);
    font-size: 2.3rem;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.015em;
    margin-bottom: 0.6rem;
}

.project-credit {
    font-family: var(--sans);
    font-size: 0.88rem;
    color: var(--muted);
    margin-bottom: 1.5rem;
}

.project-lede {
    font-size: 1.08rem;
    line-height: 1.7;
}

.project-lede + .project-lede {
    margin-top: 0.9rem;
}

/* The visualization itself sits on a white panel */
.project-figure {
    background: var(--paper);
    border: 1px solid var(--paper-edge);
    padding: 1.25rem;
    overflow-x: auto;
}

.project-figure .map-frame {
    position: relative;
    margin: 0 auto;
    border: 1px solid var(--map-frame);
}

.figure-caption {
    font-family: var(--sans);
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 1rem;
    line-height: 1.6;
}

.figure-caption strong {
    color: var(--ink);
    font-weight: 600;
}

/* Toolbar of controls above a visualization */
.figure-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 0 auto 1rem;
    font-family: var(--sans);
    font-size: 0.85rem;
    color: var(--ink);
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border-strong);
    border-radius: 50%;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
}

.icon-button:hover {
    border-color: var(--ink);
}

.icon-button .material-icons {
    font-size: 20px;
}

.icon-button.primary {
    width: 42px;
    height: 42px;
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}

.icon-button.primary:hover {
    background: var(--accent);
    border-color: var(--accent);
}

/* Range sliders */
.timeline {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    min-width: 200px;
    height: 3px;
    background: var(--paper-edge);
    outline: none;
    cursor: pointer;
}

.timeline::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--accent);
}

.timeline::-moz-range-thumb {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid #fff;
}

.timeline.short {
    flex: 0 0 140px;
    min-width: 0;
}

.toolbar-label {
    color: var(--muted);
    white-space: nowrap;
}

.toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    white-space: nowrap;
}

.toggle input {
    accent-color: var(--accent);
    width: 15px;
    height: 15px;
}

/* Overlays drawn on top of a map */
.map-year {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--serif);
    font-size: 2.5em;
    font-weight: 600;
    color: var(--ink);
    line-height: 1;
    text-shadow: 0 0 6px #fff, 0 0 12px #fff;
    pointer-events: none;
    z-index: 5;
}

.map-legend {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--paper-edge);
    padding: 0.6rem 0.8rem;
    font-family: var(--sans);
    font-size: 0.78em;
    line-height: 1.7;
    color: var(--ink);
    z-index: 5;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

/* Width key of a flow map (lib/flow-map.js) */
.legend-heading {
    margin-top: 0.5rem;
    padding-top: 0.45rem;
    border-top: 1px solid var(--paper-edge);
    font-weight: 600;
}

.flow-key-swatch {
    display: inline-flex;
    align-items: center;
    width: 26px;
    height: 22px;
}

.flow-key-swatch span {
    display: block;
    width: 26px;
    background: var(--muted);
    border-radius: 1px;
}

/* Sources and method */
.project-notes {
    max-width: var(--measure);
    margin-top: 3.5rem;
}

.project-notes h2 {
    font-family: var(--serif);
    font-size: 1.4rem;
    font-weight: 600;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--ink);
    margin-bottom: 1.25rem;
}

/* Detail pop-up, opened by clicking on a place or a node */
.modal {
    position: fixed;
    inset: 0;
    background-color: rgba(20, 20, 20, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: visibility 0s linear 0.2s, opacity 0.2s;
    z-index: 50;
}

.show-modal {
    opacity: 1;
    visibility: visible;
    transition: visibility 0s linear 0s, opacity 0.2s;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg);
    color: var(--ink);
    padding: 2rem 2.25rem;
    border-top: 3px solid var(--accent);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    max-height: 80vh;
    width: min(720px, 92vw);
    overflow-y: auto;
    font-size: 1rem;
    line-height: 1.65;
}

.modal-content h2 {
    font-family: var(--serif);
    font-size: 1.5em;
    font-weight: 600;
    margin-bottom: 0.25rem;
    padding-right: 2rem;
}

.modal-count {
    font-family: var(--sans);
    color: var(--muted);
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1.25rem;
}

.modal-content ul {
    list-style: none;
}

.modal-content ul li {
    padding: 0.85rem 0;
    border-top: 1px solid var(--paper-edge);
}

.modal-content mark {
    background: rgba(122, 31, 31, 0.12);
    color: inherit;
    padding: 0 2px;
}

.citation {
    display: block;
    margin-top: 0.35rem;
    font-family: var(--sans);
    color: var(--muted);
    font-size: 0.82em;
}

.close-button {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    font-family: var(--sans);
    font-size: 1.6em;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
}

.close-button:hover {
    color: var(--accent);
}

@media (max-width: 640px) {
    .project-header h1 {
        font-size: 1.8rem;
    }

    .project-figure {
        padding: 0.75rem;
    }
}
