/* Setup (module 03 §1 to §8 and §10; module 06 3.4, 3.5 and the setup rows of §4; look system 5.2, 6.5, 6.7, 6.14, 6.16).
   Owner: the setup slice. The flow view, its questions and answers, the safety step, the summary, the first run and the
   picker. app.css styles the shared parts (field, chips, fields, cards, marks, tiles, the picked bar); this sheet places
   them and draws setup's own pieces. Ends with this file's own .calm rules. */

/* ---- The frame: header, the habit's count, progress marks, the question ---- */
.flow{overflow-x:clip}
.hq{max-width:520px;margin:calc(-1*var(--s2)) auto var(--s2);padding:0 var(--gutter);text-align:center;font-size:var(--fs-cap);font-weight:500;color:var(--ink-2)}
.flow>.stepr{max-width:520px;margin:var(--s1) auto var(--s5);padding:0 var(--gutter)}
/* One progress form (A7-setup-3): the count in words, at the left under the header. */
.flow>.stepr small{margin-left:0;padding-left:0}
.fl{padding-bottom:max(calc(132px + var(--sb)),var(--dk,0px))}
.flow.d2 .fl{padding-bottom:max(calc(196px + var(--sb)),var(--dk,0px))}
/* While the keyboard is up (setup.js sets kb), the dock steps aside (03 1.4) without leaving the Tab order (a11y-1). */
.flow.kb .fdock{opacity:0;pointer-events:none}
.flow.kb .fl{padding-bottom:calc(32px + var(--sb))}
/* A control reached by keyboard scrolls clear of the fixed dock (a11y-3): scroll padding as high as the dock. --dk, set
   by setup.js, is the visible dock's measured height: the nudge step's own dock is taller, and any dock grows with the
   text (SN-1). */
html:has(.flow){scroll-padding-bottom:max(calc(140px + var(--sb)),calc(var(--dk,0px) + 8px))}
html:has(.flow.d2){scroll-padding-bottom:max(calc(152px + var(--sb)),calc(var(--dk,0px) + 8px))}
.qh{margin:0 0 var(--s5);text-wrap:balance;overflow-wrap:anywhere}
.qh:focus,.flow [data-fh]:focus{outline:none}
.flow main.fl>.qh+.hint{margin:calc(-1*var(--s3)) 0 var(--s5)}
.flow .hint.cvh{margin:var(--s3) 0}
.flow .lbl{margin:var(--s6) 0 var(--s2)}
.flow .fld{display:block;margin-top:var(--s5)}
.flow .fld>.lbl{margin-top:0}
.flow .fld>.in{margin-top:0}
.flow .in{margin-top:var(--s3)}
.flow .qh+.fld,.flow .hint+.fld{margin-top:0}
.flow .fld+.chips,.flow .err+.chips,.flow .in+.chips{margin-top:var(--s3)}
.flow .chips+.in,.flow .chips+textarea.in{margin-top:var(--s3)}
.flow .chips+.chips{margin-top:var(--s3)}
.flow .row.un .in{margin-top:0}
.flow .row.un .in:last-child{flex:1.4 1 8em}
.flow .err{margin-top:var(--s2)}
/* Needs (03 S5): the main need carries a star and a ring in the habit's light. */
.nd .chip .i{width:16px;height:16px;fill:currentColor;stroke:currentColor;stroke-width:1.4;color:var(--hl)}
.nd .chip.main input:checked+span{box-shadow:inset 0 0 0 1.5px var(--hl)}
.flow .pacts{margin-top:var(--s3)}
.flow details.more{margin-top:var(--s2)}
.flow .rp{margin:var(--s3) 0 0}
.flow .slh{margin:var(--s3) 0 0}
.flow .slh+.src{margin-top:var(--s1)}
.flow .fd{margin-top:var(--s4)}
.flow .scale{margin-top:var(--s1)}

/* ---- "Why we ask" (A7-setup-1): a quiet link under the question, and its sheet; the replies, the help card ---- */
.flow .lnk.wy{display:flex;margin:var(--s5) 0 var(--s4);padding:0 2px;color:var(--ink-2);text-decoration-color:rgba(255,255,255,.28)}
.wya{padding:0 0 var(--s2);font-size:var(--fs-body);line-height:1.5;color:var(--ink-2)}
.wya .wya-f{margin-top:var(--s4);color:var(--ink)}
.wyl{display:inline-flex;align-items:center;min-height:44px;margin-top:var(--s3);padding:0 2px;font-size:var(--fs-cap);line-height:1.35}
.wyl u{display:inline-flex;align-items:center;gap:6px;color:var(--ink);text-decoration-color:rgba(255,255,255,.38);text-decoration-thickness:1px;text-underline-offset:4px}
.wyl u .i{width:17px;height:17px;flex:none;color:var(--ink-2)}
.reply .ev{color:var(--ink)}
/* A reply to an answer (03 S3, S8): the app's words on glass with a fine rule in the hue. */
.reply{margin-top:var(--s4);padding:var(--s4) 18px;border-radius:var(--r-m);background:var(--glass);box-shadow:var(--edge),inset 1.5px 0 0 var(--hm);font-size:var(--fs-cap);line-height:1.45;color:var(--ink-2)}
.reply p+p{margin-top:var(--s2)}
.hcard{margin-top:var(--s3);padding:var(--s4) 18px;border-radius:var(--r-m);background:var(--well);box-shadow:inset 0 0 0 1px var(--hair)}
.hcard b{display:block;margin-bottom:var(--s1);font-size:var(--fs-lab);font-weight:600;color:var(--ink)}
.hcard .btn{margin-top:var(--s3)}
.qtx{font-size:var(--fs-cap);line-height:1.45;color:var(--ink-2);margin-bottom:var(--s1)}
.flow figure.qt+.chips{margin-top:var(--s5)}

/* ---- Hard moments: the moment cards, the open editor inside its card, the add field, the ideas ---- */
.hml{margin-top:var(--s1)}
.hmo{display:flex;align-items:center;gap:var(--s1);margin-top:var(--s2);padding:var(--s2) var(--s2) var(--s2) var(--s4);border-radius:var(--r-m);background:var(--glass);box-shadow:var(--edge)}
.hmo .g{flex:1}
.hmo p{font-size:var(--fs-lab);font-weight:600;line-height:1.35;padding-top:var(--s2);overflow-wrap:anywhere}
.hmo .g:only-child p,.hmo .g>p:only-child{padding:var(--s3) 0}
.hmo .lnk{display:flex;justify-content:flex-start;text-align:left}
.hmo .ib:not(.st){background:none;box-shadow:none;color:var(--ink-2)}
.hmo .st[aria-pressed=true]{background:var(--lit);color:var(--hk);box-shadow:inset 0 1px 0 rgba(255,255,255,.55),0 8px 20px -12px var(--hg)}
.hmo .st[aria-pressed=true] .i{fill:currentColor}
/* The card being edited holds its editor: one card, lit rim, a hairline between the moment and its times. */
.flow .hmo:has(+.ted){border-radius:var(--r-m) var(--r-m) 0 0;background:oklch(0.62 calc(var(--hc) * .7) var(--h) / .08);
  box-shadow:inset 1.5px 0 0 var(--hm),inset -1.5px 0 0 var(--hm),inset 0 1.5px 0 var(--hm)}
.flow .hmo+.ted{margin:0;padding:var(--s3) var(--s4) var(--s4);border-radius:0 0 var(--r-m) var(--r-m);background:oklch(0.62 calc(var(--hc) * .7) var(--h) / .08);
  box-shadow:inset 1.5px 0 0 var(--hm),inset -1.5px 0 0 var(--hm),inset 0 -1.5px 0 var(--hm);container:ted/inline-size}
.flow .hmo+.ted::before{content:"";display:block;height:1px;margin:0 0 var(--s3);background:var(--hair)}
/* Which days: a two by two segmented choice in a well. */
.flow .ted>.chips:first-child{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,7.5em),1fr));gap:var(--s1);padding:var(--s1);border-radius:var(--r-m);background:var(--well);margin-bottom:0}
.flow .ted>.chips:first-child .chip{display:flex}
.flow .ted>.chips:first-child .chip span{width:100%;box-shadow:none;background:none}
.flow .ted>.chips:first-child .chip input:checked+span{background:var(--lit)}
/* Seven day cells keep 44 px each: under 332 px of room (20.75em at 16 px, so large text counts) they fall to four and three
   (setup2 notes 7). */
@container ted (max-width:20.75em){.flow .ted .days{grid-template-columns:repeat(4,1fr)}}
.addm{margin-top:var(--s4)}
.addm .in{margin-top:0}
.addm .btn{flex:none}
.sgs{display:flex;flex-wrap:wrap;gap:var(--s2);margin-top:var(--s3)}
.sgc small{display:block;font-size:var(--fs-cap);color:var(--ink-3)}
.flow .fld+.sgc{margin-top:var(--s3)}
/* The time editor: setup's hard-moment screen and Plan's Hard moment sheet share these rules (plan.css adds only its .tm grid). */
.ted{margin:var(--s2) 0 var(--s1);padding:var(--s2) 0 var(--s1)}
.ted .chips{margin-bottom:var(--s3)}
.ted .days{margin:var(--s3) 0 var(--s1)}
.ted .row{margin-top:var(--s3)}
.ted .fld .lbl{margin:0 0 var(--s2)}
.ted .hint{margin:var(--s2) 0 0}
.ted .btn{min-height:44px}
.ted .lnk{display:inline-flex;align-items:center}

/* ---- The summary (06 3.5): the plan sentence (the person's words in the habit's light), the rows, the start time ---- */
.say{color:var(--hl);text-wrap:pretty}
.say i{font-style:normal;color:var(--ink)}
.say:not(:has(i)){color:var(--ink)}
/* Each row reopens its screen: a full-width button, label above the value, a pencil at the right. */
.rows button.r{position:relative;display:grid;grid-template-columns:1fr auto;gap:2px var(--s3);width:100%;min-height:60px;padding:14px 0;text-align:left;border-radius:0}
.rows button.r>span{grid-column:1}
/* The person's answer leads its label at 560; its second line stays quiet at 400 (R5-setup-8, setup2 #summary). */
.rows button.r>div{grid-column:1;font-size:var(--fs-body);font-weight:560;color:var(--ink)}
.rows button.r>div small{font-weight:400}
.rows button.r>.i{grid-column:2;grid-row:1/3;align-self:start;width:18px;height:18px;margin-top:2px;color:var(--ink-3)}
.rows button.r:active{background:rgba(255,255,255,.05)}
/* The answers behind "Change an answer" (A7-setup-4). */
.flow details.chg{margin-top:var(--s5)}
.when{margin-top:var(--s5)}
.fdock .btn+.btn{margin-top:var(--s2)}
.fdock .lnk{display:flex;margin:var(--s1) auto 0}

/* ---- First run and the picker (look system 6.16) ---- */
.pgrid>.glab:first-child{margin-top:var(--s3)}
/* While a search hides the group labels, the first tile keeps 16 px under the field (R5-setup-7, picker2 #search). */
.pgrid:has(>.glab:first-child[hidden]){margin-top:var(--s4)}
/* The search field's clear button (R5-setup-2, picker2 #search): 44 by 44 at the field's right while it holds text, no
   glass, its icon 20 px in --ink-2, its focus ring inside the field. The browser's own cancel control is hidden. */
.sbox .in.srch{padding-right:52px}
.sbox .in.srch::-webkit-search-cancel-button{-webkit-appearance:none;appearance:none;display:none}
.sbox .sx{position:absolute;right:4px;top:50%;margin-top:-22px;background:none;box-shadow:none;color:var(--ink-2)}
.sbox .sx:active{background:rgba(255,255,255,.08)}
.sbox .sx:focus-visible{outline-offset:-2px}
.sbox .sx .i{position:static;margin:0;width:20px;height:20px;color:inherit}
.pgrid>button[data-k=other] span{font-size:var(--fs-body);font-weight:560}
.pgrid>button[data-k=other] small{display:block;margin-top:2px;font-size:var(--fs-cap);font-weight:400;color:var(--ink-2)}
/* More (A7-setup-2): a quiet full-width row after the six habits; it goes once the other 17 show. */
.pgrid>.pmore{grid-column:1/-1;display:flex;align-items:center;justify-content:center;gap:8px;padding:10px 16px;background:none;box-shadow:inset 0 0 0 1px var(--hair-2);color:var(--ink-2);font-weight:560}
.pgrid>.pmore .i{width:18px;height:18px;flex:none}
/* The offer to track the typed words: a dashed wide tile with a ring-plus. */
.pgrid .cust{border:1.5px dashed var(--hair-2);box-shadow:none;font-weight:560}
.pgrid .cust .i{width:46px;height:46px;padding:12px;background:none;box-shadow:inset 0 0 0 1px var(--hair-2)}
/* The picked bar: names with their discs left, the count right, Next under them. */
.pkr{display:flex;align-items:baseline;gap:var(--s3)}
.pkr .pkl{flex:1}
.pkl>span>.i{width:24px;height:24px;padding:5px;margin-right:var(--s2);vertical-align:middle;border-radius:50%;background:var(--lit);color:var(--hk);stroke-width:1.8}
/* Your own entry reads as a preset pick, in the bar's weight and colour beside its disc (R5-setup-6); its remove icon keeps
   its 44 px button. */
.pkl .pkx{font-weight:inherit;color:inherit}
.pkl .pki>.i{margin-right:4px}
.pkn{flex:none;font-size:var(--fs-cap);color:var(--ink-2);font-variant-numeric:tabular-nums}
.pkf,.panel.stp>.pkf{animation:fade var(--t1) var(--e-out)}

/* ---- Module 06 §4: a screen swapped in place, the summary assembling, and the handover to the dial ---- */
.fl.in-f{animation:flInF var(--t2) var(--e-out) 40ms backwards}
.fl.in-b{animation:flInB var(--t2) var(--e-out) 40ms backwards}
.fl-x{position:absolute;left:0;right:0;pointer-events:none}
.fl-x.out-f{animation:flOutF var(--t1) var(--e-in) forwards}
.fl-x.out-b{animation:flOutB var(--t1) var(--e-in) forwards}
@keyframes flInF{from{opacity:0;transform:translateX(24px)}}
@keyframes flInB{from{opacity:0;transform:translateX(-24px)}}
@keyframes flOutF{to{opacity:0;transform:translateX(-16px)}}
@keyframes flOutB{to{opacity:0;transform:translateX(16px)}}
.rows.asm .r{animation:rise6 var(--t2) var(--e-out) backwards;animation-delay:calc(120ms + var(--i)*50ms)}
@keyframes rise6{from{opacity:0;transform:translateY(6px)}}
.flow.go .stepr,.flow.go .fl,.flow.go .fdock{animation:goOut var(--t1) var(--e-in) forwards;pointer-events:none}
@keyframes goOut{to{opacity:0;transform:translateY(-8px)}}
.calm .fl.in-f,.calm .fl.in-b,.calm .rows.asm .r{animation:fade var(--t1)!important}
.calm .fl-x{display:none!important}
