/* Switches (switches.html). One board of cocoa: the tax right now across its top, a lamp for every switch down its
   left side, and a sheet of paper with the words of each switch beside its lamp. A lit lamp is a disc of icing
   with the word ON under it; a dark one is a hollow ring with the word off. Colours and type are the site's own
   (styles.css). */
.sw-page { padding-bottom: 88px; min-height: 58vh; }
.sw-page .page-head { padding-bottom: 34px; }
.sw-page .empty-line { padding: 16px 0 0; font-size: 18px; }

.sw-board { --rail: 132px; background: var(--ink); color: var(--ink); border: 3px solid var(--ink); border-radius: var(--r); overflow: hidden; }

/* the top of the board: the tax right now */
.sw-now { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); align-items: baseline; padding: 22px 36px 22px 0; color: var(--bone); }
.sw-now .k { text-align: center; font-family: var(--mono); font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.sw-now p { padding-left: 32px; font-size: 19px; line-height: 1.4; }
.sw-now b { font-weight: 600; }
.sw-now p span { color: var(--muted); }

/* one switch */
.sw { --d: calc(var(--i, 0) * 45ms); display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); scroll-margin-top: 92px; }
.sw + .sw { border-top: var(--bw) solid var(--ink); }
.sw-rail { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 30px 0 26px; color: var(--bone); }

/* the lamp: a faint ring until the chain answers, a clear hollow ring when off. Lit, it fills with icing, a flat
   ring of light opens around it and a sugar cube of a glint shows. It moves once, when the answer arrives: the
   lamps come on one after the other down the board (--i is the row, set by switches.js for that first time only). */
.sw-lamp { position: relative; flex: none; width: 44px; height: 44px; }
.sw-lamp::before, .sw-lamp::after { content: ""; position: absolute; border-radius: 50%; }
.sw-lamp::before { inset: -9px; background: var(--accent); opacity: 0; transform: scale(0.72); transition: opacity 260ms var(--ease-out) var(--d), transform 260ms var(--ease-out) var(--d); }
.sw-lamp::after { inset: 0; border: var(--bw) solid var(--line); background: var(--ink-2); transition: background-color 200ms ease var(--d), border-color 200ms ease var(--d); }
.sw-lamp i { position: absolute; z-index: 1; left: 27%; top: 25%; width: 20%; height: 20%; border-radius: 22%; background: var(--bone); opacity: 0; transition: opacity 200ms ease var(--d); }
.sw[data-light="off"] .sw-lamp::after { border-color: var(--muted); }
.sw[data-light="on"] .sw-lamp::before { opacity: 0.36; transform: none; }
.sw[data-light="on"] .sw-lamp::after { background: var(--accent); border-color: var(--bone); }
.sw[data-light="on"] .sw-lamp i { opacity: 1; }
.sw-word { display: flex; align-items: center; height: 22px; font-family: var(--mono); font-size: 15px; letter-spacing: 0.04em; line-height: 1; color: var(--muted); opacity: 0; transition: opacity 200ms ease var(--d); }
.sw[data-light="on"] .sw-word, .sw[data-light="off"] .sw-word { opacity: 1; }
.sw[data-light="on"] .sw-word { font-family: var(--display); font-weight: 800; font-size: 24px; letter-spacing: 0; color: var(--bone); }

.sw-body { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 18px 56px; align-items: start; min-width: 0; padding: 30px 36px 34px 32px; background: var(--paper); }
.sw-body h2 { font-size: clamp(28px, 2.7vw, 38px); line-height: 1.05; overflow-wrap: anywhere; }
.sw-what p { margin-top: 12px; max-width: 30em; font-size: 18px; line-height: 1.5; }
.sw-when { min-width: 0; padding-top: 9px; transition: opacity 240ms var(--ease-out); }
@starting-style { .sw-when { opacity: 0; } }
.sw-when .kicker { display: block; margin-bottom: 8px; }
.sw-expect { max-width: 36em; font-size: 17px; line-height: 1.55; }

/* what is true this minute: the site's cube before each line */
.sw-live { margin-top: 16px; gap: 6px; }
.sw-live li { padding-left: 22px; font-size: 16.5px; font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; }
.sw-live li::before { top: 0.42em; width: 10px; height: 10px; border-radius: 3px; }

/* the table of the score, small; the row that sets the tax now carries the word */
.sw-table { width: auto; margin-top: 16px; }
.sw-table th { padding: 0 28px 8px 0; white-space: nowrap; }
.sw-table td, .sw-table td:first-child { padding: 8px 28px 8px 0; font-family: var(--mono); font-size: 15px; font-weight: 400; font-variant-numeric: tabular-nums; line-height: 1.4; white-space: nowrap; }
.sw-table tbody tr:last-child td { border-bottom: 0; }
.sw-table tr[aria-current] td { font-weight: 500; background: var(--bone-2); }
.sw-table tr[aria-current] td:first-child { box-shadow: -10px 0 0 var(--bone-2); }
.sw-table th:last-child, .sw-table td.mark { padding-right: 10px; min-width: 52px; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; }

.sw-foot { margin-top: 26px; font-family: var(--mono); font-size: 14px; line-height: 1.5; color: var(--muted-b); min-height: 1.5em; }

@media (max-width: 1023px) {
  .sw-board { --rail: 104px; }
  .sw-body { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .sw-when { padding-top: 0; }
}
@media (max-width: 640px) {
  .sw-board { --rail: 58px; }
  .sw-now { grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 16px 18px 18px; }
  .sw-now .k { text-align: left; }
  .sw-now p { padding-left: 0; font-size: 17px; }
  .sw-rail { gap: 8px; padding: 20px 0 18px; }
  .sw-lamp { width: 30px; height: 30px; }
  .sw-lamp::before { inset: -6px; }
  .sw-word { font-size: 13px; }
  .sw[data-light="on"] .sw-word { font-size: 19px; }
  .sw-body { padding: 18px 15px 22px; }
  .sw-body h2 { font-size: 26px; }
  .sw-what p { margin-top: 8px; font-size: 16.5px; }
  .sw-expect { font-size: 16px; }
  .sw-live li { font-size: 15.5px; }
  .sw-table th, .sw-table td, .sw-table td:first-child { padding-right: 18px; }
  .sw-foot { margin-top: 20px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  /* the lamps still change, all at once and without moving */
  .sw { --d: 0ms; }
  .sw-lamp::before { transform: none; transition: opacity 200ms ease; }
  .sw-when { transition: none; }
}
