/* PROTOTYPE — overpass/key.css: the key and the "Water shown" switch (the direction's §8.10; task B2a, with
   overpass/key.js). In the key column on a wide screen; under the panel on a tablet and a phone. The key is a two-column
   grid (a fixed swatch column, then the words), so every label starts at the same indent. When the squares failed to
   load (html.ov-squares-failed) the swatches dim to 40%. */
.show:empty, .key:empty { display: none; }

/* ---- "Water shown": a three-position switch. From 1180 px its label sits inside the pill, as the Speed switch's (in
   the panel's one column from 1180 to 1379 px the whole switch is one row; in the key column from 1380 px it takes two);
   on a tablet and a phone it sits above the pill ---- */
.show-sw, .show-o { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; }
.show-sw { width: fit-content; max-width: 100%; padding: 3px; border-radius: 20px; background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
.show-o { display: contents; }
.show-l { padding: 0 6px 0 9px; font-size: var(--fs-ui); font-weight: 600; line-height: 1.2; color: var(--pale-2); white-space: nowrap; }
@media (max-width: 1179px) {
  .show-sw { display: block; padding: 0; background: none; box-shadow: none; border-radius: 0; }
  .show-l { display: block; padding: 0; margin-bottom: 6px; font-size: var(--fs-key); }
  .show-o { display: flex; width: fit-content; max-width: 100%; padding: 3px; border-radius: 20px; background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
}
.show-sw button { font-size: var(--fs-ui); font-weight: 600; line-height: 1.2; color: var(--pale); background: none; border: 0; border-radius: var(--r-pill); padding: 6px 11px; cursor: pointer; white-space: nowrap; transition: background var(--t-quick), color var(--t-quick); }
.show-sw button:hover { color: #fff; box-shadow: inset 0 0 0 1.5px var(--track-lit); }
.show-sw button[aria-checked="true"] { background: var(--cloudtop); color: var(--ink); }
.show-sw button[aria-checked="true"]:hover { box-shadow: none; }
.show-sw button:focus-visible { outline-offset: 1px; }
.show-d { margin-top: 6px; font-size: var(--fs-small); line-height: 1.35; color: var(--pale-2); text-wrap: pretty; }
@media (pointer: coarse) { .show-sw button { min-height: var(--hit); } }
@media (prefers-reduced-motion: reduce) { .show-sw button { transition: none; } }

/* ---- the key ---- */
.key { font-size: var(--fs-key); line-height: 1.26; color: var(--pale-2); }
.key-h { font-size: var(--fs-key); font-weight: 600; line-height: 1.26; color: var(--pale); text-wrap: balance; }
.key-c { margin-top: 2px; font-size: var(--fs-small); color: var(--pale-2); }
.key-l { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.key-l li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 6px; align-items: start; }
.key-l .sw { display: flex; align-items: center; height: 1.26em; }
.key-l .sw svg { display: block; width: 40px; height: 14px; flex: none; }
.key-l .kw { min-width: 0; text-wrap: pretty; }
.key-l .kn { color: var(--pale); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.key-l li.k-hidden .sw svg { opacity: .45; }
.key-rt { margin-top: 6px; font-size: var(--fs-small); color: var(--pale-2); }
/* the timeline's own marks, after a kind of water's map swatch (the backed bar, the all-seen ghost) and for spring */
.kb { display: inline-block; height: 7px; transform: skewX(var(--lean)); vertical-align: .05em; }
.kb-c { width: 15px; background: var(--water); box-shadow: var(--glow-water); margin-left: 3px; }
.kb-g { width: 15px; background: var(--water-ghost); margin-left: 3px; }
.kb-s { width: 22px; background: repeating-linear-gradient(-45deg, var(--doubt) 0 2px, transparent 2px 4px); margin-left: 9px; }

.ov-squares-failed .key svg, .ov-squares-failed .key i { opacity: .4; }

/* In the key column, 1380 px and up (the panel's one column from 1180 to 1379 px keeps the rules for a full width,
   below): the switch's description is in its tooltip and read out (aria-describedby), and when the column is short the
   key's list scrolls inside itself as a last resort, so the never line and the prototype line under it are never cut
   off. At 1440 x 900 every view's key fits without it (F1, 16 Nov 2026). */
@media (min-width: 1380px) {
  .keycol { gap: 10px; padding-top: 16px; padding-bottom: 16px; }
  .show-d { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; margin: 0; }
  /* the key column is narrow: a slimmer swatch column (the swatches keep their shapes) gives the words the width */
  .keycol .key-l { gap: 3px; margin-top: 4px; }
  .keycol .key-rt { margin-top: 4px; }
  .keycol .key-l li { grid-template-columns: 32px minmax(0, 1fr); gap: 7px; }
  .keycol .key-l .sw svg { width: 30px; height: 10.5px; }
  .keycol .kb-s { margin-left: 4px; }
  /* only the list scrolls: the heading and "Record through" (spec R6) stay in view */
  .keycol > .key { flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; }
  .keycol > .key > .key-l { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .18) transparent; }
  .keycol > .key > .key-l.key-more { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent); }
  .keycol > .key > .key-l:focus-visible { outline-offset: -3px; }
}

/* the key's list in two columns wherever it has the panel's width: the one column from 1180 to 1379 px, a tablet */
@media (max-width: 1379px) {
  .key-l { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 18px; }
}
@media (max-width: 760px) {
  .show { padding-top: 6px; }
  .key-l { grid-template-columns: minmax(0, 1fr); }
}
