/* main.css
 *
 * Warm paper, ink, one instrument, and a stage that changes scene.
 */

:root {
    --paper:        #f6f2ea;
    --paper-deep:   #efe9dd;
    --paper-white:  #fcfaf5;
    --ink:          #1d1a16;
    --ink-soft:     #554e44;
    --ink-faint:    #9a9186;
    --rule:         #ded5c6;
    --market:       #b4412c;
    --hosts:        #6f8c82;
    --active:       #2f6b5f;
    --seam:         #3b3630;
    --warn:         #8a6d3b;
    --serif:        'Iowan Old Style', 'Palatino Linotype', Palatino,
                    Georgia, 'Times New Roman', serif;
    --mono:         ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    --hand:         'Bradley Hand', 'Segoe Script', 'Comic Sans MS',
                    cursive;
}

* { box-sizing: border-box; }

/* Each beat latches to the centre of the viewport, so the text and its
 * illustration always settle together and the piece cannot be left half
 * way between two beats. On a phone the beats latch by their top edge to
 * the foot of the stage instead; see the media query.
 */
html {
    scroll-behavior: auto;
    scroll-snap-type: y mandatory;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--serif);
    font-size: 19px;
    line-height: 1.62;
    -webkit-font-smoothing: antialiased;
}

/* Without JavaScript the stage has nothing to show. The text still reads,
 * full width, every beat at full strength, and a note says why the
 * drawings are missing.
 */
html.no-js { scroll-snap-type: none; }
html.no-js .graphic { display: none; }
html.no-js .scrolly { display: block; max-width: 40rem; }
html.no-js .step { opacity: 1; min-height: 0; padding: 2.5rem 0; }

.nojs-note {
    max-width: 34rem;
    margin: 1.5rem auto 0;
    padding: 0.8rem 1rem;
    border: 1px solid var(--rule);
    font-family: var(--mono);
    font-size: 0.72rem;
    line-height: 1.6;
    color: var(--ink-soft);
}

/* ---------------------------------------------------------------- masthead */

.masthead {
    max-width: 34rem;
    margin: 0 auto;
    padding: 22vh 1.5rem 16vh;
    text-align: center;
    scroll-snap-align: start;
}

.kicker {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin: 0 0 1.5rem;
}

.masthead h1 {
    font-size: clamp(2.6rem, 8vw, 4rem);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.05;
    margin: 0 0 1.5rem;
}

.standfirst {
    color: var(--ink-soft);
    margin: 0;
    text-wrap: pretty;
}

.scroll-hint {
    margin-top: 4rem;
    color: var(--ink-faint);
    font-size: 1.4rem;
    animation: nudge 2.4s ease-in-out infinite;
}

@keyframes nudge {
    0%, 100% { transform: translateY(0);    opacity: 0.45; }
    50%      { transform: translateY(8px);  opacity: 1;    }
}

/* ----------------------------------------------------------------- scrolly */

.scrolly {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 32rem;
    gap: 3.5rem;
    max-width: 80rem;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.graphic {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    grid-column: 1;
}

.graphic-inner {
    position: relative;
    width: 100%;
    height: 88vh;
}

/* ------------------------------------------------------------------- stage */

.stage {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 600ms ease, visibility 0s linear 600ms;
}

[data-scene="cards"] .stage-cards,
[data-scene="chart"] .stage-chart,
[data-scene="atlas"] .stage-atlas,
[data-scene="curve"] .stage-curve {
    opacity: 1;
    visibility: visible;
    transition: opacity 600ms ease 150ms, visibility 0s linear 0s;
}

.panel {
    width: 100%;
    height: auto;
    display: block;
    overflow: visible;
    max-height: 62vh;
}

/* ------------------------------------------------------------------- cards */

.card {
    position: absolute;
    inset: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 600ms ease, transform 600ms ease,
        visibility 0s linear 600ms;
}

.card.is-shown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 600ms ease 120ms, transform 600ms ease 120ms,
        visibility 0s linear 0s;
}

.artifact {
    position: relative;
    width: min(32rem, 92%);
    padding: 1.6rem 1.8rem 1.4rem;
    background: var(--paper-white);
    border: 1px solid var(--rule);
    box-shadow: 0 1px 0 #fff inset, 0 10px 30px rgba(40, 30, 10, 0.08),
        0 1px 2px rgba(0, 0, 0, 0.06);
    color: var(--ink);
}

.artifact-head {
    font-family: var(--mono);
    font-size: 0.66rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin: 0 0 1rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid var(--rule);
    padding-bottom: 0.6rem;
}

.artifact-head span {
    color: var(--ink-faint);
    letter-spacing: 0.06em;
    text-transform: none;
}

.artifact-foot {
    font-family: var(--mono);
    font-size: 0.66rem;
    color: var(--ink-faint);
    margin: 1rem 0 0;
    line-height: 1.6;
}

.artifact-note {
    font-family: var(--mono);
    font-size: 0.58rem;
    line-height: 1.6;
    color: var(--ink-faint);
    margin: 1.1rem 0 0;
    padding-top: 0.6rem;
    border-top: 1px dashed var(--rule);
}

/* The allegory drawings. */

.drawing {
    width: 100%;
    height: auto;
    display: block;
}

.drawing .ink {
    fill: none;
    stroke: var(--ink);
    stroke-width: 1.6;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.drawing .rock { fill: var(--paper-deep); }
.drawing .lever { stroke-width: 2.4; }
.drawing .half { fill: var(--paper); stroke-width: 1.2; }
.drawing .rate { stroke-dasharray: 3 4; stroke: var(--market); }
.drawing .screen { fill: var(--paper-deep); stroke-width: 1; }
.drawing .crack { stroke: var(--market); stroke-width: 1.4; }
.drawing .grid rect { fill: var(--paper-deep); stroke-width: 1; }

.drawing .label {
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.14em;
    fill: var(--ink-soft);
}

.drawing .tally {
    font-family: var(--mono);
    font-size: 13px;
    fill: var(--ink);
}

.drawing .note {
    font-family: var(--mono);
    font-size: 10.5px;
    fill: var(--ink-faint);
}

.drawing .tiny { font-size: 14px; fill: var(--market); }
.drawing .count { fill: var(--market); font-weight: 700; }
.drawing .dash { fill: var(--ink-faint); }

/* Three to a rock: the figures heave, gently, forever. */

.heave { animation: heave 2.4s ease-in-out infinite; }

@keyframes heave {
    0%, 100% { transform: translateX(0); }
    55% { transform: translateX(5px); }
}

/* The pressable lever. */

.lever-drawing {
    touch-action: none;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    outline: none;
}

.lever-drawing.is-dragging { cursor: grabbing; }

.lever-drawing:focus-visible { outline: 2px solid var(--market); }

.lever-drawing .stone { fill: var(--paper-deep); stroke-width: 1.4; }
.lever-drawing .rock-line { stroke-width: 1; stroke: var(--ink-faint); }
.lever-drawing .figure { stroke-width: 1.7; }
.lever-drawing .ground { stroke-width: 1.2; }

.lever-drawing .hint {
    fill: var(--market);
    font-size: 11px;
    letter-spacing: 0.12em;
    transition: opacity 0.4s ease;
}

.lever-drawing .hint.is-quiet { opacity: 0.35; }

.lever-drawing .tally-note { fill: var(--ink); font-size: 11.5px; }

.rock-wrap {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.9, 0.6),
        opacity 0.4s ease 0.1s;
    transform-box: view-box;
}

.rock-wrap.is-rolling {
    transform: translateX(110px) rotate(24deg);
    transform-origin: 386px 176px;
    opacity: 0;
}

.rock-wrap.is-arriving {
    transition: none;
    transform: translateX(-16px);
    opacity: 0;
}

/* The ledger. */

.artifact-ledger table,
.artifact-lever table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--mono);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}

.artifact-ledger th,
.artifact-lever th {
    text-align: left;
    font-weight: 400;
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-faint);
    padding: 0 0 0.4rem;
    border-bottom: 1px solid var(--rule);
}

.artifact-ledger td,
.artifact-lever td {
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--paper-deep);
}

.artifact-ledger td:not(:first-child),
.artifact-ledger th:not(:first-child),
.artifact-lever td:not(:first-child),
.artifact-lever th:not(:first-child) {
    text-align: right;
    padding-left: 0.8rem;
}

.artifact-lever table { margin-top: 0.8rem; }
.artifact-lever tr.is-new td { color: var(--market); }

/* The invoice. */

.artifact-invoice .artifact-line {
    font-family: var(--mono);
    font-size: 0.78rem;
    margin: 0.35rem 0;
    display: grid;
    grid-template-columns: 4rem 1fr;
    gap: 0.5rem;
    color: var(--ink);
}

.artifact-invoice .artifact-line span {
    color: var(--ink-faint);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-size: 0.62rem;
    padding-top: 0.15rem;
}

.artifact-amount {
    font-family: var(--mono);
    font-size: 2.4rem;
    letter-spacing: -0.02em;
    margin: 1rem 0 0.6rem;
    text-align: right;
    border-top: 1px solid var(--ink);
    border-bottom: 3px double var(--ink);
    padding: 0.4rem 0;
}

/* The letter. */

.letter-title {
    font-size: 1.15rem;
    text-align: center;
    margin: 0 0 1rem;
    letter-spacing: 0.02em;
}

.letter-body {
    font-family: var(--mono);
    font-size: 0.74rem;
    line-height: 1.7;
    margin: 0 0 0.8rem;
    color: var(--ink);
}

.letter-sign {
    font-family: var(--mono);
    font-size: 0.7rem;
    line-height: 1.6;
    margin: 1rem 0 0;
    color: var(--ink-soft);
}

/* The memo. */

.artifact-memo { padding-top: 3.4rem; }

.memo-annotation {
    position: absolute;
    top: 0.9rem;
    left: 1.6rem;
    transform: rotate(-4deg);
    font-family: var(--hand);
    font-size: 1.6rem;
    color: #2a4a8a;
    margin: 0;
    line-height: 1;
}

.memo-title {
    font-size: 1.3rem;
    margin: 0.4rem 0 0.2rem;
}

.memo-author {
    font-family: var(--mono);
    font-size: 0.74rem;
    color: var(--ink-soft);
    margin: 0 0 1rem;
}

.memo-abstract {
    font-size: 0.86rem;
    line-height: 1.55;
    margin: 0;
    color: var(--ink-soft);
}

/* The post. */

.artifact-post pre {
    font-family: var(--mono);
    font-size: 0.66rem;
    line-height: 1.6;
    margin: 0;
    white-space: pre-wrap;
    color: var(--ink);
}

/* The advertisement, drawn. */

.horne-drawing .house,
.horne-drawing .store { fill: var(--paper); }
.horne-drawing .window { fill: #f3e6c4; stroke-width: 1.2; }
.horne-drawing .glass { fill: #eef0ec; stroke-width: 1.2; }
.horne-drawing .set { fill: var(--paper-deep); stroke-width: 1.1; }
.horne-drawing .dial { fill: var(--paper); stroke-width: 0.9; }
.horne-drawing .awning { fill: var(--paper-deep); stroke-width: 1.1; }
.horne-drawing .mast { stroke-width: 1.3; }
.horne-drawing .tag { fill: var(--paper); stroke: var(--market); }

.horne-drawing .wave {
    fill: none;
    stroke: var(--market);
    stroke-width: 1.2;
    opacity: 0.25;
    animation: wave 3.2s ease-in-out infinite;
}

.horne-drawing .wave:nth-child(2) { animation-delay: 0.4s; }
.horne-drawing .wave:nth-child(3) { animation-delay: 0.8s; }
.horne-drawing .wave:nth-child(4) { animation-delay: 1.2s; }
.horne-drawing .wave:nth-child(5) { animation-delay: 1.6s; }

@keyframes wave {
    0%, 100% { opacity: 0.15; }
    30% { opacity: 0.9; }
}

.horne-drawing .sign {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 11px;
    letter-spacing: 0.16em;
    fill: var(--ink);
}

.horne-drawing .price {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 11px;
    font-weight: 700;
    fill: var(--market);
}

.horne-drawing .clip { fill: #fbf8f0; stroke: var(--ink); stroke-width: 1; }

.horne-drawing .headline {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 10.5px;
    font-weight: 700;
    fill: var(--ink);
}

.horne-drawing .dateline {
    font-family: var(--mono);
    font-size: 8px;
    letter-spacing: 0.04em;
    fill: var(--ink-faint);
}

.artifact-horne .artifact-foot {
    font-family: Georgia, 'Times New Roman', serif;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: 0;
    text-transform: none;
    font-size: 0.8rem;
    margin-top: 0.8rem;
}

/* Circularity. */

.circle-drawing .node { fill: var(--paper); stroke-width: 1.4; }
.circle-drawing .arc { stroke-width: 1.4; }
.circle-drawing .arc-crisis { stroke: var(--market); }
.circle-drawing .arc-phase { stroke: var(--ink); }
.circle-drawing .ring { stroke: var(--rule); stroke-dasharray: 3 5; }

.circle-drawing .name {
    font-family: var(--serif);
    font-size: 15px;
    fill: var(--ink);
}

.circle-drawing .verb {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    fill: var(--ink-soft);
}

.circle-drawing .verb-crisis { fill: var(--market); }

/* The closing card. */

.close-label {
    display: block;
    font-family: var(--mono);
    font-size: 0.66rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin: 0 0 0.6rem;
}

#ownCount {
    width: 100%;
    font-family: var(--serif);
    font-size: 1.3rem;
    padding: 0.5rem 0;
    border: 0;
    border-bottom: 2px solid var(--ink);
    background: transparent;
    color: var(--ink);
    outline: none;
}

#ownCount::placeholder {
    color: var(--ink-faint);
    /* The hint is set smaller than what the reader types, so the whole of
     * it fits the box on a phone; if a box is narrower still it ends in an
     * ellipsis rather than a cut letter.
     */
    font-size: 0.95rem;
    text-overflow: ellipsis;
}

.close-sentence {
    margin: 1.1rem 0 0;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--ink-soft);
    min-height: 3.2em;
}

.close-sentence strong { color: var(--ink); font-weight: 400; }

/* The one thing the page sends, said where it is typed. */
.close-note {
    margin: 0.9rem 0 0;
    font-family: var(--mono);
    font-size: 0.6rem;
    line-height: 1.5;
    color: var(--ink-faint);
}

/* ------------------------------------------------------------------- chart */

.grid line {
    stroke: var(--rule);
    stroke-width: 1;
}

.axis text {
    font-family: var(--mono);
    font-size: 11px;
    fill: var(--ink-faint);
}

.axis line { stroke: var(--rule); stroke-width: 1; }

.axis .axis-unit {
    font-size: 9.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.axis-right {
    opacity: 0;
    transition: opacity 700ms ease 400ms;
}

.axis-right text { fill: var(--hosts); }
.axis-right line { stroke: var(--hosts); }

.is-revealed .axis-right { opacity: 1; }

.series-market {
    fill: none;
    stroke: var(--market);
    stroke-width: 2.5;
    stroke-linejoin: round;
    stroke-linecap: round;
}

/* The sites line was running the whole time. On reveal it is drawn in from
 * its first point to the present, head on the tip, the way the market line
 * is drawn as the clock runs; the script sets the path, so nothing here
 * fades or dashes. The line with content follows the same rule.
 */
.series-hosts {
    fill: none;
    stroke: var(--hosts);
    stroke-width: 2.25;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.series-active {
    fill: none;
    stroke: var(--active);
    stroke-width: 2.75;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.head { transition: opacity 300ms ease; }
.head-market { fill: var(--market); }
.head-hosts { fill: var(--hosts); }
.head-active { fill: var(--active); }

/* The seam: the first exchange rate, drawn across the whole plot. */

.seam {
    opacity: 0;
    transition: opacity 600ms ease;
}

.seam.is-shown { opacity: 1; }

.seam line {
    stroke: var(--seam);
    stroke-width: 1.25;
    stroke-dasharray: 5 4;
}

.seam text {
    font-family: var(--mono);
    font-size: 10.5px;
    font-weight: 700;
    fill: var(--seam);
}

.events text {
    font-family: var(--mono);
    font-size: 10.5px;
    fill: var(--ink-soft);
}

.events .event-bottom text { fill: var(--hosts); }

.events line { stroke: var(--ink-faint); stroke-width: 1; }
.events .event-bottom line { stroke: var(--hosts); opacity: 0.6; }

.events g {
    opacity: 0;
    transition: opacity 450ms ease;
}

.events g.is-shown { opacity: 1; }

.chart-foot {
    font-family: var(--mono);
    font-size: 0.66rem;
    line-height: 1.75;
    color: var(--ink-faint);
    margin: 1rem 0 0;
    max-width: 44rem;
}

.key {
    font-weight: 700;
    padding-right: 0.15em;
}

.key::before {
    content: '';
    display: inline-block;
    width: 1.1em;
    height: 2px;
    vertical-align: 0.25em;
    margin-right: 0.45em;
}

.key-market { color: var(--market); }
.key-market::before { background: var(--market); }

.key-hosts { color: var(--hosts); }
.key-hosts::before { background: var(--hosts); }

.key-active { color: var(--active); }
.key-active::before { background: var(--active); }

.foot-b {
    opacity: 0;
    transition: opacity 700ms ease;
}

.is-revealed .foot-b { opacity: 1; }

/* ------------------------------------------------------------------ meters */

.meters {
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    gap: 1rem;
    min-height: 7.5rem;
    margin-bottom: 0.4rem;
}

.meter {
    text-align: center;
    transform: translateY(-8px);
    opacity: 0;
    transition: opacity 600ms ease, transform 600ms ease;
}

.meter.is-live { opacity: 1; transform: translateY(0); }

.meter-b .meter-bezel { border-color: #c5d2cc; background: #e9efe9; }
.meter-b .meter-value { color: var(--active); }

.meter-source {
    font-family: var(--mono);
    font-size: 0.55rem;
    color: var(--ink-faint);
    margin: 0.3rem 0 0;
    max-width: 12rem;
    line-height: 1.5;
    letter-spacing: 0.02em;
}

.meter-bezel {
    position: relative;
    min-width: 11rem;
    padding: 0.9rem 1.25rem 1rem;
    background: var(--paper-deep);
    border: 1px solid var(--rule);
    border-radius: 3px;
    box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(0, 0, 0, 0.06);
}

.meter-label,
.meter-unit {
    font-family: var(--mono);
    font-size: 0.6rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin: 0;
}

.meter-value {
    font-family: var(--mono);
    font-size: 2rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin: 0.3rem 0 0.15rem;
    transition: color 400ms ease;
}

.meter-caption {
    font-family: var(--mono);
    font-size: 0.6rem;
    color: var(--ink-faint);
    margin: 0.55rem 0 0;
    max-width: 12rem;
    line-height: 1.5;
}

/* The break. */

.meter.is-broken .meter-bezel {
    border-color: #c9bda9;
    background: #ece5d8;
}

.meter.is-broken .meter-value {
    color: var(--ink-faint);
}

/* Reading again through the crack, once a rate exists. */
.meter.is-broken.is-readable .meter-value {
    color: var(--ink-soft);
}

.meter.is-broken .meter-bezel::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(to bottom right, transparent 49.6%,
            #b9ab94 49.6%, #b9ab94 50.1%, transparent 50.1%),
        linear-gradient(to bottom left, transparent 63%,
            #c4b7a2 63%, #c4b7a2 63.4%, transparent 63.4%);
}

.meter.is-shaking { animation: shake 420ms ease-in-out; }

@keyframes shake {
    0%, 100% { transform: translate(0, 0); }
    20%      { transform: translate(-3px, 1px) rotate(-0.4deg); }
    45%      { transform: translate(3px, -1px) rotate(0.35deg); }
    70%      { transform: translate(-2px, 1px) rotate(-0.2deg); }
}

/* ------------------------------------------------------------------- atlas */

.atlas-band-install { fill: #efe3d6; }
.atlas-band-deploy { fill: #e4ebe4; }
.atlas-band-tp { fill: var(--market); opacity: 0.55; }
.atlas-band-tp-open { fill: url(#atlasFade); }
.atlas-band-second { fill: var(--market); opacity: 0.9; }
.atlas-band-outline { fill: none; stroke: var(--rule); stroke-width: 1; }

.atlas-column {
    fill: var(--market);
    opacity: 0.06;
}

.atlas-column-label {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    fill: var(--market);
}

.atlas-num {
    font-family: var(--mono);
    font-size: 11px;
    fill: var(--ink-faint);
}

.atlas-name {
    font-family: var(--serif);
    font-size: 14px;
    fill: var(--ink);
}

.atlas-bang {
    font-family: var(--mono);
    font-size: 9.5px;
    fill: var(--ink-faint);
}

.atlas-label {
    font-family: var(--mono);
    font-size: 10px;
    fill: var(--ink-soft);
}

.atlas-label-tp { fill: var(--market); font-weight: 700; }
.atlas-label-golden { fill: var(--active); }

.atlas-axis text {
    font-family: var(--mono);
    font-size: 10px;
    fill: var(--ink-faint);
}

.atlas-axis line { stroke: var(--rule); stroke-width: 1; }


/* ------------------------------------------------------------------- curve */

#curve { outline: none; cursor: grab; touch-action: none; }
#curve.is-dragging { cursor: grabbing; }
#curve:focus-visible .curve-pin circle { stroke: var(--ink); stroke-width: 2; }

.curve-line {
    fill: none;
    stroke: var(--ink);
    stroke-width: 2;
    stroke-linecap: round;
}

.curve-line-sixth {
    fill: none;
    stroke: var(--ink-faint);
    stroke-width: 1.5;
    stroke-dasharray: 4 5;
}

.curve-base { stroke: var(--rule); stroke-width: 1; }
.curve-divider { stroke: var(--ink-faint); stroke-width: 1; stroke-dasharray: 2 4; }

.curve-tp {
    fill: var(--market);
    opacity: 0.1;
}

.curve-phase {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    fill: var(--ink-faint);
}

.curve-period {
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    fill: var(--ink-soft);
}

.curve-years {
    font-family: var(--mono);
    font-size: 10px;
    fill: var(--ink-faint);
}

.curve-pin line { stroke: var(--ink); stroke-width: 1.25; }
.curve-pin circle { fill: var(--paper-white); stroke: var(--market); stroke-width: 3; }

.curve-pin text {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    fill: var(--ink);
}

.curve-pin-perez { opacity: 0; transition: opacity 500ms ease; }
.curve-pin-perez.is-shown { opacity: 1; }
.curve-pin-perez line { stroke: var(--active); }
.curve-pin-perez circle { stroke: var(--active); }
.curve-pin-perez text { fill: var(--active); }

.curve-controls {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-top: 0.4rem;
}

.curve-readout {
    font-family: var(--mono);
    font-size: 0.72rem;
    line-height: 1.6;
    color: var(--ink-soft);
    margin: 0;
    max-width: 30rem;
}

.curve-readout strong { color: var(--ink); font-weight: 700; }

.curve-button {
    font-family: var(--mono);
    font-size: 0.66rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.55rem 0.9rem;
    background: var(--paper-white);
    color: var(--ink);
    border: 1px solid var(--ink);
    border-radius: 2px;
    cursor: pointer;
    white-space: nowrap;
}

.curve-button:hover { background: var(--paper-deep); }

/* ------------------------------------------------------------------- steps */

.steps {
    grid-column: 2;
    position: relative;
    z-index: 1;
}

.step {
    min-height: 92vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4rem 0;
    opacity: 0.26;
    transition: opacity 400ms ease;
    scroll-snap-align: center;
    scroll-snap-stop: always;
}

.step.is-active { opacity: 1; }

.step p { margin: 0 0 1.1rem; text-wrap: pretty; }
.step p:last-child { margin-bottom: 0; }

.dateline {
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--market);
}

.step blockquote {
    margin: 0 0 1.1rem;
    padding-left: 1.1rem;
    border-left: 2px solid var(--rule);
    font-size: 1.05rem;
    line-height: 1.55;
    color: var(--ink);
}

.step blockquote cite {
    display: block;
    margin-top: 0.7rem;
    font-family: var(--mono);
    font-size: 0.68rem;
    font-style: normal;
    letter-spacing: 0.08em;
    color: var(--ink-faint);
}

.aside {
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--ink-soft);
    border-top: 1px solid var(--rule);
    padding-top: 0.9rem;
}

.caveat {
    font-family: var(--mono);
    font-size: 0.74rem;
    line-height: 1.7;
    color: var(--warn);
    border-left: 2px solid var(--warn);
    padding-left: 0.9rem;
}

.step-reveal p:first-child,
.step-open p:first-child {
    font-size: 1.45rem;
    line-height: 1.3;
}

/* --------------------------------------------------------------- colophon */

.colophon {
    max-width: 34rem;
    margin: 0 auto;
    padding: 14vh 1.5rem 18vh;
    scroll-snap-align: end;
    font-family: var(--mono);
    font-size: 0.72rem;
    line-height: 1.8;
    color: var(--ink-faint);
    border-top: 1px solid var(--rule);
}

.colophon strong { color: var(--ink-soft); font-weight: 700; }
.colophon code { color: var(--ink-soft); }

.colophon a {
    color: var(--ink-soft);
    text-decoration: underline;
    text-decoration-color: var(--rule);
    text-underline-offset: 0.2em;
}

.colophon a:hover { color: var(--market); text-decoration-color: currentColor; }

/* ----------------------------------------------------------------- mobile */

@media (max-width: 900px) {

    body { font-size: 17px; }

    /* Beats latch here too, by their top edge to the foot of the stage,
     * and only beats do: a swipe that comes to rest near the start of a
     * beat glides onto it, a swipe that rests in the middle of a tall beat
     * stays where it stopped and the beat is read as a page. CSS snapping
     * cannot express this. Mandatory snapping made Safari jump a mid-beat
     * swipe to the next beat; paragraph targets fixed that at a stop per
     * paragraph; proximity snapping still treats a tall beat as an area
     * and pulls the reader to one of a few positions inside it. So the
     * phone latch is done by main.js on scroll rest, and snapping is off.
     */
    html { scroll-snap-type: none; }

    .scrolly {
        display: block;
        padding: 0 1.1rem;
    }

    /* The text is first-class on a phone. The stage takes the top two
     * fifths of the screen and the reading gets the rest; a card that
     * would not fit is scaled down to the stage by main.js, and only a
     * card that is still too tall at the legibility floor scrolls.
     */
    .graphic {
        height: 40vh;
        height: 40svh;
        top: 0;
        /* Bleed to the screen edges so the text scrolling behind the
         * stage cannot show in the column gutters.
         */
        margin: 0 -1.1rem;
        padding: 0.35rem 1.1rem;
        background: var(--paper);
        border-bottom: 1px solid var(--rule);
        z-index: 3;
    }

    .graphic-inner { height: 100%; }

    .artifact {
        width: min(30rem, 96%);
        padding: 0.85rem 1rem 0.75rem;
        transform: scale(var(--fit, 1));
        transform-origin: center;
    }

    /* A card that main.js has capped at the legibility floor scrolls, and
     * a strip of paper fades in at its foot so the cut is visibly a fold
     * and not a broken edge. The strip is drawn on the card's untransformed
     * parent, not inside the scroller: a sticky box inside a scaled
     * scroller lands in the wrong place in Safari and covered a line of
     * the letter. main.js sets --fit and is-capped on the parent; the
     * artifact is centred and scaled about its centre, so its visible foot
     * is a fixed 3px above the parent's, and its visible width is its
     * width times the scale.
     */
    .card.is-capped .artifact { overflow-y: auto; }

    .card.is-capped::after {
        content: '';
        position: absolute;
        left: 50%;
        bottom: 4px;
        width: calc(min(30rem, 96%) * var(--fit, 1) - 2px);
        height: 1.6rem;
        transform: translateX(-50%);
        background: linear-gradient(
            to bottom, rgba(252, 250, 245, 0), var(--paper-white) 70%);
        pointer-events: none;
    }

    /* The provenance notes stay; they are the honesty of the cards. */
    .artifact-note { font-size: 0.52rem; margin-top: 0.7rem; }
    .letter-body, .ad-body { font-size: 0.68rem; }

    /* The letter is the tallest card. Tighter leading and margins on the
     * phone bring it inside the legibility floor whole, so it is scaled
     * like the others rather than capped and scrolled.
     */
    .letter-title { margin-bottom: 0.6rem; }
    .letter-body { line-height: 1.5; margin-bottom: 0.6rem; }
    .letter-sign { line-height: 1.45; margin-top: 0.6rem; }
    .artifact-post pre { font-size: 0.56rem; }

    .meters {
        min-height: 0;
        gap: 0.5rem;
        margin-bottom: 0.2rem;
    }

    .meter-bezel {
        min-width: 0;
        padding: 0.4rem 0.8rem 0.5rem;
    }

    .meter-value { font-size: 1.1rem; }
    .meter-label, .meter-unit { font-size: 0.5rem; }
    .meter-caption, .meter-source { display: none; }

    .panel { max-height: 30vh; max-height: 30svh; }

    .chart-foot { display: none; }

    .curve-controls { flex-direction: column; align-items: flex-start; }

    .step {
        min-height: 0;
        padding: 2.25rem 0;
        /* The beat below the latched one is a ghost, there only to say the
         * page goes on; anything more legible made the screen busy.
         */
        opacity: 0.12;
    }

    .step.is-active { opacity: 1; }

    .step-reveal p:first-child,
    .step-open p:first-child { font-size: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
