/* Shared shell: the switch bar and the page frame. Each view brings its own palette and type in its own CSS.
   The bar is deliberately one dark look in both themes, so every colour here is set explicitly. */
@view-transition { navigation: auto; }

:root {
  --bar-bg: #111317;
  --bar-ink: #eef0f3;
  --bar-dim: #8b919c;
  --bar-chip: #2a2f38;
  --bar-hot: #ffd84a;
  --bar-h: 3.75rem;
  --ui-display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --ui-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
[hidden] { display: none !important; }
img { max-width: 100%; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.bar {
  view-transition-name: site-bar;
  position: sticky; top: 0; z-index: 50;
  background: var(--bar-bg); color: var(--bar-ink); color-scheme: dark;
  height: var(--bar-h);
  padding: calc(0.5rem + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 0.5rem max(16px, env(safe-area-inset-left, 0px));
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.5rem 1.4rem;
  font-family: var(--ui-mono);
}
.bar a { color: inherit; text-decoration: none; }
.bar :focus-visible { outline: 2px solid var(--bar-hot); outline-offset: 2px; }
.who { font-family: var(--ui-display); font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; white-space: nowrap; }
.who small { display: block; font-family: var(--ui-mono); font-weight: 400; font-size: 0.66rem; color: var(--bar-dim); letter-spacing: 0.04em; }

.switch { display: flex; justify-content: center; gap: 0.25rem; }
.switch a {
  font-family: var(--ui-display); font-weight: 700; font-size: 1.12rem; letter-spacing: -0.01em; line-height: 1.15;
  padding: 0.32rem 0.9rem 0.38rem; border-radius: 3px; color: var(--bar-dim);
}
.switch a small { display: block; font-family: var(--ui-mono); font-weight: 400; font-size: 0.6rem; letter-spacing: 0.03em; }
.switch a:hover { color: var(--bar-ink); }
.switch a[aria-current="page"] { background: var(--bar-ink); color: var(--bar-bg); }

.sel { display: flex; align-items: center; gap: 0.5rem; font-size: 0.72rem; color: var(--bar-dim); justify-self: end; min-width: 0; }
.chip { display: inline-flex; align-items: center; gap: 0.45rem; background: var(--bar-chip); color: var(--bar-ink); border-radius: 99px; padding: 0.18rem 0.3rem 0.18rem 0.7rem; max-width: 16rem; }
.chip b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip button { font: inherit; background: none; border: 0; cursor: pointer; width: 1.3rem; height: 1.3rem; border-radius: 50%; color: var(--bar-dim); padding: 0; }
.chip button:hover { background: var(--bar-bg); color: var(--bar-ink); }
.chip.flash { animation: chip-flash 900ms ease-out; }
@keyframes chip-flash { 0% { background: var(--bar-hot); color: var(--bar-bg); } 100% { background: var(--bar-chip); } }

@media (max-width: 760px) {
  :root { --bar-h: 6.4rem; }
  .bar { grid-template-columns: minmax(0, 1fr) auto; }
  .switch { grid-column: 1 / -1; grid-row: 2; }
  .switch a { flex: 1; font-size: 0.98rem; padding-inline: 0.35rem; text-align: center; }
  .who small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  .chip.flash { animation: none; }
}
