/* The history pages' own parts. The long-read parts, the page head, the picture
   cards and the tiles are the shell's (assets/almanac.css); this file adds only
   what a history needs: old charts set on paper, a wipe between two pictures,
   the drawings, and the way from one chapter to the next. Colours are the
   site's tokens, so every part follows day and night. */

.hist-head { min-height: clamp(21rem, 62vh, 38rem); }
/* On a phone nothing is laid on the picture: the old chart or photograph stands
   clear, and its title, opening line, caption and credit come under it on the paper. */
@media (max-width: 36rem) {
  .hist-head { display: block; min-height: 0; overflow: visible; background: var(--sheet); color: var(--ink); }
  .hist-head::after { display: none; }
  .hist-head > img { position: static; z-index: auto; display: block; width: 100%; height: clamp(13rem, 64vw, 21rem); object-fit: cover; }
  .hist-head .page-head-in { padding-block: 1.1rem 0; }
  .hist-head .eyebrow { color: var(--gold); text-shadow: none; }
  .hist-head h1, .hist-head .page-head-lede { text-shadow: none; }
  .hist-head .page-head-credit { margin-top: 0.7rem; padding-bottom: 0; color: var(--ink-soft); opacity: 1; text-shadow: none; font-size: 0.75rem; line-height: 1.4; }
}
.hist-head .eyebrow a { color: inherit; text-decoration: none; border-bottom: 1px solid currentColor; }
.hist-measure { max-width: 46rem; }
.hist-read .read-meta a, .hist-read .fineprint a { color: var(--accent); }

/* The chapter read aloud: a button, and once pressed the player in its place. */
.hist-listen { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; padding: 0.8rem 1rem; border-radius: 12px; background: var(--water); border: 1px solid var(--water-edge); }
.hist-listen[hidden] { display: none; }
.hist-listen > * { margin: 0; }
.hist-listen-go::before { content: ""; display: inline-block; width: 0; height: 0; margin-right: 0.55rem; border-style: solid; border-width: 0.38em 0 0.38em 0.62em; border-color: transparent transparent transparent currentColor; vertical-align: -0.02em; }
.hist-listen-say { font-size: var(--step--1); color: var(--ink-soft); }
.hist-listen audio { flex: 1 1 16rem; min-width: 0; height: 2.5rem; }

/* A chapter opens on one large first letter, as a printed history does. */
.hist-read > .read-meta + p::first-letter, .hist-read > .hist-listen + p::first-letter { float: left; font-family: var(--display); font-weight: 600; font-size: 3.6em; line-height: 0.82; padding: 0.06em 0.09em 0 0; color: var(--accent); }

/* An old chart or engraving sits on the paper with a hairline round it, and is
   never cropped to a shape: the whole sheet shows. */
.hist-paper > img, .hist-paper > .hist-zoom > img { border: 1px solid var(--rule); border-radius: 4px; background: var(--sheet); }
.hist-zoom { display: block; cursor: zoom-in; }
.hist-zoom > img { display: block; width: 100%; height: auto; border-radius: 10px; }
.hist-paper > .hist-zoom > img { border-radius: 4px; }
.read-figure .read-credit a, .hist-credit a, .page-head-credit a { text-decoration: underline; text-underline-offset: 2px; }
.hist-credit { margin: 0; font-size: 0.75rem; line-height: 1.4; color: var(--ink-soft); overflow-wrap: anywhere; }

/* Two pictures of one place. Side by side as they stand; one over the other
   with a wipe once history.js has run. */
.hist-cmp-stage { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.hist-cmp-side { position: relative; min-width: 0; }
.hist-cmp-side > img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }
.hist-cmp-word { position: absolute; top: 0.6rem; left: 0.6rem; z-index: 2; padding: 0.2rem 0.55rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; background: var(--forest); color: var(--on-forest); }
.hist-cmp:not(.hist-cmp--live) .hist-cmp-stage { aspect-ratio: auto !important; }
.hist-cmp--live .hist-cmp-stage { display: block; overflow: hidden; border-radius: 10px; touch-action: pan-y; }
.hist-cmp--live .hist-cmp-side { position: absolute; inset: 0; }
.hist-cmp--live .hist-cmp-side > img { border-radius: 0; }
.hist-cmp--live .hist-cmp-side + .hist-cmp-side .hist-cmp-word { left: auto; right: 0.6rem; }
.hist-cmp-bar { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1.5px; background: var(--on-forest); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25); pointer-events: none; z-index: 3; }
.hist-cmp-bar::after { content: ""; position: absolute; top: 50%; left: 50%; width: 2.4rem; height: 2.4rem; margin: -1.2rem 0 0 -1.2rem; border-radius: 50%; background: var(--press); border: 2px solid var(--on-forest); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35); }
.hist-cmp-range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; z-index: 4; }
.hist-cmp-range:focus-visible + * , .hist-cmp-stage:has(.hist-cmp-range:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Drawings. A wide drawing keeps a width a finger can read and runs sideways
   on a narrow phone, with the figure's caption staying put. */
.hist-drawing { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.hist-drawing > svg { display: block; width: 100%; height: auto; min-width: 44rem; }
.hist-drawing > svg.hist-map { min-width: 34rem; }
.hist-drawing > figcaption { position: sticky; left: 0; }
.hist-drawing text { font-family: var(--text); fill: var(--ink-soft); font-size: 13px; }

.hist-map-land { fill: var(--land); stroke: var(--land-edge); stroke-width: 1.5; stroke-linejoin: round; }
.hist-map-mark line { stroke: var(--ink-soft); stroke-width: 1; }
.hist-map-mark > circle { fill: var(--ink); }
.hist-map-mark > circle.hist-map-n { fill: var(--press); stroke: var(--sheet); stroke-width: 2; }
.hist-map-mark text { fill: var(--on-press); font-weight: 700; font-size: 17px; }

.hist-rib-line { stroke: var(--gold); stroke-width: 4; stroke-linecap: round; }
.hist-rib-tick line { stroke: var(--ink-soft); stroke-width: 1; }
.hist-rib-tick text { font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase; }
.hist-rib-stop line { stroke: var(--rule); stroke-width: 1.2; }
.hist-rib-stop circle { fill: var(--sheet); stroke: var(--accent); stroke-width: 3; }
.hist-drawing text.hist-rib-when { font-family: var(--display); font-weight: 600; font-size: 17px; fill: var(--ink); }
.hist-drawing text.hist-rib-what { font-size: 12.5px; }

.hist-st-grid line { stroke: var(--rule); stroke-width: 1; stroke-dasharray: 2 5; }
.hist-st-base { stroke: var(--ink-soft); stroke-width: 1.2; }
.hist-st-year line { stroke: var(--ink-soft); stroke-width: 1; }
.hist-drawing text.hist-st-name { font-weight: 700; font-size: 12.5px; fill: var(--ink); paint-order: stroke; stroke: var(--sheet); stroke-width: 4px; stroke-linejoin: round; }
.hist-st-c1 rect { fill: color-mix(in srgb, var(--gold-bright) 38%, var(--sheet)); }
.hist-st-c2 rect { fill: color-mix(in srgb, var(--gold-bright) 62%, var(--sheet)); }
.hist-st-c3 rect { fill: var(--gold-bright); }
.hist-st-c4 rect { fill: color-mix(in srgb, var(--signal) 55%, var(--gold-bright)); }
.hist-st-c5 rect { fill: var(--signal); }
.hist-st-gap line { stroke: var(--accent); stroke-width: 2; }
.hist-st-gap text { fill: var(--accent); font-weight: 600; }

.hist-ch-grid line { stroke: var(--rule); stroke-width: 1; stroke-dasharray: 2 5; }
.hist-ch-area { fill: color-mix(in srgb, var(--accent) 14%, transparent); }
.hist-ch-line { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.hist-ch-dot circle { fill: var(--sheet); stroke: var(--accent); stroke-width: 2.5; }
.hist-ch-dot text { font-weight: 700; fill: var(--ink); font-size: 13px; }
.hist-ch-mark line { stroke: var(--gold); stroke-width: 1.5; stroke-dasharray: 4 4; }
.hist-ch-mark text { fill: var(--gold); font-weight: 700; font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; }

/* Where a visitor can stand in the chapter today. */
.hist-stand { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr)); gap: 0.9rem; max-width: none !important; }
.hist-stand > li { display: flex; flex-direction: column; gap: 0.35rem; padding: 1rem 1.1rem 1.1rem; border-radius: 12px; background: var(--land); border: 1px solid var(--land-edge); border-top: 3px solid var(--gold); }
.hist-stand h3 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 1.3rem; line-height: 1.15; }
.hist-stand h3 a { color: var(--ink); text-decoration: none; }
.hist-stand h3 a::after { content: " \2192"; color: var(--accent); }
.hist-stand p { margin: 0; font-size: 0.95rem; line-height: 1.45; }
.hist-more ul { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 0.35rem; }

/* From one chapter to the next. */
.hist-next { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.hist-next a { display: flex; flex-direction: column; gap: 0.25rem; padding: 1rem 1.15rem; border-radius: 12px; border: 1px solid var(--rule); color: var(--ink); text-decoration: none; font-family: var(--display); font-weight: 600; font-size: 1.3rem; line-height: 1.2; }
.hist-next a:hover { border-color: var(--accent); }
.hist-next a span { font-family: var(--text); font-weight: 700; font-size: 0.75rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--gold); }
.hist-next-next { text-align: right; background: var(--land); border-color: var(--land-edge) !important; }
.hist-next-next::after { content: none; }
@media (max-width: 34rem) { .hist-next { grid-template-columns: 1fr; } .hist-next-next { text-align: left; order: -1; } }

/* The front page of the history: the chapters as picture cards, each a link. */
.hist-card { padding: 0; display: flex; flex-direction: column; }
.hist-card-credit { padding: 0 1rem 0.9rem; }
.hist-card-a { display: flex; flex-direction: column; flex: 1; color: inherit; text-decoration: none; border-radius: inherit; }
.hist-card-a:hover h3 { color: var(--accent); }
.hist-card .pic-card-pic { aspect-ratio: 3 / 2; overflow: hidden; border-radius: 11px 11px 0 0; }
.hist-card .pic-card-in { padding-bottom: 0.6rem; }
.hist-card .pic-card-sub { font-weight: 700; font-size: 0.75rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--gold); }
.hist-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 2rem; height: 2rem; padding: 0 0.5rem; border-radius: 999px; background: var(--forest); color: var(--on-forest); font-family: var(--display); font-weight: 600; font-size: 1.05rem; }
.hist-card-mins { margin-top: auto !important; padding-top: 0.3rem; font-size: 0.78rem; color: var(--ink-soft); }
.hist-front-lede { font-family: var(--display); font-size: clamp(1.25rem, 1vw + 1rem, 1.6rem); line-height: 1.4; max-width: 44rem; margin: 0; }
.hist-band-say { margin: 0; max-width: 46rem; color: var(--ink-soft); }
.hist-front .tiles { margin-block: 0.4rem; }
.hist-front figure.hist-drawing { margin: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.hist-front figure.hist-drawing figcaption { max-width: 46rem; font-size: var(--step--1); line-height: 1.45; color: var(--ink-soft); }
.hist-key { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(15rem, 100%), 1fr)); gap: 0.35rem 1.2rem; font-size: 0.95rem; }
.hist-key li { display: grid; grid-template-columns: 1.9rem minmax(0, 1fr); gap: 0.5rem; align-items: baseline; }
.hist-key b { display: inline-flex; align-items: center; justify-content: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--press); color: var(--on-press); font-size: 0.82rem; }
.hist-key a { color: var(--ink); }

/* The chart room. */
.hist-gal .pic-card-pic { display: block; aspect-ratio: 4 / 3; cursor: zoom-in; }
.hist-gal .hist-gal-chart > img { object-fit: contain; background: var(--sheet); }
.hist-gal .pic-card-in { padding-bottom: 0.9rem; }
.hist-gal .pic-card-sub { font-weight: 700; font-size: 0.75rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--gold); }
.hist-ref-gap { font-size: 0.72em; vertical-align: super; line-height: 0; color: var(--accent); }

@media print { .hist-next, .hist-cmp-range, .hist-cmp-bar { display: none; } }

/* A cut through the ground of a dig. */
.hist-drawing > svg.hist-dig { min-width: 40rem; }
.hist-dig-row rect { stroke: var(--sheet); stroke-width: 2; }
.hist-dig-t0 { fill: color-mix(in srgb, var(--ink) 16%, var(--land)); }
.hist-dig-t1 { fill: color-mix(in srgb, var(--gold-bright) 30%, var(--land)); }
.hist-dig-t2 { fill: color-mix(in srgb, var(--gold-bright) 52%, var(--land)); }
.hist-dig-t3 { fill: color-mix(in srgb, var(--gold) 55%, var(--land)); }
.hist-dig-t4 { fill: color-mix(in srgb, var(--gold) 80%, var(--land)); }
.hist-dig-row line { stroke: var(--ink-soft); stroke-width: 1; }
.hist-drawing text.hist-dig-when { font-family: var(--display); font-weight: 600; font-size: 17px; fill: var(--ink); }
.hist-drawing text.hist-dig-what { font-size: 13.5px; }
.hist-drawing text.hist-dig-cm { font-size: 12px; font-variant-numeric: tabular-nums; }
.hist-drawing text.hist-dig-note { font-size: 13.5px; font-weight: 700; fill: var(--accent); }
.hist-dig-surface { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 5 5; }

/* The picture viewer (history.js): a picture opened larger without leaving the page.
   Its buttons stand in a bar above the picture and its words below; nothing is laid on it. */
html.hist-viewing { overflow: hidden; }
.hist-view { box-sizing: border-box; width: 100vw; max-width: 100vw; height: 100vh; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; background: var(--sheet); color: var(--ink); overflow: hidden; }
.hist-view[open] { display: flex; flex-direction: column; }
.hist-view::backdrop { background: rgba(6, 16, 14, 0.82); }
.hist-view-bar { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; padding: max(0.5rem, env(safe-area-inset-top, 0px)) var(--gutter-r) 0.5rem var(--gutter-l); border-bottom: 1px solid var(--rule); }
.hist-view-count { margin: 0 auto 0 0; font-size: 0.82rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.hist-view-b { min-height: 2.5rem; padding: 0.35rem 0.8rem; font-size: 0.88rem; }
.hist-view-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--land); }
.hist-view-img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.hist-view-img--more { cursor: zoom-in; }
.hist-view--full .hist-view-stage { display: block; overflow: auto; overscroll-behavior: contain; cursor: grab; }
.hist-view--full .hist-view-img { max-width: none; max-height: none; margin: auto; cursor: zoom-out; }
.hist-view-cap { flex: none; max-height: 30vh; overflow: auto; padding: 0.7rem var(--gutter-r) max(0.8rem, env(safe-area-inset-bottom, 0px)) var(--gutter-l); border-top: 1px solid var(--rule); font-size: 0.92rem; line-height: 1.45; }
.hist-view--full .hist-view-cap { display: none; }
.hist-view-cap > * { margin: 0; max-width: 78ch; }
.hist-view-cap h3 { margin: 0.1rem 0 0.2rem; font-family: var(--display); font-size: 1.1rem; }
.hist-view-cap .pic-card-sub { font-weight: 700; font-size: 0.75rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--gold); }
.hist-view-cap .read-credit, .hist-view-cap .hist-credit { display: block; margin-top: 0.3rem; font-size: 0.76rem; line-height: 1.4; color: var(--ink-soft); overflow-wrap: anywhere; }
.hist-view-cap .read-credit, .hist-view-cap .hist-credit { max-width: none; }
.hist-view-cap a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
@media (max-width: 30rem) {
  .hist-view-bar { gap: 0.3rem; }
  .hist-view-b { padding: 0.3rem 0.55rem; font-size: 0.82rem; }
  .hist-view-count-word { display: none; }
}
@media (max-width: 22rem) {
  .hist-view-count { display: none; }
  .hist-view-bar { justify-content: space-between; }
}
@media (min-width: 48rem) {
  .hist-view { width: min(96vw, 112rem); height: 94vh; margin: auto; border: 1px solid var(--rule); border-radius: 14px; }
  .hist-view-bar { padding: 0.6rem 1rem; }
  .hist-view-cap { padding: 0.8rem 1rem 0.9rem; }
}

/* The moving sea in the first chapter: the geology section's own map and bar (geology.css),
   with this section's second button beside the first. */
.hist-sea-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.hist-sea .g-controls { margin-top: 0.7rem; }
@media (max-width: 40rem) {
  .hist-sea .g-controls { grid-template-columns: minmax(0, 1fr); }
  .hist-sea .g-ends { grid-column: 1; }
  .hist-sea-buttons .button { flex: 1 1 auto; }
}

/* A scene (scene.js): the living island set to a moment a chapter tells. The model fills the picture's box; its
   buttons stand in a row under it and the step's words under those. Nothing is laid on the picture. */
.hist-scene-box { position: relative; overflow: hidden; border-radius: 10px; background: var(--forest); line-height: 0; }
.hist-scene-box > img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hist-scene-box canvas { touch-action: pan-y; }
.hist-scene-bar { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.7rem; }
.hist-scene-bar .button { min-height: 2.5rem; padding: 0.35rem 0.85rem; font-size: 0.9rem; }
.hist-scene-chip[aria-pressed="true"] { background: var(--press); color: var(--on-press); border-color: var(--press); }
.hist-scene-steps { margin: 0.7rem 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.5rem; max-width: var(--measure); }
.hist-scene-step { font-size: 1rem; line-height: 1.5; }
.hist-scene-step b { font-family: var(--display); font-size: 1.1rem; }
.hist-scene-clock { color: var(--ink-soft); }
.hist-scene--live .hist-scene-steps { min-height: 6.2em; }
@media (max-width: 30rem) {
  .hist-scene-box { aspect-ratio: 4 / 3 !important; }      /* a phone gives the model more height than a desk's wide frame */
  .hist-scene-bar .button { flex: 1 1 auto; padding: 0.3rem 0.55rem; font-size: 0.84rem; }
  .hist-scene-bar .hist-scene-play { flex-basis: 100%; }
}
