/* ============================================================
   newsletter-teaser.css
   Dezenter Slide-in unten rechts zum Abonnieren des Newsletters.

   Wird NUR auf den Seiten geladen, auf denen der Teaser auch
   ausgespielt wird (Entscheidung in includes/newsletter-teaser.php).

   Gestaltung folgt site-optimiert.css (Editorial Warmth):
   Karte auf #fff, Rahmen --pw-rule, Akzent --pw-marigold,
   Schrift Quicksand (Display) + Open Sans (Fließtext).

   Farbwahl mit Blick auf Kontrast: auf der weissen Karte wird
   fuer Text NICHT --pw-marigold (#d98b2b, nur 2.3:1) benutzt,
   sondern --pw-marigold-text (#915b1d, ~5.3:1 = AA).

   Z-Index-Landschaft der Seite (Stand 08/2026):
     nav ............ 100
     Consent-Banner .. 99990   (unten, volle Breite)
     Sticky-CTA ...... 80      (mobil, unten, volle Breite)
     back-to-top ..... 60
   Der Teaser liegt auf 85: ueber dem Sticky-CTA, aber unter dem
   Consent-Banner. Solange der Banner offen ist, zeigt das Skript
   den Teaser ohnehin nicht an.
   ============================================================ */

.pw-nl {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 85;
  width: 380px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border: 1px solid var(--pw-rule, #e5dcc6);
  border-radius: 4px;
  box-shadow: 0 18px 44px rgba(26, 15, 46, 0.16), 0 2px 6px rgba(26, 15, 46, 0.06);
  font-family: 'Open Sans', Arial, sans-serif;
  /* Ausgangszustand: unsichtbar UND aus Tab-Reihenfolge + A11y-Baum
     genommen. visibility:hidden erledigt beides — kein zusaetzliches
     inert noetig, das aeltere Engines nicht kennen. */
  visibility: hidden;
  opacity: 0;
  /* Faehrt von der rechten Kante herein statt nur nach oben zu rutschen —
     laengere Dauer und ein weich auslaufendes Easing, damit es gleitet
     statt zu schnappen. will-change haelt die Karte auf einer eigenen
     Ebene, sonst ruckelt das Gleiten auf langen Seiten. */
  transform: translateX(calc(100% + 32px));
  will-change: transform, opacity;
  transition: opacity 0.5s ease, transform 0.72s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0.72s;
}

/* Zwei Stufen, nicht eine.
   .is-armed macht die Karte nur sichtbar — sie steht dann noch aussen.
   .is-open faehrt sie herein. Firefox rechnet Sichtbarkeit und Transform
   sonst in einem Rutsch aus und ueberspringt die Bewegung ("ploppt auf").
   Das Skript setzt deshalb erst is-armed, erzwingt ein Reflow und haengt
   is-open ein Frame spaeter an. */
.pw-nl.is-armed {
  visibility: visible;
  transition: opacity 0.5s ease, transform 0.72s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s;
}

.pw-nl.is-armed.is-open {
  opacity: 1;
  transform: translateX(0);
}

/* Feiner Akzentstrich als Kopfkante — der einzige Schmuck an der Karte. */
.pw-nl::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px; right: -1px;
  height: 3px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(90deg, var(--pw-marigold, #d98b2b), var(--pw-marigold-soft, #f4c77a));
}

.pw-nl-inner { padding: 26px 28px 22px; }

/* ---- Schliessen ------------------------------------------------------- */
.pw-nl-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--pw-ink-soft, #2c2048);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.pw-nl-close:hover { background: rgba(26, 15, 46, 0.07); color: var(--pw-ink, #1a0f2e); }
.pw-nl-close svg { width: 15px; height: 15px; display: block; }

/* ---- Text ------------------------------------------------------------- */
.pw-nl-eyebrow {
  display: block;
  font-family: var(--pw-display, 'Quicksand', sans-serif);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pw-marigold-text, #915b1d);
  margin: 0 34px 8px 0;
}
.pw-nl-title {
  font-family: var(--pw-display, 'Quicksand', sans-serif);
  font-weight: 700;
  font-size: 20px;
  line-height: 1.25;
  color: var(--pw-ink, #1a0f2e);
  margin: 0 20px 8px 0;
}
.pw-nl-text {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--pw-ink-soft, #2c2048);
  margin: 0 0 16px;
}

/* ---- Formular --------------------------------------------------------- */
.pw-nl-field { margin: 0 0 12px; }
.pw-nl-label {
  display: block;
  font-family: var(--pw-display, 'Quicksand', sans-serif);
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  color: var(--pw-ink, #1a0f2e);
  margin: 0 0 6px;
}
.pw-nl-input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--pw-rule, #e5dcc6);
  border-radius: 3px;
  background: #fff;
  color: var(--pw-ink, #1a0f2e);
  font-family: 'Open Sans', Arial, sans-serif;
  font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.pw-nl-input::placeholder { color: #6e6884; }   /* 5.3:1 auf Weiss = AA; mobil ist der Platzhalter das einzige sichtbare Label */
.pw-nl-input:focus {
  outline: none;
  border-color: var(--pw-marigold, #d98b2b);
  box-shadow: 0 0 0 3px rgba(217, 139, 43, 0.18);
}
.pw-nl-input.is-error { border-color: #b5341a; background: #fff8f7; }

/* Absende-Knopf.
   ACHTUNG (bekannter Dauerbrenner im Projekt): abgerundete Knoepfe brauchen
   grosszuegiges Innenabstand LINKS/RECHTS, sonst klebt die Schrift an der
   Rundung. Hier bewusst 30px horizontal — nicht kleiner setzen. */
.pw-nl-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 30px;
  border: 2px solid var(--pw-ink, #1a0f2e);
  border-radius: 3px;
  background: var(--pw-ink, #1a0f2e);
  color: #fff;
  font-family: var(--pw-display, 'Quicksand', sans-serif);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
}
.pw-nl-submit:hover { transform: translate(-1px, -1px); }
.pw-nl-submit svg { width: 17px; height: 17px; flex-shrink: 0; }
.pw-nl-submit[disabled] { opacity: 0.6; cursor: default; transform: none; }

.pw-nl-msg {
  display: block;
  font-size: 12.5px;
  line-height: 1.5;
  color: #b5341a;
  margin: 8px 0 0;
}
.pw-nl-msg:empty { display: none; }

.pw-nl-note {
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--pw-ink-soft, #2c2048);
  margin: 12px 0 0;
}
.pw-nl-note a { color: var(--pw-marigold-text, #915b1d); text-decoration: underline; }

/* ---- Erfolgs-Ansicht (loest das Formular ab) --------------------------- */
.pw-nl-done { display: none; text-align: center; padding: 6px 0 2px; }
.pw-nl.is-done .pw-nl-form,
.pw-nl.is-done .pw-nl-eyebrow,
.pw-nl.is-done .pw-nl-title,
.pw-nl.is-done .pw-nl-text { display: none; }
.pw-nl.is-done .pw-nl-done { display: block; }
.pw-nl-done-ico {
  width: 46px; height: 46px;
  margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(217, 139, 43, 0.14);
  color: var(--pw-marigold-text, #915b1d);
}
.pw-nl-done-ico svg { width: 22px; height: 22px; }
.pw-nl-done h3 {
  font-family: var(--pw-display, 'Quicksand', sans-serif);
  font-weight: 700; font-size: 18px;
  color: var(--pw-ink, #1a0f2e);
  margin: 0 0 8px;
}
.pw-nl-done p {
  font-size: 13.5px; line-height: 1.6;
  color: var(--pw-ink-soft, #2c2048);
  margin: 0;
}

/* ---- Fokus sichtbar ---------------------------------------------------- */
.pw-nl a:focus-visible,
.pw-nl button:focus-visible,
.pw-nl input:focus-visible {
  outline: 2px solid var(--pw-marigold-text, #915b1d);
  outline-offset: 2px;
}

/* Nur fuer Screenreader (Statusmeldungen). */
.pw-nl-sr {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ============================================================
   back-to-top aus dem Weg raeumen.
   Der Pfeil sitzt auf right:24px/bottom:24px — also genau unter
   der Karte. Solange der Teaser offen ist, wird er um die
   Kartenhoehe (per JS in --pw-nl-h gesetzt) nach oben geschoben. */
body.pw-nl-open .back-to-top,
body.pw-nl-open.opt .back-to-top {
  bottom: calc(var(--pw-nl-h, 320px) + 40px);
}

/* ============================================================
   MOBIL — bewusst zurueckhaltender:
   volle Breite minus Rand, unten angedockt, und ueber dem
   mobilen Sticky-CTA (der auf Marketingseiten unten klebt). */
@media (max-width: 760px) {
  .pw-nl {
    right: 12px;
    left: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    width: auto;
    max-width: none;
    /* Volle Breite: seitlich hereinfahren wirkt hier falsch, also von unten. */
    transform: translateY(calc(100% + 24px));
  }
  .pw-nl.is-armed.is-open { transform: translateY(0); }
  /* Mobil bewusst kompakter: die Karte soll einen Bissen vom Schirm nehmen,
     nicht die halbe Seite. Gespart wird an Weissraum und am Kleingedruckten —
     nicht an der Aussage und nicht an den Pflichtangaben. */
  .pw-nl-inner { padding: 20px 18px 16px; }
  .pw-nl-eyebrow { font-size: 10.5px; margin-bottom: 6px; }
  .pw-nl-title { font-size: 17px; margin-bottom: 6px; }
  .pw-nl-text { font-size: 12.5px; line-height: 1.5; margin-bottom: 12px; }
  .pw-nl-field { margin-bottom: 10px; }

  /* Beschriftung nur noch fuer Screenreader — der Platzhalter traegt
     optisch dieselbe Information, die Verknuepfung ueber for/id bleibt. */
  .pw-nl-label {
    position: absolute; width: 1px; height: 1px;
    margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
  .pw-nl-note { font-size: 11px; line-height: 1.5; margin-top: 10px; }
  .pw-nl-note-lang { display: none; }
  .pw-nl-done h3 { font-size: 17px; }
  .pw-nl-done p { font-size: 12.5px; }

  /* Sticky-CTA (74px hoch) nicht verdecken — gleiche :has()-Technik
     wie in site-optimiert.css fuer den back-to-top-Pfeil. */
  body.opt:has(.pw-sticky-cta) .pw-nl {
    bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  }
  body.pw-nl-open .back-to-top,
  body.pw-nl-open.opt .back-to-top { display: none; }
}

/* Auf Papier hat eine schwebende Karte nichts verloren. */
@media print {
  .pw-nl { display: none !important; }
}

/* ============================================================
   Bewegung reduzieren: kein Hereingleiten, kein Verschieben —
   nur ein weiches Ein-/Ausblenden. */
@media (prefers-reduced-motion: reduce) {
  .pw-nl {
    transform: none;
    transition: opacity 0.2s linear, visibility 0s linear 0.2s;
  }
  .pw-nl.is-armed {
    transform: none;
    transition: opacity 0.2s linear, visibility 0s;
  }
  .pw-nl.is-armed.is-open {
    transform: none;
  }
  .pw-nl-submit:hover { transform: none; }
}

/* ============================================================
   "Nicht mehr anzeigen" — bewusst klein und unter dem Knopf.
   Es ist ein Nebenweg, kein Angebot, das mit dem Abonnieren
   konkurriert. Trotzdem echte 18px Klickflaeche fuer den Finger. */
.pw-nl-opt {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  cursor: pointer;
}

.pw-nl-opt input {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin: 1px 0 0;
  accent-color: var(--pw-marigold, #d98b2b);
  cursor: pointer;
}

.pw-nl-opt span {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--pw-ink-soft, #6e6e7e);
}

.pw-nl-opt-hint { display: block; opacity: 0.85; }

@media (max-width: 760px) {
  .pw-nl-opt { margin-top: 10px; }
  .pw-nl-opt span { font-size: 11px; }
}
