/* Customer Zero back-office shell: the Transit Diagram world.
   Served at /shared/zero-shell.css. Colors are the Coretura palette only
   (branding/README.md); tints stay within one hue, red never mixes into blue. */

@font-face { font-family: "Poppins"; font-weight: 400; font-display: swap; src: url("/shared/fonts/poppins-400.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 500; font-display: swap; src: url("/shared/fonts/poppins-500.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 600; font-display: swap; src: url("/shared/fonts/poppins-600.woff2") format("woff2"); }

:root {
  color-scheme: dark;

  --cz-ground: #002540;
  --cz-ground-raised: color-mix(in oklab, #002540 90%, #F2F1ED);
  --cz-ground-sunk: color-mix(in oklab, #002540 85%, black);
  --cz-ink: #F2F1ED;
  --cz-ink-muted: color-mix(in oklab, #F2F1ED 70%, #008FC9);
  --cz-rule: color-mix(in oklab, #F2F1ED 20%, #002540);
  --cz-red: #F64370;
  --cz-blue: #008FC9;
  /* Blue text on the enamel needs lifting toward beige to reach 4.5:1. */
  --cz-link: color-mix(in oklab, #008FC9 62%, #F2F1ED);
  --cz-focus: color-mix(in oklab, #008FC9 70%, #F2F1ED);
  /* Red text on the enamel needs the same lift to reach 4.5:1. */
  --cz-red-text: color-mix(in oklab, #F64370 72%, #F2F1ED);

  /* Line inks of the rail diagram: three inks, one per family. The second
     line of a family is the same ink, dashed. */
  --cz-line-software: var(--cz-red);
  --cz-line-binary: var(--cz-red);
  --cz-line-identity: var(--cz-blue);
  --cz-line-identity-2: var(--cz-blue);
  --cz-line-data: color-mix(in oklab, #F2F1ED 48%, #002540);
  --cz-dash: repeating-linear-gradient(90deg, currentColor 0 8px, transparent 8px 12px);

  --cz-font: "Poppins", system-ui, sans-serif;
  --cz-mono: ui-monospace, "SF Mono", Menlo, monospace;
  --cz-radius: 4px;

  /* Shared scripts (profile.js, footer.js) read Pico's variable names. */
  --pico-color: var(--cz-ink);
  --pico-muted-color: var(--cz-ink-muted);
  --pico-card-background-color: var(--cz-ground-raised);
  --pico-muted-border-color: var(--cz-rule);
  --pico-primary: var(--cz-red);
  --pico-primary-focus: color-mix(in oklab, #F2F1ED 10%, #002540);
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  background: var(--cz-ground);
  color: var(--cz-ink);
  font: 400 15px/1.5 var(--cz-font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  scrollbar-color: var(--cz-rule) transparent;
}

::selection { background: var(--cz-red); color: var(--cz-ground); }

a { color: var(--cz-link); text-underline-offset: 3px; }
a:hover { color: var(--cz-ink); }

:focus-visible { outline: 2px solid var(--cz-focus); outline-offset: 2px; }

h1, h2, h3 { font-weight: 600; line-height: 1.25; margin: 0; }

[hidden] { display: none !important; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── App frame ─────────────────────────────────────────────────────────── */
.cz-app { display: grid; grid-template-rows: auto 1fr auto; height: 100vh; }

/* ── Header ────────────────────────────────────────────────────────────── */
.cz-header {
  display: flex; align-items: center; gap: 24px;
  height: 56px; padding: 0 16px;
  border-bottom: 1px solid var(--cz-rule);
}
.cz-brand { display: flex; align-items: center; gap: 10px; color: var(--cz-ink); text-decoration: none; white-space: nowrap; }
.cz-brand img { width: 28px; height: 28px; }
.cz-brand b { font-weight: 600; font-size: 15px; }
.cz-brand span { color: var(--cz-ink-muted); font-size: 15px; }
.cz-header-end { margin-left: auto; display: flex; align-items: center; gap: 16px; }

/* Tool menu (hamburger.js renders the links). */
.menu-container { position: relative; }
.hamburger {
  display: grid; place-items: center; width: 36px; height: 36px;
  background: none; border: 1px solid transparent; border-radius: var(--cz-radius);
  color: var(--cz-ink); font-size: 20px; line-height: 1; cursor: pointer;
}
.hamburger:hover { border-color: var(--cz-rule); }
.menu-dropdown {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 100;
  min-width: 220px; padding: 6px 0;
  background: var(--cz-ground-raised); border: 1px solid var(--cz-rule); border-radius: var(--cz-radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}
.menu-dropdown.open { display: block; }
.menu-dropdown a { display: block; padding: 8px 16px; color: var(--cz-ink); text-decoration: none; font-size: 14px; }
.menu-dropdown a:hover { background: var(--cz-rule); }
.menu-dropdown a.current { color: var(--cz-red-text); font-weight: 600; }

/* View tabs: a standard tablist; the selected tab carries a red rule. */
.cz-tabs { display: flex; align-self: stretch; gap: 4px; }
.cz-tabs button {
  position: relative; padding: 0 12px;
  background: none; border: 0; color: var(--cz-ink-muted);
  font: 500 14px var(--cz-font); cursor: pointer;
}
.cz-tabs button:hover { color: var(--cz-ink); }
.cz-tabs button[aria-selected="true"] { color: var(--cz-ink); }
.cz-tabs button[aria-selected="true"]::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px;
  background: var(--cz-red);
}

#header-user { font-size: 14px; white-space: nowrap; }
.cz-tabs button { white-space: nowrap; }

@media (max-width: 760px) {
  .cz-header { gap: 8px; padding: 0 8px; }
  .cz-brand b, .cz-brand span { display: none; }
  .cz-tabs button { padding: 0 8px; }
  .cz-tabs button[aria-selected="true"]::after { left: 8px; right: 8px; }
  #profile-btn > span:last-child { display: none; }
}

/* ── Panels ────────────────────────────────────────────────────────────── */
.cz-panel { border-left: 1px solid var(--cz-rule); padding: 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 32px; }
.cz-panel h2 { font-size: 13px; font-weight: 600; color: var(--cz-ink-muted); margin-bottom: 12px; }

/* ── Controls ──────────────────────────────────────────────────────────── */
.cz-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px;
  background: var(--cz-red); color: var(--cz-ground-sunk);
  border: 1px solid var(--cz-red); border-radius: var(--cz-radius);
  font: 600 14px var(--cz-font); text-decoration: none; cursor: pointer;
}
.cz-btn:hover { background: color-mix(in oklab, #F64370 85%, #F2F1ED); color: var(--cz-ground-sunk); }
.cz-btn.quiet { background: none; color: var(--cz-ink); border-color: var(--cz-rule); }
.cz-btn.quiet:hover { border-color: var(--cz-ink-muted); }

/* Switch: a real checkbox drawn as a toggle. */
.cz-switch { display: flex; align-items: center; gap: 12px; min-height: 36px; cursor: pointer; font-size: 14px; }
.cz-switch input {
  appearance: none; flex: none; position: relative; width: 34px; height: 20px; margin: 0;
  border: 1px solid var(--cz-ink-muted); border-radius: 10px; cursor: pointer;
}
.cz-switch input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--cz-ink-muted);
  transition: transform 160ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.cz-switch input:checked { background: var(--cz-ink); border-color: var(--cz-ink); }
.cz-switch input:checked::after { background: var(--cz-ground); transform: translateX(14px); }
.cz-switch input:disabled { opacity: 0.35; cursor: not-allowed; }
.cz-switch:has(input:disabled) { color: var(--cz-ink-muted); cursor: not-allowed; }
.cz-switch small { display: block; color: var(--cz-ink-muted); font-size: 12px; line-height: 1.35; }

/* A line's swatch: a short stroke in that line's ink. */
.cz-swatch { flex: none; width: 24px; height: 6px; border-radius: 3px; background: currentColor; }
.cz-swatch.dotted { height: 0; border-top: 3px dotted currentColor; border-radius: 0; background: none; }
.cz-swatch.binary, .cz-swatch.identity-2 { background: var(--cz-dash); border-radius: 0; }

/* ── Footer ────────────────────────────────────────────────────────────── */
.cz-footer {
  display: flex; align-items: center; gap: 16px;
  height: 36px; padding: 0 16px;
  border-top: 1px solid var(--cz-rule); font-size: 12px; color: var(--cz-ink-muted);
}
.cz-footer .state { padding: 1px 8px; border: 1px solid var(--cz-ink-muted); border-radius: var(--cz-radius); font-weight: 600; letter-spacing: 0.06em; color: var(--cz-ink); }
.cz-footer .spacer { flex: 1; }

/* ── Sign-in card ──────────────────────────────────────────────────────── */
.cz-signin { display: grid; place-items: center; padding: 24px; }
.cz-signin article {
  width: min(380px, 100%); padding: 40px 32px; text-align: center;
  background: var(--cz-ground-raised); border: 1px solid var(--cz-rule); border-radius: var(--cz-radius);
}
.cz-signin img { width: 48px; height: 48px; }
.cz-signin h1 { font-size: 22px; margin: 16px 0 4px; }
.cz-signin p { color: var(--cz-ink-muted); margin: 0 0 24px; font-size: 14px; }
.cz-signin .cz-btn { width: 100%; margin-bottom: 16px; }
.cz-signin .links { display: flex; justify-content: center; gap: 24px; font-size: 14px; margin: 0; }

/* ── Rail diagram ──────────────────────────────────────────────────────── */
.rail { width: 100%; height: auto; display: block; font-family: var(--cz-font); }
.rail .line { fill: none; stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; }
.rail .line.software { stroke: var(--cz-line-software); }
.rail .line.binary { stroke: var(--cz-line-binary); }
.rail .line.identity { stroke: var(--cz-line-identity); }
.rail .line.identity-2 { stroke: var(--cz-line-identity-2); }
.rail .line.binary, .rail .line.identity-2 { stroke-dasharray: 18 10; stroke-linecap: butt; }
.rail .line.data { stroke: var(--cz-line-data); stroke-width: 4; }
.rail .line.ref { stroke: var(--cz-line-data); stroke-width: 3; stroke-dasharray: 1 9; }
.rail .flow { fill: var(--cz-ink-muted); font-size: 14px; }

.rail .station { cursor: pointer; outline: none; }
.rail .station .hit { fill: transparent; }
.rail .station .ring { fill: var(--cz-ground); stroke: var(--cz-ink); stroke-width: 5; }
.rail .station .ring.dashed { stroke-dasharray: 6 5; }
.rail .station .tick { fill: var(--cz-ink); }

/* A line draws itself in when its layer is switched on; lines are visible by
   default, so a paused timeline never hides the map. */
.rail .line.drawing { stroke-dasharray: 1; animation: cz-draw 700ms cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes cz-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
/* Dashed lines keep their dash and fade in instead of drawing. */
.rail .line.binary.drawing, .rail .line.identity-2.drawing { stroke-dasharray: 18 10; animation: cz-fade 500ms ease-out; }
@keyframes cz-fade { from { opacity: 0; } to { opacity: 1; } }
.rail .station .mark { fill: none; stroke-width: 2.5; opacity: 0; }
.rail .station .label { fill: var(--cz-ink); font-size: 16px; font-weight: 500; }
.rail .station.system .label { fill: var(--cz-ink-muted); font-weight: 400; }
.rail .station:hover .label { fill: var(--cz-ink); text-decoration: underline; }
.rail .station[aria-pressed="true"] .mark.selected { opacity: 1; stroke: var(--cz-red); }
.rail .station:focus-visible .mark.focus { opacity: 1; stroke: var(--cz-focus); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
