/* Additions for the Diagram and map pages. The shared layer is /assets/hub.css; nothing here overrides its layouts. */
.hub-page main code { padding: .08em .34em; border-radius: 5px; background: color-mix(in srgb, var(--hub) 60%, transparent); font: 600 .88em/1.45 ui-monospace,Menlo,monospace; overflow-wrap: anywhere }
.hub-section[data-tone="ink"] code { background: rgb(255 255 255 / .12) }
.hub-page main .hub-fine code { font-size: 1em }

/* Cards: a canvas that takes the spare height, and a wide card with its canvas first. */
.hub-card.fill .hub-card-media { flex: 1; display: grid; align-items: center }
.hub-card.wide.flip .hub-card-media { order: -1; border-left: 0; border-right: 1px solid var(--s-line) }
.hub-card-media > .replay { margin: 0 }
.dg-also { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; font-size: .9rem }
.dg-open a, .dg-more a { font-weight: 600; text-underline-offset: .24em }

/* The typed lines a drawing came from, under its canvas. */
.dg-turns { display: grid; gap: .4rem; padding: .7rem .8rem .8rem; border-top: 1px solid #cfd5c4; background: #fffdf4 }
.stage .dg-turns p { max-width: none; margin: 0; padding: .4rem .6rem; border-radius: 8px; background: #edf0e2; color: #21392f; font: 600 .8rem/1.4 ui-monospace,Menlo,monospace }

/* A slate at the width of a phone. */
.stage.mini.dg-phone { width: min(100%, 284px); margin-inline: auto; border: 6px solid #22362e; border-radius: 28px; overflow: hidden }

/* A wide card whose canvas takes two thirds, with its words from the top and the steps it takes listed under them. */
.hub-card.wide.dg-split .hub-card-media { flex: 2 }
.hub-card.wide.dg-split .hub-card-copy { justify-content: flex-start; padding-top: clamp(22px,2.4vw,36px) }
.dg-steps { display: grid; gap: .7rem; margin: .9rem 0 .3rem; padding: 0; list-style: none; counter-reset: dg-step }
.dg-steps li { position: relative; padding: .1rem 0 0 2.2rem; color: var(--s-soft); font-size: .95rem; line-height: 1.45; counter-increment: dg-step }
.dg-steps li::before { content: counter(dg-step); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: color-mix(in srgb, var(--hub) 70%, var(--s-card)); color: var(--s-ink); font: 700 .8rem/1 ui-monospace,Menlo,monospace }

/* A small table of facts on the deeper pages. */
.dg-table { width: 100%; margin-top: 1.3rem; border-collapse: collapse; font-size: .95rem }
.dg-table th, .dg-table td { padding: .7rem .8rem .7rem 0; border-top: 1px solid var(--s-line); text-align: left; vertical-align: top }
.dg-table th { width: 34%; font-weight: 600 }
.dg-table tr:last-child > * { border-bottom: 1px solid var(--s-line) }
.dg-quote { margin: 1.2rem 0 0; padding: .9rem 1.1rem; border-left: 4px solid var(--hub-deep); background: color-mix(in srgb, var(--hub) 50%, transparent); font: 700 clamp(1.15rem,1.7vw,1.5rem)/1.25 "Archivo Narrow","Arial Narrow",Arial,sans-serif }


@media (max-width: 800px) {
  .hub-card.wide.flip .hub-card-media { border-right: 0 }
}

/* A replay with one scene has no buttons under reduced motion, so the empty row takes no room. */
@media (prefers-reduced-motion: reduce) {
  .hub-card .replay { --rp-controls-on: 0 }
  .hub-card .replay > .rp-controls { display: none }
}
.dg-shelf { --stage-ratio: 1372 / 560 }
.dg-more { margin-top: 1.1rem }
.dg-table + .dg-also { margin-top: 1rem }
@media (max-width: 800px) {
  .dg-shelf { --stage-ratio: 600 / 1340 }
  .dg-tall .stage-body { aspect-ratio: 1 / 1 !important }
}
/* On a phone a route still stands two stops a row (diagrams.js), a little taller than wide, so every stop shows. */
@media (max-width: 460px) {
  .dg-tall.dg-route .stage-body { aspect-ratio: 5 / 6 !important }
}

/* The engine draws a line's label at a fixed 13 units, which is too small to read once a drawing is scaled to a
   card or a phone. Each label and the plate behind it are scaled about their own centre, so they stay together
   wherever the engine puts them. */
.hub-page main svg text[font-size="13"], .hub-page main svg rect:has(+ text[font-size="13"]) { transform-box: fill-box; transform-origin: center; transform: scale(1.7) }
.hub-section[data-tone="ink"] .dg-quote { display: inline-block; border-left-color: #e9c46a; background: rgb(255 255 255 / .09); color: #fffdf4 }

/* The four ready-drawing tabs wrap onto two rows on a phone, so none of them sits off the edge unseen. */
@media (max-width: 480px) {
  .hub-page[data-hub="diagrams"] .hub-tablist { flex-wrap: wrap; overflow-x: visible; margin-inline: 0; padding-inline: 0 }
}

/* A ready drawing's words start level with the top of its slate. */
@media (min-width: 801px) {
  .hub-page[data-hub="diagrams"] .hub-tabpanel { align-items: start }
  .hub-page[data-hub="diagrams"] .hub-tabpanel > div { padding-top: clamp(1rem,2.4vw,2.4rem) }
}
