/* ─────────────────────────────────────────────────────────────────────────────
   Baumis – Styles
   ───────────────────────────────────────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --card-bg:       rgba(248, 244, 236, 0.75);
  --card-border:   rgba(185, 172, 220, 0.3);
  --text-quote:    #3a2858;
  --text-author:   #6d5a8a;
  --text-date:     #8a7aaa;
  --accent:        #b5a7d5;
  --divider:       rgba(160, 145, 205, 0.38);
  --shadow:        rgba(90, 72, 130, 0.1);
  --heart:         #a08cc8;
}

/* ── Hintergrund ────────────────────────────────────────────────────────────── */

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Jost', system-ui, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  background: #ede7d4;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Hintergrund-Blob 1: Lila, schwimmt langsam ───────────── */
body::before {
  content: '';
  position: fixed;
  inset: -15%;
  background:
    radial-gradient(ellipse 65% 55% at 22% 28%, #ddd4f2 0%, transparent 65%),
    radial-gradient(ellipse 55% 48% at 78% 72%, #cfc5e8 0%, transparent 60%),
    radial-gradient(ellipse 75% 65% at 55% 5%,  #ede5cc 0%, transparent 55%),
    radial-gradient(ellipse 60% 50% at 15% 85%, #e4ddc8 0%, transparent 60%),
    #ede7d4;
  animation: blob1 22s ease-in-out infinite alternate;
  z-index: 0;
}

/* ── Hintergrund-Blob 2: Beige-Warm, andere Geschwindigkeit ── */
body::after {
  content: '';
  position: fixed;
  inset: -10%;
  background:
    radial-gradient(ellipse 50% 45% at 70% 20%, #e8e0f0 0%, transparent 55%),
    radial-gradient(ellipse 60% 50% at 30% 75%, #d8d0ec 0%, transparent 60%);
  opacity: 0.55;
  animation: blob2 28s ease-in-out infinite alternate;
  z-index: 0;
}

@keyframes blob1 {
  0%   { transform: translate(0%,   0%)   scale(1);    }
  30%  { transform: translate(2%,  -3%)   scale(1.02); }
  60%  { transform: translate(-3%,  2%)   scale(0.98); }
  100% { transform: translate(1%,   3%)   scale(1.01); }
}

@keyframes blob2 {
  0%   { transform: translate(0%,   0%)   rotate(0deg);   }
  40%  { transform: translate(-2%,  2%)   rotate(1.5deg); }
  70%  { transform: translate(3%,  -1%)   rotate(-1deg);  }
  100% { transform: translate(-1%,  3%)   rotate(0.5deg); }
}

/* ── Foto-Hintergrund ───────────────────────────────────────────────────────── */

.bg-photo {
  position: fixed;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 1.2s ease;
  z-index: 1;
}

.bg-photo.loaded {
  opacity: 1;
}

.bg-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.25) 0%,
    rgba(0, 0, 0, 0.45) 50%,
    rgba(0, 0, 0, 0.35) 100%
  );
  opacity: 0;
  transition: opacity 1.2s ease;
  z-index: 2;
}

.bg-overlay.visible {
  opacity: 1;
}

/* Im Foto-Modus: Farben auf hell umschalten */
body.has-photo {
  --card-bg:     rgba(0, 0, 0, 0.35);
  --card-border: rgba(255, 255, 255, 0.18);
  --text-quote:  #ffffff;
  --text-author: rgba(255, 255, 255, 0.75);
  --text-date:   rgba(255, 255, 255, 0.65);
  --divider:     rgba(255, 255, 255, 0.25);
  --shadow:      rgba(0, 0, 0, 0.3);
  --heart:       rgba(255, 255, 255, 0.7);
}

body.has-photo::before,
body.has-photo::after {
  display: none;
}

/* ── App-Layout ─────────────────────────────────────────────────────────────── */

.app {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding:
    max(env(safe-area-inset-top), 2rem)
    max(env(safe-area-inset-right), 1.5rem)
    max(env(safe-area-inset-bottom), 2rem)
    max(env(safe-area-inset-left), 1.5rem);
  gap: 1.5rem;
}

/* ── Datum ──────────────────────────────────────────────────────────────────── */

.date-header {
  text-align: center;
}

.date-text {
  font-family: 'Jost', sans-serif;
  font-weight: 200;
  font-size: clamp(0.75rem, 2.5vw, 0.9rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-date);
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.1s;
}

/* ── Karte ──────────────────────────────────────────────────────────────────── */

.card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--card-bg);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid var(--card-border);
  border-radius: 1.75rem;
  padding: 2.5rem 2.25rem 2rem;
  box-shadow:
    0 8px 32px var(--shadow),
    0 1px 0 var(--card-border) inset;
  opacity: 0;
  animation: fadeUp 0.9s ease forwards 0.3s;
  overflow: hidden;
}

/* Großes dekoratives Anführungszeichen */
.quote-mark {
  position: absolute;
  top: -0.5rem;
  left: 1.25rem;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 7rem;
  line-height: 1;
  color: var(--accent);
  opacity: 0.25;
  pointer-events: none;
  user-select: none;
}

body.has-photo .quote-mark {
  color: rgba(255, 255, 255, 0.3);
}

/* Spruch-Text */
.quote-text {
  font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.25rem, 4.5vw, 1.65rem);
  line-height: 1.7;
  color: var(--text-quote);
  text-align: center;
  position: relative;
  z-index: 1;
  hyphens: auto;
  word-break: break-word;
}

/* Trennlinie */
.divider {
  border: none;
  border-top: 1px solid var(--divider);
  margin: 1.4rem auto;
  width: 3rem;
  opacity: 0;
  animation: fadeIn 0.6s ease forwards 0.9s;
}

/* Autor */
.quote-author {
  display: block;
  font-family: 'Jost', sans-serif;
  font-weight: 300;
  font-size: clamp(0.7rem, 2.2vw, 0.82rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-author);
  text-align: center;
  font-style: normal;
}

/* ── Herz ───────────────────────────────────────────────────────────────────── */

.heart-footer {
  opacity: 0;
  animation: fadeUp 0.7s ease forwards 1.1s;
}

.heart-icon {
  width: 1.2rem;
  height: 1.2rem;
  fill: var(--heart);
  animation: heartbeat 2.8s ease-in-out infinite 1.5s;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  14%       { transform: scale(1.18); }
  28%       { transform: scale(1); }
  42%       { transform: scale(1.1); }
  56%       { transform: scale(1); }
}

/* ── Animationen ────────────────────────────────────────────────────────────── */

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Zoom-Button (Foto auf Breite skalieren) ─────────────────────────────────── */

.zoom-btn {
  position: fixed;
  bottom: max(env(safe-area-inset-bottom), 1.5rem);
  right: 1.25rem;
  z-index: 20;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  padding: 0.45rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.zoom-btn svg {
  width: 100%;
  height: 100%;
}

body.has-photo .zoom-btn {
  opacity: 1;
  pointer-events: auto;
}

/* Fit-Modus: volles Foto sichtbar, Letterbox schwarz */
body.photo-fit .bg-photo {
  background-size: contain !important;
  background-color: #000;
}

body.photo-fit .bg-overlay {
  opacity: 0 !important;
  transition: opacity 0.35s ease !important;
}

/* ── Glocken-Button (Benachrichtigungen aktivieren) ─────────────────────────── */

.notify-btn {
  position: fixed;
  bottom: max(env(safe-area-inset-bottom), 1.5rem);
  left: 1.25rem;
  z-index: 20;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.notify-btn svg { width: 100%; height: 100%; }

body.has-photo .notify-btn { opacity: 1; pointer-events: auto; }

/* ── Peek: Antippen → Foto freilegen ────────────────────────────────────────── */

body.has-photo .card {
  cursor: pointer;
}

.card,
.date-header,
.heart-footer {
  transition: opacity 0.4s ease;
}

.card.peek,
.date-header.peek,
.heart-footer.peek {
  opacity: 0 !important;
  pointer-events: none;
}

.bg-overlay.peek {
  opacity: 0 !important;
  transition: opacity 0.4s ease !important;
}

/* ── Landscape / kleine Geräte ──────────────────────────────────────────────── */

@media (max-height: 600px) and (orientation: landscape) {
  .app { gap: 0.8rem; }
  .card { padding: 1.5rem 1.75rem 1.2rem; }
  .quote-mark { font-size: 5rem; }
  .heart-footer { display: none; }
}

@media (max-width: 360px) {
  .card { padding: 2rem 1.5rem 1.75rem; border-radius: 1.25rem; }
}
