/* ============================================================
   AVISON — Edit-Modus
   Toolbar, Auge-Badges, Dialoge, Passwort-Gate — und die Regeln,
   die im Edit-Modus alle Einblend-Animationen neutralisieren,
   damit man beim Bearbeiten die komplette Seite sieht.
   ============================================================ */

:root {
  --avedit-bar-h: 3.5rem;
  --avedit-bg: #141516;
  --avedit-fg: #f6f3ee;
  --avedit-dim: rgba(246, 243, 238, 0.55);
  --avedit-line: rgba(246, 243, 238, 0.16);
  --avedit-accent: #adbdd6;
  --avedit-danger: #d9705b;
  --avedit-radius: 0.65rem;
  --avedit-font: "Chillax", system-ui, sans-serif;
  --avedit-mono: "Martian Mono", ui-monospace, monospace;
}

/* ------------------------------------------------------------
   Animations-Neutralisierer — alles sofort sichtbar
   ------------------------------------------------------------ */
.edit-mode .preloader { display: none !important; }
.edit-mode .cursor,

.edit-mode [data-reveal] { opacity: 1 !important; transform: none !important; }
.edit-mode .line__inner { transform: none !important; }
.edit-mode .hero__wordmark .char { transform: none !important; }
.edit-mode .float-chip { opacity: 1 !important; }
.edit-mode .journey__flag { transform: scale(1) !important; }
.edit-mode .journey__card { opacity: 1 !important; transform: none !important; }
.edit-mode .journey__marker { transform: scale(1); }
.edit-mode .journey__dot { display: none; }

/* Fixe Leisten unter die Toolbar schieben */
.edit-mode .nav { top: var(--avedit-bar-h); }
.edit-mode { scroll-padding-top: var(--avedit-bar-h); }

/* ------------------------------------------------------------
   Editierbare Elemente — Markierung & Fokus
   ------------------------------------------------------------ */
.edit-mode [data-edit],
.edit-mode [data-pedit] {
  outline: 1px dashed transparent;
  outline-offset: 4px;
  transition: outline-color 0.15s ease;
  min-height: 0.8em;
}
.edit-mode [data-edit]:hover,
.edit-mode [data-pedit]:hover { outline-color: rgba(173, 189, 214, 0.55); }
.edit-mode [data-edit]:focus,
.edit-mode [data-pedit]:focus {
  outline: 2px solid rgba(173, 189, 214, 0.9);
  outline-offset: 4px;
  border-radius: 2px;
}
.edit-mode [contenteditable] { cursor: text; caret-color: var(--avedit-accent); }

/* ------------------------------------------------------------
   Badge-Ebene — die kleinen Augen "editierbar"
   ------------------------------------------------------------ */
.avedit-badges {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 9990;
}
.avedit-chip {
  position: absolute; top: 0; left: 0;
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.22rem 0.6rem 0.22rem 0.45rem;
  background: rgba(20, 21, 22, 0.92);
  color: var(--avedit-fg);
  border: 1px solid rgba(246, 243, 238, 0.22);
  border-radius: 999px;
  font-family: var(--avedit-mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
  pointer-events: auto;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  /* WICHTIG: transform wird für die Positionierung benutzt — hier darf
     nichts (auch kein :active-Effekt) das transform überschreiben, sonst
     springt der Chip beim Drücken weg und der Klick geht ins Leere. */
  transition: background 0.15s ease;
}
.avedit-chip:hover { background: #26282a; }
.avedit-chip:active { filter: brightness(1.35); }
.avedit-chip .avedit-eye { width: 1rem; height: 0.8rem; display: block; }
.avedit-chip.is-hidden { display: none; }

.avedit-eye { width: 1.1rem; height: 0.9rem; display: inline-block; object-fit: contain; }

/* ------------------------------------------------------------
   Toolbar — klebt ganz oben
   ------------------------------------------------------------ */
.avedit-bar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--avedit-bar-h);
  z-index: 10000;
  display: flex; align-items: center; gap: 0.9rem;
  padding: 0 1rem;
  background: var(--avedit-bg);
  color: var(--avedit-fg);
  border-bottom: 1px solid var(--avedit-line);
  font-family: var(--avedit-font);
  font-size: 0.8rem;
}
.avedit-bar__brand {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--avedit-mono);
  font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase;
  flex: none;
}
.avedit-bar__brand .avedit-eye { width: 1.5rem; height: 1.2rem; }
.avedit-bar__brand b { font-weight: 400; color: var(--avedit-accent); }

.avedit-bar__mid {
  display: flex; align-items: center; gap: 0.7rem;
  flex: 1 1 auto;
  overflow-x: auto;
  scrollbar-width: thin;
  padding: 0.3rem 0;
}
.avedit-color {
  display: inline-flex; align-items: center; gap: 0.35rem;
  flex: none;
  color: var(--avedit-dim);
  font-size: 0.68rem;
  font-family: var(--avedit-mono);
  letter-spacing: 0.04em;
}
.avedit-color input[type="color"] {
  appearance: none; -webkit-appearance: none;
  width: 1.6rem; height: 1.6rem;
  padding: 0; border: 1px solid rgba(246, 243, 238, 0.3);
  border-radius: 50%;
  background: none; cursor: pointer;
}
.avedit-color input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.avedit-color input[type="color"]::-webkit-color-swatch { border: none; border-radius: 50%; }
.avedit-color input[type="color"]::-moz-color-swatch { border: none; border-radius: 50%; }

.avedit-bar__theme {
  flex: none;
  color: var(--avedit-dim);
  font-family: var(--avedit-mono);
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.avedit-bar__right { display: flex; align-items: center; gap: 0.5rem; flex: none; margin-left: auto; }

.avedit-btn {
  appearance: none;
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  background: transparent;
  color: var(--avedit-fg);
  border: 1px solid rgba(246, 243, 238, 0.28);
  border-radius: 999px;
  font-family: var(--avedit-font);
  font-size: 0.78rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.avedit-btn:hover { background: rgba(246, 243, 238, 0.09); }
.avedit-btn--primary {
  background: var(--avedit-accent);
  border-color: var(--avedit-accent);
  color: #141516;
  font-weight: 600;
}
.avedit-btn--primary:hover { background: #c3d0e4; }
.avedit-btn svg { width: 1.1rem; height: 0.9rem; }

.avedit-dot {
  width: 0.5rem; height: 0.5rem; border-radius: 50%;
  background: var(--avedit-danger);
  display: none;
}
.avedit-bar.is-dirty .avedit-dot { display: inline-block; }

/* ------------------------------------------------------------
   Dialoge (Medienwahl, Projekt anlegen, Kachel hinzufügen)
   ------------------------------------------------------------ */
.avedit-modal {
  position: fixed; inset: 0; z-index: 10010;
  display: flex; align-items: center; justify-content: center;
  padding: 1.2rem;
  background: rgba(10, 11, 12, 0.66);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.avedit-modal__panel {
  width: min(30rem, 100%);
  max-height: min(85vh, 46rem);
  overflow-y: auto;
  background: var(--avedit-bg);
  color: var(--avedit-fg);
  border: 1px solid var(--avedit-line);
  border-radius: 1rem;
  padding: 1.4rem;
  font-family: var(--avedit-font);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.avedit-modal__panel h3 {
  margin: 0 0 1rem;
  font-size: 1.05rem; font-weight: 600;
  display: flex; align-items: center; gap: 0.55rem;
}
.avedit-modal__panel h3 .avedit-eye { width: 1.4rem; height: 1.1rem; }

.avedit-field { margin-bottom: 0.9rem; }
.avedit-field > label {
  display: block;
  font-family: var(--avedit-mono);
  font-size: 0.65rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--avedit-dim);
  margin-bottom: 0.35rem;
}
.avedit-field input[type="text"],
.avedit-field input[type="url"],
.avedit-field input[type="password"],
.avedit-field textarea,
.avedit-field select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  background: #1d1f21;
  color: var(--avedit-fg);
  border: 1px solid rgba(246, 243, 238, 0.2);
  border-radius: var(--avedit-radius);
  font-family: var(--avedit-font);
  font-size: 0.85rem;
}
.avedit-field textarea { min-height: 5.5rem; resize: vertical; }
.avedit-field input:focus, .avedit-field textarea:focus, .avedit-field select:focus {
  outline: 2px solid rgba(173, 189, 214, 0.7); outline-offset: 1px;
}
.avedit-field--row .avedit-field { flex: 1; margin-bottom: 0; }
.avedit-field input[type="color"] {
  width: 100%; height: 2.4rem; padding: 0.2rem;
  background: #1d1f21;
  border: 1px solid rgba(246, 243, 238, 0.2);
  border-radius: var(--avedit-radius);
  cursor: pointer;
}
.avedit-field__hint { font-size: 0.7rem; color: var(--avedit-dim); margin-top: 0.3rem; }

.avedit-media-pick {
  display: flex; align-items: center; gap: 0.6rem;
}
.avedit-media-pick .avedit-btn { flex: none; }
.avedit-media-pick__name {
  flex: 1; min-width: 0;
  font-size: 0.72rem; color: var(--avedit-dim);
  font-family: var(--avedit-mono);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.avedit-drop {
  border: 1.5px dashed rgba(246, 243, 238, 0.3);
  border-radius: var(--avedit-radius);
  padding: 1.4rem 1rem;
  text-align: center;
  color: var(--avedit-dim);
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  margin-bottom: 0.9rem;
}
.avedit-drop:hover, .avedit-drop.is-over {
  border-color: var(--avedit-accent);
  background: rgba(173, 189, 214, 0.06);
  color: var(--avedit-fg);
}
.avedit-drop b { color: var(--avedit-fg); font-weight: 600; }
.avedit-drop.is-busy { pointer-events: none; opacity: 0.6; }

.avedit-modal__foot {
  display: flex; justify-content: flex-end; gap: 0.5rem;
  margin-top: 1.2rem;
}

/* ------------------------------------------------------------
   Toast
   ------------------------------------------------------------ */
.avedit-toast {
  position: fixed;
  left: 50%; bottom: 1.4rem;
  transform: translate(-50%, 150%);
  z-index: 10020;
  background: var(--avedit-bg);
  color: var(--avedit-fg);
  border: 1px solid var(--avedit-line);
  border-radius: 999px;
  padding: 0.6rem 1.2rem;
  font-family: var(--avedit-font);
  font-size: 0.8rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
.avedit-toast.is-on { transform: translate(-50%, 0); }
.avedit-toast.is-error { border-color: rgba(217, 112, 91, 0.6); color: #f3b7aa; }

/* ------------------------------------------------------------
   Passwort-Gate
   ------------------------------------------------------------ */
.avedit-gate {
  position: fixed; inset: 0; z-index: 10030;
  display: flex; align-items: center; justify-content: center;
  padding: 1.2rem;
  background: #141516;
  color: var(--avedit-fg);
  font-family: var(--avedit-font);
}
.avedit-gate__box {
  width: min(21rem, 100%);
  text-align: center;
  display: flex; flex-direction: column; gap: 0.8rem;
}
.avedit-gate__box .avedit-gate__eye svg,
.avedit-gate__box .avedit-eye { width: 4.2rem; height: 3.4rem; margin: 0 auto 0.4rem; }
.avedit-gate__box h1 {
  margin: 0;
  font-family: "Chillax", var(--avedit-font);
  font-size: 1.6rem; font-weight: 600; letter-spacing: 0.02em;
}
.avedit-gate__box p { margin: 0 0 0.6rem; color: var(--avedit-dim); font-size: 0.85rem; }
.avedit-gate__box input {
  padding: 0.75rem 0.9rem;
  background: #1d1f21;
  color: var(--avedit-fg);
  border: 1px solid rgba(246, 243, 238, 0.25);
  border-radius: var(--avedit-radius);
  font-size: 1rem;
  text-align: center;
  letter-spacing: 0.2em;
}
.avedit-gate__box input:focus { outline: 2px solid var(--avedit-accent); outline-offset: 1px; }
.avedit-gate__box button {
  padding: 0.75rem 0.9rem;
  background: var(--avedit-accent);
  color: #141516;
  border: none; border-radius: 999px;
  font-family: var(--avedit-font);
  font-size: 0.95rem; font-weight: 600;
  cursor: pointer;
}
.avedit-gate__box button:hover { background: #c3d0e4; }
.avedit-gate__box a { color: var(--avedit-dim); font-size: 0.78rem; text-decoration: none; }
.avedit-gate__box a:hover { color: var(--avedit-fg); }
.avedit-gate__box.is-wrong { animation: aveditShake 0.4s ease; }
.avedit-gate__box.is-wrong input { border-color: var(--avedit-danger); }
@keyframes aveditShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

/* ------------------------------------------------------------
   Kleine Inline-Steuerleisten auf den Projektseiten
   ------------------------------------------------------------ */
.avedit-panel {
  position: absolute;
  display: flex; align-items: center; gap: 0.3rem;
  padding: 0.3rem;
  background: rgba(20, 21, 22, 0.92);
  border: 1px solid rgba(246, 243, 238, 0.2);
  border-radius: 999px;
  z-index: 40;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}
.avedit-panel button {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.9rem; height: 1.9rem;
  padding: 0 0.55rem;
  background: transparent;
  color: var(--avedit-fg);
  border: none; border-radius: 999px;
  font-family: var(--avedit-mono);
  font-size: 0.68rem;
  cursor: pointer;
  white-space: nowrap;
}
.avedit-panel button:hover { background: rgba(246, 243, 238, 0.12); }
.avedit-panel button.is-danger:hover { background: rgba(217, 112, 91, 0.2); color: #f3b7aa; }

@media (max-width: 860px) {
  .avedit-bar { font-size: 0.72rem; gap: 0.6rem; }
  .avedit-bar__brand span { display: none; }
  .avedit-bar__theme { display: none; }
}

/* Meldung unter dem Passwortfeld, wenn der Server nicht antwortet */
.avedit-gate__fehler { margin: 0; font-size: 0.8rem; color: #e26b5a; }
.avedit-gate__fehler[hidden] { display: none; }
