/* =========================================================
   Sopi Maskottchen · Soziale Projekte Steiermark
========================================================== */

.sp-mascot {
  --sp-teal: #78A7A1;
  --sp-teal-dark: #527c77;
  --sp-teal-light: #EAF2F1;
  --sp-navy: #001a33;
  --sp-text: #333333;
  --sp-radius: 20px;
  --sp-size: 88px;
  --sp-dock-size: 54px;
  --sp-ease: cubic-bezier(.2, .8, .2, 1);

  position: fixed;
  top: 52%;
  right: 18px;
  transform: translateY(-50%);
  z-index: 99998;

  display: flex;
  align-items: center;
  gap: 16px;

  font-family: inherit;
  pointer-events: none;
}

/* bis das Script bereit ist, nichts zeigen (kein Aufflackern) */
.sp-mascot:not(.is-ready) {
  visibility: hidden;
}

.sp-mascot *,
.sp-mascot *::before,
.sp-mascot *::after {
  box-sizing: border-box;
}


/* =========================================
   SPRECHBLASE
========================================== */

.sp-mascot__panel {
  position: relative;
  width: min(340px, calc(100vw - 140px));
  margin: 0;
  padding: 22px 24px 24px;

  background: #ffffff;
  border: 1px solid rgba(120, 167, 161, .35);
  border-radius: var(--sp-radius);
  box-shadow:
    0 2px 6px rgba(0, 26, 51, .06),
    0 18px 40px rgba(0, 26, 51, .16);

  text-align: left;
  pointer-events: auto;
  transform-origin: right center;

  transition:
    opacity .35s var(--sp-ease),
    transform .45s var(--sp-ease),
    visibility 0s linear 0s;
}

.sp-mascot__panel::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -9px;
  width: 18px;
  height: 18px;
  background: #ffffff;
  border-top: 1px solid rgba(120, 167, 161, .35);
  border-right: 1px solid rgba(120, 167, 161, .35);
  border-radius: 0 4px 0 0;
  transform: translateY(-50%) rotate(45deg);
}

.sp-mascot:not(.is-open) .sp-mascot__panel {
  opacity: 0;
  visibility: hidden;
  transform: translateX(20px) scale(.94);
  pointer-events: none;
  transition:
    opacity .25s ease,
    transform .25s ease,
    visibility 0s linear .25s;
}


/* =========================================
   INHALT
========================================== */

.sp-mascot__label {
  display: inline-block;
  margin-bottom: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--sp-teal-light);
  color: var(--sp-teal-dark);
  font-size: .75rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.sp-mascot__panel p {
  margin: 0 0 14px;
  color: var(--sp-text);
  font-size: .95rem;
  line-height: 1.6;
}

.sp-mascot__panel .sp-mascot__title {
  margin: 0 36px 8px 0;
  color: var(--sp-navy);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.25;
}

.sp-mascot__panel strong {
  color: var(--sp-navy);
}

.sp-mascot__panel .sp-mascot__note {
  padding: 10px 14px;
  border-left: 3px solid var(--sp-teal);
  border-radius: 0 10px 10px 0;
  background: var(--sp-teal-light);
  color: var(--sp-navy);
  font-style: italic;
}

.sp-mascot__panel > :last-child,
.sp-mascot__text > :last-child {
  margin-bottom: 0;
}

.sp-mascot__text + .sp-mascot__note,
.sp-mascot__text + .sp-mascot__cta {
  margin-top: 14px;
}

.sp-mascot__cta,
.sp-mascot__cta:visited {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--sp-navy);
  color: #ffffff;
  font-size: .92rem;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  transition: background-color .2s ease, gap .2s ease;
}

.sp-mascot__cta svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sp-mascot__cta:hover,
.sp-mascot__cta:focus {
  background: var(--sp-teal-dark);
  color: #ffffff;
  gap: 12px;
  text-decoration: none;
}

.sp-mascot__cta:focus-visible {
  outline: 3px solid var(--sp-teal);
  outline-offset: 3px;
}


/* =========================================
   SCHLIESSEN-BUTTON
========================================== */

.sp-mascot .sp-mascot__close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--sp-teal-light);
  color: var(--sp-navy);
  box-shadow: none;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease, transform .2s ease;
}

.sp-mascot__close svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
}

.sp-mascot .sp-mascot__close:hover {
  background: var(--sp-navy);
  color: #ffffff;
  transform: rotate(90deg);
}

.sp-mascot__close:focus-visible {
  outline: 3px solid var(--sp-teal);
  outline-offset: 2px;
}


/* =========================================
   MASKOTTCHEN-BUTTON
========================================== */

.sp-mascot .sp-mascot__launcher {
  position: relative;
  flex: 0 0 auto;
  width: var(--sp-size);
  height: var(--sp-size);
  min-height: 0;
  margin: 0;
  padding: 0;

  border: 4px solid var(--sp-teal);
  border-radius: 50%;
  background: radial-gradient(circle at 40% 30%, #ffffff 0%, var(--sp-teal-light) 60%, #cfe2df 100%);
  box-shadow:
    0 0 0 3px #ffffff,
    0 10px 26px rgba(0, 26, 51, .25);

  cursor: pointer;
  pointer-events: auto;
  overflow: hidden;

  transition:
    transform .25s var(--sp-ease),
    box-shadow .25s ease;
}

.sp-mascot .sp-mascot__launcher:hover {
  background: radial-gradient(circle at 40% 30%, #ffffff 0%, var(--sp-teal-light) 60%, #cfe2df 100%);
  transform: translateY(-3px) scale(1.05);
  box-shadow:
    0 0 0 3px #ffffff,
    0 14px 32px rgba(0, 26, 51, .3);
}

.sp-mascot__launcher:focus-visible {
  outline: 4px solid rgba(120, 167, 161, .6);
  outline-offset: 4px;
}

.sp-mascot .sp-mascot__avatar {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  object-fit: contain;
  filter: drop-shadow(0 3px 3px rgba(0, 26, 51, .2));
  user-select: none;
  -webkit-user-drag: none;
}

.sp-mascot__badge {
  position: absolute;
  z-index: 1;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: #e8775f;
  transition: transform .25s var(--sp-ease), opacity .25s ease;
}

.sp-mascot.is-open .sp-mascot__badge,
.sp-mascot.is-seen .sp-mascot__badge {
  transform: scale(0);
  opacity: 0;
}


/* =========================================
   ANIMATIONEN
========================================== */

.sp-mascot__avatar {
  transform-origin: center bottom;
  animation: sp-float 3.2s ease-in-out infinite;
}

.sp-mascot.is-open .sp-mascot__avatar {
  animation:
    sp-wave 1.2s ease-in-out 2,
    sp-float 3.2s ease-in-out 2.4s infinite;
}

@keyframes sp-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}

@keyframes sp-wave {
  0%, 100% { transform: rotate(0deg); }
  20%      { transform: rotate(-9deg); }
  40%      { transform: rotate(6deg); }
  60%      { transform: rotate(-6deg); }
  80%      { transform: rotate(3deg); }
}


/* =========================================
   TABLET
========================================== */

@media (max-width: 900px) {
  .sp-mascot {
    right: 12px;
    --sp-size: 78px;
  }

  .sp-mascot__panel {
    width: min(320px, calc(100vw - 120px));
    padding: 20px 20px 22px;
  }
}


/* =========================================
   SMARTPHONE – Blase sitzt über Sopi
========================================== */

@media (max-width: 600px) {
  .sp-mascot {
    top: 62%;
    right: 12px;
    --sp-size: 68px;
  }

  .sp-mascot__panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 14px);
    width: min(360px, calc(100vw - 24px));
    max-height: calc(62vh - 60px);
    overflow-y: auto;
    padding: 18px 18px 20px;
    border-radius: 18px;
    transform-origin: calc(100% - 34px) bottom;
  }

  .sp-mascot__panel::after {
    display: none;
  }

  .sp-mascot:not(.is-open) .sp-mascot__panel {
    transform: translateY(12px) scale(.95);
  }

  .sp-mascot__panel .sp-mascot__title {
    font-size: 1.2rem;
  }

  .sp-mascot__panel p {
    font-size: .92rem;
  }

  .sp-mascot--hide-mobile {
    display: none !important;
  }
}

@media (max-width: 380px) {
  .sp-mascot {
    right: 8px;
    --sp-size: 62px;
  }

  .sp-mascot__panel {
    width: calc(100vw - 16px);
    padding: 16px;
  }
}


/* =========================================
   VERSTECKT UNTER DEM LOGO
   (top/left setzt das Script)
========================================== */

.sp-mascot.is-docked {
  --sp-size: var(--sp-dock-size);
  right: auto;
  transform: none;
}

.sp-mascot.is-docked .sp-mascot__panel {
  position: absolute;
  top: 0;
  right: 100%;
  bottom: auto;
}

.sp-mascot.is-docked .sp-mascot__launcher {
  border-width: 3px;
  box-shadow:
    0 0 0 2px #ffffff,
    0 4px 14px rgba(0, 26, 51, .2);
  transition: transform .25s var(--sp-ease), box-shadow .25s ease;
}

.sp-mascot.is-docked .sp-mascot__launcher:hover {
  transform: scale(1.08);
}

.sp-mascot.is-docked .sp-mascot__avatar {
  animation: none;
}


/* =========================================
   WENIGER BEWEGUNG
========================================== */

@media (prefers-reduced-motion: reduce) {
  .sp-mascot *,
  .sp-mascot .sp-mascot__panel,
  .sp-mascot .sp-mascot__launcher {
    animation: none !important;
    transition: none !important;
  }
}
