/* WindoorERP Documentation — platform map page.
   The canvas language is the in-app Process Map studio's, re-cut for the
   public docs surface: boxes are HTML (titles wrap), links are SVG
   (curves get arrowheads), both on one transformed layer. */

/* ── Page frame ─────────────────────────────────────────────────── */
/* The map is the page here: it gets the whole shell, sidebar included.
   Every pixel handed back to the canvas is a percent of readable zoom,
   and the nav is one click away in the header. */
.wd-shell:has(.wd-main-map) { max-inline-size: none; }

/* Only above the drawer breakpoint: below it the sidebar is already
   off-canvas and costs the map nothing, and hiding it would leave the
   header's menu button opening nothing. */
@media (min-width: 981px) {
  .wd-shell:has(.wd-main-map) .wd-sidebar { display: none; }
}

.wd-main-map {
  display: flex;
  flex-direction: column;
  padding: 24px 36px 28px;
}

.wd-map-head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
  margin-block-start: 6px;
}

.wd-map-title {
  font-size: clamp(24px, 3vw, 32px);
  margin: 0;
}

.wd-map-lede {
  color: var(--ink-3);
  max-inline-size: 62ch;
  margin: 6px 0 0;
}

/* The map's guided journey: the same offer the map makes in the app,
   phrased as a link because on the website a journey is a page. */
.wd-map-journey {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-block-start: 10px;
  padding: 7px 14px;
  border: 1px solid var(--tint-blue-strong);
  border-radius: 999px;
  background: var(--tint-blue);
  color: var(--blue-darker);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s var(--ease);
}

.wd-map-journey:hover { border-color: var(--blue-deep); }

.wd-map-journey svg {
  inline-size: 15px;
  block-size: 15px;
  flex: none;
}

.wd-map-journey-name {
  color: var(--ink-2);
  font-weight: 500;
}

.wd-map-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.wd-map-btn {
  min-inline-size: 34px;
  block-size: 34px;
  padding: 0 10px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: #fff;
  color: var(--ink-2);
  font: 600 15px/1 var(--font-ui);
  cursor: pointer;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}

.wd-map-btn:hover {
  background: var(--tint-blue);
  color: var(--blue-darker);
}

.wd-map-btn-fit { font-size: 13px; }

.wd-map-zoom {
  min-inline-size: 46px;
  text-align: center;
  color: var(--ink-3);
  font: 500 12.5px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ── Canvas ─────────────────────────────────────────────────────── */
.wd-map {
  position: relative;
  flex: 1;
  /* A map wants the screen: this one is 58 boxes wide, and every
     pixel taken from the canvas is another 3% off the fitted zoom. */
  block-size: calc(100vh - var(--header-h) - 210px);
  min-block-size: 520px;
  margin-block-start: 18px;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background-color: #f6f8fb;
  background-image: radial-gradient(circle, rgba(15, 26, 53, 0.10) 1px,
                                    transparent 1px);
  background-size: 26px 26px;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  /* Geometry is authored left-to-right even when the UI is Arabic;
     flipping the canvas would mirror every saved coordinate. */
  direction: ltr;
}

.wd-map.is-panning { cursor: grabbing; }

.wd-map-world {
  position: absolute;
  inset-inline-start: 0;
  inset-block-start: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.wd-map-links {
  position: absolute;
  overflow: visible;
  pointer-events: none;
  /* docs.css caps every svg at `max-width: 100%`, and this one's parent
     is a zero-sized transform layer — so the cap resolves to 0 and the
     whole link layer disappears. Its size is its geometry; never a
     percentage of anything. */
  max-inline-size: none;
  max-block-size: none;
}

.wd-map-lane-label {
  font: 700 13px var(--font-ui);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  opacity: 0.75;
}

.wd-map-edge-label { font: 600 11.5px var(--font-ui); }

.wd-map-edge-chip {
  fill: #f6f8fb;
  stroke: rgba(15, 26, 53, 0.08);
}

.wd-map-frame-title { font: 700 12.5px var(--font-ui); }
.wd-map-frame-note { font: 500 11px var(--font-ui); }

.wd-map-hint {
  position: absolute;
  inset-block-end: 10px;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--rule-soft);
  color: var(--ink-3);
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  direction: ltr;
}

.wd-rtl .wd-map-hint { direction: rtl; }

/* ── Ink palette (mirrors the studio's) ─────────────────────────── */
.wd-mink-slate  { --mink: #64748B; --mtint: rgba(100, 116, 139, 0.09); --mline: rgba(100, 116, 139, 0.30); }
.wd-mink-blue   { --mink: #155CB0; --mtint: rgba(21, 92, 176, 0.09);  --mline: rgba(21, 92, 176, 0.30); }
.wd-mink-sky    { --mink: #3B9EFF; --mtint: rgba(59, 158, 255, 0.09); --mline: rgba(59, 158, 255, 0.30); }
.wd-mink-teal   { --mink: #0E9E96; --mtint: rgba(14, 158, 150, 0.09); --mline: rgba(14, 158, 150, 0.30); }
.wd-mink-green  { --mink: #12855A; --mtint: rgba(18, 133, 90, 0.09);  --mline: rgba(18, 133, 90, 0.30); }
.wd-mink-amber  { --mink: #C68A00; --mtint: rgba(198, 138, 0, 0.09);  --mline: rgba(198, 138, 0, 0.30); }
.wd-mink-orange { --mink: #D9730D; --mtint: rgba(217, 115, 13, 0.09); --mline: rgba(217, 115, 13, 0.30); }
.wd-mink-red    { --mink: #C1342C; --mtint: rgba(193, 52, 44, 0.09);  --mline: rgba(193, 52, 44, 0.30); }
.wd-mink-purple { --mink: #6D48C7; --mtint: rgba(109, 72, 199, 0.09); --mline: rgba(109, 72, 199, 0.30); }
.wd-mink-pink   { --mink: #C93F86; --mtint: rgba(201, 63, 134, 0.09); --mline: rgba(201, 63, 134, 0.30); }

/* ── Boxes ──────────────────────────────────────────────────────── */
.wd-mnode {
  position: absolute;
  box-sizing: border-box;
  display: block;
  padding: 7px 10px;
  border-radius: 11px;
  border: 1.5px solid var(--mline, rgba(15, 26, 53, 0.16));
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 26, 53, 0.06),
              0 6px 16px rgba(15, 26, 53, 0.05);
  overflow: hidden;
  text-decoration: none;
  /* A box with no stored width sizes itself to its text, exactly like
     the studio: max-content between the same two bounds. */
  inline-size: max-content;
  min-inline-size: 120px;
  max-inline-size: 320px;
  /* Arabic and English boxes sit on the same canvas; each follows the
     direction of its own text, not the map's. */
  unicode-bidi: plaintext;
  text-align: start;
  transition: box-shadow 0.12s ease;
}

a.wd-mnode.is-linked { cursor: pointer; }
a.wd-mnode:not(.is-linked) { cursor: default; }

.wd-mnode.is-linked:hover {
  box-shadow: 0 2px 4px rgba(15, 26, 53, 0.08),
              0 10px 24px rgba(15, 26, 53, 0.10),
              0 0 0 3px var(--mtint);
  border-color: var(--mink);
}

.wd-mnode-head {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  line-height: 1.25;
}

.wd-mnode-dot {
  flex: none;
  inline-size: 9px;
  block-size: 9px;
  margin-block-start: 4px;
  border-radius: 3px;
  background: var(--mink, #64748B);
}

.wd-mnode-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-1);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wd-mnode-book {
  flex: none;
  inline-size: 12px;
  block-size: 12px;
  margin-inline-start: auto;
  margin-block-start: 2px;
  color: var(--mink, #64748B);
  opacity: 0.65;
}

.wd-mnode-role {
  display: block;
  margin-block-start: 2px;
  font-size: 10.5px;
  color: var(--ink-3);
}

.wd-mnode-outputs {
  margin: 3px 0 0;
  padding: 2px 0 0;
  list-style: none;
  border-block-start: 1px dashed rgba(15, 26, 53, 0.12);
}

.wd-mnode-outputs li {
  font-size: 10.5px;
  line-height: 1.3;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wd-mnode-outputs li::before {
  content: "•";
  color: var(--mink, #64748B);
  margin-inline-end: 4px;
}

/* Type is meaning, so it is shape and weight — not just colour. */
.wd-mtype-department {
  background: var(--mtint, #f1f5f9);
  border-width: 2px;
}

.wd-mtype-department .wd-mnode-title { font-size: 13.5px; }

.wd-mtype-decision {
  background: var(--mtint, #fff8e6);
  clip-path: polygon(18px 0, calc(100% - 18px) 0, 100% 50%,
                     calc(100% - 18px) 100%, 18px 100%, 0 50%);
  border: 0;
  box-shadow: none;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  outline: 2px solid var(--mline);
  outline-offset: -2px;
}

.wd-mtype-decision .wd-mnode-head { justify-content: center; }
.wd-mtype-decision .wd-mnode-dot { display: none; }

.wd-mtype-document {
  border-inline-start-width: 5px;
  border-radius: 4px 11px 11px 4px;
  background: #fcfdff;
}

.wd-mtype-milestone {
  background: var(--mink, #12855A);
  border-color: var(--mink);
  border-radius: 999px;
  text-align: center;
}

.wd-mtype-milestone .wd-mnode-head { justify-content: center; }
.wd-mtype-milestone .wd-mnode-title { color: #fff; }
.wd-mtype-milestone .wd-mnode-dot { background: rgba(255, 255, 255, 0.8); }
.wd-mtype-milestone .wd-mnode-outputs {
  border-block-start-color: rgba(255, 255, 255, 0.35);
}
.wd-mtype-milestone .wd-mnode-outputs li { color: rgba(255, 255, 255, 0.92); }
.wd-mtype-milestone .wd-mnode-outputs li::before { color: rgba(255, 255, 255, 0.7); }

.wd-mtype-start,
.wd-mtype-end {
  border-radius: 999px;
  background: var(--mtint);
  text-align: center;
}

.wd-mtype-start .wd-mnode-head,
.wd-mtype-end .wd-mnode-head { justify-content: center; }

.wd-mtype-note {
  background: #fffbeb;
  border-style: dashed;
  border-radius: 4px;
}

.wd-mtype-system { border-style: dashed; }

/* ── Small screens ──────────────────────────────────────────────── */
@media (max-width: 720px) {
  .wd-main-map { padding: 18px 14px 18px; }
  .wd-map { min-block-size: 380px; border-radius: 12px; }
  .wd-map-hint { display: none; }
}
