/* Zoro company map. Self-contained: fonts and logo come from ../shared, the
   data from data.js. Nothing loads from another site. */

@font-face { font-family: "Switzer"; font-weight: 400; font-style: normal; font-display: swap; src: url("../shared/fonts/switzer-400.woff2") format("woff2"); }
@font-face { font-family: "Switzer"; font-weight: 500; font-style: normal; font-display: swap; src: url("../shared/fonts/switzer-500.woff2") format("woff2"); }
@font-face { font-family: "Switzer"; font-weight: 600; font-style: normal; font-display: swap; src: url("../shared/fonts/switzer-600.woff2") format("woff2"); }
@font-face { font-family: "Chivo Mono"; font-weight: 100 900; font-style: normal; font-display: swap; src: url("../shared/fonts/chivo-mono-latin.woff2") format("woff2"); }

:root {
  --bg: #151310;
  --bg-deep: #0f0d0b;
  --raised: #1f1c18;
  --raised-2: #26221d;
  --ink: #f3efe9;
  --ink-soft: #d9d3cb;
  --muted: #b7b2ac;
  --faint: #8d877f;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.22);
  --accent: #d14a5e;
  --accent-deep: #7a1f2b;
  --sans: "Switzer", "Helvetica Neue", Arial, sans-serif;
  --mono: "Chivo Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --top-h: 56px;
  --panel-w: 360px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button { font: inherit; color: inherit; }
a { color: inherit; }
svg { display: block; }

/* ---------- top bar ---------- */
.top {
  position: relative;
  z-index: 5;
  height: var(--top-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-deep);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand img { width: 28px; height: 28px; object-fit: contain; }
.brand__name { font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.brand__sep { color: var(--faint); }
.brand__page { color: var(--muted); font-size: 15px; white-space: nowrap; }
.top__right { display: flex; align-items: center; gap: 18px; }
.sample {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
}
.sample i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.top__link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: 14px; text-decoration: none;
  transition: color 160ms ease;
}
.top__link svg, .top__cta svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.top__cta {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border-radius: 8px; background: var(--accent-deep); color: #fff;
  font-size: 14px; font-weight: 500; text-decoration: none;
  transition: background-color 160ms ease, transform 120ms var(--ease-out);
}
.top__cta:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) {
  .top__link:hover { color: var(--ink); }
  .top__cta:hover { background: #8e2533; }
}

/* ---------- app frame ---------- */
.app {
  height: calc(100% - var(--top-h));
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--panel-w);
}
.is-embed .top { display: none; }
.is-embed { --panel-w: 330px; }
.is-embed .app { height: 100%; }
.is-embed .guide, .is-embed .pfoot { display: none; }

.stage {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background:
    radial-gradient(46% 52% at 50% 50%, rgba(209, 74, 94, 0.07), transparent 70%),
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 44px 44px,
    var(--bg);
}
.graph { position: absolute; inset: 52px 12px 60px; width: calc(100% - 24px); height: calc(100% - 112px); overflow: visible; touch-action: manipulation; transition: opacity 140ms ease; }
.graph.is-swap { opacity: 0; }

/* guide: what to click, in order */
.guide {
  position: absolute; top: 14px; left: 16px; z-index: 3;
  display: flex; gap: 2px; margin: 0; padding: 0; list-style: none;
  border: 1px solid var(--line); border-radius: 10px; background: rgba(15, 13, 11, 0.86);
  overflow: hidden;
}
.guide li {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; font-size: 12.5px; color: var(--faint);
  transition: color 160ms ease, background-color 160ms ease;
}
.guide li + li { border-left: 1px solid var(--line); }
.guide b {
  display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  border: 1px solid var(--line-strong); font-family: var(--mono); font-size: 10px; font-weight: 500; color: var(--faint);
}
.guide li[data-on] { color: var(--ink); background: rgba(255, 255, 255, 0.05); }
.guide li[data-on] b { border-color: var(--accent); background: var(--accent); color: #fff; }
.guide li[data-done] { color: var(--muted); }
.guide li[data-done] b { border-color: var(--muted); color: var(--muted); }

.back {
  position: absolute; top: 14px; right: 16px; z-index: 3;
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: rgba(15, 13, 11, 0.86);
  font-size: 13px; cursor: pointer;
  transition: border-color 160ms ease, transform 120ms var(--ease-out);
}
.back[hidden] { display: none; }
.back svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.back:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .back:hover { border-color: var(--muted); } }

.hint {
  position: absolute; left: 50%; bottom: 18px; z-index: 2; transform: translateX(-50%);
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
  white-space: nowrap; pointer-events: none;
  transition: opacity 160ms ease;
}
.hint[data-off] { opacity: 0; }

.stepper {
  position: absolute; left: 50%; bottom: 14px; z-index: 3; transform: translateX(-50%);
  display: flex; align-items: center; gap: 4px;
  padding: 4px; border: 1px solid var(--line-strong); border-radius: 12px; background: rgba(15, 13, 11, 0.9);
}
.stepper[hidden] { display: none; }
.stepper button {
  display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent; cursor: pointer;
  transition: background-color 160ms ease, transform 120ms var(--ease-out);
}
.stepper button:active { transform: scale(0.94); }
.stepper svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.stepper span { min-width: 150px; text-align: center; font-size: 14px; font-weight: 600; }
@media (hover: hover) and (pointer: fine) { .stepper button:hover { background: rgba(255, 255, 255, 0.07); } }

.tip {
  position: absolute; z-index: 4; pointer-events: none;
  max-width: 240px; padding: 8px 10px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: rgba(15, 13, 11, 0.96);
  font-size: 13px; line-height: 1.35;
  opacity: 0; transform: translateY(4px);
  transition: opacity 140ms ease, transform 140ms var(--ease-out);
}
.tip[data-on] { opacity: 1; transform: none; }
.tip small { display: block; margin-top: 2px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

/* ---------- graph ---------- */
.e { fill: none; stroke-linecap: round; transition: opacity 220ms ease; }
.e[data-k="pillar"] { stroke: rgba(243, 239, 233, 0.38); stroke-width: 1.3; }
.e[data-k="head"] { stroke: rgba(209, 74, 94, 0.75); stroke-width: 1.2; stroke-dasharray: 3 4; }
.e[data-k="sop"] { stroke: rgba(243, 239, 233, 0.2); stroke-width: 1; }
.e[data-k="does"] { stroke: rgba(243, 239, 233, 0.26); stroke-width: 1; }
.e[data-k="uses"] { stroke: rgba(183, 178, 172, 0.16); stroke-width: 0.9; }
.is-focus .e[data-k="pillar"] { stroke-width: 2.6; stroke: rgba(243, 239, 233, 0.5); }
.is-focus .e[data-k="sop"] { stroke: rgba(243, 239, 233, 0.34); stroke-width: 1.5; stroke-dasharray: 2 5; animation: flow 1.4s linear infinite; }
.is-focus .e[data-k="does"] { stroke: rgba(243, 239, 233, 0.5); stroke-width: 1.4; }
.is-focus .e[data-k="uses"] { stroke: rgba(183, 178, 172, 0.34); stroke-width: 1; }
.e[data-hot] { stroke: var(--accent) !important; stroke-width: 1.8 !important; }
.e[data-off] { opacity: 0; }
@keyframes flow { to { stroke-dashoffset: -14; } }

.n { cursor: pointer; outline: none; transition: opacity 220ms ease; }
.n:focus-visible .halo { opacity: 1; }
.n[data-off] { opacity: 0; pointer-events: none; }
.n .hit, .n .hitrow { fill: transparent; }
.n .hitrow { display: none; }
.n .body { transition: stroke 160ms ease, fill 160ms ease; }
.n text { pointer-events: none; font-family: var(--sans); fill: var(--ink-soft); paint-order: stroke; stroke: var(--bg); stroke-width: 5px; stroke-linejoin: round; }
.n .lbl { opacity: 0; transition: opacity 180ms ease; }
.n[data-label] .lbl { opacity: 1; }
.n .ic { fill: none; stroke-linecap: round; stroke-linejoin: round; }

.n--core .body { fill: url(#coreFill); stroke: rgba(243, 239, 233, 0.22); stroke-width: 1; }
.n--core .ring { fill: none; stroke: rgba(243, 239, 233, 0.12); stroke-dasharray: 2 5; }
.n--core .dust { transform-box: fill-box; transform-origin: center; animation: spin 140s linear infinite; }
.n--core .dust circle { fill: #e9805f; }
.n--core .dust circle:nth-child(3n) { fill: #f3e2c9; }
.n--core .dust circle:nth-child(5n) { animation: twinkle 3.4s ease-in-out infinite; }
.n--core .lbl { font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.14em; fill: var(--muted); text-transform: uppercase; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes twinkle { 50% { opacity: 0.25; } }

.n--dept .body { fill: #1f1b17; stroke: var(--ink); stroke-width: 1.5; }
.n--dept .ic { stroke: var(--ink); stroke-width: 1.7; }
.n--dept .lbl { font-size: 13.5px; font-weight: 600; fill: var(--ink); }
.n--dept[data-focus] .body { stroke: var(--accent); stroke-width: 2; fill: #2a1418; }
.n--dept[data-focus] .ic { stroke: var(--accent); }
.n--dept[data-focus] .lbl { font-size: 17px; }
.n--dept[data-flank] .lbl { fill: var(--muted); font-size: 11.5px; }

.n--head .body, .n--person .body { fill: #2a1418; stroke: var(--accent); stroke-width: 1.4; }
.n--head .ic, .n--person .ic { stroke: var(--accent); stroke-width: 2; }
.n--head .lbl, .n--person .lbl { font-size: 10.5px; font-weight: 600; fill: #f0a8b2; }
.is-focus .n--head .lbl, .is-focus .n--person .lbl { font-size: 14px; }

.n--agent .body { fill: #181512; stroke: var(--ink); stroke-width: 1.4; }
.n--agent .mid { fill: none; stroke: rgba(243, 239, 233, 0.55); stroke-width: 0.9; }
.n--agent .dot { fill: var(--ink); }
.n--agent .lbl { font-size: 10.5px; font-weight: 500; }
.is-focus .n--agent .lbl { font-size: 14px; }

.n--task .body { fill: #24201b; stroke: #9a948c; stroke-width: 1.1; }
.n--task .ic { stroke: #cfc9c1; stroke-width: 2; }
.n--task[data-mode="approve"] .body, .n--task[data-mode="person"] .body { stroke: var(--accent); }
.n--task .lbl { font-size: 10.5px; fill: var(--ink); }
.is-focus .n--task .lbl { font-size: 14px; }

.n--tool .body { fill: #171411; stroke: #7d776f; stroke-width: 1; }
.n--tool .ic { stroke: #b9b2a9; stroke-width: 2.2; }
.n--tool .lbl { font-size: 9.5px; fill: var(--muted); }
.is-focus .n--tool .lbl { font-size: 12.5px; }

/* ---------- phone outline (one department) ---------- */
.sec { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; fill: var(--faint); opacity: 0; pointer-events: none; }
.sec[data-on] { opacity: 1; }
.is-rows .n .hitrow { display: block; }
.is-rows .n--agent .hit, .is-rows .n--person .hit { pointer-events: none; }
.is-rows .n--dept .lbl { font-size: 20px; }
.is-rows .n--head .lbl { font-size: 15px; }
.is-rows .n--task .lbl { font-size: 15.5px; font-weight: 500; }
.is-rows .n--agent .lbl, .is-rows .n--person .lbl { font-size: 14px; font-weight: 500; fill: var(--muted); }
.is-rows .n--person .lbl { fill: #f0a8b2; }
.is-rows .n--tool .lbl { font-size: 13px; fill: var(--ink-soft); }
.is-rows .e[data-k="sop"], .is-rows .e[data-k="does"] { stroke: rgba(243, 239, 233, 0.3); stroke-width: 1.2; }

.n[data-sel] .body { stroke: var(--accent); stroke-width: 2.4; }
.n[data-sel] .halo { opacity: 1; }
.n .halo { fill: none; stroke: var(--accent); stroke-width: 1; opacity: 0; transition: opacity 160ms ease; }
@media (hover: hover) and (pointer: fine) {
  .n:hover .body { stroke: var(--accent); }
}

/* ---------- side panel ---------- */
.panel {
  min-width: 0;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: var(--bg-deep);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
.pv { padding: 22px 22px 28px; animation: pv-in 200ms var(--ease-out); }
@keyframes pv-in { from { opacity: 0; transform: translateY(6px); } }

.crumb {
  display: inline-flex; align-items: center; gap: 6px; margin: -4px 0 14px -6px; padding: 6px;
  border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 13px; cursor: pointer;
  transition: color 160ms ease;
}
.crumb svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) and (pointer: fine) { .crumb:hover { color: var(--ink); } }

.eyebrow { margin: 0; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.ptitle { margin: 8px 0 0; font-size: 24px; font-weight: 500; line-height: 1.15; letter-spacing: -0.02em; }
.plede { margin: 10px 0 0; color: var(--muted); font-size: 14.5px; line-height: 1.55; }
.psec {
  margin: 24px 0 0;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint);
}
.psec + .rows, .psec + .rules, .psec + .ptext, .psec + .stats, .psec + .legend { margin-top: 10px; }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 16px 0 0; }
.stat { padding: 12px 12px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--raised); }
.stat b { display: block; font-size: 24px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat span { display: block; margin-top: 6px; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.stats-note { margin: 6px 0 0; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }

.legend { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.legend li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 5px 0; font-size: 13.5px; color: var(--ink-soft); }
.legend li span:last-child { font-family: var(--mono); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.legend svg { width: 22px; height: 22px; overflow: visible; }

.rows { display: grid; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.row {
  display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  width: 100%; min-height: 48px; padding: 9px 4px 9px 2px;
  border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer;
  transition: background-color 160ms ease;
}
.row:active { background: rgba(255, 255, 255, 0.05); }
@media (hover: hover) and (pointer: fine) { .row:hover { background: rgba(255, 255, 255, 0.04); } .row:hover .row__go { color: var(--ink); } }
.row__num { font-family: var(--mono); font-size: 11px; color: var(--accent); font-variant-numeric: tabular-nums; }
.row__ic { width: 22px; height: 22px; }
.row__ic svg { width: 22px; height: 22px; overflow: visible; }
.row__main { min-width: 0; }
.row__t { display: block; font-size: 14px; font-weight: 500; line-height: 1.3; }
.row__s { display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.row__go { color: var(--faint); transition: color 160ms ease; }
.row__go svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.pmode { margin: 10px 0 12px; font-size: 15px; font-weight: 500; line-height: 1.45; color: var(--ink); }

.rules { margin: 0; padding: 0; list-style: none; counter-reset: r; display: grid; gap: 0; border-top: 1px solid var(--line); }
.rules li { counter-increment: r; display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; line-height: 1.5; color: var(--ink-soft); }
.rules li::before { content: counter(r, decimal-leading-zero); font-family: var(--mono); font-size: 11px; line-height: 21px; color: var(--accent); }

.ptext { margin: 0; font-size: 14px; line-height: 1.55; color: var(--ink-soft); }
.pfoot { margin: 26px 0 0; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.06em; line-height: 1.6; text-transform: uppercase; color: var(--faint); }
.pfoot a { color: var(--muted); }

.btn-line {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 16px;
  height: 38px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 8px; background: transparent;
  font-size: 13.5px; font-weight: 500; cursor: pointer;
  transition: border-color 160ms ease, transform 120ms var(--ease-out);
}
.btn-line:active { transform: scale(0.97); }
.btn-line svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) and (pointer: fine) { .btn-line:hover { border-color: var(--muted); } }

/* ---------- phone sheet ---------- */
.sheet-scrim { position: fixed; inset: 0; z-index: 20; background: rgba(8, 7, 6, 0.6); opacity: 0; transition: opacity 220ms ease; }
.sheet-scrim[data-on] { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21;
  max-height: 86vh; max-height: 86dvh; display: flex; flex-direction: column;
  border-top: 1px solid var(--line-strong); border-radius: 18px 18px 0 0; background: var(--bg-deep);
  transform: translateY(100%); transition: transform 260ms var(--ease-drawer);
}
.sheet[hidden] { display: none; }
.sheet[data-on] { transform: none; }
.sheet__close {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; background: var(--raised); cursor: pointer;
}
.sheet__close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.sheet__body { overflow-y: auto; padding-bottom: env(safe-area-inset-bottom); }
.sheet__body .pv { padding-top: 26px; }
.sheet .crumb { display: none; }

/* ---------- phone layout ---------- */
@media (max-width: 760px) {
  body { overflow: auto; height: auto; }
  html { height: auto; }
  :root { --top-h: 56px; }
  .top { position: sticky; top: 0; padding: 0 16px; }
  .brand__sep, .brand__page { display: none; }
  .top__link { display: none; }
  .top__right { gap: 12px; }
  .top__cta { height: 34px; padding: 0 12px; font-size: 13.5px; }
  .sample { font-size: 10px; }
  .app { display: block; height: auto; }
  .is-embed .app { height: auto; }
  .stage { aspect-ratio: 1 / 1.02; max-height: 74vh; width: 100%; }
  .graph { inset: 10px 4px 46px; width: calc(100% - 8px); height: calc(100% - 56px); }
  /* One department: the outline sets the height, so every row is readable. */
  .stage.is-rows { aspect-ratio: auto; max-height: none; padding: 14px 4px 64px; }
  .stage.is-rows .graph { position: relative; inset: auto; width: 100%; height: auto; }
  .guide { display: none; }
  /* Phone: the arrow alone, so a long department name never meets it. */
  .back { top: 12px; right: 12px; width: 40px; height: 40px; padding: 0; justify-content: center; }
  .back span { display: none; }
  .hint { bottom: 14px; font-size: 10px; }
  .stepper { bottom: 8px; }
  .stepper span { min-width: 128px; font-size: 13.5px; }
  .stepper button { width: 40px; height: 40px; }
  .panel { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .pv { padding: 22px 16px 32px; }
  .ptitle { font-size: 26px; }
  .row { min-height: 52px; }
  .n--dept .lbl { font-size: 15.5px; }
  .n--core .lbl { display: none; }
}

/* Off screen, or behind the other tab on the website: nothing moves. */
.is-paused .n--core .dust, .is-paused .n--core .dust circle, .is-paused .e { animation-play-state: paused; }

@media (prefers-reduced-motion: reduce) {
  .n--core .dust, .n--core .dust circle, .is-focus .e[data-k="sop"] { animation: none; }
  .pv { animation: none; }
  .sheet, .graph { transition: none; }
}
