/* love — daily devotion. Elegant, warm, quiet. */

:root {
  --ink-dark: #fdf7f4;
  --ink-light: #4a2c2a;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html, body {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  background: #14090c;
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  touch-action: none;          /* the whole page is a playground */
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.28) 100%);
  transition: opacity 1s ease;
}

body.theme-light #vignette {
  background: radial-gradient(ellipse at center, transparent 60%, rgba(120,60,60,0.14) 100%);
}

/* ---------- scrim: a quiet stage for the text ----------
   Bottom gradient so words never fight the artwork behind them. */
#scrim {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 54vh;
  height: 54dvh;
  pointer-events: none;
  z-index: 4;
  background: linear-gradient(to top,
    rgba(12,5,8,0.85) 0%,
    rgba(12,5,8,0.55) 42%,
    rgba(12,5,8,0.18) 68%,
    transparent 100%);
  transition: background 1s ease;
}

body.theme-light #scrim {
  background: linear-gradient(to top,
    rgba(253,244,240,0.94) 0%,
    rgba(253,244,240,0.62) 42%,
    rgba(253,244,240,0.20) 68%,
    transparent 100%);
}

/* ---------- brand ---------- */
#brand {
  position: fixed;
  top: max(20px, env(safe-area-inset-top));
  left: 24px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  pointer-events: none;
  user-select: none;
  z-index: 5;
}

.brand-heart { color: #e0576b; font-size: 20px; animation: brand-beat 2.4s ease-in-out infinite; }
.brand-word {
  font-size: 22px;
  letter-spacing: 6px;
  font-style: italic;
  color: var(--ink-dark);
  opacity: 0.9;
}
body.theme-light .brand-word { color: var(--ink-light); }

@keyframes brand-beat {
  0%, 100% { transform: scale(1); }
  12% { transform: scale(1.25); }
  24% { transform: scale(1); }
}

/* ---------- overlay text ---------- */
#overlay {
  position: fixed;
  left: 24px;
  right: 24px;
  bottom: max(92px, env(safe-area-inset-bottom));
  text-align: center;
  pointer-events: none;
  user-select: none;
  z-index: 5;
  text-shadow: 0 1px 14px rgba(0,0,0,0.45), 0 0 2px rgba(0,0,0,0.4);
}
body.theme-light #overlay { text-shadow: 0 1px 12px rgba(255,255,255,0.7), 0 0 2px rgba(255,255,255,0.6); }

#date-line {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--ink-dark);
  opacity: 0.65;
  margin-bottom: 10px;
}
body.theme-light #date-line { color: var(--ink-light); }

#anim-title {
  font-size: clamp(28px, 5.4vw, 52px);
  font-weight: 400;
  font-style: italic;
  color: var(--ink-dark);
  letter-spacing: 1px;
  line-height: 1.1;
  margin-bottom: 2px;
}
body.theme-light #anim-title { color: var(--ink-light); }

#anim-tagline {
  margin-top: 8px;
  font-size: clamp(14px, 2.4vw, 18px);
  font-style: italic;
  color: var(--ink-dark);
  opacity: 0.75;
}
body.theme-light #anim-tagline { color: var(--ink-light); }

#day-counter {
  margin-top: 14px;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--ink-dark);
  opacity: 0.5;
}
body.theme-light #day-counter { color: var(--ink-light); }

#day-counter .dot { margin: 0 6px; }

/* ---------- daily love note + weather ---------- */
#daily-block { margin-top: 16px; }

#love-note {
  font-size: clamp(15px, 2.6vw, 19px);
  font-style: italic;
  line-height: 1.5;
  color: #f0b48a;
  max-width: 560px;
  margin: 0 auto;
  opacity: 0.95;
}
body.theme-light #love-note { color: #b0603c; }

#weather-line {
  margin-top: 8px;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--ink-dark);
  opacity: 0.6;
}
body.theme-light #weather-line { color: var(--ink-light); }

#weather-line .w-heart { color: #e0576b; opacity: 1; letter-spacing: 2.5px; }

/* ---------- controls ---------- */
#controls {
  position: fixed;
  bottom: max(22px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  align-items: center;
  z-index: 6;
}

#controls button, #btn-mute {
  font-family: var(--sans);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.22);
  color: var(--ink-dark);
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.25s ease, transform 0.15s ease, opacity 0.25s ease;
}
body.theme-light #controls button,
body.theme-light #btn-mute {
  background: rgba(255,255,255,0.45);
  border-color: rgba(74,44,42,0.25);
  color: var(--ink-light);
}

#controls button:hover, #btn-mute:hover { transform: translateY(-1px); }
#controls button:active, #btn-mute:active { transform: translateY(0); }

#btn-prev, #btn-next {
  width: 40px; height: 40px;
  font-size: 16px;
  line-height: 1;
}
#btn-today {
  height: 40px;
  padding: 0 20px;
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
}
#btn-today.is-today { opacity: 0.45; pointer-events: none; }

#btn-mute {
  position: fixed;
  top: max(20px, env(safe-area-inset-top));
  right: 24px;
  width: 40px; height: 40px;
  font-size: 14px;
  z-index: 6;
}

#hint {
  position: fixed;
  bottom: max(66px, env(safe-area-inset-bottom));
  left: 0; right: 0;
  text-align: center;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--ink-dark);
  opacity: 0;
  pointer-events: none;
  z-index: 5;
  animation: hintIn 1s ease 1.2s forwards, hintOut 1.5s ease 7s forwards;
}
body.theme-light #hint { color: var(--ink-light); }
@keyframes hintIn { to { opacity: 0.55; } }
@keyframes hintOut { to { opacity: 0; } }

/* ---------- transitions ---------- */
.fade-swap { animation: fadeSwap 0.9s ease; }
@keyframes fadeSwap {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
  #overlay { bottom: max(108px, env(safe-area-inset-bottom)); left: 16px; right: 16px; }
  #anim-title { font-size: clamp(26px, 9vw, 40px); }
  #anim-tagline { font-size: 14px; }
  #brand { left: 18px; }
  #btn-mute { right: 18px; }
  #btn-prev, #btn-next { width: 48px; height: 48px; }   /* thumb-friendly */
  #btn-today { height: 48px; }
  #btn-mute { width: 48px; height: 48px; }
  #hint { bottom: max(78px, env(safe-area-inset-bottom)); }
}

/* short landscape screens (phones turned sideways) */
@media (max-height: 520px) {
  #scrim {
    height: 100vh;
    height: 100dvh;
    opacity: 0.75;
  }
  #overlay { bottom: auto; top: 50%; transform: translateY(-50%); }
  #anim-title { font-size: clamp(22px, 5vh, 32px); }
  #anim-tagline { display: none; }
  #day-counter { margin-top: 6px; }
  #date-line { margin-bottom: 4px; }
  #brand { top: 12px; }
  #btn-mute { top: 12px; }
  #controls { bottom: 12px; }
  #hint { display: none; }
}

/* coarse pointers: bigger targets everywhere */
@media (hover: none) and (pointer: coarse) {
  #btn-prev, #btn-next, #btn-mute { width: 48px; height: 48px; }
  #btn-today { height: 48px; padding: 0 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .brand-heart { animation: none; }
  .fade-swap { animation: none; }
}
