/* ============================================================
   Bloom — Shared Styles
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@500;600;700&family=Gochi+Hand&family=Patrick+Hand&family=Quicksand:wght@400;500;600;700&display=swap');

/* ---- Non-color tokens (shared across themes) ---- */
:root {
  --radius: 18px;
}

/* ---- NIGHT theme: Ember (warm dark) — also the safe default ---- */
:root,
html[data-theme="night"] {
  --fill-surface: #F4EEDF;
  --bg:      #1B1815;
  --cream:   #262019;
  --paper:   #2A231B;
  --ink:     #ECE5D8;
  --ink2:    #A89B86;
  --ink3:    #6E6354;
  --rose:    #93B08F;
  --rose-d:  #A7C2A0;
  --blush:   rgba(147,176,143,.18);
  --blush2:  rgba(147,176,143,.10);
  --sage:    #93B08F;
  --sage-d:  #A7C2A0;
  --mint:    #8FCBB8;
  --butter:  #E3C36B;
  --butter-d:#F0D589;
  --lilac:   #B4A6D6;
  --lilac-d: #C7BCE3;
  --sky:     #8BBFD6;
  --sky-d:   #A6D2E6;
  --peach:   #E0A57E;
  --peach-d: #ECBF9C;
  --line:    #38302A;
  --shadow:  0 10px 36px rgba(0,0,0,.38);
}

/* ---- DAY theme: classic Bloom (original pink / cream) ---- */
html[data-theme="day"] {
  --fill-surface: #FFFCF8;
  --bg:      #ECE4DD;
  --cream:   #FDF5EE;
  --paper:   #FFFCF8;
  --ink:     #6E5763;
  --ink2:    #A38E9B;
  --ink3:    #C9B8C2;
  --rose:    #F2A5C0;
  --rose-d:  #DC7B9D;
  --blush:   #FBDCE7;
  --blush2:  #FDEDF3;
  --sage:    #BCD9B4;
  --sage-d:  #8DBE86;
  --mint:    #CDEDE1;
  --butter:  #FCE39B;
  --butter-d:#EFC34B;
  --lilac:   #DAC8F1;
  --lilac-d: #B89BE6;
  --sky:     #C2E5F2;
  --sky-d:   #8BCAE6;
  --peach:   #FBD3B4;
  --peach-d: #F1A579;
  --line:    #EBD8DF;
  --shadow:  0 8px 32px rgba(120,80,100,.13);
}

/* ---- Suppress transitions on initial load (no-FOUC guard) ---- */
@media (prefers-reduced-motion: no-preference) {
  html:not(.theme-ready) body,
  html:not(.theme-ready) #bloom-nav,
  html:not(.theme-ready) .card,
  html:not(.theme-ready) .bloom-card,
  html:not(.theme-ready) button,
  html:not(.theme-ready) input,
  html:not(.theme-ready) textarea,
  html:not(.theme-ready) a {
    transition: none !important;
  }
}

/* ---- Smooth theme cross-fade (armed only after theme-ready) ---- */
@media (prefers-reduced-motion: no-preference) {
  body,
  #bloom-nav,
  .card,
  .bloom-card,
  button,
  input,
  textarea,
  a {
    transition:
      background-color .35s cubic-bezier(.4,0,.2,1),
      color            .35s cubic-bezier(.4,0,.2,1),
      border-color     .35s cubic-bezier(.4,0,.2,1);
  }
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  font-family: 'Quicksand', sans-serif;
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---- Nav Bar ---- */
#bloom-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--cream);
  border-bottom: 1.5px solid var(--line);
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  height: 56px;
  will-change: transform;
}

#bloom-nav .nav-logo {
  font-family: 'Caveat', cursive;
  font-size: 26px;
  font-weight: 700;
  color: var(--rose-d);
  text-decoration: none;
  flex-shrink: 0;
}

#bloom-nav .nav-links {
  display: flex;
  gap: 4px;
  margin-left: 16px;
  flex: 1;
}

#bloom-nav .nav-link {
  font-family: 'Patrick Hand', cursive;
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
  padding: 5px 13px;
  border: 1.5px solid transparent;
  border-radius: 20px;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}

#bloom-nav .nav-link:hover,
#bloom-nav .nav-link.active {
  background: var(--blush2);
  border-color: var(--rose);
  color: var(--rose-d);
}

#bloom-nav .nav-crisis {
  margin-left: auto;
  font-family: 'Patrick Hand', cursive;
  font-size: 13px;
  color: var(--rose-d);
  background: var(--blush);
  border: 1.5px solid var(--rose);
  border-radius: 16px;
  padding: 4px 12px;
  cursor: pointer;
  transition: background .15s;
  flex-shrink: 0;
}
#bloom-nav .nav-crisis:hover { background: var(--rose); color: #fff; }

#bloom-nav .nav-demo-badge {
  font-family: 'Quicksand', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--peach-d);
  background: var(--paper);
  border: 1.5px solid var(--peach);
  border-radius: 10px;
  padding: 2px 8px;
  flex-shrink: 0;
  display: none;
}
#bloom-nav .nav-demo-badge.visible { display: inline-block; }

/* ---- Disclaimer Banner ---- */
#disclaimer-banner {
  background: var(--blush2);
  border-bottom: 1px solid var(--line);
  text-align: center;
  font-family: 'Quicksand', sans-serif;
  font-size: 12px;
  color: var(--ink2);
  padding: 7px 20px;
  line-height: 1.4;
}
#disclaimer-banner a {
  color: var(--rose-d);
  cursor: pointer;
  text-decoration: underline;
}

/* ---- Crisis Modal ---- */
#crisis-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(110, 70, 90, 0.45);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#crisis-modal.open {
  display: flex;
}

#crisis-modal-box {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(120,80,100,.28);
  max-width: 460px;
  width: 100%;
  padding: 32px 28px 24px;
  position: relative;
  animation: modal-in .22s cubic-bezier(.25,.46,.45,.94);
  will-change: transform, opacity;
}

@keyframes modal-in {
  from { transform: translate3d(0,18px,0); opacity: 0; }
  to   { transform: translate3d(0,0,0);    opacity: 1; }
}

#crisis-modal-box h2 {
  font-family: 'Caveat', cursive;
  font-size: 28px;
  color: var(--rose-d);
  margin-bottom: 8px;
}
#crisis-modal-box .crisis-intro {
  font-family: 'Quicksand', sans-serif;
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 16px;
  line-height: 1.6;
}
#crisis-modal-box ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#crisis-modal-box ul li {
  background: var(--blush2);
  border: 1.5px solid var(--rose);
  border-radius: 12px;
  padding: 10px 14px;
  font-family: 'Patrick Hand', cursive;
  font-size: 15px;
  color: var(--ink);
}
#crisis-modal-close {
  position: absolute;
  top: 14px; right: 14px;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--ink2);
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background .1s;
}
#crisis-modal-close:hover { background: var(--blush); }

/* ---- Footer ---- */
#bloom-footer {
  background: var(--cream);
  border-top: 1.5px solid var(--line);
  text-align: center;
  padding: 16px 20px;
  font-family: 'Quicksand', sans-serif;
  font-size: 12px;
  color: var(--ink2);
  line-height: 1.6;
}
#bloom-footer a {
  color: var(--rose-d);
  cursor: pointer;
  text-decoration: underline;
}

/* ---- Toast ---- */
#bloom-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translate3d(-50%, 0, 0);
  background: var(--ink);
  color: var(--cream);
  font-family: 'Patrick Hand', cursive;
  font-size: 15px;
  padding: 10px 22px;
  border-radius: 20px;
  box-shadow: 0 6px 20px rgba(60,30,50,.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
  z-index: 900;
  will-change: opacity;
}
#bloom-toast.show { opacity: 1; }

/* ---- Card / Tile ---- */
.bloom-card {
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

/* ---- Button primitives ---- */
.btn-primary {
  font-family: 'Patrick Hand', cursive;
  font-size: 15px;
  color: #fff;
  background: var(--rose-d);
  border: none;
  border-radius: 20px;
  padding: 10px 22px;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn-primary:hover { background: var(--rose); }
.btn-primary:active { transform: scale(.97); }

.btn-secondary {
  font-family: 'Patrick Hand', cursive;
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 8px 16px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.btn-secondary:hover { border-color: var(--rose); background: var(--blush2); }

/* ---- Responsive ---- */
@media (max-width: 600px) {
  /* crowded nav → horizontal-scroll strip on phones; keeps every item (incl. theme toggle) reachable, no page-wide x-overflow */
  #bloom-nav { padding: 0 12px; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  #bloom-nav::-webkit-scrollbar { display: none; }
  #bloom-nav .nav-links { gap: 2px; margin-left: 8px; flex: 0 0 auto; }
  #bloom-nav .nav-link { padding: 4px 9px; font-size: 13px; }
}
