/* Wake the Fred Up: signing up, signing in and the account page. Builds on /styles.css (the tokens, fonts,
   the living sky, buttons, cards and form fields) and adds only what these pages need. Motion uses transform
   and opacity, plus the small SVG strokes the app already draws, and all of it stops under
   prefers-reduced-motion. */

a { color: var(--ink); text-decoration-color: color-mix(in srgb, var(--brass) 70%, transparent); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--brass); }
h2[tabindex="-1"]:focus { outline: none; }
/* Headings with the person's first name: a long one-word name breaks inside the word instead of widening the page. */
#ready-title, #acct-hello { overflow-wrap: anywhere; }
.top-link { flex: none; display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 14px; font-weight: 650; text-decoration: none; }
@media (hover: hover) { .top-link:hover { background: var(--surface-2); } }

/* ---- the step meter and the eyebrow ---- */
.meter { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; width: 132px; margin: 0 0 16px; }
.meter i { position: relative; height: 4px; border-radius: 4px; overflow: hidden; background: var(--surface-2); }
.meter i::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--brass); transform: scaleX(0); transform-origin: 0 50%; }
.meter i.on::after { transform: none; }
.panel.enter .meter i.now::after { animation: fill 0.8s var(--ease) 0.3s backwards; }
.eyebrow { display: flex; width: fit-content; align-items: center; margin: 0 0 12px; padding: 7px 12px; border-radius: 999px; background: var(--brass-100); color: var(--brass-ink); font-size: 12px; line-height: 1; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }

/* ---- forms under the sky ---- */
.flow-form { margin-top: 6px; }
.flow-form > .btn.primary { margin-top: 16px; }
.flow-form .hint { margin-top: 8px; }
.flow-form .error { margin-top: 14px; }
form input[aria-invalid="true"], form select[aria-invalid="true"] { border-color: var(--stop); }
/* An error line takes no room until it has something to say. */
.error:empty { min-height: 0; margin: 0; }
.fine { margin: 16px 0 0; color: var(--ink-3); font-size: 13.5px; line-height: 1.45; }
.alt { margin: 14px 0 0; color: var(--ink-3); font-size: 15px; text-align: center; }
.alt a { display: inline-block; padding: 12px 4px; font-weight: 650; }
.panel > .actions + .alt { margin-top: 8px; }
.row > div { min-width: 0; }

/* The consent box: a real checkbox, with the full text as its label. */
.consent { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; margin-top: 18px; padding: 14px 14px 14px 12px; border-radius: 18px; background: var(--surface-2); }
form .consent input[type="checkbox"] {
  appearance: none; display: grid; place-items: center; width: 28px; height: 28px; min-height: 0; margin: 0; padding: 0;
  border-radius: 9px; border: 2px solid var(--ink-3); background: var(--surface); cursor: pointer; transition: background-color 0.2s ease, border-color 0.2s ease;
}
form .consent input[type="checkbox"]::before { content: ""; width: 12px; height: 7px; border: solid var(--on-primary); border-width: 0 0 2.5px 2.5px; transform: translateY(-1px) rotate(-45deg) scale(0); transition: transform 0.3s var(--spring); }
form .consent input[type="checkbox"]:checked { background: var(--primary); border-color: var(--primary); }
form .consent input[type="checkbox"]:checked::before { transform: translateY(-1px) rotate(-45deg) scale(1); }
form .consent input[type="checkbox"]:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; box-shadow: none; }
form .consent input[aria-invalid="true"] { border-color: var(--stop); }
form .consent label { margin: 0; color: var(--ink-2); font-size: 14.5px; line-height: 1.45; font-weight: 500; cursor: pointer; }

/* ---- the code: one real field, drawn as six boxes ---- */
.code { position: relative; margin-top: 8px; }
form .code input {
  position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0 0 0 4%;
  border: 0; border-radius: 14px; background: transparent; color: transparent; caret-color: transparent; font-size: 16px; letter-spacing: 1.6em;
}
form .code input:focus-visible { outline: none; box-shadow: none; }
.code input::selection { background: transparent; }
.cells { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.cells i {
  position: relative; display: grid; place-items: center; height: 60px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg);
  color: var(--ink); font: 600 28px/1 var(--serif); font-style: normal; font-variant-numeric: lining-nums tabular-nums;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease;
}
.cells i.full { animation: digit 0.32s var(--spring); }
.code:focus-within .cells i.at { border-color: var(--focus); box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 24%, transparent); }
.code:focus-within .cells i.at:empty::after { content: ""; width: 2px; height: 26px; border-radius: 2px; background: var(--focus); animation: blink 1.1s steps(2, jump-none) infinite; }
.cells.ok i { border-color: var(--sage); background: var(--sage-100); color: var(--sage-600); }
.cells.nope { animation: nope 0.42s ease; }
@media (max-width: 360px) { .cells { gap: 5px; } .cells i { height: 52px; font-size: 24px; } }

/* The resend button: a small ring drains while it waits. */
.resend { margin-top: 6px; }
.resend .timer { display: none; width: 22px; height: 22px; flex: none; rotate: -90deg; }
.resend.waiting .timer { display: block; }
.timer circle { fill: none; stroke-width: 2.5; }
.timer .track { stroke: var(--line); }
.timer .left { stroke: var(--brass); stroke-linecap: round; stroke-dasharray: 56.55; stroke-dashoffset: 0; }
.timer .left.run { animation: drain 30s linear forwards; }
.resend:disabled { opacity: 0.8; }

/* ---- checkout ---- */
.price { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 18px 0 0; }
.price > div { display: grid; gap: 8px; padding: 14px 16px; border-radius: 18px; background: var(--surface-2); }
.price > .now { background: var(--brass-100); }
.p-label { font-size: 11.5px; line-height: 1; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.now .p-label { color: var(--brass-ink); }
.p-amount { font: 600 clamp(24px, 7vw, 30px)/1 var(--serif); letter-spacing: -0.02em; font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.p-amount small { display: block; margin-top: 6px; font: 650 13px/1 var(--sans); letter-spacing: 0; color: var(--ink-3); }
.lines { list-style: none; display: grid; gap: 10px; margin: 16px 0 0; padding: 0; color: var(--ink-2); }
.lines li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; align-items: start; }
.tick { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--sage-100); color: var(--sage-600); }
.tick .ico { width: 14px; height: 14px; stroke-width: 2.8; }
.panel.enter .lines li { animation: rise 0.5s var(--ease) backwards; }
.panel.enter .lines li:nth-child(2) { animation-delay: 0.06s; } .panel.enter .lines li:nth-child(3) { animation-delay: 0.12s; } .panel.enter .lines li:nth-child(4) { animation-delay: 0.18s; }
.lines b { color: var(--ink); }
#v-checkout .note { margin-top: 14px; }
.wait { display: grid; gap: 12px; margin-top: 18px; }

/* ---- ready ---- */
.ready-steps { list-style: none; display: grid; gap: 12px; margin: 20px 0 0; padding: 0; counter-reset: step; }
.step { padding: 16px 16px 18px; border-radius: 20px; background: var(--surface-2); }
.step-title { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font: 600 18px/1.25 var(--serif); letter-spacing: -0.01em; }
.step-title::before { counter-increment: step; content: counter(step); flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--brass); color: var(--on-brass); font: 700 14px/1 var(--sans); }
.panel.enter .step { animation: rise 0.6s var(--ease) backwards; }
.panel.enter .step:nth-child(1) { animation-delay: 0.12s; } .panel.enter .step:nth-child(2) { animation-delay: 0.2s; } .panel.enter .step:nth-child(3) { animation-delay: 0.28s; }
.number { margin: 4px 0 0; font: 600 clamp(26px, 8vw, 34px)/1.1 var(--serif); letter-spacing: -0.015em; font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; user-select: all; }
.step .actions { margin-top: 14px; }
.step .detail { margin-top: 0; }
.how { list-style: none; display: grid; gap: 8px; margin: 0; padding: 0; color: var(--ink-2); }
.how b { color: var(--ink); }
.step .hint { margin-top: 8px; }
/* Two buttons share a row only when both fit on one line each. */
.actions.two { display: flex; flex-wrap: wrap; }
.actions.two > .btn { flex: 1 1 auto; width: auto; }

/* ---- account ---- */
.practice { margin-top: 16px; padding: 14px 16px 16px; border-radius: 18px; background: var(--brass-100); animation: rise 0.45s var(--ease) backwards; }
.practice .detail { margin: 0; color: var(--brass-ink); font-weight: 650; }
.practice .actions { margin-top: 14px; }
#review-banner { margin-top: 14px; }
.btn.warn-text { color: var(--stop); }
.confirm { margin-top: 14px; padding: 14px 16px 16px; border-radius: 18px; background: var(--urgent-bg); color: var(--urgent-ink); animation: rise 0.4s var(--ease) backwards; }
.confirm p { margin: 0; font-weight: 600; }
.confirm .actions { margin-top: 14px; }
.optin .consent { margin-top: 12px; }
.optin .btn { margin-top: 16px; }
.card .detail { margin-top: 6px; }
.card > .hint:first-of-type { margin-top: 6px; }
.card > .actions { margin-top: 16px; }
#calls-controls > .actions { margin-top: 16px; }
.try { background: linear-gradient(180deg, var(--brass-100), var(--surface) 80%); }
#times-form .btn, #snooze-form .btn { margin-top: 18px; }
.facts, .changes { list-style: none; display: grid; gap: 6px; margin: 8px 0 0; padding: 0; color: var(--ink-2); font-size: 15px; }
.facts li, .changes li { position: relative; padding-left: 16px; overflow-wrap: anywhere; }
.facts li::before, .changes li::before { content: ""; position: absolute; left: 2px; top: 0.62em; width: 6px; height: 6px; border-radius: 50%; background: var(--brass); }
.facts li.bad { color: var(--urgent-ink); }
.owner .sync { margin-top: 16px; padding-bottom: 14px; }
.owner .sync .actions { margin-top: 12px; }
/* Recent mornings: a tag goes on its own line under the date, so a long one never widens the card. */
#recent > li { grid-template-columns: auto minmax(0, 1fr) auto; }
#recent .tag { display: block; width: fit-content; max-width: 100%; margin: 4px 0 0; white-space: normal; }
.foot a { color: var(--ink-3); }

/* ---- wider screens ---- */
@media (min-width: 680px) {
  /* The account page sits beside the sky, like the owner app. */
  body[data-layout="account"] main, body[data-layout="account"] .top { max-width: 1000px; }
  body[data-layout="account"] .stage { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); justify-content: normal; }
}
@media (min-width: 960px) {
  /* Signup steps: one card, the sky on the left and the step on the right. */
  body[data-layout="flow"] main, body[data-layout="flow"] .top { max-width: 1080px; }
  body[data-layout="flow"] .stage { grid-template-columns: minmax(0, 1fr); }
  body[data-layout="flow"] .hero { --scene-h: 400px; position: relative; top: auto; display: grid; grid-template-columns: minmax(0, 0.92fr) minmax(0, 1fr); }
  body[data-layout="flow"] .scene { height: auto; min-height: 620px; border-radius: var(--radius) 0 0 var(--radius); }
  body[data-layout="flow"] .hills { height: 32%; }
  body[data-layout="flow"] .hero-body { align-self: center; padding: 48px 52px 44px; }
  body[data-layout="flow"] .hl { font-size: 34px; }
}
/* A shorter sky above the long forms on a phone, so the first field is in view. */
@media (max-width: 959px) {
  body[data-view="start"] .hero, body[data-view="signin"] .hero, body[data-view="closed"] .hero, body[data-view="checkout"] .hero { --scene-h: clamp(180px, 50vw, 236px); }
}

/* ---- motion ---- */
@keyframes fill { from { transform: scaleX(0); } }
@keyframes digit { from { transform: scale(0.7); opacity: 0.4; } }
@keyframes blink { from { opacity: 1; } to { opacity: 0; } }
@keyframes drain { to { stroke-dashoffset: 56.55; } }

/* Reduced motion: no glides, pops or draining ring; state changes are instant. */
@media (prefers-reduced-motion: reduce) {
  .meter i::after, .cells i, .cells.nope, .timer .left, .practice, .confirm, .lines li, .step, .code .cells i::after { animation: none !important; transition: none !important; }
  .panel.enter .meter i.now::after { animation: none !important; }
}
