/* Prescribers shared UI, Phase 1: a few design tokens and the perspective bar (Studio / Practice / Console).
 *
 * This file is authored here and copied byte-for-byte into web/ (Practice and Console) and create/static/ (Studio). A test fails if a copy differs.
 * It is deliberately small: every selector is prefixed .pz-, it reads no application variable, and it changes nothing outside the bar. The two applications keep their own
 * stylesheets; --pz-ink is pinned by a test to equal both applications' own --ink so the two cannot drift apart unnoticed. */

:root {
  --pz-ink: #0a1530;
  --pz-navy: #0a1530;
  --pz-navy-deep: #060d22;
  --pz-on-navy: #eef1f8;
  --pz-on-navy-mute: #aab4cf;
  --pz-pill: #f4f6fb;
  --pz-pill-ink: #0a1530;
  --pz-focus: #86b6ff;
  /* Reserved for later phases: what the audience may see, and what only the facilitator sees. Not used by the bar. */
  --pz-aud: #4fd8c2;
  --pz-priv: #f0b35a;
  --pz-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --pz-dur: 220ms;
}

/* The bar: a slim, deliberately dark strip, the same in every application and in light and dark themes. */
.pz-bar {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  padding: 5px max(14px, env(safe-area-inset-right)) 5px max(14px, env(safe-area-inset-left));
  background: var(--pz-navy);
  color: var(--pz-on-navy);
  font-family: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.2;
  view-transition-name: pz-bar;
}
.pz-bar[hidden] { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pz-bar { background: var(--pz-navy-deep); border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
}
:root[data-theme="dark"] .pz-bar { background: var(--pz-navy-deep); border-bottom: 1px solid rgba(255, 255, 255, 0.08); }

.pz-nav { display: block; }
.pz-list { list-style: none; margin: 0; padding: 3px; display: flex; gap: 2px; background: rgba(255, 255, 255, 0.07); border-radius: 999px; }
.pz-list li { margin: 0; padding: 0; }
.pz-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 96px;
  min-height: 44px;
  padding: 4px 20px;
  border-radius: 999px;
  color: var(--pz-on-navy-mute);
  text-decoration: none;
  font-weight: 600;
  transition: background var(--pz-dur) var(--pz-ease), color var(--pz-dur) var(--pz-ease);
}
.pz-item:hover { color: #fff; background: rgba(255, 255, 255, 0.09); }
.pz-item[aria-current="page"] { background: var(--pz-pill); color: var(--pz-pill-ink); cursor: default; }
.pz-hint { font-size: 10.5px; font-weight: 500; letter-spacing: 0.07em; text-transform: uppercase; opacity: 0.8; }
/* A destination its application has switched off (for example while an attempt that would be lost is in progress). The application sets aria-disabled and says why in `title`. */
.pz-item[aria-disabled="true"] { opacity: 0.4; cursor: not-allowed; }
.pz-item[aria-disabled="true"]:hover { background: transparent; color: var(--pz-on-navy-mute); }
.pz-item:focus-visible, .pz-theme:focus-visible { outline: 2px solid var(--pz-focus); outline-offset: 2px; }

/* The appearance control (Auto / Light / Dark). Pinned to the right on wide screens so the three perspectives stay centred. */
.pz-theme {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: transparent;
  color: var(--pz-on-navy-mute);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--pz-dur) var(--pz-ease), color var(--pz-dur) var(--pz-ease);
}
.pz-theme:hover { color: #fff; background: rgba(255, 255, 255, 0.09); }
@media (pointer: coarse) { .pz-theme { min-height: 44px; } }
.pz-theme-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; background: linear-gradient(90deg, currentColor 50%, transparent 50%); }

/* Phones: the descriptors go, the three perspectives share the width, and the appearance control becomes a small round button beside them. */
@media (max-width: 640px) {
  .pz-bar { justify-content: space-between; min-height: 56px; }
  .pz-nav { flex: 1; min-width: 0; }
  .pz-list { width: 100%; }
  .pz-list li { flex: 1; min-width: 0; }
  .pz-item { min-width: 0; padding: 4px 6px; min-height: 46px; }
  .pz-hint { display: none; }
  .pz-theme { position: static; transform: none; flex: none; width: 46px; height: 46px; padding: 0; justify-content: center; }
  .pz-theme-text { display: none; }
}

/* Leaving for another application: a short, dark interstitial in the page we are leaving. It is only ever shown to people who have not asked for reduced motion. */
.pz-veil {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #02050f;
  color: var(--pz-on-navy);
  text-align: center;
  font-family: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms var(--pz-ease);
}
.pz-veil.on { opacity: 1; pointer-events: auto; }
.pz-veil-title { margin: 0; font-size: clamp(1.5rem, 4vw, 2.4rem); font-weight: 600; letter-spacing: -0.02em; }
.pz-veil-sub { margin: 10px auto 0; max-width: 42ch; color: var(--pz-on-navy-mute); font-size: 1rem; }

/* Movement between Practice and Console (same origin) is a cross-document view transition: the bar stays put while the page beneath it cross-fades. A progressive enhancement.
   The opt-in (@view-transition) is NOT here: it belongs to the two pages that are same-origin siblings, so it lives in Practice's own stylesheet (web/styles.css). If this shared file opted
   in, every page that loads it would, and a same-origin navigation to a page that has not (Create to its private preview) would be aborted by the browser with an error. */
@media (prefers-reduced-motion: no-preference) {
  .pz-bar { animation: pz-in 0.35s var(--pz-ease) both; }
  @keyframes pz-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.22s; }
}
@media (prefers-reduced-motion: reduce) {
  .pz-item, .pz-theme, .pz-veil { transition: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
