/* Penny app styles. Colors come only from tokens.css. */

/* Dynamic Type: on iOS, -apple-system-body follows the user's text size setting. Everything else is in rem. */
html { font: -apple-system-body; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
@supports not (font: -apple-system-body) { html { font-size: 17px; } }
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--surface); color: var(--ink); line-height: 1.4; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
button, a { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; border-radius: 0.5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Screen ── */
main {
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + 1rem) 1.25rem calc(env(safe-area-inset-bottom) + 9rem);
  max-width: 34rem; margin: 0 auto; outline: none;
}
.screen-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin: 0.5rem 0 1.5rem; }
.screen-head h1 { font-size: 1.75rem; font-weight: 650; letter-spacing: -0.01em; margin: 0; }

.greeting { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin: 0.75rem 0 0.25rem; }
.greeting h1 { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.01em; margin: 0; line-height: 1.2; }
.greeting .date { color: var(--ink-soft); margin: 0.35rem 0 0; }
.huddle-toggle { display: flex; justify-content: flex-end; margin: 1rem 0 1.5rem; }

/* ── Overview / Detailed toggle ── */
.toggle { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.toggle button { border: 0; background: transparent; color: var(--ink-soft); min-height: 2.75rem; padding: 0 1rem; border-radius: 999px; font-size: 0.875rem; font-weight: 550; }
.toggle button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ── Cards and sections ── */
.section-label { font-size: 0.75rem; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); margin: 2rem 0 0.6rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 1.25rem; padding: 1.25rem; box-shadow: var(--shadow); }
.empty { text-align: center; padding: 2.5rem 1.5rem; }
.empty .mark { width: 3rem; height: 3rem; margin: 0 auto 1rem; color: var(--accent); }
.empty p { margin: 0; }
.empty .soft { color: var(--ink-soft); margin-top: 0.4rem; font-size: 0.9375rem; }

.list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 1.25rem; overflow: hidden; box-shadow: var(--shadow); }
.list li + li { border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 0.9rem; width: 100%; min-height: 3.5rem; padding: 0.75rem 1.1rem; border: 0; background: transparent; text-align: left; text-decoration: none; }
.row .grow { flex: 1; }
.row .sub { display: block; color: var(--ink-soft); font-size: 0.875rem; }
.row .chev { color: var(--ink-soft); }
.foot { color: var(--ink-soft); font-size: 0.8125rem; text-align: center; margin-top: 2rem; }

/* ── Person dot (always carries an initial) ── */
.dot { display: inline-grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 50%; color: var(--on-person); font-weight: 650; font-size: 1rem; flex: none; border: 0; padding: 0; }
.c-person-mom { background: var(--person-mom); }
.c-person-dad { background: var(--person-dad); }
.c-person-toddler { background: var(--person-toddler); }
.c-person-baby { background: var(--person-baby); }
.c-person-otis { background: var(--person-otis); }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 3.25rem; padding: 0 1.5rem; border-radius: 999px; border: 0; background: var(--accent-ink); color: var(--on-accent); font-weight: 600; text-decoration: none; }
.btn.quiet { background: transparent; color: var(--accent-ink); }
.btn.block { width: 100%; }

/* ── Tab bar ── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  padding: 0.35rem 0.5rem calc(env(safe-area-inset-bottom) + 0.35rem);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; min-height: 3rem; justify-content: flex-end; text-decoration: none; color: var(--ink-soft); font-size: 0.6875rem; font-weight: 550; }
.tabbar svg { width: 1.6rem; height: 1.6rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a[aria-current="page"] { color: var(--ink); }
.tabbar .center .circle { display: grid; place-items: center; width: 3.6rem; height: 3.6rem; margin-top: -1.6rem; border-radius: 50%; background: var(--accent); color: var(--on-person); box-shadow: var(--shadow); border: 3px solid var(--surface); }
.tabbar .center svg { width: 1.7rem; height: 1.7rem; stroke-width: 1.8; }

/* ── Floating + ── */
.fab {
  position: fixed; z-index: 21; right: max(1.25rem, calc((100vw - 34rem) / 2 + 1.25rem));
  bottom: calc(env(safe-area-inset-bottom) + 5.25rem);
  width: 3.5rem; height: 3.5rem; border-radius: 50%; border: 0;
  background: var(--accent); color: var(--on-person); box-shadow: var(--shadow);
  display: grid; place-items: center;
}
.fab svg { width: 1.6rem; height: 1.6rem; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }

/* ── Sheet ── */
.sheet-backdrop { position: fixed; inset: 0; z-index: 30; background: rgb(0 0 0 / 0.25); }
.sheet {
  position: fixed; z-index: 31; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 34rem;
  background: var(--card); border-radius: 1.5rem 1.5rem 0 0; box-shadow: var(--shadow);
  padding: 0.75rem 1.25rem calc(env(safe-area-inset-bottom) + 1.25rem);
  max-height: 85dvh; overflow: auto; animation: sheet-in 260ms ease-out;
}
.sheet .grab { width: 2.5rem; height: 0.3rem; border-radius: 99px; background: var(--line); margin: 0 auto 1rem; }
.sheet h2 { font-size: 1.25rem; font-weight: 650; margin: 0 0 0.75rem; }
.sheet .soft { color: var(--ink-soft); }
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }

/* ── Toast (Undo lives here from slice 1 on) ── */
.toast {
  position: fixed; z-index: 40; left: 1rem; right: 1rem; margin: 0 auto; max-width: 30rem;
  bottom: calc(env(safe-area-inset-bottom) + 5.5rem);
  display: flex; align-items: center; gap: 1rem; padding: 0.4rem 0.5rem 0.4rem 1.1rem; min-height: 3.25rem;
  background: var(--ink); color: var(--surface); border-radius: 1rem; box-shadow: var(--shadow);
  animation: toast-in 200ms ease-out;
}
.toast span { flex: 1; }
.toast button { border: 0; background: transparent; color: var(--surface); font-weight: 650; min-height: 2.75rem; padding: 0 0.9rem; text-decoration: underline; text-underline-offset: 3px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(0.5rem); } to { opacity: 1; transform: none; } }

/* ── Onboarding ── */
.onboard { min-height: calc(100dvh - 4rem); display: flex; flex-direction: column; justify-content: center; gap: 1.25rem; padding-bottom: 2rem; }
.onboard .mark { width: 4.5rem; height: 4.5rem; border-radius: 1.2rem; box-shadow: var(--shadow); }
.onboard h1 { font-size: 2rem; font-weight: 600; letter-spacing: -0.01em; margin: 0; line-height: 1.15; }
.onboard p { margin: 0; color: var(--ink-soft); font-size: 1.0625rem; }
.onboard .actions { display: grid; gap: 0.5rem; margin-top: 1rem; }
.steps-dots { display: flex; gap: 0.4rem; }
.steps-dots i { width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--line); }
.steps-dots i.on { background: var(--accent); }
.coach { display: grid; gap: 0.9rem; counter-reset: s; padding: 0; margin: 0; list-style: none; }
.coach li { display: flex; gap: 0.9rem; align-items: center; color: var(--ink); }
.coach li::before { counter-increment: s; content: counter(s); display: grid; place-items: center; width: 2rem; height: 2rem; flex: none; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); font-weight: 650; font-size: 0.875rem; }
.coach svg { width: 1.2rem; height: 1.2rem; vertical-align: -0.2rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Switches */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.5rem; padding: 0.5rem 1.1rem; }
.switch-row label { flex: 1; }
.switch { appearance: none; -webkit-appearance: none; position: relative; width: 3.2rem; height: 2rem; border-radius: 99px; background: var(--line); margin: 0; flex: none; cursor: pointer; transition: background 160ms; }
.switch::after { content: ""; position: absolute; top: 0.2rem; left: 0.2rem; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--card); box-shadow: var(--shadow); transition: transform 160ms; }
.switch:checked { background: var(--accent-ink); }
.switch:checked::after { transform: translateX(1.2rem); }
.group-label { font-size: 0.8125rem; color: var(--ink-soft); padding: 0.9rem 1.1rem 0.2rem; font-weight: 600; }

/* Signed-out / offline banners */
.banner { background: var(--nudge-bg); color: var(--nudge-ink); border-radius: 1rem; padding: 0.9rem 1.1rem; margin: 0 0 1rem; }

/* Reduce Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Headings get focus for VoiceOver on screen changes; no ring needed for that */
[tabindex="-1"]:focus { outline: none; }
