/* views/home.css — the home screen: today's hero, one capture bar,
   a slim backup reminder, the library header and the desktop rail.
   The list itself is styled in views/library.css. */

/* ── Today's hero ────────────────────────────────────────────────
   One tinted paper block answers "what now?" in a glance: the count, one
   action, the goal and the other ways to practise. Its tint is the chosen
   accent, so the hero belongs to the same ink as every button — the
   highlighter stays the only other colour, and nothing turns black. */
.home-page { display: block; }
.home-grid { display: block; }
.home-main { min-width: 0; }
.home-rail { display: none; }

.today-hero {
  display: grid; gap: 14px;
  padding: 18px;
  background: var(--brand-soft);
  color: var(--ink);
  border-radius: var(--r-lg);
  border: 1px solid color-mix(in srgb, var(--brand) 14%, var(--line));
  box-shadow: 0 12px 28px -26px rgb(20 27 45 / .45);
}
.today-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 10px; min-width: 0; }
.today-streak {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  height: 24px; padding: 0 9px; border-radius: var(--r-pill);
  background: var(--mark);
  color: var(--on-mark);
  font-size: var(--text-xs); font-weight: 700; white-space: nowrap;
}
.today-streak .icon { width: 14px; height: 14px; }
.today-copy { display: grid; gap: 4px; min-width: 0; }
.today-copy h2 {
  color: var(--ink);
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 1.95rem);
  line-height: 1.15; letter-spacing: -.02em; text-wrap: pretty;
}
/* The highlighter is a solid marker behind the count, on paper or on the tint. */
.today-hero .mark {
  background: var(--mark); color: var(--on-mark);
  padding: 0 .12em; border-radius: 4px;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.today-line { color: var(--ink-2); font-size: var(--text-sm); line-height: 1.45; max-width: 46ch; }

.today-goal { display: flex; align-items: center; gap: 8px; min-width: 0; flex: none; margin-inline-start: auto; }
.today-goal-label {
  display: inline-flex; align-items: center; gap: 4px; min-width: 0;
  color: var(--ink-3); font-size: var(--text-xs); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.today-goal-label b { color: var(--ink); font-weight: 700; }
.today-goal-label .icon { width: 13px; height: 13px; flex: none; }
.today-goal-sep { color: var(--ink-3); opacity: .6; }
.today-goal-extra { color: var(--ink-3); }
.today-goal-track { width: 52px; height: 4px; border-radius: var(--r-pill); background: rgb(20 27 45 / .10); overflow: hidden; flex: none; }
.today-goal-track i { display: block; height: 100%; border-radius: inherit; background: var(--mark); box-shadow: inset 0 0 0 1px rgb(20 27 45 / .12); transition: width 420ms var(--ease); }
.today-goal.is-done .today-goal-label,
.today-goal.is-done .today-goal-label b,
.today-goal.is-done .today-goal-label .icon { color: var(--good); }

/* The one action: solid ink blue on the tint, white label, white arrow chip. */
.today-cta {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  min-height: 50px; padding: 0 10px 0 var(--s-4);
  background: var(--brand); color: var(--on-brand);
  border-radius: var(--r-md); text-decoration: none;
  font-weight: 700; font-size: var(--text-md);
  transition: transform var(--fast) var(--ease), background var(--fast);
}
.today-cta:hover { background: var(--brand-hover); transform: translateY(-1px); }
.today-cta-ico {
  display: grid; place-items: center; width: 30px; height: 30px; flex: none;
  border-radius: 50%; background: rgb(255 255 255 / .18); color: var(--on-brand);
}

/* Practice shortcuts: one scrollable line inside the hero. */
.today-steps {
  display: flex; gap: 6px; list-style: none; padding: 0 1px 1px; margin: 0 -1px;
  overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
}
.today-steps::-webkit-scrollbar { display: none; }
.today-steps li { flex: none; }
.today-steps a {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 11px;
  border-radius: var(--r-pill); border: 1px solid color-mix(in srgb, var(--brand) 16%, var(--line));
  background: var(--surface);
  color: var(--ink-2); font-size: var(--text-xs); font-weight: 600; text-decoration: none; white-space: nowrap;
}
.today-steps a .icon { width: 14px; height: 14px; color: var(--brand); }
.today-steps b {
  font-variant-numeric: tabular-nums; font-size: .7rem; line-height: 18px;
  color: var(--on-mark); background: var(--mark); padding: 0 6px; border-radius: var(--r-pill);
}
.today-steps a:hover { background: #fff; border-color: color-mix(in srgb, var(--brand) 30%, var(--line)); color: var(--ink); }
.today-steps .is-done a {
  background: var(--mark-soft);
  border-color: transparent; color: var(--on-mark);
}
.today-steps .is-done a .icon { color: var(--on-mark); }
.today-steps .is-quick a { border-style: dashed; color: var(--ink-2); }
.today-steps .is-quick a .icon { color: var(--on-mark); }
.today-steps.is-overflow {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent);
          mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent);
}
.today-steps.is-end { -webkit-mask-image: none; mask-image: none; }

/* Small phones: the goal keeps its word but loses "Daily", and the track
   shortens. The numbers stay; the streak pill stays whole. */
@media (max-width: 420px) {
  /* Tighter chips let the four main ways to practise fit whole at 390,
     so the only thing off-screen is Quick 5 — a clean edge, not half a word. */
  .today-steps { gap: 4px; }
  .today-steps a { padding: 0 8px; }
}
@media (max-width: 400px) {
  .today-goal-extra { display: none; }
  .today-goal-track { width: 40px; }
}
@media (max-width: 359px) {
  .today-hero { padding: 16px; gap: 12px; }
  .today-steps a { padding: 0 9px; }
  .today-goal-track { display: none; }
}

/* ── Add a word: one quiet capture bar ───────────────────────────
   The highlighter still draws under what you type; the bar stays a
   utility, not the first screen. */
.quick-add { display: grid; gap: 6px; margin: var(--s-4) 0 0; max-width: none; }
.quick-label {
  font-family: var(--font-display); font-size: var(--text-lg); line-height: 1.2;
  font-weight: 700; color: var(--ink);
}
.quick-add .hint { font-size: max(.82rem, 13px); line-height: 1.5; }
.quick-add .hint a { font-weight: 600; white-space: nowrap; }
.add-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-2); align-items: stretch; }
.add-line .field { min-width: 0; }
.add-line .field input { width: 100%; min-width: 0; }
.quick-add .field { background: var(--surface); border-color: var(--line); }
.quick-add .field:focus-within { border-color: var(--brand); }
/* The band is sized to the typed word in JS (--mark-w, views/library.js). */
.quick-add .field-xl input {
  font-family: var(--font-word); font-weight: 500; text-align: start; letter-spacing: 0;
  font-size: 1rem;
  background: linear-gradient(transparent 60%, var(--mark) 60%, var(--mark) 88%, transparent 88%) no-repeat;
  background-size: var(--mark-w, 0px) 100%;
  transition: background-size 260ms var(--ease);
}
.quick-add .add-line .btn { flex: none; padding: 0 var(--s-4); }
.quick-add.is-compact { margin: var(--s-3) 0 0; }
.quick-add.is-compact .field { box-shadow: none; }
.quick-add.is-compact .field-xl input { font-weight: 500; }
.quick-add.is-compact .btn { min-height: 46px; }
/* The smallest phones: the plus is enough; it keeps the field wide. */
@media (max-width: 374px) {
  .quick-add .add-label { display: none; }
  .quick-add .add-line .btn { width: 46px; padding: 0; }
}

/* ── Backup: a weekly one-line utility, never a yellow hero ────── */
.backup-row {
  display: flex; align-items: center; gap: 2px;
  margin: var(--s-3) 0 0; padding: 3px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
}
.backup-main {
  display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0;
  min-height: 44px; padding: 3px 4px 3px 6px;
  color: inherit; text-decoration: none; border-radius: var(--r-sm);
}
.backup-main:hover { background: var(--surface-2); }
.backup-ico {
  display: grid; place-items: center; width: 30px; height: 30px; flex: none;
  border-radius: var(--r-sm); background: var(--mark-soft); color: var(--on-mark);
}
.backup-copy { display: grid; min-width: 0; line-height: 1.3; }
.backup-copy b { font-size: var(--text-xs); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.backup-copy .hint { font-size: var(--text-2xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.backup-arrow { color: var(--ink-3); flex: none; }
.backup-dismiss { width: 40px; height: 40px; flex: none; color: var(--ink-3); }

/* ── Empty library: a first-run page ──────────────────────────── */
.home-empty { display: grid; gap: var(--s-3); max-width: 560px; margin-bottom: var(--s-2); }
.home-empty h1 { font-size: clamp(1.8rem, 1.35rem + 2.2vw, 2.4rem); line-height: 1.12; }
.home-empty h1 .mark { padding-inline: .1em; }
.home-empty-copy { color: var(--ink-2); font-size: var(--text-md); line-height: 1.55; max-width: 46ch; }
.first-steps {
  display: grid; gap: var(--s-4); list-style: none; padding: 0; margin: var(--s-6) 0 0;
  max-width: 560px;
}
.first-steps li { display: flex; gap: var(--s-3); align-items: flex-start; }
.first-steps .step-n { width: 30px; height: 30px; font-size: var(--text-xs); background: var(--brand-soft); color: var(--brand); }
.first-steps b { display: block; font-size: var(--text-sm); line-height: 1.35; }
.first-steps .hint { display: block; font-size: var(--text-xs); line-height: 1.45; }
.first-note { margin-top: var(--s-6); max-width: 48ch; }

/* ── Library header ─────────────────────────────────────────────
   On a phone the status chips already carry the counts, so the extra
   stats line stays on the desktop where it has room. */
.lib-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); margin-top: var(--s-6); }
.lib-head h1 { font-size: 1.4rem; line-height: 1.2; letter-spacing: -.015em; }
.lib-stats {
  display: none;
  font-size: var(--text-xs); color: var(--ink-3);
}
.lib-stats b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.lib-stats [aria-hidden] { color: var(--line-strong); margin-inline: 4px; }

/* ── Tablet / desktop ─────────────────────────────────────────── */
@media (min-width: 760px) {
  .today-hero {
    grid-template-columns: minmax(0, 1fr) 236px;
    grid-template-areas: "top top" "copy cta" "steps steps";
    align-items: center; column-gap: var(--s-6);
    padding: var(--s-5) var(--s-6);
  }
  .today-top { grid-area: top; }
  .today-copy { grid-area: copy; }
  .today-cta { grid-area: cta; align-self: center; }
  .today-steps { grid-area: steps; }
  .today-copy h2 { font-size: 2rem; }
  .quick-add.is-compact { max-width: none; margin-top: var(--s-4); }
  .lib-head { margin-top: var(--s-6); }
  .lib-head h1 { font-size: var(--text-xl); }
  .lib-stats { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 4px; }
}

@media (min-width: 1024px) {
  .home-grid {
    display: grid; grid-template-columns: minmax(0, 1fr) 320px;
    gap: var(--s-6); align-items: start;
  }
  .home-rail { display: grid; gap: var(--s-3); position: sticky; top: calc(var(--bar-h) + var(--s-4)); }
  .today-steps .is-quick { display: none; }
}

/* ── Desktop rail ───────────────────────────────────────────────
   Quiet cards, one job each: the week at a glance, a five-minute door,
   and the long-term numbers. No duplicate of the hero's CTA. */
.rail-card {
  display: grid; gap: var(--s-3);
  padding: var(--s-4);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.rail-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-2); }
.rail-head h2 { font-family: var(--font-display); font-size: var(--text-sm); font-weight: 700; letter-spacing: -.01em; }
.rail-head a { display: inline-flex; align-items: center; gap: 2px; color: var(--ink-3); font-size: var(--text-2xs); font-weight: 600; text-decoration: none; }
.rail-head a:hover { color: var(--brand); }
.rail-days { list-style: none; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; padding: 0; margin: 0; }
.rail-days li { display: grid; justify-items: center; gap: 6px; min-width: 0; }
.rail-bar {
  display: flex; align-items: end; width: 100%; height: 48px;
  border-radius: 4px; background: var(--surface-2); overflow: hidden;
}
.rail-bar i { display: block; width: 100%; border-radius: 4px 4px 0 0; background: var(--brand); }
.rail-days .is-today .rail-bar { background: var(--brand-soft); }
.rail-days .is-today .rail-bar i { background: var(--mark); }
.rail-days .is-future .rail-bar { background: transparent; border: 1px dashed var(--line); }
.rail-days small { color: var(--ink-3); font-size: 10px; line-height: 1; white-space: nowrap; }
.rail-days .is-today small { color: var(--ink); font-weight: 700; }
.rail-note { color: var(--ink-3); font-size: var(--text-2xs); }
.rail-note b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.rail-quick {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-4);
  background: var(--mark-soft); color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--mark) 70%, transparent);
  border-radius: var(--r-lg); text-decoration: none;
}
.rail-quick:hover { border-color: var(--mark); }
.rail-quick-ico {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none;
  border-radius: 50%; background: var(--mark); color: var(--on-mark);
}
.rail-quick-copy { display: grid; gap: 1px; flex: 1; min-width: 0; }
.rail-quick-copy b { font-family: var(--font-display); font-size: var(--text-sm); }
.rail-quick-copy small { color: var(--on-mark); font-size: var(--text-2xs); line-height: 1.4; }
.rail-quick > .icon { color: var(--on-mark); flex: none; }
.rail-stats { display: grid; gap: var(--s-2); margin: 0; }
.rail-stats > div { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); padding-top: var(--s-2); border-top: 1px solid var(--line); }
.rail-stats > div:first-child { padding-top: 0; border-top: 0; }
.rail-stats dt { color: var(--ink-3); font-size: var(--text-2xs); }
.rail-stats dd { margin: 0; font-family: var(--font-display); font-size: var(--text-sm); font-weight: 700; font-variant-numeric: tabular-nums; }
