/* Hearth — Ember Design System stylesheet (Spec: HRT-015 §2–§9).
   One accent, warm canvas, sentences not labels, nothing bounces. */

:root {
  /* Paper (light) */
  --hearth-bg: #FAF6F0;
  --hearth-surface: #FFFFFF;
  --hearth-ink: #2A2420;
  --hearth-ink-soft: #6E645C;
  --hearth-ember: #E8590C;
  --hearth-ember-glow: rgba(232, 89, 12, 0.20);
  --hearth-calm: #3E7C59;
  --hearth-hairline: #EDE5DA;
  --hearth-danger: #B3372F;

  --r-card: 16px;
  --r-chip: 12px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

[data-theme="fireside"] {
  --hearth-bg: #1C1917;
  --hearth-surface: #26221F;
  --hearth-ink: #F2EBE3;
  --hearth-ink-soft: #A89E94;
  --hearth-ember: #FF7A2E;
  --hearth-ember-glow: rgba(255, 122, 46, 0.25);
  --hearth-calm: #6FBF8F;
  --hearth-hairline: #37312C;
  --hearth-danger: #E06C5F;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* Grandparent / accessibility large-type profile (HRT-015 §11): scale the
   reading sizes ~1.35× without breaking layout. */
.large-type .hello { font-size: 34px; line-height: 40px; }
.large-type .card-sentence, .large-type .confirm .sentence { font-size: 26px; line-height: 34px; }
.large-type .timing, .large-type .card-context, .large-type .sheet-row { font-size: 18px; }
.large-type .action-btn, .large-type .edit-save, .large-type .edit-cancel { font-size: 18px; }

/* First-capture onboarding card (brand-new user; not a permanent state) */
.onboard-card {
  border: 1.5px dashed var(--hearth-ember) !important;
  background: transparent !important;
  box-shadow: none !important;
}
/* The hidden attribute must always win over layout display rules below
   (a class like .overlay{display:flex} otherwise overrides [hidden]). */
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--hearth-bg);
  color: var(--hearth-ink);
  font-family: var(--sans);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + var(--s3)) var(--s5) var(--s2);
}
.brandmark { color: var(--hearth-ember); font-size: 20px; }
.avatar-btn {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--hearth-hairline); background: var(--hearth-surface);
  color: var(--hearth-ink); font-size: 18px; cursor: pointer;
}

/* Screens — horizontal snap */
.screens {
  flex: 1; display: flex; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scroll-behavior: smooth;
}
.screens::-webkit-scrollbar { display: none; }
.screen {
  min-width: 100vw; scroll-snap-align: start; height: 100%;
  overflow-y: auto; padding: var(--s4) var(--s5) 260px;
}
.hello {
  font-family: var(--serif); font-size: 28px; line-height: 34px;
  font-weight: 600; margin: var(--s4) 0 var(--s5);
}

/* Cards */
.card-list, .family-list { display: flex; flex-direction: column; gap: var(--s5); }
.card {
  background: var(--hearth-surface); border-radius: var(--r-card);
  padding: 20px; box-shadow: 0 1px 3px rgba(42, 36, 32, 0.07);
  transition: opacity .32s ease, transform .32s ease;
}
[data-theme="fireside"] .card { box-shadow: none; border: 1px solid var(--hearth-hairline); }
.card.exhale { opacity: 0; transform: scaleY(0.96); }
/* Swipe-left-to-complete: card arms with a calm green edge past threshold. */
.card { touch-action: pan-y; position: relative; }
.card.swipe-armed { box-shadow: inset 4px 0 0 var(--hearth-calm); }

/* Inline fact editor (tap a fact → edit; no prompt dialogs) */
.row-editor {
  background: var(--hearth-surface); border: 1px solid var(--hearth-ember);
  border-radius: var(--r-card); padding: 14px; margin: -8px 0 var(--s5);
  display: flex; flex-direction: column; gap: var(--s3); animation: rise .18s ease-out;
}
.edit-input {
  width: 100%; border: 1px solid var(--hearth-hairline); border-radius: var(--r-chip);
  background: var(--hearth-bg); color: var(--hearth-ink);
  font-family: var(--serif); font-size: 17px; padding: 12px var(--s4);
}
.edit-input:focus { outline: 2px solid var(--hearth-ember); }
.edit-check { font-size: 14px; color: var(--hearth-ink-soft); display: flex; align-items: center; gap: 8px; }
.edit-actions { display: flex; justify-content: flex-end; gap: var(--s3); }
.edit-cancel, .edit-save {
  border: 1px solid var(--hearth-hairline); background: transparent; color: var(--hearth-ink);
  font-weight: 600; font-size: 15px; padding: 9px 16px; border-radius: var(--r-chip); cursor: pointer;
}
.edit-save { background: var(--hearth-ember); border-color: var(--hearth-ember); color: #fff; }
.assign-choices { display: flex; flex-wrap: wrap; gap: var(--s2); }
.assign-choice {
  border: 1px solid var(--hearth-hairline); background: transparent; color: var(--hearth-ink);
  font-size: 15px; padding: 9px 14px; border-radius: var(--r-chip); cursor: pointer;
}
.assign-choice.is-current { border-color: var(--hearth-ember); color: var(--hearth-ember); }
.card-context { cursor: pointer; }

.card-context {
  display: flex; align-items: center; gap: var(--s2);
  font-size: 13px; color: var(--hearth-ink-soft); margin-bottom: var(--s2);
  text-transform: none;
}
.face {
  width: 22px; height: 22px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
  color: #fff; background: var(--hearth-ink-soft);
}
.card-sentence {
  font-family: var(--serif); font-size: 20px; line-height: 28px; margin: 0 0 var(--s3);
}
.fact { font-weight: 600; text-decoration: underline dotted 1.5px; text-underline-offset: 3px;
  cursor: pointer; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.timing { font-size: 15px; color: var(--hearth-ink-soft); }
.timing.overdue { color: var(--hearth-ink); font-weight: 600; }
.action-btn {
  border: 1px solid var(--hearth-hairline); background: transparent;
  color: var(--hearth-ink); font-weight: 600; font-size: 15px;
  padding: 8px 14px; border-radius: var(--r-chip); cursor: pointer;
}
.step-hint { font-size: 13px; color: var(--hearth-ink-soft); margin-top: var(--s2); }

.release-line {
  text-align: center; color: var(--hearth-ink-soft); font-style: italic;
  margin-top: var(--s6); font-size: 15px;
}
.release-line .more { display: block; margin-top: var(--s2); color: var(--hearth-ember); cursor: pointer; font-style: normal; }
.empty { text-align: center; color: var(--hearth-ink-soft); font-style: italic; font-family: var(--serif);
  font-size: 20px; margin-top: 25vh; }

/* Week */
.week-list { display: flex; flex-direction: column; gap: var(--s5); }
.week-day-label { font-size: 13px; color: var(--hearth-ink-soft); margin: var(--s3) 0 var(--s2); font-weight: 600; }

/* Family */
.member-row {
  display: flex; align-items: center; gap: var(--s3);
  background: var(--hearth-surface); border-radius: var(--r-card); padding: var(--s4) 20px;
}
.member-row .face { width: 44px; height: 44px; font-size: 17px; }
.member-info { flex: 1; }
.member-name { font-family: var(--serif); font-size: 18px; }
.load-bar { height: 6px; border-radius: 3px; background: var(--hearth-hairline); margin-top: 6px; overflow: hidden; }
.load-fill { height: 100%; background: var(--hearth-ink-soft); }
.load-count { font-size: 13px; color: var(--hearth-ink-soft); }
.text-action {
  margin-top: var(--s5); background: none; border: none; color: var(--hearth-ember);
  font-size: 16px; font-weight: 600; cursor: pointer;
}

/* Dots */
.dots {
  position: fixed; bottom: calc(136px + var(--safe-b)); left: 0; right: 0;
  display: flex; justify-content: center; gap: var(--s5); z-index: 5;
}
.dot { background: none; border: none; color: var(--hearth-ink-soft); font-size: 13px; opacity: .5; cursor: pointer; }
.dot.is-active { color: var(--hearth-ember); opacity: 1; font-weight: 600; }

/* Dock */
.dock {
  position: fixed; bottom: calc(var(--s6) + var(--safe-b)); left: 0; right: 0;
  display: flex; align-items: center; justify-content: center; gap: var(--s6); z-index: 6;
}
/* In Safari browser (non-standalone), the bottom chrome (~50px) sits on top of
   position:fixed elements, making the dock invisible. Shift everything up. */
@media not all and (display-mode: standalone) {
  .dock { bottom: calc(56px + var(--safe-b)); }
  .dots { bottom: calc(160px + var(--safe-b)); }
  .capture-form { bottom: calc(56px + var(--safe-b)); }
  .confirm { bottom: calc(180px + var(--safe-b)); }
  .listening-label { bottom: calc(176px + var(--safe-b)); }
  .screen { padding-bottom: 300px; }
}
.dock-side {
  width: 44px; height: 44px; border: none; background: none;
  color: var(--hearth-ink-soft); font-size: 22px; cursor: pointer; opacity: .8;
}
.orb {
  position: relative; width: 72px; height: 72px; border-radius: 50%;
  border: none; background: none; cursor: pointer; padding: 0;
}
.orb-core {
  position: absolute; inset: 0; border-radius: 50%;
  background: var(--hearth-ember); box-shadow: 0 4px 16px var(--hearth-ember-glow);
}
.orb-glow {
  position: absolute; inset: -6px; border-radius: 50%;
  background: var(--hearth-ember-glow); opacity: 0; transform: scale(1);
}
.orb.listening .orb-glow { animation: breathe 2.4s ease-in-out infinite; opacity: 1; }
.orb.thinking .orb-core { animation: settle .6s ease-out; }
@keyframes breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@keyframes settle { from { transform: scale(1.08); } to { transform: scale(1); } }

/* Listening label */
.listening-label {
  position: fixed; bottom: calc(120px + var(--safe-b)); left: 50%; transform: translateX(-50%);
  background: var(--hearth-surface); color: var(--hearth-ember); font-size: 14px; font-weight: 600;
  padding: 6px 16px; border-radius: 20px; box-shadow: 0 2px 10px rgba(42,36,32,.1);
  z-index: 6; pointer-events: none; animation: rise .2s ease-out;
}

/* Capture form */
.capture-form {
  position: fixed; bottom: calc(var(--s6) + var(--safe-b)); left: var(--s5); right: var(--s5);
  display: flex; gap: var(--s2); z-index: 7;
}
.capture-input {
  flex: 1; border: 1px solid var(--hearth-hairline); border-radius: var(--r-chip);
  background: var(--hearth-surface); color: var(--hearth-ink);
  font-family: var(--serif); font-size: 17px; padding: 14px var(--s4);
}
.capture-input:focus { outline: 2px solid var(--hearth-ember); }
.capture-send {
  border: none; background: var(--hearth-ember); color: #fff; font-weight: 600;
  padding: 0 var(--s4); border-radius: var(--r-chip); cursor: pointer;
}

/* Confirmation card */
.confirm {
  position: fixed; left: var(--s5); right: var(--s5);
  bottom: calc(130px + var(--safe-b)); z-index: 8;
  background: var(--hearth-surface); border-radius: var(--r-card); padding: 20px;
  box-shadow: 0 8px 30px rgba(42, 36, 32, 0.14);
  animation: rise .24s ease-out;
}
[data-theme="fireside"] .confirm { border: 1px solid var(--hearth-hairline); }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.confirm .lead { color: var(--hearth-calm); font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.confirm .sentence { font-family: var(--serif); font-size: 20px; line-height: 28px; }
.confirm .hint { font-size: 13px; color: var(--hearth-ink-soft); margin-top: var(--s3); }
.confirm .undo-btn {
  margin-top: var(--s4); padding: 8px 18px; border: 1px solid var(--hearth-ember);
  border-radius: 999px; background: transparent; color: var(--hearth-ember);
  font-size: 15px; font-weight: 600; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.confirm .undo-btn:active { background: var(--hearth-ember); color: #fff; }
/* Deep-link focus pulse when a notification opens a specific reminder. */
@keyframes focusFlash {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232,89,12,0); }
  30%      { box-shadow: 0 0 0 3px rgba(232,89,12,0.55); }
}
.focus-flash { animation: focusFlash 1.2s ease-in-out 2; border-radius: 16px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .12s !important; transition-duration: .12s !important; }
  .orb.listening .orb-glow { animation: none; opacity: 1; }
}

/* Settings sheet */
.overlay {
  position: fixed; inset: 0; z-index: 20; background: rgba(28, 25, 23, 0.45);
  display: flex; align-items: flex-end; animation: fade .2s ease-out;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  width: 100%; background: var(--hearth-surface); color: var(--hearth-ink);
  border-radius: 24px 24px 0 0; padding: var(--s5) var(--s5) calc(var(--s6) + var(--safe-b));
  animation: rise .24s ease-out;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s4); }
.sheet-head h2 { font-family: var(--serif); font-size: 22px; margin: 0; }
.sheet-close { background: none; border: none; font-size: 20px; color: var(--hearth-ink-soft); cursor: pointer; }
.sheet-row {
  display: block; width: 100%; text-align: left; background: none; border: none;
  border-top: 1px solid var(--hearth-hairline); padding: var(--s4) 0;
  font-size: 17px; color: var(--hearth-ink); cursor: pointer;
}
.sheet-row.danger { color: var(--hearth-danger); }
.sheet-foot { font-size: 13px; color: var(--hearth-ink-soft); margin-top: var(--s4); }
.whisper-note { font-size: 14px; color: var(--hearth-ink-soft); font-style: italic; margin: 0 0 var(--s4); }
#answerArea { display: flex; flex-direction: column; gap: var(--s4); }

/* Import overlay */
.import-textarea {
  width: 100%; border: 1px solid var(--hearth-hairline); border-radius: var(--r-chip);
  background: var(--hearth-surface); color: var(--hearth-ink);
  font-family: var(--sans); font-size: 16px; padding: 14px;
  resize: none; display: block; margin-bottom: var(--s4);
}
.import-textarea:focus { outline: 2px solid var(--hearth-ember); }
.import-tag-label { display: block; font-size: 14px; color: var(--hearth-ink-soft); margin-bottom: var(--s2); }
.import-tag-input {
  width: 100%; border: 1px solid var(--hearth-hairline); border-radius: var(--r-chip);
  background: var(--hearth-surface); color: var(--hearth-ink);
  font-family: var(--sans); font-size: 16px; padding: 12px 14px;
  display: block; margin-bottom: var(--s4);
}
.import-tag-input:focus { outline: 2px solid var(--hearth-ember); }
.import-submit {
  width: 100%; border: none; background: var(--hearth-ember); color: #fff;
  font-size: 17px; font-weight: 600; padding: 16px; border-radius: var(--r-chip);
  cursor: pointer; display: block;
}

/* Assist chip — Maps link on OUTING/APPOINTMENT cards */\n.assist-chip {\n  display: inline-flex; align-items: center; gap: 6px;\n  margin-top: var(--s2); padding: 8px 14px;\n  border: 1.5px solid var(--hearth-ember); border-radius: var(--r-chip);\n  font-size: 14px; font-weight: 600; color: var(--hearth-ember);\n  text-decoration: none; background: none;\n}\n.assist-chip:hover { background: var(--hearth-ember); color: #fff; }\n\n/* Bug report overlay */
.bug-attach-label {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 14px; border: 1.5px dashed var(--hearth-hairline);
  border-radius: var(--r-chip); font-size: 15px;
  color: var(--hearth-ink-soft); cursor: pointer; margin-bottom: var(--s4);
}
.bug-attach-label:hover { border-color: var(--hearth-ember); color: var(--hearth-ink); }
.bug-attach-preview { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s3); }
.bug-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--hearth-hairline); border-radius: 8px;
  padding: 4px 8px 4px 10px; font-size: 13px; color: var(--hearth-ink-soft);
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bug-chip button { border: none; background: none; cursor: pointer; font-size: 14px; line-height: 1; color: var(--hearth-ink-soft); }
.bug-report-list { margin-top: var(--s4); }
.bug-report-item {
  border-top: 1px solid var(--hearth-hairline); padding: var(--s4) 0;
}
.bug-report-meta {
  display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s2);
  flex-wrap: wrap;
}
.bug-report-num { font-weight: 700; font-size: 14px; }
.bug-report-when { font-size: 12px; color: var(--hearth-ink-soft); flex: 1; }
.bug-report-text { font-size: 15px; white-space: pre-wrap; color: var(--hearth-ink); }
.bug-resolve-btn {
  border: 1.5px solid var(--hearth-calm); background: none;
  border-radius: var(--r-chip); padding: 4px 12px;
  font-size: 13px; font-weight: 600; color: var(--hearth-calm); cursor: pointer;
}
.bug-resolve-btn:hover { background: var(--hearth-calm); color: #fff; }
.bug-resolve-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.bug-file-link {
  display: inline-flex; align-items: center; gap: 4px; font-size: 13px;
  color: var(--hearth-ink-soft); text-decoration: none;
  border: 1px solid var(--hearth-hairline); border-radius: 8px;
  padding: 4px 10px; background: var(--hearth-bg);
}
.bug-file-link:hover { color: var(--hearth-ink); }
.bug-thumbs { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s2); }
.bug-thumb {
  width: 60px; height: 60px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--hearth-hairline);
}

