/* Hopewick 2.0 Stage 3 screens. Uses tokens from assets/hopewick-tokens.css
   and components from assets/hopewick-ui.css. Mobile first. */
.hw3-view { padding: var(--space-4) var(--space-4) var(--space-12); }
.hw3-inner { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--space-4); }
.hw3-hero h1:focus { outline: none; }
.hw3-hero h1:focus-visible, .hw3-h1:focus-visible, .hw3-h2:focus-visible { outline: 3px solid var(--focus-color); outline-offset: 3px; border-radius: var(--radius-xs); }
.hw3-card { display: flex; flex-direction: column; gap: var(--space-3); }
.hw3-card > p, .hw3-card .hw-field > p { margin: 0; }
.hw3-h1 { font-family: var(--font-display); font-size: var(--text-xl); margin: 0; }
.hw3-h2 { font-family: var(--font-display); font-size: var(--text-lg); margin: 0; line-height: var(--leading-tight); }
.hw3-h3 { font-weight: var(--weight-semibold); margin: 0; }
.hw3-note { margin: 0; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--surface-2); color: var(--text); font-size: var(--text-sm); }
.hw3-note--warn { background: var(--accent-warm-soft); }
.hw3-error { color: var(--danger); font-size: var(--text-sm); margin: 0; min-height: 0; }
.hw3-error:empty { display: none; }
.hw3-link { background: none; border: 0; padding: var(--space-1) 0; color: var(--accent-strong, var(--accent)); text-decoration: underline; font: inherit; cursor: pointer; min-height: 24px; }
.hw3-link:focus-visible { outline: 3px solid var(--focus-color); outline-offset: 2px; }
.hw3-back { align-self: flex-start; }
.hw3-crisis-line { font-size: var(--text-sm); color: var(--muted); margin: var(--space-2) 0 0; }
.hw3-crisis-line a { color: var(--text); font-weight: var(--weight-semibold); }
.hw3-inline { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.hw3-inline .hw-input { flex: 1 1 180px; }
.hw3-row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; }
.hw3-fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.hw3-fieldset legend { padding: 0; margin-bottom: var(--space-2); }
.hw3-out { font-weight: var(--weight-semibold); min-width: 5.5em; }
.hw3-range { display: flex; align-items: center; gap: var(--space-2); }
.hw3-range input, .hw3-inline input[type="range"] { flex: 1; accent-color: var(--accent); min-height: var(--tap); }
.hw3-badge { display: inline-block; font-size: var(--text-xs); font-weight: var(--weight-semibold); padding: 2px 8px; border-radius: var(--radius-pill); background: var(--accent-gold-soft); color: var(--text); border: 1px solid var(--accent-gold); }
.hw3-tag { font-size: var(--text-xs); padding: 2px 8px; border-radius: var(--radius-pill); background: var(--surface-2); border: 1px solid var(--border); }
.hw3-ico { display: inline-flex; }
.hw-card .hw-progress__bar, .hw-progress .hw-progress__bar { display: block; height: 100%; background: var(--accent); border-radius: inherit; }

/* Mood picker */
.hw3-moods { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-2); }
.hw3-mood { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 72px; padding: var(--space-2) 2px; border-radius: var(--radius-md); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.hw3-mood:hover { border-color: var(--accent); }
.hw3-mood:focus-visible { outline: 3px solid var(--focus-color); outline-offset: 2px; }
.hw3-mood[aria-checked="true"] { background: var(--accent-soft); border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.hw3-mood__face { font-size: 1.6rem; line-height: 1; }
.hw3-mood__label { font-size: var(--text-xs); font-weight: var(--weight-semibold); text-align: center; }
.hw3-support { border-left: 4px solid var(--danger); background: var(--danger-soft); padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); }
.hw3-support p { margin: 0 0 var(--space-1); }
.hw3-support a:not(.hw-btn) { color: var(--text); font-weight: var(--weight-bold); }
.hw3-support a.hw-btn { font-weight: var(--weight-bold); }
.hw3-switch { display: flex; flex-direction: column; gap: var(--space-1); }
.hw3-switch .hw-hint { margin: 0; }

/* Trends */
.hw3-seg .hw-chip { min-width: 72px; justify-content: center; }
.hw3-summary { margin: 0; }
.hw3-chart { width: 100%; height: auto; max-height: 220px; }
.hw3-chart__grid { stroke: var(--border); stroke-width: 1; }
.hw3-chart__ylab, .hw3-chart__xlab { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.hw3-chart__line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.hw3-chart__dot { fill: var(--accent); stroke: var(--surface); stroke-width: 1.5; }
.hw3-chart__dot--legacy { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.hw3-details summary { cursor: pointer; font-weight: var(--weight-semibold); min-height: var(--tap); display: flex; align-items: center; }
.hw3-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.hw3-table th, .hw3-table td { text-align: left; padding: var(--space-2); border-bottom: 1px solid var(--border); vertical-align: top; }
.hw3-table thead th { color: var(--muted); font-weight: var(--weight-semibold); }

/* Lists */
.hw3-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.hw3-list__item { display: flex; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.hw3-list__item:first-child { border-top: 0; }
.hw3-list__item p { margin: 0; }
.hw3-list__title { font-weight: var(--weight-semibold); }
.hw3-list__actions { display: flex; gap: var(--space-2); align-items: flex-start; flex-wrap: wrap; }

/* Coping */
.hw3-tools { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: var(--space-3); }
.hw3-tool { display: flex; flex-direction: column; gap: var(--space-2); }
.hw3-tool__head { display: flex; gap: var(--space-3); align-items: center; }
.hw3-tool__head p { margin: 2px 0 0; }
.hw3-tool__title { font-size: var(--text-md); margin: 0; }
.hw3-tool__short { margin: 0; }
.hw3-step-text { font-size: var(--text-md); line-height: var(--leading); margin: 0; }
.hw3-player__nav { justify-content: space-between; }
.hw3-breath { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); padding: var(--space-4) 0; }
.hw3-breath__circle { width: 168px; height: 168px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 40% 35%, var(--brand-river-soft, var(--accent-soft)), var(--accent-soft)); border: 3px solid var(--accent); transform: scale(.7); transition: transform var(--hw3-dur, 4s) linear; }
.hw3-breath__circle[data-phase="in"] { transform: scale(1); }
.hw3-breath__circle[data-phase="out"] { transform: scale(.7); }
.hw3-breath__circle[data-phase="hold"] { transition: none; }
.hw3-breath__count { font-size: var(--text-2xl); font-weight: var(--weight-bold); color: var(--text); }
.hw3-breath__label { font-size: var(--text-lg); font-weight: var(--weight-semibold); margin: 0; text-align: center; }
.hw3-breath--text .hw3-breath__circle { transform: none !important; transition: none; width: auto; height: auto; min-width: 96px; min-height: 64px; border-radius: var(--radius-md); background: var(--surface-2); }
.hw3-timer { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.hw3-timer__out { font-variant-numeric: tabular-nums; font-size: var(--text-lg); font-weight: var(--weight-semibold); min-width: 3.5em; }
@media (prefers-reduced-motion: reduce) {
  .hw3-breath__circle { transition: none; transform: none !important; }
}

/* Goals */
.hw3-goals { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.hw3-goal { display: flex; flex-direction: column; gap: var(--space-2); }
.hw3-goal__title { margin: 0; font-size: var(--text-md); }
.hw3-goal p { margin: 0; }
.hw3-dash-goals { border-top: 1px solid var(--border); padding-top: var(--space-3); margin-top: var(--space-2); display: flex; flex-direction: column; gap: var(--space-2); }

/* Next step */
.hw3-step-now { font-size: var(--text-lg); font-weight: var(--weight-semibold); margin: 0; }
.hw3-stepform { display: flex; flex-direction: column; gap: var(--space-2); }
.hw3-suggest { margin-top: var(--space-3); padding: var(--space-3); border-radius: var(--radius-md); border: 1px solid var(--accent-gold); background: var(--accent-gold-soft); display: flex; flex-direction: column; gap: var(--space-2); max-width: 520px; }
.hw3-suggest__q { margin: 0; font-weight: var(--weight-semibold); }
.hw3-suggest__done { margin: 0; }

/* Journal tools */
.hw3-jtools { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2) var(--space-3); align-items: end; margin: var(--space-3) 0; }
.hw3-jtools__q { grid-column: 1 / -1; }
.hw3-jtools .hw-field { margin: 0; }
.hw3-jexport { margin: 0 0 var(--space-2); }
.j-kind { display: inline-block; font-size: var(--text-xs); padding: 1px 8px; border-radius: var(--radius-pill); background: var(--surface-2); border: 1px solid var(--border); margin-right: var(--space-2); }
.j-local { display: inline-block; font-size: var(--text-xs); padding: 1px 8px; border-radius: var(--radius-pill); background: var(--accent-warm-soft); color: var(--text); }
.j-prompt { font-style: italic; color: var(--muted); margin: 4px 0; }
.hw3-check { display: flex; gap: var(--space-2); align-items: center; min-height: var(--tap); }
.hw3-check input { width: 20px; height: 20px; accent-color: var(--accent); }
.hw3-dialog { max-width: min(92vw, 460px); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); padding: var(--space-5); box-shadow: var(--shadow-lg); }
.hw3-dialog::backdrop { background: var(--scrim); }
.hw3-import { margin: 0 0 var(--space-4); }

@media (min-width: 640px) {
  .hw3-view { padding: var(--space-6) var(--space-6) var(--space-12); }
  .hw3-tools { grid-template-columns: 1fr 1fr; }
  .hw3-mood { min-height: 84px; }
  .hw3-mood__label { font-size: var(--text-sm); }
  .hw3-jtools { grid-template-columns: 2fr 1fr 1fr 1fr auto; }
  .hw3-jtools__q { grid-column: auto; }
}
.j-meta-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.j-prompt-row { display: flex; flex-direction: column; gap: var(--space-2); margin: var(--space-2) 0; }
.journal-entries-title { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }
#journalEntries[hidden] { display: none; }
.hw3-view { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.hw3-view[hidden], .app.showing-launch-prefs .hw3-view { display: none !important; }
.hw3-support[hidden] { display: none; }

/* ---------- Free and Plus (founder-approved model) ---------- */
.hw3-plus-tag { margin-left: 6px; font-size: var(--text-xs); font-weight: var(--weight-semibold); padding: 0 6px; border-radius: var(--radius-pill); border: 1px solid var(--accent-gold); background: var(--accent-gold-soft); color: var(--text); }
.hw3-plusinfo, .hw3-window { margin: var(--space-2) 0; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--surface-2); border: 1px solid var(--border); }
.hw3-plusinfo p, .hw3-window p { margin: 0 0 var(--space-2); font-size: var(--text-sm); }
.hw3-plusinfo .hw-card__actions, .hw3-window .hw-card__actions { margin-top: 0; }
.hw3-badges { display: flex; flex-wrap: wrap; gap: var(--space-1); margin: var(--space-1) 0 0; }
.hw3-badge--new { background: var(--accent-soft, var(--surface-2)); border-color: var(--accent); }
.hw3-badge--soon { background: var(--surface-2); border-color: var(--border); }
.hw3-teaser .hw3-list__title { margin-bottom: 2px; }
.hw3-insights { margin: var(--space-2) 0; padding-left: 1.2em; display: grid; gap: var(--space-1); }
.hw3-checklist { list-style: none; margin: var(--space-2) 0; padding: 0; display: grid; gap: var(--space-2); }
.hw3-checklist .hw3-check { display: flex; gap: var(--space-2); align-items: center; min-height: var(--tap, 44px); }
.hw3-checklist input[type="checkbox"] { width: 22px; height: 22px; flex: none; }
.hw3-row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin-top: var(--space-2); }
.hw3-row .hw-input { flex: 1 1 200px; max-width: 320px; }
.hw3-table-wrap { overflow-x: auto; }
.hw3-cmp { display: grid; gap: var(--space-2, 8px); }
.hw3-cmp__sec { border: 1px solid var(--border, rgba(0,0,0,.12)); border-radius: var(--radius-md, 12px); background: var(--surface, transparent); }
.hw3-cmp__sum { list-style: none; cursor: pointer; display: grid; grid-template-columns: 1fr auto; column-gap: var(--space-2, 8px); padding: 12px 14px; min-height: var(--tap, 44px); border-radius: inherit; }
.hw3-cmp__sum::-webkit-details-marker { display: none; }
.hw3-cmp__sum::after { content: ""; grid-column: 2; grid-row: 1 / span 2; align-self: center; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .15s ease; }
.hw3-cmp__sec[open] > .hw3-cmp__sum::after { transform: rotate(-135deg); }
.hw3-cmp__sum:focus-visible { outline: 3px solid var(--focus-color, #2f7fa0); outline-offset: 2px; }
.hw3-cmp__title { font-weight: var(--weight-semibold, 600); }
.hw3-cmp__line { grid-column: 1; color: var(--muted, inherit); font-size: var(--text-sm, .92em); }
.hw3-cmp__table { width: 100%; border-collapse: collapse; margin: 0 0 8px; font-size: .95em; }
.hw3-cmp__table th, .hw3-cmp__table td { padding: 8px 14px; text-align: left; vertical-align: top; border-top: 1px solid var(--border, rgba(0,0,0,.08)); }
.hw3-cmp__table th[scope="row"] { font-weight: var(--weight-regular, 400); }
.hw3-cmp__table thead th { font-size: var(--text-xs, .85em); color: var(--muted, inherit); }
.hw3-cmp__table td { width: 26%; }
@media (prefers-reduced-motion: reduce) { .hw3-cmp__sum::after { transition: none; } }
@media print { .hw3-cmp__sec:not([open]) > :not(summary) { display: none; } }
.j-plus-note { margin-top: var(--space-2); }
.j-pack-row select { max-width: 100%; }

/* Printable report: shown on screen as a sheet, printed on its own. */
.hw3-print { position: fixed; inset: 0; z-index: 1000; overflow: auto; background: var(--bg, #fff); color: var(--text); padding: var(--space-5, 24px); max-width: none; }
.hw3-print h1 { font-size: 1.5rem; margin: 0 0 var(--space-2); }
.hw3-print h2 { font-size: 1.1rem; margin: var(--space-4) 0 var(--space-2); }
.hw3-print table { border-collapse: collapse; width: 100%; max-width: 760px; }
.hw3-print th, .hw3-print td { border: 1px solid var(--border); padding: 4px 8px; text-align: left; font-size: var(--text-sm); }
.hw3-print__note { font-size: var(--text-sm); color: var(--text-muted, var(--text)); }
@media print {
  body.hw3-printing > *:not(#hw3Print) { display: none !important; }
  body.hw3-printing #hw3Print { position: static; overflow: visible; background: #fff; color: #000; padding: 0; }
  body.hw3-printing .hw3-print__actions { display: none !important; }
  .hw3-print th, .hw3-print td { border-color: #999; color: #000; }
}
