/* Interaktive Nuklidkarte — Gestaltung
 *
 * Farbe gehört ausschliesslich den Daten. Die Bedienoberfläche bleibt
 * unbunt, damit nichts mit den Zerfallsfarben konkurriert.
 */

:root {
  --slate:     #1f2933;
  --slate-2:   #323f4b;
  --line:      #e4e7eb;
  --ink:       #1f2933;
  --ink-soft:  #616e7c;
  --paper:     #ffffff;
  --shell:     #f5f7f9;
  --focus:     #7b8794;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--shell);
  color: var(--ink);
  font: 400 15px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-text-size-adjust: 100%;
}

/* ---------------------------------------------------------------- *
 * Kopfleiste
 * ---------------------------------------------------------------- */

#bar {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 52px;
  padding: 0 16px;
  background: var(--slate);
  color: #f0f2f4;
  position: relative;
  z-index: 3;
}

#bar h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

#bar .group {
  display: flex;
  align-items: center;
  gap: 6px;
}

#bar .spacer { flex: 1; }

button,
#bar input {
  font: inherit;
  font-size: 13px;
}

#bar button {
  background: var(--slate-2);
  color: #e8ebee;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 6px 11px;
  cursor: pointer;
}

#bar button:hover { background: #3f4d5a; }

#bar button.on {
  background: #e8ebee;
  color: var(--slate);
  font-weight: 600;
}

#bar button:focus-visible,
#bar input:focus-visible {
  outline: 2px solid #9fb0c0;
  outline-offset: 1px;
}

.search-wrap { position: relative; }

#search {
  width: 190px;
  padding: 6px 9px;
  border-radius: 4px;
  border: 1px solid #4a5765;
  background: #2a3742;
  color: #eef1f3;
}

#search::placeholder { color: #8b98a5; }
#search.miss { border-color: #c47b74; }

#search-hint {
  position: absolute;
  top: 34px;
  left: 2px;
  font-size: 12px;
  color: #d3a8a2;
  white-space: nowrap;
}

#bar label.toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #cfd6dc;
  cursor: pointer;
  user-select: none;
}

/* ---------------------------------------------------------------- *
 * Kartenfläche
 * ---------------------------------------------------------------- */

#chart {
  position: absolute;
  inset: 52px 0 30px 0;
  background: var(--paper);
  overflow: hidden;
}

#chart canvas {
  position: absolute;
  inset: 0;
  display: block;
}

#overlay { cursor: grab; touch-action: none; }
#overlay:active { cursor: grabbing; }

/* Achsentitel liegen als HTML über dem Canvas, damit sie beim
   Zoomen ruhig stehen bleiben. */
.axis-title {
  position: absolute;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  pointer-events: none;
}

#axis-n { bottom: 4px; right: 12px; }
#axis-z { top: 8px; left: 8px; }

/* ---------------------------------------------------------------- *
 * Legende — liegt auf der Tafel, nicht in einem Panel
 * ---------------------------------------------------------------- */

#legend {
  position: absolute;
  left: 16px;
  bottom: 16px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 10px 12px;
  font-size: 12.5px;
  pointer-events: none;
  max-width: 260px;
}

#legend.decay {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px 14px;
}

#legend .item,
#legend .extra {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

#legend .chip {
  width: 13px;
  height: 13px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  flex: none;
}

#legend.heat { width: 280px; }
#legend .scale-title { font-weight: 600; margin-bottom: 6px; }
#legend .scale { height: 13px; border-radius: 2px; border: 1px solid rgba(0,0,0,.18); }
#legend .ticks { position: relative; height: 16px; margin-top: 2px; }
#legend .ticks span {
  position: absolute;
  transform: translateX(-50%);
  font-size: 10.5px;
  color: var(--ink-soft);
  white-space: nowrap;
}
#legend .extra { margin-top: 10px; }

/* ---------------------------------------------------------------- *
 * Detailfeld
 * ---------------------------------------------------------------- */

#panel {
  position: absolute;
  top: 52px;
  right: 0;
  bottom: 30px;
  width: 340px;
  max-width: 88vw;
  background: var(--paper);
  border-left: 1px solid var(--line);
  padding: 20px 22px 28px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 180ms ease;
  z-index: 2;
}

@media (prefers-reduced-motion: reduce) {
  #panel { transition: none; }
}

#panel.open { transform: translateX(0); }

#panel .close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 4px;
}

#panel .close:hover { background: var(--shell); color: var(--ink); }

#panel header { margin-bottom: 18px; }

#panel .nuclide {
  font-size: 32px;
  font-weight: 300;
  letter-spacing: -0.01em;
}

#panel .nuclide sup {
  font-size: 17px;
  font-weight: 500;
  vertical-align: super;
  margin-right: 1px;
}

#panel .element {
  font-size: 14px;
  color: var(--ink-soft);
  margin-top: 1px;
}

#panel .swatch {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
}

#panel .swatch span {
  width: 15px;
  height: 15px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

#panel dl { margin: 0 0 20px; }

#panel .row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}

#panel dt { color: var(--ink-soft); }
#panel dd { margin: 0; text-align: right; font-weight: 500; }

#panel h3 {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 8px;
}

#panel table.decays {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

#panel .decays td {
  padding: 5px 4px;
  border-bottom: 1px solid var(--line);
  vertical-align: baseline;
}

#panel .decays .mode { font-weight: 600; white-space: nowrap; }
#panel .decays .pct  { text-align: right; color: var(--ink-soft); white-space: nowrap; }
#panel .decays .q    { text-align: right; white-space: nowrap; }
#panel .decays .to   { text-align: right; }
#panel .none { color: #9aa5b1; font-size: 12px; }

#panel button.link {
  background: none;
  border: none;
  padding: 2px 4px;
  font: inherit;
  color: var(--slate);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  border-radius: 3px;
}

#panel button.link:hover { background: var(--shell); }
#panel button.link sup { font-size: 10px; vertical-align: super; }

#panel .note {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-soft);
  background: var(--shell);
  border-radius: 4px;
  padding: 9px 11px;
  margin: 14px 0 0;
}

/* ---------------------------------------------------------------- *
 * Fusszeile
 * ---------------------------------------------------------------- */

#foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 30px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: var(--shell);
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-soft);
  z-index: 3;
}

#foot .spacer { flex: 1; }
#source { text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------- *
 * Schmale Fenster
 * ---------------------------------------------------------------- */

@media (max-width: 760px) {
  #bar { gap: 10px; overflow-x: auto; }
  #bar h1 { display: none; }
  #search { width: 120px; }
  #legend { max-width: 190px; font-size: 11.5px; }
  #legend.decay { grid-template-columns: 1fr; }
  #panel { width: 100%; }
}
