/* ============================================================================
   views.css — per-view layout. Composition only; primitives live in
   components.css so these rules stay about arrangement, not appearance.
   ============================================================================ */

/* ======================= Dashboard ======================================= */
.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
  padding: clamp(20px, 3vw, 30px);
  overflow: hidden;
  background:
    linear-gradient(125deg, rgb(var(--area, var(--primary)) / 0.13), transparent 55%),
    rgb(var(--surface));
}
.hero__main { flex: 1; min-width: 260px; }
.hero__eyebrow { font-size: 13px; color: rgb(var(--text-2)); font-weight: 600; letter-spacing: 0.01em; }
.hero__title { font-size: clamp(24px, 4vw, 33px); font-weight: 700; letter-spacing: -0.03em; margin-top: 6px; }
.hero__focus { margin-top: 9px; color: rgb(var(--text-2)); font-size: 15px; max-width: 54ch; line-height: 1.5; }
.hero__focus strong { color: rgb(var(--area, var(--primary))); font-weight: 650; }
.hero__meta { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }
.hero__energy { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 9px; }
.hero__energy-label { font-size: 13px; color: rgb(var(--text-2)); font-weight: 600; }
.hero__energy-hint { font-size: 12.5px; color: rgb(var(--text-2)); max-width: 32ch; text-align: right; }
.hero__energy-hint.muted { color: rgb(var(--text-3)); }

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(290px, 100%), 1fr));
  gap: var(--gap);
  margin-top: var(--gap);
  align-items: start;
}

.dash-progress__row { display: flex; align-items: center; gap: 22px; }
.dash-progress__side { flex: 1; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.mini-streak { font-size: 13.5px; color: rgb(var(--text-2)); display: flex; align-items: center; gap: 7px; }
.mini-streak strong { color: rgb(var(--text)); }
.mini-streak .icon { color: rgb(var(--home)); }

.right-now { position: relative; }
.right-now__tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: rgb(var(--area, var(--primary))); }
.right-now__title { font-size: 19px; font-weight: 650; margin-top: 9px; letter-spacing: -0.01em; }
.right-now__time { color: rgb(var(--text-2)); font-size: 14px; margin-top: 5px; }
.right-now__actions { margin-top: 16px; }

.task-list { display: flex; flex-direction: column; gap: 1px; }
.task { display: flex; align-items: center; gap: 11px; padding: 8px; border-radius: var(--r-sm); transition: background var(--dur-1) var(--ease); }
.task:hover { background: rgb(var(--surface-2)); }
.task__title { flex: 1; font-size: 14.5px; }
.task.is-done .task__title { color: rgb(var(--text-3)); text-decoration: line-through; }
.task__del { opacity: 0; transition: opacity var(--dur-1) var(--ease); }
.task:hover .task__del { opacity: 1; }

.streak-list { display: flex; flex-direction: column; gap: 10px; }
.streak-list__item { display: flex; align-items: center; gap: 12px; }
.streak-list__flame { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; color: rgb(var(--home)); min-width: 46px; }
.streak-list__name { font-size: 14px; }

.glance { display: flex; flex-direction: column; gap: 13px; }
.glance-row { display: grid; grid-template-columns: 118px 1fr; align-items: center; gap: 12px; }
.glance-row__label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 550; }

.quote .icon { color: rgb(var(--primary)); }
.quote__text { font-size: 16px; line-height: 1.55; font-weight: 500; margin-top: 12px; }
.quote__by { margin-top: 12px; color: rgb(var(--text-3)); font-size: 13px; }

/* ======================= Today =========================================== */
.today-grid { display: grid; grid-template-columns: 1fr 344px; gap: var(--gap); align-items: start; }
.today-grid__main { min-width: 0; }
.today-grid__side { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }

.timeline { display: flex; flex-direction: column; }
.tblock { position: relative; display: grid; grid-template-columns: 76px 20px 1fr auto; align-items: center; gap: 10px; padding: 9px 6px; border-radius: var(--r-sm); transition: background var(--dur-1) var(--ease), opacity var(--dur-2) var(--ease); }
.tblock:hover { background: rgb(var(--surface-2)); }
.tblock__time { text-align: right; line-height: 1.2; }
.tblock__time span { display: block; font-size: 13px; font-weight: 600; }
.tblock__dur { font-size: 11px; }
.tblock__rail { position: relative; display: flex; justify-content: center; align-self: stretch; align-items: center; }
.tblock__rail::before { content: ''; position: absolute; top: 0; bottom: 0; width: 2px; background: rgb(var(--border)); }
.tblock__rail .area-dot { position: relative; z-index: 1; box-shadow: 0 0 0 4px rgb(var(--surface)); }
.tblock:hover .tblock__rail .area-dot { box-shadow: 0 0 0 4px rgb(var(--surface-2)); }
.tblock__body { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tblock__title { font-size: 14.5px; font-weight: 500; }
.tblock--done .tblock__title { color: rgb(var(--text-3)); text-decoration: line-through; }
.tblock--past { opacity: 0.58; }
.tblock--now { background: rgb(var(--area, var(--primary)) / 0.09); }
.tblock--now .tblock__title { font-weight: 650; }
.tblock__del { opacity: 0; transition: opacity var(--dur-1) var(--ease); }
.tblock:hover .tblock__del { opacity: 1; }

.now-line { position: relative; margin: 9px 0; height: 1px; background: rgb(var(--primary) / 0.5); }
.now-line__dot { position: absolute; left: 68px; top: 50%; transform: translateY(-50%); width: 8px; height: 8px; border-radius: var(--r-full); background: rgb(var(--primary)); box-shadow: 0 0 0 4px rgb(var(--primary) / 0.16); }
.now-line__label { position: absolute; right: 0; top: 50%; transform: translateY(-50%); background: rgb(var(--surface)); padding: 2px 9px; border-radius: var(--r-full); font-size: 11px; font-weight: 700; color: rgb(var(--primary)); border: 1px solid rgb(var(--primary) / 0.3); }

.block-add { display: flex; gap: 8px; align-items: center; margin-top: 16px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid rgb(var(--border)); }
.block-add .input:not(.input--time):not(.input--select) { flex: 1; min-width: 150px; }
.block-add__dash { color: rgb(var(--text-3)); }

/* ======================= Habits ========================================== */
.habit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(232px, 100%), 1fr)); gap: 16px; }
.habit {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 17px 16px 15px;
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border));
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color var(--dur-2) var(--ease), transform var(--dur-2) var(--ease);
}
.habit::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: rgb(var(--area, var(--primary)) / 0.25); transition: background var(--dur-2) var(--ease); }
.habit.is-done::before { background: rgb(var(--area, var(--primary))); }
.habit.is-done { border-color: rgb(var(--area, var(--primary)) / 0.35); }
.habit__top { display: flex; align-items: center; gap: 11px; }
.habit__icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: var(--r-sm); background: rgb(var(--area, var(--primary)) / 0.13); color: rgb(var(--area, var(--primary))); flex: none; }
.habit__id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.habit__name { font-size: 14.5px; font-weight: 600; }
.habit__streak { font-size: 12px; color: rgb(var(--text-3)); display: inline-flex; align-items: center; gap: 4px; }
.habit__streak .icon { color: rgb(var(--home)); }
.habit > .counter { align-self: center; }
.habit > .check-control { justify-content: center; }
.habit__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.habit__stat { font-size: 11.5px; color: rgb(var(--text-3)); }

/* ======================= Week ============================================ */
.week-summary__row { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.week-summary__notes { flex: 1; min-width: 250px; }
.week-summary__list { margin-top: 14px; display: flex; flex-direction: column; gap: 9px; }
.week-summary__list li { display: flex; align-items: center; gap: 9px; font-size: 14px; color: rgb(var(--text-2)); }
.week-summary__list li strong { color: rgb(var(--text)); }
.week-summary__list .icon { color: rgb(var(--primary)); flex: none; }

.area-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(198px, 100%), 1fr)); gap: 16px; margin-top: var(--gap); }
.area-card { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 18px; background: rgb(var(--surface)); border: 1px solid rgb(var(--border)); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); text-align: center; }
.area-card__head { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; }
.area-card__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-sm); background: rgb(var(--area, var(--primary)) / 0.13); color: rgb(var(--area, var(--primary))); flex: none; }
.area-card__name { font-size: 14.5px; font-weight: 650; }
.area-card__blurb { font-size: 12px; }
.area-card__detail { font-size: 12.5px; color: rgb(var(--text-2)); font-weight: 550; }

.week-two { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); margin-top: var(--gap); align-items: start; }
.rhythm { display: flex; flex-direction: column; gap: 3px; }
.rhythm__day { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-sm); transition: background var(--dur-1) var(--ease); }
.rhythm__day:hover { background: rgb(var(--surface-2)); }
.rhythm__dow { font-size: 12.5px; font-weight: 700; color: rgb(var(--text-3)); width: 38px; flex: none; }
.rhythm__focus { font-size: 14px; flex: 1; }
.rhythm__day.is-today { background: rgb(var(--area, var(--primary)) / 0.1); }
.rhythm__day.is-today .rhythm__dow { color: rgb(var(--area, var(--primary))); }
.rhythm__badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: rgb(var(--area, var(--primary))); background: rgb(var(--area, var(--primary)) / 0.14); padding: 2px 8px; border-radius: var(--r-full); }

/* ======================= Life ============================================ */
.goal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: var(--gap); }
.goal { display: flex; flex-direction: column; gap: 12px; }
.goal__head { display: flex; align-items: flex-start; gap: 12px; }
.goal__icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: var(--r-sm); background: rgb(var(--area, var(--primary)) / 0.13); color: rgb(var(--area, var(--primary))); flex: none; }
.goal__id { flex: 1; min-width: 0; }
.goal__title { font-size: 16px; font-weight: 650; }
.goal__tags { display: flex; align-items: center; gap: 10px; margin-top: 7px; flex-wrap: wrap; }
.goal__target { font-size: 12px; color: rgb(var(--text-2)); display: inline-flex; align-items: center; gap: 5px; }
.goal__target .icon { color: rgb(var(--area, var(--primary))); }
.goal__pct { font-size: 22px; font-weight: 700; color: rgb(var(--area, var(--primary))); flex: none; letter-spacing: -0.02em; }
.goal__pct span { font-size: 12px; color: rgb(var(--text-3)); font-weight: 600; }
.goal__count { font-size: 12.5px; }
.ms-list { display: flex; flex-direction: column; gap: 1px; margin-top: 2px; }
.ms { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: var(--r-xs); transition: background var(--dur-1) var(--ease); }
.ms:hover { background: rgb(var(--surface-2)); }
.ms__title { font-size: 14px; }
.ms.is-done .ms__title { color: rgb(var(--text-3)); text-decoration: line-through; }

/* ======================= Settings ======================================== */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: var(--gap); }
.set-card--wide { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 13px; }
.field__label { font-size: 13px; font-weight: 600; color: rgb(var(--text-2)); }
.field__hint { font-size: 12px; }
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; font-size: 14.5px; font-weight: 550; }
.set-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.set-version { text-align: center; margin-top: 28px; font-size: 12.5px; }

/* ======================= Responsive ====================================== */
@media (max-width: 1024px) {
  .today-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .week-two { grid-template-columns: 1fr; }
}

/* Prevent iOS Safari from auto-zooming on focus: any control under 16px
   triggers it. Bump form text to 16px on small screens. */
@media (max-width: 900px) {
  .input, select.input, input.input, textarea.input { font-size: 16px; }
}

@media (max-width: 640px) {
  .hero { gap: 20px; }
  .hero__energy { align-items: flex-start; width: 100%; }
  .hero__energy-hint { text-align: left; }
  .hero__energy .seg { display: flex; width: 100%; }
  .hero__energy .seg__item { flex: 1; justify-content: center; }
  .dash-progress__row { gap: 16px; }
  .page-head__aside { display: none; }
}

/* Comfortable stacking for the two multi-field add forms on phones. */
@media (max-width: 560px) {
  .add-row { flex-wrap: wrap; }
  .add-row .input:not(.input--select) { flex: 1 1 100%; }
  .add-row .input--select { flex: 1; }

  .block-add { flex-direction: column; align-items: stretch; }
  .block-add > * { width: 100%; }
  .block-add__dash { display: none; }
  .block-add .icon-btn { align-self: flex-end; width: auto; padding: 0 18px; }

  /* Life areas read best as a tidy 2‑up grid rather than a long column. */
  .area-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .area-card { padding: 15px; }
  .area-card__blurb { display: none; }
}

/* Larger, finger-friendly hit targets on touch devices (never on desktop). */
@media (hover: none) {
  .task__del, .tblock__del { opacity: 0.55; }
  .check { width: 30px; height: 30px; }
  .check--lg { width: 34px; height: 34px; }
  .icon-btn--mini { width: 34px; height: 34px; }
  .counter__btn--sm { width: 32px; height: 32px; }
}
