/* ============================================================
   Mommy Tefillos — token system
   Dark-first: the 6am open happens in a dark room.
   No cards, no rounded blobs, no scorekeeping affordances.
   ============================================================ */

:root {
  /* --- ground / ink: warm, never blue-black ------------------ */
  --ground:        #12100E;
  --ground-raised: #1B1815;
  --ink:           #EDE6DA;
  --ink-dim:       #9C9184;
  --ink-faint:     #6B6259;
  --rule:          #2A2521;
  --accent:        #C89A54;
  --accent-dim:    #7A5E33;
  --field:         #1B1815;

  /* --- type -------------------------------------------------- */
  --font-thought: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  --t-thought: 1.75rem;
  --t-thought-lh: 1.5;
  --t-body: 1.0625rem;
  --t-label: 0.75rem;

  /* --- geometry: squared off, generous targets ---------------- */
  --radius: 3px;
  --tap: 60px;
  --measure: 30ch;

  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;

  --fade: 200ms ease;
}

/* Afternoon: same room, warmer light. Only the ground moves. */
:root[data-mode="afternoon"] {
  --ground:        #17130F;
  --ground-raised: #221B15;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --ground:        #F4EEE2;
    --ground-raised: #EDE5D5;
    --ink:           #1A1612;
    --ink-dim:       #5C5348;
    --ink-faint:     #8B8175;
    --rule:          #DDD3C1;
    --accent:        #8A6220;
    --accent-dim:    #B9A583;
    --field:         #FBF7EF;
  }
  :root:not([data-theme="dark"])[data-mode="afternoon"] {
    --ground:        #F6EDDC;
    --ground-raised: #EFE4CE;
  }
}

:root[data-theme="light"] {
  --ground:        #F4EEE2;
  --ground-raised: #EDE5D5;
  --ink:           #1A1612;
  --ink-dim:       #5C5348;
  --ink-faint:     #8B8175;
  --rule:          #DDD3C1;
  --accent:        #8A6220;
  --accent-dim:    #B9A583;
  --field:         #FBF7EF;
}
:root[data-theme="light"][data-mode="afternoon"] {
  --ground:        #F6EDDC;
  --ground-raised: #EFE4CE;
}

/* ============================================================ */

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

html, body {
  margin: 0; padding: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
body {
  min-height: 100svh;
  transition: background-color 600ms ease;
}

button, input, select { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }

.app {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding: max(var(--s5), env(safe-area-inset-top)) var(--s5)
           max(var(--s5), env(safe-area-inset-bottom));
  max-width: 34rem;
  margin: 0 auto;
}

.screen { display: none; flex: 1; flex-direction: column; }
.screen.is-active { display: flex; animation: rise 400ms ease both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .screen.is-active { animation: none; }
  * { transition-duration: 1ms !important; }
}

/* --- shared bits -------------------------------------------- */

.eyebrow {
  font-size: var(--t-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 500;
}

.thought {
  font-family: var(--font-thought);
  font-size: var(--t-thought);
  line-height: var(--t-thought-lh);
  max-width: var(--measure);
  margin: 0;
  text-wrap: pretty;
}
.thought + .thought { margin-top: 1em; }

@media (min-height: 780px) { :root { --t-thought: 1.9375rem; } }
@media (max-height: 620px) { :root { --t-thought: 1.5rem; } }

.source {
  font-size: 0.875rem;
  color: var(--ink-faint);
  margin-top: var(--s5);
  font-style: normal;
}

/* --- the acknowledgment: the only accent in the app ---------- */

.ack {
  min-height: var(--tap);
  width: 100%;
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  color: var(--accent);
  font-size: var(--t-body);
  letter-spacing: 0.02em;
  transition: background-color var(--fade), opacity var(--fade);
}
.ack:active { background: color-mix(in srgb, var(--accent) 12%, transparent); }

.acked {
  min-height: var(--tap);
  display: flex; align-items: center;
  color: var(--ink-faint);
  font-size: var(--t-body);
  animation: soften 400ms ease both;
}
@keyframes soften { from { opacity: 0; } to { opacity: 1; } }

/* --- buttons ------------------------------------------------- */

.btn {
  min-height: var(--tap);
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font-size: var(--t-body);
  transition: background-color var(--fade);
}
.btn:active { background: var(--ground-raised); }
.btn--primary { border-color: var(--accent-dim); color: var(--accent); }
.btn--quiet { border: none; color: var(--ink-dim); min-height: 48px; }

/* --- footer nav: text only, no icons, no badges -------------- */

.footer {
  display: flex;
  gap: var(--s5);
  align-items: center;
  padding-top: var(--s5);
  margin-top: var(--s5);
  border-top: 1px solid var(--rule);
}
.footer button {
  font-size: 0.9375rem;
  color: var(--ink-faint);
  min-height: 48px;
  padding: 0 var(--s1);
}
.footer button[aria-current="true"] { color: var(--ink-dim); }

/* --- settings ------------------------------------------------ */

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  min-height: var(--tap);
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--rule);
}
.row__label { font-size: var(--t-body); }
.row__note {
  font-size: 0.8125rem;
  color: var(--ink-faint);
  margin-top: var(--s1);
  line-height: 1.45;
  max-width: 26ch;
}
.row input[type="time"], .row select, .row input[type="text"] {
  background: var(--field);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--s3) var(--s3);
  min-height: 48px;
  text-align: right;
}
.row input[type="text"] { text-align: left; width: 100%; }

/* switch — squared, not a pill */
.switch {
  position: relative;
  width: 56px; height: 32px;
  flex: 0 0 auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--field);
  transition: background-color var(--fade), border-color var(--fade);
}
.switch::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px;
  background: var(--ink-faint);
  border-radius: 1px;
  transition: transform var(--fade), background-color var(--fade);
}
.switch[aria-checked="true"] { border-color: var(--accent-dim); }
.switch[aria-checked="true"]::after {
  transform: translateX(24px);
  background: var(--accent);
}

.group-title {
  font-size: var(--t-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: var(--s7) 0 var(--s2);
}
.group-title:first-of-type { margin-top: var(--s5); }

/* --- onboarding --------------------------------------------- */

.ob-step {
  display: flex; gap: var(--s4);
  padding: var(--s4) 0;
  align-items: flex-start;
}
.ob-num {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  display: grid; place-items: center;
  font-size: 0.8125rem;
  color: var(--ink-dim);
  margin-top: 2px;
}
.ob-body { font-size: var(--t-body); line-height: 1.5; }
.ob-body .ios-glyph {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 3px 8px;
  margin: 0 2px;
  vertical-align: -3px;
  color: var(--ink);
  white-space: nowrap;
}
.ob-body .ios-glyph svg { display: block; }

.note {
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--ink-dim);
  border-left: 1px solid var(--rule);
  padding-left: var(--s4);
  margin: var(--s5) 0;
}

.stack { display: flex; flex-direction: column; gap: var(--s3); }
.spacer { flex: 1; min-height: var(--s6); }
.hidden { display: none !important; }
