@font-face {
  font-family: "Tilda Sans";
  src: url("fonts/TildaSans-VF.woff2") format("woff2");
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --navy: #091b49;
  --blue: #0054e8;
  --paper: #f7fafd;
  --line: #d5e1f0;
  --muted: #52637f;
  --focus: #99bcff;
  font-family: "Tilda Sans", Arial, sans-serif;
  color: var(--navy);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body { overflow: hidden; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
button, a { touch-action: manipulation; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }
button:focus-visible, a:focus-visible, .canvas:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
[hidden] { display: none !important; }

.app {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.app:fullscreen { height: 100%; }
.header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 17px 24px 18px;
  border-bottom: 1px solid var(--line);
}
.project { margin: 0 0 3px; font-size: 14px; line-height: 1.2; color: var(--muted); }
h1 { margin: 0; font-size: clamp(20px, 2vw, 29px); line-height: 1.12; font-weight: 750; letter-spacing: -.025em; }
.miro-link { flex-shrink: 0; font-size: 16px; font-weight: 650; padding: 10px 0 10px 12px; white-space: nowrap; }
.miro-link span { padding-left: 5px; font-size: 21px; vertical-align: -1px; }

.canvas {
  position: relative;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
  background: #fff;
  cursor: grab;
  touch-action: none;
  overscroll-behavior: contain;
  user-select: none;
  -webkit-user-select: none;
}
.canvas.is-dragging { cursor: grabbing; }
.canvas[aria-busy="true"] { cursor: progress; }
.diagram, .hotspots {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  transform-origin: 0 0;
  visibility: hidden;
  pointer-events: none;
  -webkit-user-drag: none;
}
.canvas.is-ready .diagram { visibility: visible; }
.hotspots { pointer-events: none; visibility: visible; }
.node-hotspot {
  position: absolute;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  touch-action: none;
}
.node-hotspot:hover, .node-hotspot:focus-visible {
  outline: calc(2px * var(--inverse-scale, 1)) solid var(--blue);
  outline-offset: calc(2px * var(--inverse-scale, 1));
  background: #0054e808;
}
.canvas.is-dragging .node-hotspot { cursor: grabbing; }
.node-detail {
  position: absolute;
  z-index: 3;
  width: min(420px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  overflow: auto;
  border: 1px solid #a5c4f7;
  border-radius: 10px;
  background: #fff;
  padding: 20px 47px 21px 21px;
  box-shadow: 0 6px 24px #091b491f;
  user-select: text;
  -webkit-user-select: text;
  touch-action: pan-y;
  cursor: auto;
}
.node-detail p { margin: 0; font-size: 21px; line-height: 1.32; white-space: pre-line; }
.detail-close {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}
.detail-close:hover { background: #e9f1fe; color: var(--blue); }
.detail-close svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.canvas-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: min(90%, 440px);
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.4;
}
.canvas-message a { display: inline-block; padding: 8px; }

.toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 10px 20px;
  border-top: 1px solid var(--line);
}
.zoom-controls { display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
.control {
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 10px;
  color: var(--navy);
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
}
.control:hover { color: var(--blue); background: #e9f1fe; }
.control:active { background: #d9e7fc; }
.control:disabled { opacity: .35; cursor: default; background: transparent; }
.control svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-control { width: 42px; padding: 0; }
.zoom-value { min-width: 62px; text-align: center; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.control-divider { height: 21px; width: 1px; background: var(--line); margin: 0 7px; }
.leave-fullscreen { display: none; }
.is-fullscreen .enter-fullscreen { display: none; }
.is-fullscreen .leave-fullscreen { display: block; }
.secondary-controls { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 28px; }
.hint { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.3; }
.downloads { display: flex; align-items: center; gap: 13px; white-space: nowrap; font-size: 15px; }
.downloads > span { color: var(--muted); }
.downloads a { font-weight: 650; padding: 10px 0; }

@media (max-width: 1060px) {
  .secondary-controls { gap: 18px; }
  .hint { max-width: 230px; }
}
@media (max-width: 760px) {
  .header { padding: 13px 16px 14px; gap: 12px; }
  .project { font-size: 12px; }
  h1 { max-width: 420px; font-size: 21px; }
  .miro-link { font-size: 14px; }
  .toolbar { padding: 7px 12px 9px; flex-direction: column; gap: 1px; }
  .zoom-controls { justify-content: center; }
  .secondary-controls { width: 100%; justify-content: space-between; gap: 16px; }
  .hint { max-width: 270px; font-size: 12px; }
  .downloads { font-size: 13px; gap: 11px; }
  .downloads > span { display: none; }
  .downloads a { padding: 8px 0; }
  .node-detail { left: 12px !important; right: 12px; top: auto !important; bottom: 12px; width: auto; max-height: min(52vh, calc(100% - 24px)); }
  .node-detail p { font-size: 20px; }
}
@media (max-width: 390px) {
  h1 { font-size: 19px; }
  .header { gap: 8px; }
  .hint { max-width: 215px; }
  .control { height: 40px; }
  .icon-control { width: 40px; }
  .zoom-value { min-width: 50px; }
  .control-divider { margin: 0 3px; }
  .fit-control { padding: 0 6px; gap: 5px; font-size: 14px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .header { padding: 8px 16px; }
  .project { display: none; }
  h1 { font-size: 20px; }
  .toolbar { padding: 4px 12px; flex-direction: row; gap: 16px; }
  .secondary-controls { width: auto; }
  .hint { display: none; }
  .control { height: 36px; }
  .icon-control { width: 36px; }
  .downloads a { padding: 8px 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}

.header-links { display: flex; align-items: center; gap: 20px; flex-shrink: 0; }
@media (max-width: 600px) { .header-links { gap: 8px; } .header-links .miro-link { padding-left: 0; font-size: 14px; } }
