/* ————— Affirmations — radiant light theme ————— */

:root {
  --ink: #4a3f45;
  --ink-soft: #8a7a82;
  --ink-faint: #b3a3ab;
  --paper: rgba(255, 253, 250, 0.82);
  --paper-solid: #fffdfa;
  --line: rgba(200, 170, 150, 0.28);
  --gold: #f5b942;
  --rose: #f79cae;
  --sky: #9ed0f5;
  --mint: #a8e6c9;
  --lilac: #cdb4f0;
  --peach: #ffc9a3;
  --shadow: 0 18px 50px -18px rgba(180, 120, 90, 0.28);
  --radius: 22px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: "Nunito Sans", -apple-system, sans-serif;
  color: var(--ink);
  min-height: 100vh;
  background: linear-gradient(178deg, #fff9ef 0%, #fdeee6 28%, #f3ecfb 62%, #e8f4fb 100%);
  overflow-x: hidden;
}

/* ————— Parallax sky ————— */

.sky {
  position: fixed;
  inset: -12vh -12vw;
  z-index: -1;
  overflow: hidden;
}

.sky-layer {
  position: absolute;
  inset: 0;
  will-change: transform;
  transition: transform 0.25s ease-out;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.75;
  animation: drift 26s ease-in-out infinite alternate;
}

.orb-sun   { width: 46vmax; height: 46vmax; top: -18vmax; right: -10vmax;
             background: radial-gradient(circle, #ffe9a8 0%, #ffd98f 40%, transparent 70%); }
.orb-rose  { width: 34vmax; height: 34vmax; bottom: -8vmax; left: -12vmax;
             background: radial-gradient(circle, #ffd3dd 0%, transparent 68%); animation-delay: -6s; }
.orb-sky   { width: 30vmax; height: 30vmax; top: 32%; left: -10vmax;
             background: radial-gradient(circle, #cfe8fb 0%, transparent 66%); animation-delay: -12s; }
.orb-mint  { width: 26vmax; height: 26vmax; bottom: 12%; right: -6vmax;
             background: radial-gradient(circle, #d4f5e4 0%, transparent 66%); animation-delay: -3s; }
.orb-lilac { width: 24vmax; height: 24vmax; top: 55%; left: 42%;
             background: radial-gradient(circle, #e6d8fb 0%, transparent 66%); animation-delay: -18s; }
.orb-peach { width: 20vmax; height: 20vmax; top: 8%; left: 22%;
             background: radial-gradient(circle, #ffe0c7 0%, transparent 66%); animation-delay: -9s; }

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(3vmax, -2.5vmax, 0) scale(1.08); }
}

/* floating light motes */
.sky-motes { pointer-events: none; }
.mote {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95), rgba(255, 235, 200, 0));
  animation: float linear infinite;
}
@keyframes float {
  from { transform: translateY(8vh) scale(0.9); opacity: 0; }
  12%  { opacity: 0.9; }
  88%  { opacity: 0.7; }
  to   { transform: translateY(-105vh) scale(1.15); opacity: 0; }
}

/* soft grain so the gradients don't band */
.sky-grain {
  position: absolute; inset: 0;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.035 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

#sparkles {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 50;
}

/* ————— Layout ————— */

main {
  max-width: 640px;
  margin: 0 auto;
  padding: clamp(2rem, 6vh, 4.5rem) 1.25rem 4rem;
}

.hero { text-align: center; margin-bottom: 2.4rem; }

.hero-kicker {
  font-size: 0.85rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.6rem;
}

h1 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 500;
  font-size: clamp(2.6rem, 8vw, 3.8rem);
  letter-spacing: -0.015em;
  background: linear-gradient(96deg, #d98a2b 0%, #e6689a 45%, #8d6fd1 80%, #4d9fd6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 0.7rem;
}

.hero-sub {
  color: var(--ink-soft);
  font-size: 1.02rem;
  line-height: 1.55;
  max-width: 30rem;
  margin: 0 auto 1.4rem;
}

.prompt-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid var(--line);
  background: var(--paper);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  padding: 0.6rem 1.15rem;
  font: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  max-width: 100%;
}
.prompt-pill:hover { transform: translateY(-2px); }
.prompt-spark { color: var(--gold); animation: twinkle 2.4s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: 0.35; transform: scale(0.8) rotate(20deg); } }

/* ————— Cards ————— */

.card {
  background: var(--paper);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.3rem 1.4rem;
  margin-bottom: 1.6rem;
}

.chip-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.9rem; }
.chip-row-small { margin-bottom: 0; }

.chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  padding: 0.42rem 0.9rem;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.18s ease;
}
.chip:hover { color: var(--ink); border-color: var(--gold); }
.chip.is-active {
  background: linear-gradient(120deg, #fff2d4, #ffe3ec);
  border-color: rgba(230, 160, 90, 0.55);
  color: #9a5b23;
  box-shadow: 0 4px 14px -6px rgba(230, 150, 80, 0.5);
}

textarea {
  width: 100%;
  border: none;
  background: transparent;
  resize: vertical;
  font: inherit;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--ink);
  outline: none;
  min-height: 4.5rem;
}
textarea::placeholder { color: var(--ink-faint); }

.composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.6rem;
}

.soft-note { font-size: 0.82rem; color: var(--ink-faint); }

.btn-save {
  border: none;
  border-radius: 999px;
  padding: 0.7rem 1.5rem;
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  background: linear-gradient(120deg, #f7a742, #ef7fa6);
  cursor: pointer;
  box-shadow: 0 10px 24px -8px rgba(240, 130, 120, 0.65);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  white-space: nowrap;
}
.btn-save:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 14px 30px -8px rgba(240, 130, 120, 0.75); }
.btn-save:active { transform: scale(0.97); }

/* ————— Reflect ————— */

.reflect {
  background: linear-gradient(135deg, rgba(255, 246, 224, 0.9), rgba(243, 233, 255, 0.88));
}
.reflect-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.7rem; }
.reflect-label {
  font-size: 0.8rem; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: #b07a2a;
}
.reflect blockquote {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.25rem;
  line-height: 1.5;
  font-weight: 400;
  color: #5a4450;
}
.reflect-meta { margin-top: 0.7rem; font-size: 0.82rem; color: var(--ink-soft); }

.link-btn {
  border: none; background: none;
  font: inherit; font-size: 0.85rem; font-weight: 700;
  color: #b0722a; cursor: pointer;
  text-decoration: underline dotted;
  padding: 0;
}
.link-btn:hover { color: #8a5518; }

/* ————— Stats ————— */

.glowbar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.7rem;
  margin-bottom: 2rem;
}
.glowstat {
  text-align: center;
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 18px;
  padding: 0.8rem 0.4rem;
  box-shadow: var(--shadow);
}
.glowstat strong {
  display: block;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: #c07a2e;
}
.glowstat span { font-size: 0.72rem; color: var(--ink-soft); }

/* ————— Timeline ————— */

.timeline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 1.1rem;
}
.timeline h2 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 500;
  font-size: 1.45rem;
  color: #6b5560;
}

.day-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 1.4rem 0 0.6rem 0.4rem;
}

.entry {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 18px;
  box-shadow: 0 10px 30px -16px rgba(180, 120, 90, 0.25);
  padding: 0.95rem 1.1rem;
  margin-bottom: 0.65rem;
  animation: rise 0.45s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.entry-emoji { font-size: 1.15rem; line-height: 1.5; }
.entry-body { flex: 1; min-width: 0; }
.entry-text { line-height: 1.55; overflow-wrap: break-word; white-space: pre-wrap; }
.entry-meta { margin-top: 0.35rem; font-size: 0.76rem; color: var(--ink-faint); }

.entry.is-done .entry-text { color: var(--ink-soft); }
.entry.is-done .entry-text::after { content: "  ✨ done!"; color: #c48a2f; font-weight: 700; }

.entry-actions { display: flex; gap: 0.3rem; flex-shrink: 0; }
.icon-btn {
  border: none; background: none;
  font-size: 0.95rem;
  cursor: pointer;
  opacity: 0.35;
  transition: opacity 0.15s ease, transform 0.15s ease;
  padding: 0.15rem 0.3rem;
}
.icon-btn:hover { opacity: 1; transform: scale(1.15); }

.empty {
  text-align: center;
  color: var(--ink-faint);
  padding: 2.5rem 1rem;
  line-height: 1.7;
}
.empty p:first-child { font-size: 2rem; margin-bottom: 0.5rem; }

/* ————— Footer / toast ————— */

.foot {
  margin-top: 3.5rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--ink-faint);
  line-height: 2;
}
.foot-heart { margin-top: 0.6rem; letter-spacing: 0.06em; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.6rem;
  transform: translate(-50%, 140%);
  background: #fff;
  color: #8a5a1e;
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 999px;
  padding: 0.65rem 1.4rem;
  box-shadow: 0 14px 40px -10px rgba(160, 100, 60, 0.45);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 60;
  pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); }

@media (max-width: 540px) {
  .glowbar { grid-template-columns: repeat(2, 1fr); }
  .composer-foot { flex-direction: column; align-items: stretch; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .orb, .mote, .prompt-spark { animation: none; }
  .sky-layer { transition: none; }
  html { scroll-behavior: auto; }
}
