/* The geology pages' own parts: maps with names laid over them, the two maps
   where the reader raises the sea, one chart, the earthquake map's dots, and keys. The long-read parts
   (.read, .read-figure, .read-aside, .read-notes and the rest) are the shell's
   and are not repeated here.

   Colours: everything on the paper takes the Almanac's tokens. The maps are
   pictures with colours of their own, the same by day and by night, so the
   names laid over them keep one ink and one halo; at night the whole map is
   dimmed a little so it does not glare. The maps' own colours are set once,
   here, and the build's Python (src/rocks.py, src/sea.py) uses the same
   values for the pictures it draws. */

:root {
  /* the maps' own ink */
  --g-map-ink: #172027;
  --g-map-halo: #F7FAF9;
  /* the rising-sea maps (read by sea.js) */
  --g-sea: #CBE1E4;
  --g-land: #B0BEA0;
  --g-drowned: #DEBA68;
  --g-coast: #243430;
  /* the rock map's groups (src/rocks.py holds the same) */
  --g-rock-pale: #E2C48C;
  --g-rock-basalt: #7AA068;
  --g-rock-beds: #B09660;
  --g-rock-undivided: #E8D0B0;
  --g-rock-feeders: #CC844E;
  --g-rock-louisenhoj: #70A4AA;
  --g-rock-limestone: #3C6EBE;
  --g-rock-tutu: #A88CBA;
  --g-rock-tonalite: #C43448;
  --g-rock-dikes: #34383C;
  --g-rock-young: #ECEEE6;
  /* storm tracks, by strength */
  --g-storm-1: #D6A028;
  --g-storm-3: #B0243C;
  --g-storm-0: #969E9C;
  /* dots for earthquakes, by how long ago (read by nothing but this sheet) */
  --g-quake-new: var(--g-storm-3);
  --g-quake-week: var(--g-storm-1);
  --g-quake-old: var(--g-map-ink);
  /* the island in 100 m squares (src/ground.py holds the same) */
  --g-ground-rock: #B0BEA0;
  --g-ground-steep: #747C64;
  --g-ground-young: #ECD078;
  --g-ground-low: #D67A30;
  --g-ground-off: #CED4C8;
}

/* ----- a map: a picture with names laid over it ----- */
.g-map { position: relative; overflow: hidden; border-radius: 6px; background: var(--land); line-height: 0; }
.g-map > img, .g-map > canvas { display: block; width: 100%; height: 100%; border-radius: 0; }
.g-map[style*="--ar"] { aspect-ratio: var(--ar); }
.g-map[style*="--ar"] > img, .g-map[style*="--ar"] > canvas { position: absolute; inset: 0; }
.g-l {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap; pointer-events: none;
  font-size: clamp(0.6rem, 0.35rem + 0.75vw, 0.82rem); font-weight: 600; line-height: 1.05; letter-spacing: 0.005em;
  color: var(--g-map-ink);
  text-shadow: 0 0 2px var(--g-map-halo), 0 0 2px var(--g-map-halo), 0 0 3px var(--g-map-halo), 0 0 5px var(--g-map-halo);
}
.g-l--sea { font-style: italic; font-weight: 500; }
.g-l--big { font-size: clamp(0.72rem, 0.4rem + 1vw, 1.05rem); font-weight: 700; }
.g-l--left { transform: translate(0, -50%); }
.g-l--right { transform: translate(-100%, -50%); }
.g-l--dot::before { content: ""; display: inline-block; width: 0.42em; height: 0.42em; margin-right: 0.3em; border-radius: 50%; background: var(--g-map-ink); vertical-align: 0.08em; box-shadow: 0 0 0 1.5px var(--g-map-halo); }
.g-l--w { display: none; }
@media (min-width: 44rem) { .g-l--w { display: block; } }
/* a bar that says how long a mile is on this map */
.g-scale { position: absolute; left: 3%; bottom: 5%; display: flex; flex-direction: column; gap: 0.2rem; font-size: clamp(0.6rem, 0.35rem + 0.7vw, 0.78rem); font-weight: 600; line-height: 1; color: var(--g-map-ink); text-shadow: 0 0 3px var(--g-map-halo), 0 0 3px var(--g-map-halo); pointer-events: none; }
.g-scale i { display: block; height: 0.3rem; border: 1.5px solid var(--g-map-ink); border-top: 0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .g-map { filter: brightness(0.86); } }
:root[data-theme="dark"] .g-map { filter: brightness(0.86); }

/* ----- the map of recent earthquakes: dots laid over the sea-floor map ----- */
.g-map > svg.g-quakes { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.g-quakes circle { stroke: var(--g-map-halo); stroke-width: 0.6; pointer-events: auto; }
.g-q-old { fill: var(--g-quake-old); fill-opacity: 0.5; }
.g-q-week { fill: var(--g-quake-week); fill-opacity: 0.9; }
.g-q-new { fill: var(--g-quake-new); }
.g-key .g-dot { width: 0.85rem; height: 0.85rem; border-radius: 50%; margin-left: 0.12rem; border: 0; box-shadow: 0 0 0 1.5px var(--g-map-halo), 0 0 0 2.5px var(--rule); }
.g-quake-list { display: flex; flex-direction: column; gap: 1rem; }
.g-quake-list > p { margin: 0; max-width: var(--read-measure); }
.g-quake-list .g-wait { color: var(--ink); }
[data-quake-alerts]:empty { display: none; }
.g-mag { font-family: var(--display); font-weight: 600; font-size: 1.2rem; }
.g-felt { font-weight: 600; color: var(--ink); }
table.data td small { color: var(--ink-soft); }

/* the island in 100 m squares: drawn in squares, kept in squares */
.g-map--squares > img { image-rendering: pixelated; }

/* a table of two columns, a name and a sentence, reads as a list on a phone */
@media (max-width: 40rem) {
  table.g-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.g-stack tr { display: block; padding: 0.6rem 0; border-bottom: 1px solid var(--rule); }
  table.g-stack td { display: block; padding: 0; border: 0; }
  table.g-stack td:first-child { font-weight: 600; }
  table.g-stack td:first-child br { display: none; }
  table.g-stack td:first-child small { font-weight: 400; margin-left: 0.4rem; }
}

/* what to do: a short list that reads as steps */
.g-do { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }
.g-do li { padding-left: 0.9rem; border-left: 3px solid var(--accent); }

/* a figure too wide for a phone slides sideways instead of shrinking to nothing */
.g-slide-x { overflow-x: auto; }
.g-slide-x > .g-map { min-width: 40rem; }

/* ----- keys ----- */
.g-key { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(15.5rem, 1fr)); gap: 0.35rem 1.25rem; font-size: var(--step--1); line-height: 1.35; color: var(--ink-soft); }
.g-key li { display: grid; grid-template-columns: 1.1rem minmax(0, 1fr); gap: 0.5rem; align-items: start; }
.g-key i { width: 1.1rem; height: 0.85rem; margin-top: 0.18rem; border-radius: 2px; border: 1px solid var(--rule); }
.g-key b { font-weight: 600; color: var(--ink); }
.g-key .g-line { height: 0; margin-top: 0.55rem; border: 0; border-top: 2px solid var(--ink); border-radius: 0; }
.g-key .g-line--dash { border-top-style: dashed; }
.g-key--row { grid-template-columns: repeat(auto-fit, minmax(9rem, max-content)); }

/* ----- the maps where the reader raises the sea ----- */
.g-controls { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.6rem 1rem; align-items: center; }
.g-controls .button { white-space: nowrap; }
.g-range { width: 100%; margin: 0; accent-color: var(--accent); min-height: 2rem; }
.g-ends { grid-column: 2; display: flex; justify-content: space-between; font-size: 0.72rem; line-height: 1; color: var(--ink-soft); margin-top: -0.45rem; }
.g-readout { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 0.6rem 1.5rem; margin: 0; padding-top: 0.7rem; border-top: 1px solid var(--rule); }
.g-readout > div { min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.g-readout dt { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.g-readout dd { margin: 0; font-family: var(--display); font-weight: 600; font-size: 1.35rem; line-height: 1.15; font-variant-numeric: tabular-nums lining-nums; }
.g-readout dd small { font-family: var(--text); font-size: 0.8rem; font-weight: 500; color: var(--ink-soft); }
.g-readout .g-wide { grid-column: 1 / -1; }
.g-readout .g-wide dd { font-family: var(--text); font-weight: 400; font-size: 1rem; line-height: 1.45; }
.g-wait { font-size: var(--step--1); color: var(--ink-soft); }

/* ----- the chart of sea level ----- */
.g-chart { --yw: 3.1rem; display: flex; flex-direction: column; gap: 0.3rem; padding-top: 0.6rem; }
.g-chart-area { position: relative; height: clamp(190px, 34vw, 300px); margin-left: var(--yw); }
.g-chart-area svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.g-chart-area svg * { vector-effect: non-scaling-stroke; }
.g-grid { stroke: var(--rule); stroke-width: 1; fill: none; }
.g-band { fill: var(--accent); fill-opacity: 0.16; stroke: none; }
.g-curve { stroke: var(--accent); stroke-width: 2.5; fill: none; stroke-linejoin: round; }
.g-sealine { stroke: var(--ink-soft); stroke-width: 1; fill: none; }
.g-y { position: absolute; left: calc(-1 * var(--yw)); width: calc(var(--yw) - 0.45rem); text-align: right; transform: translateY(-50%); font-size: 0.72rem; line-height: 1; color: var(--ink-soft); white-space: nowrap; font-variant-numeric: tabular-nums lining-nums; }
.g-x { position: relative; height: 1.1rem; margin-left: var(--yw); font-size: 0.72rem; line-height: 1.2; color: var(--ink-soft); }
.g-x span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.g-x span:first-child { transform: none; }
.g-x span:last-child { transform: translateX(-100%); }
.g-axis { margin: 0 0 0 var(--yw); text-align: center; font-size: 0.72rem; line-height: 1.2; color: var(--ink-soft); }
.g-pin { position: absolute; width: 1.35rem; height: 1.35rem; margin: -0.675rem 0 0 -0.675rem; border-radius: 50%; background: var(--press); color: var(--on-press); font-size: 0.74rem; font-weight: 700; line-height: 1.35rem; text-align: center; box-shadow: 0 0 0 2px var(--sheet); }
.g-pins { margin: 0.4rem 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0.35rem 1.5rem; font-size: var(--step--1); line-height: 1.4; color: var(--ink-soft); counter-reset: pin; }
.g-pins li { counter-increment: pin; display: grid; grid-template-columns: 1.5rem minmax(0, 1fr); gap: 0.4rem; }
.g-pins li::before { content: counter(pin); width: 1.3rem; height: 1.3rem; border-radius: 50%; background: var(--press); color: var(--on-press); font-size: 0.72rem; font-weight: 700; line-height: 1.3rem; text-align: center; }
.g-pins b { color: var(--ink); font-weight: 600; }

/* ----- small things ----- */
.g-more > summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.g-more[open] > summary { margin-bottom: 0.75rem; }
.g-cards .card .body { max-width: none; }
.g-by { font-size: var(--step--1); color: var(--ink-soft); }
table.data caption { caption-side: top; }
