/* Home, the practice (spec/home.md; App/JournalView.swift): the amber wash, the greeting, This week,
   the support row, the six tool tiles, the instrument chip in the title row and its picker. */

:root {
  --home-quote: #5E4E3E;                          /* the quote line, warm to read on the wash */
  --home-avatar: #FFFFFF;
  --home-avatar-edge: transparent;
  --home-avatar-shadow: 0 1px 3px rgba(61, 41, 10, 0.14);
  --home-ink-08: rgba(0, 0, 0, 0.068);            /* primary × 8 % */
  --home-ink-10: rgba(0, 0, 0, 0.085);            /* primary × 10 % */
  --home-ink-18: rgba(0, 0, 0, 0.153);            /* primary × 18 % */
  --home-lit-ink-75: rgba(30, 18, 3, 0.75);       /* selectedInk × 75 % */
  --home-tile-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  --home-wash-top: #FFC062;
  --home-wash: linear-gradient(#FFC062 0%, #FFD596 35.1%, #FFE9C9 70.2%, #F2F2F7 100%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --home-quote: rgba(255, 255, 255, 0.78);
    --home-avatar: #2C2C2E;
    --home-avatar-edge: rgba(255, 255, 255, 0.1);
    --home-avatar-shadow: 0 0 0 0 transparent;
    --home-ink-08: rgba(255, 255, 255, 0.068);
    --home-ink-10: rgba(255, 255, 255, 0.085);
    --home-ink-18: rgba(255, 255, 255, 0.153);
    --home-wash-top: rgba(255, 170, 31, 0.62);
    --home-wash: linear-gradient(rgba(255, 170, 31, 0.62) 0%, rgba(255, 170, 31, 0.38) 37.3%, rgba(255, 170, 31, 0.16) 72.4%, rgba(255, 170, 31, 0) 100%);
  }
}

:root[data-theme="dark"] {
  --home-quote: rgba(255, 255, 255, 0.78);
  --home-avatar: #2C2C2E;
  --home-avatar-edge: rgba(255, 255, 255, 0.1);
  --home-avatar-shadow: 0 0 0 0 transparent;
  --home-ink-08: rgba(255, 255, 255, 0.068);
  --home-ink-10: rgba(255, 255, 255, 0.085);
  --home-ink-18: rgba(255, 255, 255, 0.153);
  --home-wash-top: rgba(255, 170, 31, 0.62);
  --home-wash: linear-gradient(rgba(255, 170, 31, 0.62) 0%, rgba(255, 170, 31, 0.38) 37.3%, rgba(255, 170, 31, 0.16) 72.4%, rgba(255, 170, 31, 0) 100%);
}

/* ---------------------------------------------------------------- the page and its wash */

.home-page { position: relative; }

/* From 58 above the content to 9 under the support row (height set from the measure), its top
   colour running on 800 up under the title row; the whole window wide, under the sidebar glass. */
.home-wash {
  position: absolute; z-index: 0;
  top: -58px; left: calc(-1 * (var(--sidebar-w) + 8px)); right: 0;
  height: 457px;
  background: var(--home-wash);
  pointer-events: none;
}
.home-wash::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 100%;
  height: 800px;
  background: var(--home-wash-top);
}
@media (max-width: 639px) {
  .home-wash { left: 0; }
}

/* The 760 column, 16 either side. */
.home-col {
  position: relative; z-index: 1;
  max-width: calc(760px + 32px);
  margin: 0 auto;
  padding: 4px 16px 8px;
}
/* The soft top edge: what passes under the title row fades out there. */
.home-col.home-scrolled {
  -webkit-mask-image: linear-gradient(to bottom, transparent calc(var(--home-st, 0px) - 14px), #000 calc(var(--home-st, 0px) + 10px));
  mask-image: linear-gradient(to bottom, transparent calc(var(--home-st, 0px) - 14px), #000 calc(var(--home-st, 0px) + 10px));
}

.home-above { display: flex; flex-direction: column; gap: 18px; }

.home-card {
  background: var(--row);
  border-radius: 22px;
  corner-shape: squircle;
}

/* ---------------------------------------------------------------- greeting */

.home-greeting { display: flex; align-items: center; gap: 12px; }
.home-avatar {
  flex: none;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--home-avatar);
  box-shadow: var(--home-avatar-shadow), inset 0 0 0 1px var(--home-avatar-edge);
  color: var(--label-2);
}
.home-avatar .icon { width: 20px; height: 20px; }
/* The account's picture (views/account.js), on a phone only: wider, the sidebar holds it. */
.home-avatar.account-avatar-button { padding: 0; overflow: hidden; }
.home-avatar .account-avatar { --avatar: 44px; background: transparent; color: inherit; }
.home-avatar .account-avatar.signed-in { background: var(--accent); color: var(--on-accent); }
.home-avatar .account-avatar .icon { width: 20px; height: 20px; margin: 0; }
@media (min-width: 640px) { .home-avatar.account-avatar-button { display: none; } }
.home-greeting-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.home-hello {
  margin: 0;
  font-size: calc(15px * var(--text-scale)); font-weight: 700; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Always two lines' room, so a one-line day moves nothing under it. */
.home-quote {
  margin: 0;
  font-size: calc(11px * var(--text-scale)); line-height: 1.3;
  color: var(--home-quote);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden;
  min-height: 2.6em;
}
.home-quote.home-measuring { display: block; -webkit-line-clamp: unset; min-height: 0; }
.home-q { quotes: none; }
.home-q::before, .home-q::after { content: none; }
.home-by { font-style: normal; font-weight: 600; }

/* ---------------------------------------------------------------- This week */

.home-week { display: flex; flex-direction: column; gap: 10px; padding: 16px; overflow: hidden; }

.home-week-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.home-week-title { margin: 0; flex: none; font: inherit; }
.home-week-link {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--label);
  font-size: calc(13px * var(--text-scale)); font-weight: 700;
}
.home-week-link:active { opacity: 0.6; }
.home-chev { width: 10px; height: 10px; stroke-width: 3; }
:root[dir="rtl"] .home-chev { transform: scaleX(-1); }
.home-week-link .home-chev { color: var(--label-2); }
.home-week-gap { flex: 1 0 8px; }
.home-week-status {
  flex: 0 1 auto; min-width: 0;
  display: flex; align-items: baseline; gap: 4px;
  font-size: calc(11px * var(--text-scale)); font-weight: 600;
  color: var(--label-2);
  white-space: nowrap; overflow: hidden;
}
.home-add-goal, .home-praise { color: var(--accent); }
.home-add-goal:active { opacity: 0.6; }

/* The chain: seven cells a ball wide, the first and last at the ends. */
.home-chain { display: flex; flex-direction: column; gap: 4px; }
.home-chain-row { position: relative; display: flex; justify-content: space-between; align-items: center; }
.home-chain-cell { position: relative; z-index: 1; flex: none; display: flex; justify-content: center; align-items: center; }
.home-chain-letters span { font-size: calc(10px * var(--text-scale)); font-weight: 600; line-height: 1.2; color: var(--label-2); white-space: nowrap; }
.home-chain-letters span.today { font-weight: 700; color: var(--label); }
.home-chain-line { position: absolute; z-index: 0; top: 0; inset-inline-start: -16px; line-height: 0; pointer-events: none; }
.home-chain-line svg { display: block; }
:root[dir="rtl"] .home-chain-line svg { transform: scaleX(-1); }
.home-chain-line .grey { fill: var(--home-ink-10); }
.home-chain-line .acc { fill: var(--accent); }
.home-chain-line .fillcard { fill: var(--row); }
.home-chain-line .acc20 { fill: color-mix(in srgb, var(--accent) 20%, transparent); }

.home-ball { display: block; overflow: visible; }
.home-ball .acc { fill: var(--accent); }
.home-ball .gray { fill: var(--gray3); }
.home-ball .fillcard { fill: var(--row); }
.home-ball .acc10 { fill: color-mix(in srgb, var(--accent) 10%, transparent); }
.home-ball .acc45-stroke { fill: none; stroke: color-mix(in srgb, var(--accent) 45%, transparent); }
.home-ball .acc20-stroke { fill: none; stroke: color-mix(in srgb, var(--accent) 20%, transparent); }
.home-ball .acc-stroke { fill: none; stroke: var(--accent); stroke-linecap: round; stroke-linejoin: round; }
.home-ball .ink18-stroke { fill: none; stroke: var(--home-ink-18); }
.home-ball .ink-stroke { fill: none; stroke: var(--on-accent); stroke-linecap: round; stroke-linejoin: round; }

/* Goals, Journal, Calendar, Stats. */
.home-shortcuts { display: flex; gap: 8px; }
.home-shortcut {
  flex: 1 1 0; min-width: 0; min-height: 48px;
  padding: 4px 2px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border-radius: 14px;
  background: var(--fill);
  color: var(--label);
}
.home-shortcut:active { opacity: 0.7; }
.home-shortcut-icon { height: 20px; display: grid; place-items: center; color: var(--accent); }
.home-shortcut-icon .icon { width: 19px; height: 19px; stroke-width: 2; }
.home-shortcut-title {
  max-width: 100%;
  font-size: calc(10px * var(--text-scale)); font-weight: 600; line-height: 1.2;
  white-space: nowrap; overflow: hidden;
}

/* ---------------------------------------------------------------- support row */

.home-support {
  margin-top: -8px;
  width: 100%;
  padding: 10px;
  display: flex; align-items: center; gap: 12px;
  text-align: start;
  color: var(--label);
}
.home-support:active { opacity: 0.7; }
.home-support-heart {
  flex: none;
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-15);
  color: var(--accent);
}
.home-support-heart .icon { width: 13px; height: 13px; }
.home-support-text {
  flex: 0 1 auto; min-width: 0;
  font-size: calc(11px * var(--text-scale)); font-weight: 600; line-height: 1.3;
  white-space: nowrap; overflow: hidden;
}
.home-support-text.wrap { white-space: normal; }
.home-support-gap { flex: 1 0 0; }
.home-support-chev { flex: none; color: var(--label-3); }

/* ---------------------------------------------------------------- Tools */

.home-tools-title { margin: 0; font-size: calc(15px * var(--text-scale)); font-weight: 700; line-height: 1.25; }

.home-tiles {
  --home-tile-h: 120px;
  --home-tile-scale: 1;
  --home-title-lines: 1;
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(var(--home-columns, 2), minmax(0, 1fr));
  gap: 10px;
}

/* Tall: the disc at the top, the words at the foot. Short: side by side. */
.home-tile {
  position: relative;
  height: var(--home-tile-h);
  min-width: 0;
  padding: 12px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  border-radius: 22px;
  corner-shape: squircle;
  background: var(--row);
  box-shadow: var(--home-tile-shadow);
  color: var(--label);
  text-align: start;
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
}
.home-tile:active { opacity: 0.75; }
.home-tile.short { flex-direction: row; align-items: center; gap: 10px; padding-block: 0; }
.home-tile.lit { background: var(--lit-tile); color: var(--on-accent); box-shadow: none; }

.home-tile-disc {
  flex: none;
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-15);
  color: var(--accent);
}
.home-tile.lit .home-tile-disc { background: var(--row); }
/* The narrowest phones (home.js toolTileText): a smaller disc and padding, so the words fit. */
.home-tiles.compact .home-tile { padding: 10px; }
.home-tiles.compact .home-tile.short { padding-block: 0; gap: 8px; }
.home-tiles.compact .home-tile-disc { width: 32px; height: 32px; }
.home-tile-metronome { width: 21px; height: 21px; }
.home-tile-tuner { width: 20px; height: 20px; stroke-width: 2.1; }

.home-tile-labels {
  margin-top: auto;
  max-width: 100%; min-width: 0;
  display: flex; flex-direction: column; gap: 1px;
}
.home-tile.short .home-tile-labels { margin-top: 0; flex: 1; }
.home-tile-title {
  font-size: calc(17px * var(--home-tile-scale));
  font-weight: 600; line-height: 1.2;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: var(--home-title-lines);
  overflow: hidden;
}
.home-tiles:not(.two-lines) .home-tile-title { white-space: nowrap; text-overflow: ellipsis; display: block; }
.home-tile-status {
  font-size: calc(15px * var(--home-tile-scale));
  line-height: 1.25;
  color: var(--label-2);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden;
}
.home-tile.lit .home-tile-status { color: var(--home-lit-ink-75); }
.home-tile-pause { display: inline-block; width: 0.7em; height: 0.7em; margin-inline-end: 3px; vertical-align: -0.02em; }

/* ---------------------------------------------------------------- the instrument chip (title row) */

.home-chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px;
  padding-inline: 12px 14px;
  border-radius: 999px;
  background: var(--row);
  box-shadow: inset 0 0 0 1px var(--home-ink-08);
  color: var(--label);
  white-space: nowrap;
}
.home-chip:active { opacity: 0.7; }
.home-chip .home-inst-icon { color: var(--accent); }
.home-chip-name { font-size: calc(13px * var(--text-scale)); font-weight: 700; }
.home-chip-plus { display: grid; place-items: center; color: var(--accent); }
.home-chip-plus .icon { width: 11px; height: 11px; stroke-width: 3; }
.home-chip-chevron { width: 10px; height: 10px; stroke-width: 3; color: var(--label-2); }

.home-inst-icon { flex: none; display: inline-grid; place-items: center; }
.home-inst-icon svg { overflow: visible; }
.home-inst-symbol { stroke-width: 1.8; }

/* The picker: a popover under the chip, 312 wide. */
.bubble.home-picker { padding: 14px; }
.home-picker-body { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.home-picker-heading { margin: 0; font-size: calc(11px * var(--text-scale)); font-weight: 600; color: var(--label-2); text-align: center; }
.home-picker-grid {
  width: 100%;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: 6px; row-gap: 12px; align-items: start;
}
.home-picker-cell { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--label); }
.home-picker-cell:active .home-picker-disc { opacity: 0.75; }
.home-picker-disc {
  width: 54px; height: 54px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--chip);
}
.home-picker-cell.selected .home-picker-disc { background: var(--accent); color: var(--on-accent); }
.home-picker-name {
  max-width: 100%;
  font-size: calc(10px * var(--text-scale)); font-weight: 600; line-height: 1.2; text-align: center;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden;
}
.home-picker-month {
  width: 100%;
  display: flex; align-items: baseline; gap: 12px;
  padding-top: 12px;
  border-top: 0.5px solid var(--hairline);
  font-size: calc(10px * var(--text-scale)); color: var(--label-2);
}
.home-picker-month-list { flex: 1; text-align: end; }

/* ---------------------------------------------------------------- Home's pushed pages */

.home-pushed { position: relative; }
.home-pushed-missing { margin: 0; padding: 24px; color: var(--label-2); }
