/* =========================================================
   Unresponsive Diver – Layout & Stil
   Baut auf /style.css (pf-tool-main, pf-tool-frame, pf-zoom) auf.
   Alle Farben als Variablen, damit sie später zentral wandern können.
   ========================================================= */

.ud-tool {
  --ud-purple: #3b22a3;
  --ud-purple-ink: #2a1878;
  --ud-purple-soft: rgba(59, 34, 163, 0.07);
  --ud-yellow: #f4c542;
  --ud-yellow-dark: #d8a92f;
  --ud-yellow-soft: #fdf4d3;
  --ud-lavender: #dcdcf2;
  --ud-text: #333;
  --ud-muted: #5e5a70;
  --ud-line: #4a3d8c;

  /* Wasser: dunkel in der Tiefe, hell an der Oberfläche */
  --ud-band-depth: #cfcaea;
  --ud-band-ascent: #e3e0f4;
  --ud-band-surface: #f8f8fd;
}

/* Rahmen etwas breiter als der Standard, das Diagramm braucht Platz */
.pf-tool-frame.ud-tool {
  max-width: 1000px;
  padding: 24px 28px 28px;
  color: var(--ud-text);
  line-height: 1.55;
}

.ud-tool a {
  color: var(--ud-purple);
}

.ud-tool a:focus-visible,
.ud-tool button:focus-visible {
  outline: 3px solid var(--ud-yellow);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------------------------------------------------------
   Startseite
   --------------------------------------------------------- */

.ud-head h1 {
  font-size: 1.9rem;
  line-height: 1.2;
  margin: 0 0 12px;
  color: var(--ud-purple);
}

/* Startseite: Text so breit wie das Diagramm */
.ud-intro {
  margin: 0 0 20px;
  font-size: 1.05rem;
}

/* Untertitel: erster Satz, leicht hervorgehoben */
.ud-subtitle {
  margin: 0 0 10px;
  font-size: 1.25rem;
  line-height: 1.45;
  font-weight: 600;
  color: var(--ud-purple-ink);
}

.ud-legend {
  display: flex;
  gap: 20px;
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: var(--ud-muted);
}

.ud-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ud-legend-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  box-sizing: border-box;
}

.ud-legend-icon--decision {
  width: 13px;
  height: 13px;
  margin: 0 2px;
  background: #fff;
  border: 2px solid var(--ud-purple);
  transform: rotate(45deg);
}

.ud-legend-icon--optional {
  width: 22px;
  height: 0;
  border-top: 2px dashed var(--ud-line);
}

.ud-legend-icon--action {
  width: 20px;
  height: 13px;
  background: var(--ud-purple);
  border-radius: 3px;
}

/* Diagramm */
.ud-diagram {
  border: 1px solid var(--ud-lavender);
  border-radius: 12px;
  overflow: hidden;
  background: var(--ud-band-surface);
}

.ud-map {
  display: block;
  width: 100%;
  height: auto;
  font-family: "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
}

.ud-band--depth   { fill: var(--ud-band-depth); }
.ud-band--ascent  { fill: var(--ud-band-ascent); }
.ud-band--surface { fill: var(--ud-band-surface); }

.ud-band-label {
  fill: var(--ud-purple-ink);
  font-size: 14px;
  font-weight: 600;
  opacity: 0.7;
}

.ud-wave {
  fill: none;
  stroke: var(--ud-purple);
  stroke-width: 2;
  opacity: 0.35;
}

.ud-edge {
  fill: none;
  stroke: var(--ud-line);
  stroke-width: 1.8;
  stroke-linejoin: round;
}

.ud-edge--optional {
  stroke-dasharray: 6 5;
}

.ud-edge-label--optional {
  font-size: 12px;
  font-weight: 600;
  font-style: italic;
}

.ud-arrowhead {
  fill: var(--ud-line);
}

.ud-edge-label {
  fill: var(--ud-purple-ink);
  font-size: 13px;
  font-weight: 700;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 4px;
  stroke-linejoin: round;
}

.ud-node {
  cursor: pointer;
  outline: none;
}

.ud-node .ud-shape {
  transition: fill 0.15s ease, stroke 0.15s ease, stroke-width 0.15s ease;
}

.ud-node--decision .ud-shape {
  fill: #fff;
  stroke: var(--ud-purple);
  stroke-width: 2;
}
.ud-node--decision .ud-node-text { fill: var(--ud-purple-ink); }

.ud-node--action .ud-shape {
  fill: var(--ud-purple);
  stroke: var(--ud-purple);
  stroke-width: 2;
}
.ud-node--action .ud-node-text { fill: #fff; }

.ud-node--start .ud-shape {
  fill: var(--ud-yellow);
  stroke: var(--ud-yellow-dark);
  stroke-width: 2;
}
.ud-node--start .ud-node-text { fill: var(--ud-purple-ink); }

/* Hover & Tastaturfokus: gelb wie die Nav-Buttons der Seite */
.ud-node:hover .ud-shape,
.ud-node:focus-visible .ud-shape {
  stroke: var(--ud-yellow);
  stroke-width: 5;
}
.ud-node--decision:hover .ud-shape,
.ud-node--decision:focus-visible .ud-shape {
  fill: var(--ud-yellow-soft);
}
.ud-node--start:hover .ud-shape,
.ud-node--start:focus-visible .ud-shape {
  stroke: var(--ud-purple);
  stroke-width: 3;
}

.ud-status {
  min-height: 3em;
  margin: 12px 0 0;
  padding: 10px 14px;
  border-left: 4px solid var(--ud-lavender);
  background: var(--ud-purple-soft);
  border-radius: 0 10px 10px 0;
  font-size: 0.95rem;
  color: var(--ud-muted);
  transition: border-color 0.15s ease;
}
.ud-status.is-active {
  border-left-color: var(--ud-yellow);
  color: var(--ud-text);
}

/* Mobile Liste (ersetzt das Diagramm auf kleinen Bildschirmen) */
.ud-list { display: none; }

.ud-list-phase {
  margin: 0 0 18px;
  padding: 12px 14px 6px;
  border-radius: 12px;
}
.ud-list-phase--depth   { background: var(--ud-band-depth); }
.ud-list-phase--ascent  { background: var(--ud-band-ascent); }
.ud-list-phase--surface { background: var(--ud-band-surface); border: 1px solid var(--ud-lavender); }

.ud-list-phase h2 {
  margin: 0 0 10px;
  font-size: 1rem;
  color: var(--ud-purple-ink);
}

.ud-list-steps {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ud-list-item {
  position: relative;
  margin: 0 0 10px;
  padding: 10px 12px 10px 38px;
  background: #fff;
  border-radius: 10px;
}

.ud-list-item::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 15px;
  box-sizing: border-box;
}
.ud-list-item--decision::before {
  width: 12px; height: 12px;
  border: 2px solid var(--ud-purple);
  transform: rotate(45deg);
}
.ud-list-item--action::before {
  width: 16px; height: 11px;
  left: 11px; top: 16px;
  background: var(--ud-purple);
  border-radius: 3px;
}
.ud-list-item--start::before {
  width: 16px; height: 11px;
  left: 11px; top: 16px;
  background: var(--ud-yellow);
  border-radius: 6px;
}

.ud-list-link {
  font-weight: 600;
  text-decoration: none;
}

.ud-list-branches {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  font-size: 0.92rem;
}
.ud-list-branches li {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin: 4px 0;
}

.ud-pill {
  flex: 0 0 auto;
  display: inline-block;
  min-width: 2.6em;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
}
.ud-pill--yes { background: var(--ud-purple); color: #fff; }
.ud-pill--no  { background: #fff; color: var(--ud-purple); border: 1.5px solid var(--ud-purple); }
.ud-pill--optional { background: #fff; color: var(--ud-muted); border: 1.5px dashed var(--ud-line); font-weight: 600; }

.ud-foot {
  margin-top: 24px;
  font-size: 0.88rem;
  color: var(--ud-muted);
}
.ud-foot p { margin: 0 0 8px; }
.ud-disclaimer { color: var(--ud-text); }

.ud-error {
  padding: 14px;
  border-left: 4px solid var(--ud-yellow);
  background: var(--ud-yellow-soft);
  border-radius: 0 10px 10px 0;
}

/* ---------------------------------------------------------
   Detailseite
   --------------------------------------------------------- */

.ud-step-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 40px;
  align-items: start;
}

.ud-article {
  max-width: 68ch;
}

.ud-back {
  display: inline-block;
  padding: 6px 14px;
  border: 2px solid var(--ud-purple);
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.ud-back:hover {
  background: var(--ud-purple);
  color: #fff;
}

.ud-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 22px 0 6px;
  font-size: 0.88rem;
}

.ud-phase-tag {
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 600;
  color: var(--ud-purple-ink);
}
.ud-phase-tag--depth   { background: var(--ud-band-depth); }
.ud-phase-tag--ascent  { background: var(--ud-band-ascent); }
.ud-phase-tag--surface { background: var(--ud-band-surface); border: 1px solid var(--ud-lavender); }

.ud-type { color: var(--ud-muted); }

.pf-tool-frame.ud-tool .ud-article h1 {
  margin: 0 0 14px;
  font-size: 2rem;
  line-height: 1.2;
  color: var(--ud-purple);
}

.ud-lead {
  font-size: 1.15rem;
  line-height: 1.6;
  margin: 0 0 24px;
}

.ud-keypoints {
  margin: 0 0 32px;
  padding: 16px 20px 8px;
  background: var(--ud-yellow-soft);
  border-left: 5px solid var(--ud-yellow);
  border-radius: 0 12px 12px 0;
}
.ud-keypoints h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  color: var(--ud-purple-ink);
}
.ud-keypoints ul {
  margin: 0;
  padding-left: 1.2em;
}
.ud-keypoints li { margin: 0 0 8px; }

.ud-section { margin: 0 0 30px; }

.ud-section h2 {
  margin: 0 0 10px;
  font-size: 1.3rem;
  line-height: 1.3;
  color: var(--ud-purple);
}

.ud-section p {
  margin: 0 0 14px;
  line-height: 1.65;
}

.ud-bullets {
  margin: 0 0 14px;
  padding-left: 1.2em;
}
.ud-bullets li { margin: 0 0 8px; line-height: 1.55; }
.ud-bullets li::marker { color: var(--ud-purple); }

.ud-callout {
  margin: 6px 0 16px;
  padding: 14px 18px 2px;
  border-radius: 0 12px 12px 0;
}
.ud-callout--warning {
  border-left: 5px solid var(--ud-purple);
  background: var(--ud-purple-soft);
}
.ud-callout--note {
  border-left: 5px solid var(--ud-yellow);
  background: var(--ud-yellow-soft);
}
.ud-callout--pending {
  border-left: 5px solid var(--ud-lavender);
  background: var(--ud-purple-soft);
  color: var(--ud-muted);
}
.ud-callout-title {
  margin: 0 0 6px !important;
  font-weight: 700;
  color: var(--ud-purple-ink);
}

/* Bilder */
.ud-figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin: 8px 0 12px;
}
.ud-figure { margin: 0; }
.ud-figure img { width: 100%; }
.ud-figure figcaption {
  margin-top: 8px;
  font-size: 0.88rem;
  color: var(--ud-muted);
}
.ud-credit {
  display: block;
  font-size: 0.8rem;
  opacity: 0.8;
}
.ud-figure-placeholder {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  aspect-ratio: 4 / 3;
  padding: 16px;
  box-sizing: border-box;
  border: 2px dashed var(--ud-lavender);
  border-radius: 10px;
  background: var(--ud-band-surface);
  font-size: 0.88rem;
  color: var(--ud-muted);
  text-align: center;
}
.ud-figure-placeholder strong { color: var(--ud-purple); }
.ud-figure-placeholder code { font-size: 0.78rem; opacity: 0.8; }

/* Links & Quellen */
.ud-links ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.ud-links li {
  margin: 0 0 12px;
  padding-left: 14px;
  border-left: 3px solid var(--ud-lavender);
}
.ud-links a { font-weight: 600; }
.ud-link-note {
  display: block;
  font-size: 0.9rem;
  color: var(--ud-muted);
}

/* Verweise im Text */
.ud-ref {
  font-size: 0.72em;
  line-height: 0;
  margin-left: 1px;
}
.ud-ref a {
  font-weight: 700;
  text-decoration: none;
  padding: 0 1px;
  border-radius: 3px;
}
.ud-ref a:hover {
  background: var(--ud-yellow-soft);
  text-decoration: underline;
}
.ud-ref--note a { font-style: italic; }
.ud-ref--unknown {
  color: #b3261e;
  font-weight: 700;
}

/* Quellen & Anmerkungen */
.ud-sources ol,
.ud-notes ol {
  margin: 0;
  padding-left: 1.8em;
  font-size: 0.9rem;
  color: var(--ud-muted);
}
.ud-sources li,
.ud-notes li {
  margin: 0 0 8px;
  padding: 3px 6px;
  border-radius: 6px;
  scroll-margin-top: 24px;
  transition: background-color 0.4s ease;
}
.ud-sources li::marker,
.ud-notes li::marker {
  color: var(--ud-purple);
  font-weight: 700;
}
.ud-sources li:target,
.ud-notes li:target {
  background: var(--ud-yellow-soft);
  color: var(--ud-text);
}
.ud-source-link {
  display: inline-block;
  margin-left: 8px;
  font-weight: 600;
}
.ud-backrefs {
  margin-left: 8px;
  white-space: nowrap;
}
.ud-backref {
  margin-right: 6px;
  font-weight: 700;
  text-decoration: none;
}
.ud-backref:hover { text-decoration: underline; }

/* Rücksprung-Ziel im Text kurz markieren */
.ud-ref a:target {
  background: var(--ud-yellow);
  color: var(--ud-purple-ink);
}
.ud-ref a { scroll-margin-top: 120px; }

/* Im Ablauf: Davor / Danach */
.ud-flownav {
  margin: 36px 0 0;
  padding: 18px 20px;
  border-radius: 12px;
  background: var(--ud-purple-soft);
}
.ud-flownav h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
  color: var(--ud-purple-ink);
}
.ud-flownav-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.ud-flownav h3 {
  margin: 0 0 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ud-muted);
}
.ud-flownav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.ud-flownav li {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin: 0 0 8px;
  font-size: 0.95rem;
}
.ud-muted {
  margin: 0;
  color: var(--ud-muted);
  font-size: 0.92rem;
}

/* Blättern */
.ud-pager {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: center;
  margin: 20px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--ud-lavender);
}
.ud-pager-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
}
.ud-pager-link--next { text-align: right; }
.ud-pager-link:hover span:last-child { text-decoration: underline; }
.ud-pager-kicker {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--ud-muted);
}
.ud-pager-count {
  font-size: 0.82rem;
  color: var(--ud-muted);
  white-space: nowrap;
}

/* Übersichtskarte rechts */
.ud-minimap {
  position: sticky;
  top: 16px;
}
.ud-minimap-title {
  margin: 0 0 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ud-muted);
}
.ud-minimap-svg {
  border: 1px solid var(--ud-lavender);
  border-radius: 10px;
  overflow: hidden;
}
.ud-map--mini .ud-node:not(.is-current) { opacity: 0.55; }
.ud-map--mini .ud-node:hover { opacity: 1; }
.ud-map--mini .ud-node.is-current .ud-shape {
  stroke: var(--ud-yellow);
  stroke-width: 10;
}
.ud-map--mini .ud-node-text { display: none; }
.ud-map--mini .ud-edge { stroke-width: 3; }

/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */

@media (max-width: 900px) {
  .ud-step-layout { grid-template-columns: minmax(0, 1fr); }
  .ud-minimap { display: none; }
}

@media (max-width: 700px) {
  .pf-tool-frame.ud-tool { padding: 14px 12px 18px; }
  .ud-head h1 { font-size: 1.45rem; }
  .ud-subtitle { font-size: 1.1rem; }
  .pf-tool-frame.ud-tool .ud-article h1 { font-size: 1.5rem; }
  .ud-lead { font-size: 1.05rem; }

  .ud-diagram,
  .ud-status,
  .ud-legend { display: none; }
  .ud-list { display: block; }

  .ud-flownav-cols { grid-template-columns: 1fr; }
  .ud-pager { grid-template-columns: 1fr 1fr; }
  .ud-pager-count { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ud-node .ud-shape,
  .ud-status,
  .ud-back,
  .ud-sources li,
  .ud-notes li { transition: none; }
}
