/* baby.stephens.page — "Dawn Nursery" design system
   Warm oat paper, sunrise glow, Fraunces numerals + Hanken Grotesk UI.
   Two themes: light (day) and a dim, low-contrast Night theme for 3am feeds. */

:root {
  /* Day theme */
  --paper: #fbf3e7;
  --paper-2: #fff9f0;
  --card: #fffdf8;
  --ink: #2f2823;
  --ink-soft: #6f6358;
  --ink-faint: #a99c8d;
  --line: #ece0cf;
  --clay: #cd7351;       /* primary accent */
  --clay-deep: #b25a3b;
  --sage: #7f9a76;       /* secondary */
  --gold: #d9a441;
  --rose: #cf7d8e;
  --sky: #6f93ad;
  --plum: #9a7aa0;
  --glow-a: #ffd9a8;
  --glow-b: #ffc7c2;
  --shadow: 24px 24px 60px -28px rgba(90, 60, 40, .35);
  --shadow-sm: 0 4px 18px -8px rgba(90, 60, 40, .28);
  --radius: 26px;
  --radius-sm: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --display: "Fraunces", Georgia, serif;
  --ui: "Hanken Grotesk", system-ui, sans-serif;
}

[data-theme="night"] {
  --paper: #181310;
  --paper-2: #1f1814;
  --card: #241c17;
  --ink: #ecd9c6;
  --ink-soft: #b59c87;
  --ink-faint: #7c6a5a;
  --line: #352a22;
  --clay: #d68a68;
  --clay-deep: #e09e7e;
  --sage: #92ab88;
  --gold: #d9ab5f;
  --rose: #d2909f;
  --sky: #8aa9c0;
  --plum: #b196b6;
  --glow-a: #3a2a1e;
  --glow-b: #36211f;
  --shadow: 24px 24px 60px -30px rgba(0, 0, 0, .6);
  --shadow-sm: 0 4px 18px -10px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--ui);
  color: var(--ink);
  background: var(--paper);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Sunrise glow + paper grain layered behind everything */
body::before {
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(120% 70% at 50% -10%, var(--glow-a) 0%, transparent 55%),
    radial-gradient(90% 50% at 85% 0%, var(--glow-b) 0%, transparent 50%);
  opacity: .85; z-index: -2; pointer-events: none;
  transition: opacity .6s ease;
}
body::after {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
[data-theme="night"] body::after { opacity: .06; }

button { font-family: var(--ui); cursor: pointer; border: none; background: none; color: inherit; }

/* ---- typographic helpers ---- */
.display { font-family: var(--display); font-optical-sizing: auto; font-weight: 500; line-height: 1; }
.eyebrow {
  font-size: .72rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 600;
}

/* ---- app frame ---- */
#app { max-width: 560px; margin: 0 auto; padding: 0 18px calc(120px + var(--safe-b)); }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 4px 14px;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand .mark {
  width: 38px; height: 38px; border-radius: 13px;
  background: linear-gradient(150deg, var(--clay), var(--gold));
  display: grid; place-items: center; box-shadow: var(--shadow-sm);
}
.brand .mark svg { width: 22px; height: 22px; }
.brand h1 { font-family: var(--display); font-weight: 600; font-size: 1.18rem; margin: 0; letter-spacing: -.01em; }
.brand small { display: block; color: var(--ink-faint); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; margin-top: 1px; }

.icon-btn {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  background: var(--card); box-shadow: var(--shadow-sm); color: var(--ink-soft);
  transition: transform .15s ease;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---- cards ---- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  border: 1px solid var(--line);
}
.stack > * + * { margin-top: 16px; }
.reveal { animation: rise .6s cubic-bezier(.2,.8,.2,1) both; }
.reveal:nth-child(2) { animation-delay: .05s; }
.reveal:nth-child(3) { animation-delay: .1s; }
.reveal:nth-child(4) { animation-delay: .15s; }
.reveal:nth-child(5) { animation-delay: .2s; }
.reveal:nth-child(6) { animation-delay: .25s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---- hero: pregnancy countdown ---- */
.hero { text-align: center; position: relative; overflow: hidden; }
.hero .ring-wrap { position: relative; width: 220px; height: 220px; margin: 6px auto 4px; }
.hero svg.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.hero .ring-bg { fill: none; stroke: var(--line); stroke-width: 12; }
.hero .ring-fg { fill: none; stroke: url(#ringgrad); stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(.2,.8,.2,1); }
.hero .ring-label { position: absolute; inset: 0; display: grid; place-content: center; gap: 2px; }
.hero .ring-label .big { font-family: var(--display); font-size: 3.4rem; font-weight: 500; letter-spacing: -.02em; }
.hero .ring-label .sub { color: var(--ink-soft); font-size: .82rem; letter-spacing: .04em; }
.hero .trimester { display: inline-block; margin-top: 4px; padding: 5px 14px; border-radius: 999px; background: color-mix(in srgb, var(--sage) 18%, transparent); color: var(--sage); font-weight: 600; font-size: .8rem; }
.hero h2 { font-family: var(--display); font-weight: 500; font-size: 1.5rem; margin: 14px 0 2px; }
.hero .due { color: var(--ink-soft); font-size: .92rem; }

/* size comparison */
.size-card { display: flex; align-items: center; gap: 18px; }
.size-card .fruit { font-size: 3.1rem; line-height: 1; filter: drop-shadow(0 6px 10px rgba(0,0,0,.12)); }
.size-card .meta { flex: 1; }
.size-card .meta .name { font-family: var(--display); font-size: 1.35rem; font-weight: 500; }
.size-card .meta .dims { color: var(--ink-soft); font-size: .85rem; margin-top: 2px; }
.size-card .meta .blurb { color: var(--ink); font-size: .9rem; margin-top: 9px; line-height: 1.5; }

/* ---- section title ---- */
.sec-head { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 4px 12px; }
.sec-head h3 { font-family: var(--display); font-weight: 500; font-size: 1.2rem; margin: 0; }
.sec-head a, .sec-head button.link { color: var(--clay); font-weight: 600; font-size: .85rem; }

/* ---- quick actions grid ---- */
.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.quick {
  display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
  padding: 16px; border-radius: var(--radius-sm); background: var(--card);
  box-shadow: var(--shadow-sm); border: 1px solid var(--line);
  transition: transform .15s ease;
}
.quick:active { transform: scale(.96); }
.quick .qi { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.quick .qi svg { width: 22px; height: 22px; }
.quick .qt { font-weight: 600; font-size: .98rem; }
.quick .qs { font-size: .76rem; color: var(--ink-faint); }
/* tint variants */
.t-clay .qi { background: color-mix(in srgb, var(--clay) 16%, transparent); color: var(--clay-deep); }
.t-sage .qi { background: color-mix(in srgb, var(--sage) 18%, transparent); color: var(--sage); }
.t-gold .qi { background: color-mix(in srgb, var(--gold) 20%, transparent); color: var(--gold); }
.t-rose .qi { background: color-mix(in srgb, var(--rose) 18%, transparent); color: var(--rose); }
.t-sky  .qi { background: color-mix(in srgb, var(--sky) 18%, transparent); color: var(--sky); }
.t-plum .qi { background: color-mix(in srgb, var(--plum) 18%, transparent); color: var(--plum); }

/* ---- "since" stat row (baby home) ---- */
.glance { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.glance .g {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm); padding: 14px; text-align: center;
}
.glance .g .gl { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-faint); }
.glance .g .gv { font-family: var(--display); font-size: 1.5rem; font-weight: 500; margin-top: 4px; }
.glance .g .gu { font-size: .72rem; color: var(--ink-soft); }

/* ---- timeline ---- */
.timeline { position: relative; }
.tl-day-label { font-family: var(--display); font-size: 1.05rem; color: var(--ink-soft); margin: 22px 4px 10px; }
.tl-item {
  display: flex; gap: 14px; padding: 13px 16px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm); margin-bottom: 10px; align-items: center;
}
.tl-item .ti { width: 38px; height: 38px; border-radius: 11px; flex: none; display: grid; place-items: center; }
.tl-item .ti svg { width: 20px; height: 20px; }
.tl-item .tb { flex: 1; min-width: 0; }
.tl-item .tt { font-weight: 600; font-size: .96rem; }
.tl-item .ts { font-size: .8rem; color: var(--ink-soft); margin-top: 1px; }
.tl-item .tr { text-align: right; flex: none; }
.tl-item .tr .time { font-size: .82rem; color: var(--ink-soft); white-space: nowrap; }
.tl-item .tr .ago { font-size: .68rem; color: var(--ink-faint); }
.tl-item.pending { opacity: .6; }
.tl-item.pending::after { content: "⟳"; color: var(--ink-faint); }

.empty { text-align: center; color: var(--ink-faint); padding: 40px 20px; }
.empty .e-emoji { font-size: 2.4rem; }
.empty p { margin: 10px 0 0; }

/* ---- chips / filters ---- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 4px 10px; margin: 0 -4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  white-space: nowrap; padding: 8px 15px; border-radius: 999px; font-weight: 600; font-size: .84rem;
  background: var(--card); border: 1px solid var(--line); color: var(--ink-soft);
}
.chip.on { background: var(--ink); color: var(--paper-2); border-color: var(--ink); }

/* ---- bottom nav ---- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: center; padding: 10px 14px calc(10px + var(--safe-b));
  pointer-events: none;
}
.nav .bar {
  pointer-events: auto; display: flex; gap: 4px; padding: 7px;
  background: color-mix(in srgb, var(--card) 86%, transparent);
  backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid var(--line); border-radius: 999px;
  box-shadow: var(--shadow); width: 100%; max-width: 420px; justify-content: space-between;
}
.nav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 4px; border-radius: 999px; color: var(--ink-faint); font-size: .66rem; font-weight: 600;
  transition: color .2s, background .2s;
}
.nav button svg { width: 22px; height: 22px; }
.nav button.on { color: var(--clay-deep); background: color-mix(in srgb, var(--clay) 13%, transparent); }

/* ---- FAB ---- */
.fab {
  position: fixed; right: max(18px, calc(50% - 280px + 18px)); bottom: calc(90px + var(--safe-b)); z-index: 31;
  width: 60px; height: 60px; border-radius: 20px;
  background: linear-gradient(150deg, var(--clay), var(--clay-deep));
  color: #fff; display: grid; place-items: center; box-shadow: 0 14px 30px -8px rgba(180,90,59,.6);
  transition: transform .18s cubic-bezier(.2,1.4,.5,1);
}
.fab:active { transform: scale(.9) rotate(90deg); }
.fab svg { width: 28px; height: 28px; }

/* ---- modal / sheet ---- */
.scrim {
  position: fixed; inset: 0; z-index: 50; background: rgba(40,28,20,.45);
  backdrop-filter: blur(3px); display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.scrim.open { opacity: 1; pointer-events: auto; }
.sheet {
  background: var(--paper-2); width: 100%; max-width: 560px;
  border-radius: 30px 30px 0 0; padding: 10px 20px calc(26px + var(--safe-b));
  max-height: 92dvh; overflow-y: auto; transform: translateY(100%);
  transition: transform .3s cubic-bezier(.2,.9,.2,1); border: 1px solid var(--line); border-bottom: none;
}
.scrim.open .sheet { transform: none; }
.sheet .grab { width: 42px; height: 5px; border-radius: 999px; background: var(--line); margin: 6px auto 16px; }
.sheet h3 { font-family: var(--display); font-weight: 500; font-size: 1.45rem; margin: 0 0 4px; }
.sheet .sub { color: var(--ink-soft); font-size: .88rem; margin: 0 0 18px; }

/* ---- forms ---- */
label.fld { display: block; margin-bottom: 14px; }
label.fld .lt { font-size: .78rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; display: block; letter-spacing: .02em; }
input, select, textarea {
  width: 100%; font-family: var(--ui); font-size: 1rem; color: var(--ink);
  background: var(--card); border: 1.5px solid var(--line); border-radius: 14px;
  padding: 13px 14px; outline: none; transition: border-color .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--clay); }
textarea { resize: vertical; min-height: 70px; }

.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button {
  flex: 1; min-width: fit-content; padding: 12px; border-radius: 13px; font-weight: 600;
  background: var(--card); border: 1.5px solid var(--line); color: var(--ink-soft);
}
.seg button.on { background: color-mix(in srgb, var(--clay) 14%, transparent); border-color: var(--clay); color: var(--clay-deep); }

.btn {
  width: 100%; padding: 16px; border-radius: 16px; font-weight: 700; font-size: 1rem;
  background: var(--ink); color: var(--paper-2); transition: transform .15s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(150deg, var(--clay), var(--clay-deep)); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink-soft); border: 1.5px solid var(--line); }
.btn.danger { background: transparent; color: #c0584a; border: 1.5px solid color-mix(in srgb, #c0584a 40%, transparent); }
.btn-row { display: flex; gap: 10px; margin-top: 6px; }
.btn-row .btn { width: auto; flex: 1; }

/* ---- big timer (kick/contraction/feed) ---- */
.timer-face { text-align: center; padding: 18px 0; }
.timer-face .tval { font-family: var(--display); font-size: 4.2rem; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.timer-face .tlab { color: var(--ink-soft); letter-spacing: .04em; }
.pulse { animation: pulse 2.2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }

.big-tap {
  width: 200px; height: 200px; border-radius: 50%; margin: 16px auto; display: grid; place-content: center; gap: 4px;
  background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--clay) 30%, var(--card)), var(--card));
  box-shadow: var(--shadow), inset 0 0 0 2px var(--line); border: none;
  transition: transform .1s;
}
.big-tap:active { transform: scale(.95); }
.big-tap .n { font-family: var(--display); font-size: 3.6rem; font-weight: 500; }
.big-tap .l { color: var(--ink-soft); font-size: .82rem; }

/* ---- chart ---- */
.chart { width: 100%; height: 180px; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--clay); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart .area { fill: url(#chartgrad); opacity: .5; }
.chart .dot { fill: var(--card); stroke: var(--clay); stroke-width: 2.5; }
.chart-legend { display: flex; gap: 14px; justify-content: center; margin-top: 10px; font-size: .8rem; color: var(--ink-soft); }

/* ---- login ---- */
.login-wrap { min-height: 100dvh; display: grid; place-content: center; text-align: center; padding: 24px; gap: 4px; }
.login-wrap .mark-lg { width: 84px; height: 84px; border-radius: 26px; margin: 0 auto 22px;
  background: linear-gradient(150deg, var(--clay), var(--gold)); display: grid; place-items: center; box-shadow: var(--shadow); }
.login-wrap .mark-lg svg { width: 46px; height: 46px; }
.login-wrap h1 { font-family: var(--display); font-weight: 500; font-size: 2.1rem; margin: 0; }
.login-wrap p { color: var(--ink-soft); margin: 6px 0 26px; }
.login-card { width: min(360px, 88vw); margin: 0 auto; }
.login-err { color: #c0584a; font-size: .86rem; min-height: 20px; margin-top: 10px; }

/* ---- toast ---- */
.toast {
  position: fixed; left: 50%; bottom: calc(160px + var(--safe-b)); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--paper-2); padding: 12px 20px; border-radius: 999px; font-weight: 600; font-size: .9rem;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 60; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.muted { color: var(--ink-soft); font-size: .88rem; }
.tiny { font-size: .76rem; color: var(--ink-faint); }
.offline-banner {
  background: color-mix(in srgb, var(--gold) 20%, var(--card)); color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent); border-radius: 14px;
  padding: 10px 14px; font-size: .84rem; font-weight: 600; margin-bottom: 14px; display: none;
}
body.is-offline .offline-banner { display: block; }

.list-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: none; }
