/* Snoozeberry design system — "night nursery"
   Tokens first; every color/size below derives from them. */

@font-face {
  font-family: "Baloo 2";
  src: url("/baloo2.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}
@font-face {
  font-family: "Jakarta";
  src: url("/jakarta.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  /* color */
  --bg: #0f1122;
  --surface: #181b31;
  --surface-2: #222647;
  --stroke: rgba(255, 255, 255, 0.08);
  --ink: #edebfb;
  --dim: #9c99be;
  --faint: #6b6890;
  --lavender: #a493ff;
  --lavender-ink: #171233;
  --amber: #f2b36b;
  --sleep: #7b96ff;
  --mint: #6fd9ae;
  --rose: #ff8b93;
  /* shape + rhythm */
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --pad: 16px;
  /* type */
  --font-ui: "Jakarta", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-brand: "Baloo 2", var(--font-ui);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; overscroll-behavior-y: none; }
body.sheet-open { overflow: hidden; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.45;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

/* ---------- top bar ---------- */
#topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px 6px;
}
.brand {
  font-family: var(--font-brand); font-weight: 700;
  color: var(--faint); font-size: 15px; letter-spacing: 0.2px;
}
.chip {
  background: var(--surface); border: 1px solid var(--stroke);
  border-radius: 999px; padding: 6px 14px;
  font-size: 13.5px; font-weight: 700;
}

/* App chrome hidden until sign-in is confirmed */
body:not(.authed) #topbar, body:not(.authed) #tabs { display: none; }
body:not(.authed) { padding-bottom: 24px; }

main { padding: 8px 16px 24px; max-width: 560px; margin: 0 auto; }

h2 {
  font-size: 13px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--dim);
  margin: 26px 4px 10px;
}
h2:first-child { margin-top: 8px; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--r-md);
  padding: var(--pad);
  margin-bottom: 12px;
}
.card .sub { color: var(--dim); font-size: 13.5px; line-height: 1.55; }

/* ---------- sweet spot hero ---------- */
#sweetspot {
  position: relative; text-align: center;
  padding: 24px 16px 20px;
  border-radius: var(--r-lg);
  background:
    radial-gradient(120% 90% at 50% -20%, #232858 0%, var(--surface) 62%);
  overflow: hidden;
}
#sweetspot .stars { position: absolute; inset: 0; pointer-events: none; }
/* starlight: each star sparkles on its own quick cycle */
#sweetspot .stars circle { animation: twinkle 2.2s ease-in-out infinite; }
#sweetspot .stars circle:nth-child(2) { animation-delay: 0.7s; animation-duration: 2.8s; }
#sweetspot .stars circle:nth-child(3) { animation-delay: 1.4s; animation-duration: 1.9s; }
#sweetspot .stars circle:nth-child(4) { animation-delay: 0.3s; animation-duration: 3.1s; }
#sweetspot .stars circle:nth-child(5) { animation-delay: 1.8s; animation-duration: 2.4s; }
@keyframes twinkle {
  0%, 100% { opacity: 0.1; }
  50% { opacity: 1; }
}
#sweetspot .hero-moon {
  position: absolute; left: 6%; top: 12px;
  width: 118px; height: 118px; pointer-events: none;
  filter: drop-shadow(0 0 18px rgba(246, 217, 138, 0.5));
}
.ring-wrap { position: relative; width: 196px; height: 196px; margin: 2px auto 6px; }
.ring-wrap svg {
  position: absolute; inset: 0;
  /* the arc is the room's light source */
  filter: drop-shadow(0 0 10px rgba(164, 147, 255, 0.35));
}
.ring-center {
  position: absolute; inset: 22px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; border-radius: 50%;
}
#sweetspot .kicker {
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--dim);
}
#sweetspot .big {
  font-size: 31px; font-weight: 800; letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums; line-height: 1.1; margin-top: 2px;
}
#sweetspot .big.overdue {
  color: var(--amber); font-size: 24px;
  text-shadow: 0 0 16px rgba(242, 179, 107, 0.5);
}
#sweetspot .big.now {
  color: var(--mint); font-size: 24px;
  text-shadow: 0 0 16px rgba(111, 217, 174, 0.5);
}
#sweetspot .window {
  font-size: 13.5px; color: var(--dim); margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
#sweetspot .basis {
  font-size: 12px; color: var(--faint); margin-top: 10px;
  max-width: 300px; margin-left: auto; margin-right: auto; line-height: 1.5;
}

/* ---------- buttons ---------- */
button {
  font: inherit; border: 0; border-radius: var(--r-md); cursor: pointer;
  color: var(--ink); background: var(--surface-2);
  transition: transform 120ms ease, filter 120ms ease;
}
button:active { transform: scale(0.98); }
:focus-visible { outline: 2px solid var(--lavender); outline-offset: 2px; }

.btn-primary {
  display: block; width: 100%; padding: 17px; font-size: 16.5px; font-weight: 800;
  background: var(--lavender); color: var(--lavender-ink);
  border-radius: var(--r-md); margin-bottom: 12px;
  box-shadow: 0 6px 24px -8px rgba(164, 147, 255, 0.45);
}
.btn-primary.sleeping {
  background: var(--sleep); color: #10142e;
  box-shadow: 0 6px 24px -8px rgba(123, 150, 255, 0.45);
}
.btn-danger { background: rgba(255, 139, 147, 0.12); color: var(--rose); }
.btn-ghost { background: transparent; color: var(--dim); }
.btn-accent {
  background: var(--lavender); color: var(--lavender-ink);
  font-weight: 800; padding: 12px 18px;
}
.btn-primary { display: flex; align-items: center; justify-content: center; gap: 8px; }
.avatar {
  font-family: var(--font-brand); font-weight: 700; font-size: 16px;
  color: var(--dim);
}
.avatar.sel { background: var(--lavender); color: var(--lavender-ink); }
.avatar-photo { object-fit: cover; }
.avatar-photo.sel { box-shadow: 0 0 0 2px var(--lavender); }
.chip { display: flex; align-items: center; gap: 7px; }
.chip-photo {
  width: 20px; height: 20px; border-radius: 50%; object-fit: cover;
  margin-left: -4px;
}

/* ---------- growth spurt card ---------- */
/* The one card that glows mint: growth is the app's "good news" color. */
.spurt-card {
  position: relative;
  border-color: rgba(111, 217, 174, 0.28);
  background:
    radial-gradient(130% 120% at 0% 0%, rgba(111, 217, 174, 0.10) 0%,
                    var(--surface) 58%);
  box-shadow: 0 0 24px -8px rgba(111, 217, 174, 0.35);
}
.spurt-card .spurt-head {
  display: flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 14.5px; color: var(--mint);
  margin-bottom: 6px; padding-right: 28px; letter-spacing: -0.2px;
}
.spurt-card .spurt-head svg { filter: drop-shadow(0 0 6px rgba(111, 217, 174, 0.6)); }
.spurt-card .dismiss {
  position: absolute; top: 8px; right: 8px;
  background: transparent; color: var(--faint);
  font-size: 20px; line-height: 1; padding: 6px 10px;
}
.spurt-card .dismiss:hover { color: var(--dim); }
.spurt-card .basis {
  font-size: 12px; color: var(--faint); margin-top: 10px; line-height: 1.5;
}
.spurt-card .spurt-main { display: flex; align-items: flex-end; gap: 8px; }
.spurt-card .spurt-main .sub { flex: 1; min-width: 0; }
.spurt-art {
  width: 92px; height: 92px; flex: none; margin: -6px -4px -10px 0;
  pointer-events: none;
  filter: drop-shadow(0 0 12px rgba(111, 217, 174, 0.3));
}
.spurt-art .tw path, .spurt-art .tw circle { animation: twinkle 5s ease-in-out infinite; }
.spurt-art .tw :nth-child(2) { animation-delay: 1.4s; }
.spurt-art .tw :nth-child(3) { animation-delay: 2.6s; animation-duration: 6s; }
.spurt-art .tw :nth-child(4) { animation-delay: 0.7s; }
.spurt-art .tw :nth-child(5) { animation-delay: 3.4s; animation-duration: 4.5s; }
/* stage drawings in the what-to-expect accordion */
details.card summary .s-left {
  display: flex; align-items: center; gap: 10px; min-width: 0;
}
.stage-art { flex: none; color: var(--mint); opacity: 0.85; }

/* expandable card */
details.card summary {
  list-style: none; cursor: pointer; font-weight: 700; font-size: 14.5px;
  display: flex; justify-content: space-between; align-items: center;
}
details.card summary::-webkit-details-marker { display: none; }
details.card summary::after {
  content: "+"; color: var(--dim); font-size: 20px; font-weight: 600; line-height: 1;
}
details.card[open] summary::after { content: "–"; }
details.card .body { margin-top: 14px; }

.btn-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.btn-row button {
  padding: 13px 4px 11px; font-size: 12.5px; font-weight: 700; color: var(--dim);
  background: var(--surface); border: 1px solid var(--stroke);
}
.btn-row button svg { display: block; margin: 0 auto 5px; color: var(--ink); }
/* quick-log buttons carry their event color */
#feed-btn svg { color: var(--amber); filter: drop-shadow(0 0 7px rgba(242, 179, 107, 0.35)); }
#diaper-btn svg { color: var(--mint); filter: drop-shadow(0 0 7px rgba(111, 217, 174, 0.35)); }
#pump-btn svg { color: var(--sleep); filter: drop-shadow(0 0 7px rgba(123, 150, 255, 0.35)); }

/* ---------- stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat {
  background: var(--surface); border: 1px solid var(--stroke);
  border-radius: var(--r-md); padding: 13px 8px; text-align: center;
}
.stat .v {
  font-size: 19px; font-weight: 800; letter-spacing: -0.3px;
  font-variant-numeric: tabular-nums;
}
.stat .l {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--faint); margin-top: 3px; line-height: 1.45;
}
.stat .v.ok { color: var(--mint); text-shadow: 0 0 14px rgba(111, 217, 174, 0.4); }
.stat .v.low { color: var(--amber); text-shadow: 0 0 14px rgba(242, 179, 107, 0.4); }

/* ---------- event list ---------- */
.event {
  display: flex; align-items: center; gap: 12px; padding: 11px 2px;
  border-bottom: 1px solid var(--stroke);
}
.event:last-child { border-bottom: 0; }
.event .icon {
  width: 34px; height: 34px; flex: none; display: flex;
  align-items: center; justify-content: center;
  border-radius: var(--r-sm); background: var(--surface-2); color: var(--dim);
}
/* each event type keeps its own hue in every list */
.event .icon.ic-sleep { color: var(--sleep); background: rgba(123, 150, 255, 0.12); }
.event .icon.ic-feed { color: var(--amber); background: rgba(242, 179, 107, 0.12); }
.event .icon.ic-diaper { color: var(--mint); background: rgba(111, 217, 174, 0.12); }
.event .icon.ic-pump { color: var(--sleep); background: rgba(123, 150, 255, 0.10); }
.event .icon.ic-growth { color: var(--mint); background: rgba(111, 217, 174, 0.12); }
.event .icon.ic-medicine { color: var(--rose); background: rgba(255, 139, 147, 0.12); }
.event .icon.ic-note { color: var(--lavender); background: rgba(164, 147, 255, 0.12); }
.event .what { flex: 1; min-width: 0; }
.event .what .t { font-weight: 700; font-size: 14.5px; }
.event .what .d {
  color: var(--dim); font-size: 12.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.event .when {
  color: var(--dim); font-size: 12.5px; text-align: right;
  white-space: nowrap; font-variant-numeric: tabular-nums; line-height: 1.5;
}
.day-head {
  color: var(--dim); font-size: 12px; font-weight: 700;
  letter-spacing: 0.07em; text-transform: uppercase; margin: 18px 4px 6px;
}
/* a row that is itself a card (settings lists): .event's padding would
   otherwise override .card's and pin content to the card edge */
.card.event { padding: 12px 14px; }

/* ---------- bottom nav ---------- */
#tabs {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex;
  background: var(--bg); /* solid fallback: content must never show through */
  border-top: 1px solid var(--stroke);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  #tabs {
    background: rgba(15, 17, 34, 0.86);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
  }
}
#tabs button {
  flex: 1; background: none; color: var(--faint); font-size: 10.5px;
  font-weight: 700; letter-spacing: 0.02em;
  padding: 6px 0 4px; border-radius: var(--r-sm);
}
#tabs button svg { display: block; margin: 0 auto 3px; }
#tabs button.active { color: var(--lavender); }
#tabs button.active svg { filter: drop-shadow(0 0 8px rgba(164, 147, 255, 0.65)); }
#tabs button:active { transform: none; }

/* ---------- sheet (bottom modal) ---------- */
#sheet-backdrop { position: fixed; inset: 0; background: rgba(5, 6, 16, 0.66); z-index: 9; }
#sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--surface); border: 1px solid var(--stroke); border-bottom: 0;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  max-width: 560px; margin: 0 auto; max-height: 85vh; overflow-y: auto;
  animation: sheet-up 200ms ease;
}
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0.4; } }
#sheet h3 { margin: 0 0 16px; font-size: 17px; letter-spacing: -0.2px; }

label.f { display: block; margin-bottom: 13px; font-size: 12.5px; font-weight: 600; color: var(--dim); }
label.f input, label.f select, label.f textarea {
  display: block; width: 100%; margin-top: 6px; padding: 12px;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--stroke); border-radius: var(--r-sm);
  font: inherit; font-size: 16px;
}
label.f input:focus, label.f select:focus {
  outline: none; border-color: var(--lavender);
}

.seg { display: flex; gap: 8px; margin-bottom: 13px; }
.seg button {
  flex: 1; padding: 12px 4px; font-size: 13.5px; font-weight: 700;
  border: 1px solid var(--stroke); color: var(--dim);
}
.seg button.sel {
  background: var(--lavender); color: var(--lavender-ink); border-color: transparent;
}
.sheet-actions { display: flex; gap: 10px; margin-top: 8px; }
.sheet-actions button { flex: 1; padding: 14px; font-size: 15px; font-weight: 800; }
.sheet-actions .save { background: var(--lavender); color: var(--lavender-ink); }

/* ---------- training ---------- */
.method { margin-bottom: 10px; }
.method .name { font-weight: 800; font-size: 15.5px; letter-spacing: -0.2px; }
.method p { color: var(--dim); font-size: 13.5px; line-height: 1.55; margin: 6px 0 12px; }
#check-count {
  font-size: 48px; font-weight: 800; text-align: center; margin: 6px 0 2px;
  font-variant-numeric: tabular-nums; letter-spacing: -1px;
}
.timer-note { text-align: center; color: var(--dim); font-size: 13px; margin-bottom: 14px; }

/* ---------- insights ---------- */
.chart-wrap { overflow-x: auto; }
.legend { color: var(--faint); font-size: 12px; margin: 8px 4px 0; line-height: 1.5; }
svg text { fill: var(--faint); font-size: 10px; font-family: var(--font-ui); }

/* ---------- login ---------- */
.login-hero { text-align: center; padding: 48px 0 8px; }
.login-hero img { width: 148px; height: 148px; }
.login-hero .name {
  font-family: var(--font-brand);
  font-size: 40px; font-weight: 700; letter-spacing: 0.3px;
  margin-top: 12px; color: var(--ink); line-height: 1;
}
.login-hero .tag { color: var(--faint); font-size: 13.5px; margin-top: 6px; }

/* ---------- misc ---------- */
#toast {
  position: fixed; bottom: 92px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--stroke);
  padding: 10px 18px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; z-index: 20;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5); white-space: nowrap;
}
.empty { color: var(--faint); text-align: center; padding: 30px 10px; font-size: 13.5px; }
a { color: var(--lavender); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
