/* Kyogijo's own look, after family.css: the stage, the controls, and the page of examples. Mobile first. */
:root { --intro-room: 12rem; --intro-room-wide: 6.5rem; }
.setup { margin-top: 10px; }
.fam-field { max-width: 100%; }
select.fam-field { min-width: min(100%, 20rem); }

.try-head h2, .more h2 { margin: 0 0 4px; font-size: 1.15rem; }
.try-head p { margin: 0 0 12px; color: var(--muted); font-size: .9rem; max-width: 70ch; }
.try-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 980px) {
  .try-grid { grid-template-columns: minmax(0, 1.55fr) minmax(310px, 1fr); align-items: start; }
  .try-stage { position: sticky; top: 12px; }
}

/* The stage: the surface on the family's felt, as big as the box allows, and no taller than most of the screen when tall.
   Its box is kept from the first paint: as tall as the drawing will be, by the drawing's shape (--r, its width over its height) and
   the width the felt gives it, or as tall as a tall drawing is. A drawing the script has yet to make leaves the box as it is
   (data-pending hides the one in its place), and an empty stage, or a drawing that has not come, never collapses to a bar.
   The mount measures a stage with no content and its own least height set to 0, so the box does not decide the drawing's way round. */
.stage-felt { padding: 12px 8px; container-type: inline-size; }
#stage { display: flex; justify-content: center; align-items: center; min-height: calc(100cqw / var(--r, 2.1386)); }
#stage svg { max-width: 100%; }
#stage[data-orientation="portrait"] { min-height: min(78vh, 880px); }
#stage[data-orientation="portrait"] svg { width: auto; height: min(78vh, 880px); }
/* A folded curling sheet is a square when tall too: the stage is as tall as it is wide, not as tall as most of the screen. */
#stage[data-orientation="portrait"]:has(.ky-fold-frame) { min-height: min(78vh, 880px, calc(100cqw / var(--r, 1))); }
#stage[data-orientation="portrait"]:has(.ky-fold-frame) svg { height: min(78vh, 880px, calc(100cqw / var(--r, 1))); }
#stage[data-pending] svg { visibility: hidden; }
#stage[data-view="3d"] { display: block; min-height: 0; }
#stage[data-view="3d"][data-pending] { min-height: calc(100cqw / 1.6 + 120px); }
#stage[data-view="3d"] svg { max-width: none; }
@media (min-width: 700px) { .stage-felt { padding: 18px 16px; } }

.try-controls { display: grid; gap: 10px; min-width: 0; }
details.group { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); padding: 0 12px 12px; min-width: 0; }
details.group > summary { font-weight: 700; font-size: .95rem; }
details.group > .setup:first-of-type { margin-top: 0; }
.fam-seg { max-width: 100%; }
.setup > .fam-label { min-width: 5.4rem; }
.era-range { flex: 1 1 10rem; min-width: 0; padding: 0; accent-color: var(--accent); }
.era-season { font-weight: 700; min-width: 4.6rem; text-align: right; font-variant-numeric: tabular-nums; }
.era-notes { margin: 8px 0 0; padding-left: 1.1rem; font-size: .85rem; color: var(--muted); display: grid; gap: 4px; }
.team { border-top: 1px solid var(--rule); margin-top: 12px; padding-top: 4px; }
.team h3 { margin: 6px 0 0; font-size: .85rem; letter-spacing: .02em; }
.team-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.team-grid .setup { flex-wrap: nowrap; }
.team-grid .fam-label { min-width: 3.4rem; }
.team-grid .fam-field { width: 100%; min-width: 0; }
.fam-colour { padding: 2px 4px; width: 100%; }
.logo-url { width: 100%; margin-top: 8px; }
.fam-chip { min-width: 44px; cursor: pointer; font: inherit; font-size: .85rem; font-weight: 600; color: inherit; }
.fam-chip[aria-pressed="true"] { border-color: var(--ink); background: color-mix(in srgb, var(--accent) 18%, transparent); }

/* The code. */
.embed pre { max-height: 18rem; overflow: auto; white-space: pre; }
.embed pre[data-kind="svg"] code { overflow-wrap: anywhere; white-space: pre-wrap; word-break: break-all; }
.embed .fam-tabs button { font-size: .85rem; }
#embed-status { font-size: .85rem; }

/* The examples. */
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.cards-pair { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.cards-small { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.card { margin: 0; min-width: 0; }
.card-stage { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 8px; display: flex; justify-content: center; align-items: center; min-height: 80px; }
.card-stage svg { max-width: 100%; }
.card-stage svg[data-orientation="portrait"] { width: auto; height: min(64vh, 600px); }
.card figcaption { margin: 6px 4px 0; font-size: .85rem; color: var(--muted); }
kyogijo-field { display: block; background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 8px; min-width: 0; }
kyogijo-field::part(plate) { filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .25)); }

.badge-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.badge-list li { min-width: 0; }
.badge-list svg { width: 100%; height: auto; }

.replay-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.replay-grid .card-stage { min-width: 0; }
.live-grid { display: grid; gap: 10px; max-width: 720px; }
.live-stage { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 8px; display: flex; justify-content: center; }
.live-stage svg { max-width: 100%; }
.live-stage svg[data-orientation="portrait"] { width: auto; height: min(64vh, 600px); }

/* The Ballparks and Soccer grounds sections (place-grid.js). Shut, a phone shows one row that scrolls sideways and a wider screen the first rows
   (--cap cards, in whole rows of the columns it has); "show all" (data-open="true") opens a grid of every card, 3, 4 or 8 across. */
.parks { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 12px; --cap: 6; }
.parks[data-open="false"] { display: flex; overflow-x: auto; scroll-snap-type: x proximity; overscroll-behavior-x: contain; padding-bottom: 8px; scroll-padding-inline: 2px; }
.parks[data-open="false"] > .park { flex: 0 0 calc((100% - 20px) / 3.35); scroll-snap-align: start; }
@media (min-width: 560px) {
  .parks, .parks[data-open="false"] { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: visible; padding-bottom: 0; --cap: 8; }
  .parks[data-open="false"] > .park { flex: none; }
  .parks[data-open="false"] > .park:nth-child(n + 9) { display: none; }
}
@media (min-width: 900px) {
  .parks, .parks[data-open="false"] { grid-template-columns: repeat(8, minmax(0, 1fr)); --cap: 16; }
  .parks[data-open="false"] > .park:nth-child(n + 9) { display: grid; }
  .parks[data-open="false"] > .park:nth-child(n + 17) { display: none; }
}
.pf { margin-top: 10px; display: grid; gap: 2px; }
.pf-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 16px; }
.pf-field { display: grid; gap: 2px; min-width: 0; max-width: 100%; flex: none; }
.pf-field .fam-label { min-width: 0; }
.pf-field .fam-seg button { padding: 0 8px; }
.pf-search { flex: 1 1 12rem; }
.pf-field select.fam-field { min-width: 8rem; }
.pf-search .fam-field { width: 100%; }
.pf-status { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 46px; }
.pf-count { font-weight: 700; font-variant-numeric: tabular-nums; }
.pf-more { justify-content: center; margin-top: 10px; }
.pf-empty { grid-column: 1 / -1; margin: 0; padding: 14px 4px; color: var(--muted); }
.park { text-align: left; font: inherit; color: inherit; border: 1px solid var(--rule); background: var(--surface); border-radius: 12px; padding: 8px; display: grid; gap: 2px; align-content: start; cursor: pointer; min-height: 44px; min-width: 0; }
.park:hover { border-color: var(--ink); }
.park .pf-img { display: block; width: 100%; margin-bottom: 4px; }
.park .pf-img svg { display: block; width: 100%; height: auto; }
.park-name { font-size: .78rem; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.park-sub { font-size: .7rem; color: var(--muted); }

/* Every sport and The soccer pitch (the same grid, with cards of made-up games): the cards lie wide in boxes of one shape, which the page holds from the
   first byte, whether the drawing is in it yet or not. Shut, a phone shows one row that scrolls sideways with the next card peeking, a tablet two rows of two
   and a desk two rows of three; "show all" opens a grid of every card, one, two or three across. The chips scroll sideways on a phone. */
.pf-cards { gap: 12px; grid-template-columns: minmax(0, 1fr); --cap: 4; }
.pf-cards[data-open="false"] > .card { flex: 0 0 78%; scroll-snap-align: start; }
.pf-cards .card-stage { position: relative; aspect-ratio: 8 / 5; padding: 0; }
.pf-cards .card-stage svg { position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); max-width: none; }
.pf-cards .card figcaption { margin-top: 4px; }
.pf-chips { position: relative; }
@media (max-width: 559px) {
  .pf-chips { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .pf-chips button { flex: none; }
}
@media (min-width: 560px) {
  .pf-cards, .pf-cards[data-open="false"] { grid-template-columns: repeat(2, minmax(0, 1fr)); --cap: 4; }
  .pf-cards[data-open="false"] > .card { flex: none; }
  .pf-cards[data-open="false"] > .card:nth-child(n + 5) { display: none; }
}
@media (min-width: 900px) {
  .pf-cards, .pf-cards[data-open="false"] { grid-template-columns: repeat(3, minmax(0, 1fr)); --cap: 6; }
  .pf-cards[data-open="false"] > .card:nth-child(n + 5) { display: block; }
  .pf-cards[data-open="false"] > .card:nth-child(n + 7) { display: none; }
}

.uses { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.uses code { font-family: var(--mono); font-size: .82rem; overflow-wrap: anywhere; }
.more .uses { grid-template-columns: 1fr; }
@media (max-width: 520px) {
  .setup > .fam-label { min-width: 100%; }
  .team-grid .fam-label { min-width: 100%; }
  .team-grid .setup { flex-wrap: wrap; }
}

/* Soccer: the pitches and the providers' frames, and the converter between them. */
.more-sub { margin: 18px 0 6px; font-size: 1rem; }
.converter { display: grid; gap: 2px; max-width: 30rem; }
.converter .fam-field { min-width: 0; width: 100%; }
.conv-result { margin: 8px 0 0; font-weight: 700; }
.conv-result output { font-family: var(--mono); }
.provider figcaption strong { font-weight: 700; }

/* Point at the field: the drawing, a marker where it was pointed at, and the place in every provider's numbers. */
.pointer { display: grid; gap: 8px; max-width: 46rem; }
.point-wrap { position: relative; }
.point-stage { touch-action: none; cursor: crosshair; border-radius: 8px; outline-offset: 3px; }
.point-stage svg { display: block; }
.point-marker { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border: 2px solid #fff; border-radius: 50%; background: rgba(217, 72, 15, .85); box-shadow: 0 0 0 2px rgba(0, 0, 0, .6); pointer-events: none; }
.point-zone { margin: 0; font-weight: 700; min-height: 1.4em; }
.point-table { border-collapse: collapse; font-size: .85rem; width: 100%; }
.point-table td { padding: 2px 8px 2px 0; border-bottom: 1px solid color-mix(in srgb, currentColor 15%, transparent); }
.point-table td:nth-child(n+2) { font-family: var(--mono); text-align: right; white-space: nowrap; }

.data-table { margin-top: 8px; font-size: 0.85rem; }
.data-table summary { cursor: pointer; padding: 6px 0; }
.data-table-body { max-height: 260px; overflow: auto; }
.data-table-body table { border-collapse: collapse; width: 100%; margin-bottom: 12px; }
.data-table-body caption { text-align: left; font-weight: 600; padding: 4px 0; }
.data-table-body th, .data-table-body td { border-bottom: 1px solid color-mix(in srgb, currentColor 18%, transparent); padding: 3px 8px; text-align: left; }

/* The atlas: filters, the map with its markers, the list, and the chosen place's surface. Mobile first. */
.atlas-text { margin: 0 0 12px; color: var(--muted); font-size: .9rem; max-width: 70ch; }
.atlas-filters { display: grid; gap: 0 22px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .atlas-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.atlas-filters .fam-field { min-width: 0; max-width: 100%; }
.atlas-filters select.fam-field, .atlas-filters input[type="search"] { flex: 1 1 10rem; }
.atlas-year-row { flex-wrap: wrap; }
.atlas-count-row { justify-content: space-between; align-items: center; }
.atlas-count { font-weight: 700; font-variant-numeric: tabular-nums; }
.atlas-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); margin-top: 12px; }
@media (min-width: 980px) { .atlas-grid { grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); align-items: start; } }
.atlas-map-col, .atlas-side { min-width: 0; }
.atlas-map { position: relative; }
.atlas-map .atlas-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.atlas-map .czm-controls, .atlas-map .czm-zoom { z-index: 2; }
.atlas-tip { position: absolute; z-index: 3; pointer-events: none; padding: 2px 8px; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); font-size: .8rem; white-space: nowrap; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); }
.atlas-key { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .8rem; }
.atlas-key li { display: inline-flex; align-items: center; gap: 4px; }
.atlas-icon { flex: none; overflow: visible; }
.atlas-hint { margin: 6px 0 0; font-size: .8rem; color: var(--muted); }
.atlas-detail { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); padding: 10px; min-width: 0; }
.atlas-surface { padding: 10px; display: flex; justify-content: center; }
.atlas-surface svg { max-width: 100%; max-height: 17rem; height: auto; }
.atlas-map .czm-says { display: none; }
.atlas-name { margin: 10px 0 4px; font-size: 1.05rem; overflow-wrap: anywhere; }
.atlas-facts { margin: 0; display: grid; gap: 2px; font-size: .85rem; }
.atlas-facts > div { display: grid; grid-template-columns: 6.4rem minmax(0, 1fr); gap: 8px; }
.atlas-facts dt { color: var(--muted); }
.atlas-facts dd { margin: 0; overflow-wrap: anywhere; }
.atlas-detail .fam-actions { margin-top: 10px; align-items: center; }
.atlas-link { font-size: .85rem; }
.atlas-tenants-title { margin: 12px 0 4px; font-size: .85rem; color: var(--muted); font-weight: 600; }
.atlas-tenants { list-style: none; margin: 0; padding: 0; max-height: 11rem; overflow: auto; font-size: .85rem; display: grid; gap: 2px; }
.atlas-tenants li { display: flex; flex-wrap: wrap; gap: 0 6px; overflow-wrap: anywhere; }
.atlas-tenant-name { font-weight: 600; }
.atlas-tenants li[data-current="false"] .atlas-tenant-name { font-weight: 400; }
.atlas-tenant-meta { color: var(--muted); }
.atlas-also { margin-top: 8px; flex-wrap: wrap; align-items: center; }
.atlas-also-label { font-size: .85rem; color: var(--muted); }
.atlas-pick { margin: 0; color: var(--muted); }
.atlas-list { list-style: none; margin: 10px 0 0; padding: 0; max-height: 22rem; overflow: auto; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); }
.atlas-list li { min-width: 0; }
.atlas-list li > .atlas-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 6px 10px; border: 0; border-bottom: 1px solid var(--rule); border-left: 4px solid transparent; background: none; text-align: left; }
.atlas-list li > .atlas-item:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.atlas-list li > .atlas-item[aria-pressed="true"] { border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.atlas-item:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.atlas-list .atlas-item-text { display: grid; gap: 0; min-width: 0; }
.atlas-list li .atlas-item-name { font-weight: 700; font-size: .9rem; color: var(--ink); overflow-wrap: anywhere; }
.atlas-list li .atlas-item-sub { font-size: .78rem; color: var(--muted); overflow-wrap: anywhere; }
.atlas-empty { padding: 14px 10px; color: var(--muted); }
.atlas-credits { margin: 14px 0 0; display: grid; gap: 2px; font-size: .8rem; }
.atlas-credits > div { display: flex; flex-wrap: wrap; gap: 0 8px; }
.atlas-credits dt { color: var(--muted); min-width: 7rem; }
.atlas-credits dd { margin: 0; }

/* The pickers of ready-made emblems: a grid of tiles a finger wide, each the emblem itself. */
.tiles-row { flex-wrap: wrap; align-items: flex-start; }
.emblem-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 4px; width: 100%; max-height: 236px; overflow-y: auto; border-radius: 16px; padding: 4px; overscroll-behavior: contain; }
.emblem-tiles button { min-width: 52px; min-height: 52px; padding: 5px; border-radius: 12px; }
.emblem-tiles svg { width: 34px; height: 34px; pointer-events: none; flex: none; }
.emblem-tiles button[aria-pressed="true"] { background: color-mix(in srgb, var(--ink) 12%, transparent); color: var(--ink); outline: 2px solid var(--ink); outline-offset: 1px; }
@media (max-width: 480px) { .emblem-tiles { max-height: 208px; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); } .emblem-tiles button { min-width: 56px; min-height: 56px; } }
