/* The look switch: one control carried by all three looks of the site, so its tokens live here and it reads the same
   wherever it sits. Each look places it in its own header (scripts/looks.mjs fills the slot); the rules at the foot
   of this file are the three placements. */
.look {
  --look-ground: oklch(97.6% 0.008 85);
  --look-ink: oklch(17% 0.01 60);
  --look-mute: oklch(42% 0.012 60);
  --look-on-ink: oklch(80% 0.01 85);
  --look-rule: oklch(17% 0.01 60 / 0.7);
  --look-wash: oklch(92.4% 0.012 82);
  --look-accent: oklch(55% 0.2 33);
  --look-accent-deep: oklch(48% 0.19 33);
  --look-h: 30px;
  --look-pad: 12px;
  --look-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --look-swap: 320ms;
  display: flex;
  align-items: center;
  gap: 10px;
  font: 500 11px/1 "Plex Mono", ui-monospace, monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--look-ink);
  pointer-events: auto;
}
.look__label { color: var(--look-mute); }
.look__set {
  display: flex;
  border: 1px solid var(--look-rule);
  background: var(--look-ground);
}
.look__opt {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: var(--look-h);
  padding: 0 var(--look-pad);
  color: var(--look-ink);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 180ms var(--look-ease), color 180ms var(--look-ease);
}
.look__opt + .look__opt { border-left: 1px solid var(--look-rule); }
.look__n { color: var(--look-mute); font-variant-numeric: tabular-nums; transition: color 180ms var(--look-ease); }
/* The chosen look is filled with ink and carries the vermilion dot every look's own mark carries. */
.look__opt::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--look-ink);
  transform: scaleX(0);
  transform-origin: left;
}
.look__opt[aria-current]::before { transform: scaleX(1); }
.look__opt[aria-current] { color: var(--look-ground); }
.look__opt[aria-current] .look__n { color: var(--look-on-ink); }
.look__dot { display: none; width: 7px; height: 7px; border-radius: 50%; background: var(--look-accent); }
.look__opt[aria-current] .look__dot { display: block; }
.look__opt:not([aria-current]):hover,
.look__opt:not([aria-current]):focus-visible { background: var(--look-wash); }
.look__opt:not([aria-current]):hover .look__n,
.look__opt:not([aria-current]):focus-visible .look__n { color: var(--look-accent-deep); }
.look__opt:focus-visible { outline: 2px solid var(--look-accent); outline-offset: 2px; z-index: 1; }

/* Arriving from another look, the fill slides in from that look's side of the switch, at the page's own pace. */
@media (prefers-reduced-motion: no-preference) {
  html[data-look-from="left"] .look__opt[aria-current]::before { transform-origin: left; animation: look-fill var(--look-swap) var(--look-ease) both; }
  html[data-look-from="right"] .look__opt[aria-current]::before { transform-origin: right; animation: look-fill var(--look-swap) var(--look-ease) both; }
  html:active-view-transition-type(look)::view-transition-group(root),
  html:active-view-transition-type(look)::view-transition-old(root),
  html:active-view-transition-type(look)::view-transition-new(root) { animation-duration: 320ms; animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); }
}
@keyframes look-fill { from { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) {
  html:active-view-transition-type(look)::view-transition-group(root),
  html:active-view-transition-type(look)::view-transition-old(root),
  html:active-view-transition-type(look)::view-transition-new(root) { animation: none; }
}

/* ---- Poster, the root: on the opening's first row at the left, where the ticket sits at the right. The nav is 64px
   and the opening starts 26px under it. On a phone it is a row of its own under the bar. The labels take the nav's
   12px, so the switch adds no step to Poster's type scale (the census holds it to Signal-A's twelve). ---- */
.looks-root { position: absolute; z-index: 19; top: 90px; left: var(--pad); }
.looks-root .look { font-size: 12px; }
@media (max-width: 860px) {
  .looks-root { position: static; display: flex; justify-content: center; padding: 12px var(--pad) 0; }
  .looks-root .look { --look-h: 44px; }
  .looks-root .look__n { display: none; }
}

/* ---- Wall, under /form: in the bar beside the door, without the numbers, so the bar's tagline keeps one line.
   Below 860px the bar holds only the mark, the door and the menu, so the switch floats at the foot of the screen, where
   a thumb reaches it, at the left, clear of the controls Wall sets at the right. The bar is fixed to the top and moves
   on arrival, which makes it the switch's containing block, so the switch hangs from the bar by one screen's height
   rather than being fixed on its own; the page keeps 76px of scroll padding so a focused link never sits under it. ---- */
.bar__look .look__label, .bar__look .look__n { display: none; }
@media (max-width: 860px) {
  html:has(.bar__look .look) { scroll-padding-bottom: 76px; }
  .bar__look { position: absolute; z-index: 21; left: var(--gut); top: calc(100dvh - 58px); }
  .bar__look .look__set { box-shadow: 0 10px 28px -14px oklch(17% 0.01 60 / 0.55); }
  .bar__look .look { --look-h: 44px; --look-pad: 9px; }
}

/* ---- Stack, under /huy: a column under the mark, the way the mark itself stands; on a phone a row between the mark and
   the menu. ---- */
.looks .look { flex-direction: column; align-items: flex-start; gap: 8px; }
.looks .look__set { flex-direction: column; min-width: 132px; }
.looks .look__opt + .look__opt { border-left: 0; border-top: 1px solid var(--look-rule); }
.looks .look__opt::before { transform: scaleY(0); transform-origin: top; }
.looks .look__opt[aria-current]::before { transform: scaleY(1); }
@media (prefers-reduced-motion: no-preference) {
  html[data-look-from="left"] .looks .look__opt[aria-current]::before { transform-origin: top; animation-name: look-fill-down; }
  html[data-look-from="right"] .looks .look__opt[aria-current]::before { transform-origin: bottom; animation-name: look-fill-down; }
}
@keyframes look-fill-down { from { transform: scaleY(0); } }
@media (max-width: 860px) {
  /* Set against the menu button, not centred: centred, the switch runs into the mark on a 390px screen. */
  .looks { left: auto; right: calc(var(--side) + 64px); transform: none; }
  .looks .look { flex-direction: row; }
  .looks .look__label, .looks .look__n, .looks .look__dot { display: none; }
  .looks .look__set { flex-direction: row; min-width: 0; }
  .looks .look__opt { --look-pad: 8px; min-height: 44px; letter-spacing: 0.02em; }
  .looks .look__opt + .look__opt { border-top: 0; border-left: 1px solid var(--look-rule); }
  .looks .look__opt::before { transform: scaleX(0); transform-origin: left; }
  .looks .look__opt[aria-current]::before { transform: scaleX(1); }
  html[data-look-from="left"] .looks .look__opt[aria-current]::before { transform-origin: left; animation-name: look-fill; }
  html[data-look-from="right"] .looks .look__opt[aria-current]::before { transform-origin: right; animation-name: look-fill; }
}
