/* Home (the hub). Tokens, buttons, the gate and modals come from tokens.css
   and app.css; navigation from ui.css. This file is the morning page itself:
   the greeting, the cards and the destination tiles. */

.hub-boot { display: grid; place-items: center; min-height: 100vh; color: var(--subtle); }
.hub-main { max-width: 1180px; margin: 0 auto; padding: 26px 24px 60px; }
.hub-top { padding-top: 10px; padding-bottom: 10px; }

/* ---- greeting, on the full hero art ----
   The cinematic night at full strength, a 3:1 frame like the original Home
   banner; the greeting sits on its dark lower left so the art still leads. */
.hub-hero {
  position: relative; overflow: hidden; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); aspect-ratio: 3 / 1; min-height: 220px; display: flex; align-items: flex-end;
}
.hub-hero-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 38% 58%; }
.hub-hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(5, 5, 5, 0) 35%, rgba(5, 5, 5, .78) 100%),
    linear-gradient(90deg, rgba(5, 5, 5, .55) 0%, rgba(5, 5, 5, 0) 55%);
}
@media (max-width: 720px) { .hub-hero { aspect-ratio: 4 / 3; } }
.hub-hero-in { position: relative; z-index: 1; padding: 26px 28px; text-shadow: 0 2px 18px rgba(0, 0, 0, .65); }
.hub-date { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-soft); }
.hub-h1 { margin: 8px 0 6px; font-size: clamp(28px, 4.2vw, 40px); font-weight: 800; letter-spacing: -0.8px; line-height: 1.1; }
.hub-h1 #nameBtn { background: none; border: none; padding: 0; font: inherit; color: var(--text); cursor: pointer; border-bottom: 1px dashed transparent; }
.hub-h1 #nameBtn:hover { border-bottom-color: var(--accent-line); }
.hub-sub { margin: 0; color: var(--subtle); font-size: 15px; }

/* ---- cards ----
   Data cards share the width two or three to a row; the business strip, the
   tiles and the banner always take a full row. Order is the owner's. */
.home { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap-lg); margin-top: var(--gap-lg); }
.hc { min-width: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px 20px; }
/* Full-width cards, and a data card left alone in its row (hub.js balance). */
.hc-business, .hc-places, .hc-art, .hc.wide { grid-column: 1 / -1; }
.hc-places { background: none; border: 0; padding: 6px 0 0; }
.hc-h { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.hc-h h2 { margin: 0; flex: 1; font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--subtle); }
.hc-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--accent-soft); text-decoration: none; padding: 4px 8px; margin: -4px -8px; border-radius: 8px; }
.hc-link:hover { background: var(--accent-wash); color: #fff; }
.hc-b { flex: 1; display: flex; flex-direction: column; gap: 14px; }
/* Two cards side by side are the same height; each card's main block grows
   to fill it, so neither has an empty band at the bottom. */
.hc-today .today-grid, .hc-money .hs-grid, .hc-freedom .hs-grid { flex: 1; }
.hc-life .ach { flex: 1; grid-auto-rows: 1fr; }
.hc.wide .hs-grid.two { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.hc-load { color: var(--subtle-2); font-size: 13.5px; min-height: 60px; }
.hc-err { margin: 0; color: var(--negative); font-size: 13.5px; }
.hc-note { margin: 0; color: var(--subtle); font-size: 13.5px; }

.hc-lead { display: grid; gap: 4px; }
.hc-big { font-size: clamp(32px, 4vw, 42px); font-weight: 800; letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.hc-row { display: grid; gap: 7px; }
.hc-row-h { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.hs { display: grid; gap: 3px; min-width: 0; padding: 11px 12px; border-radius: 12px; background: var(--bg-0); border: 1px solid var(--line); }
.hs-k { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--subtle-2); }
.hs-v { font-size: 19px; font-weight: 750; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hs-s { font-size: 12.5px; color: var(--subtle); }
.hs.warn .hs-v { color: var(--warning); }
.hs-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.hs-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.prog { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.prog > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent-deep), var(--accent-soft)); transition: width .5s ease; }
.chip.ok { background: rgba(52, 211, 153, .14); color: var(--positive); }
.chip.bad { background: rgba(248, 113, 113, .14); color: var(--negative); }

/* Today */
.today-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.today-tile { display: grid; gap: 4px; align-content: start; padding: 12px 14px; border-radius: 12px; background: var(--bg-0); border: 1px solid var(--line); color: inherit; text-decoration: none; transition: border-color .15s; }
.today-tile:hover { border-color: var(--accent-line); }
.today-t { font-size: 18px; font-weight: 750; line-height: 1.3; }
/* The action sits on the tile's bottom edge, so a tall tile reads full. */
.today-go { margin-top: auto; padding-top: 12px; font-size: 13px; font-weight: 650; color: var(--accent-soft); }
.today-tile { display: flex; flex-direction: column; gap: 4px; }
.today-t.ok { color: var(--positive); }
.alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.al a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; font-size: 14px; font-weight: 550; background: var(--bg-0); border: 1px solid var(--line); }
.al a::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--accent); }
.al.bad a { border-color: rgba(248, 113, 113, .4); } .al.bad a::before { background: var(--negative); }
.al.warn a { border-color: rgba(251, 191, 36, .35); } .al.warn a::before { background: var(--warning); }
.al a:hover { border-color: var(--accent-line); }

/* Life */
.ach { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ach li { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; background: var(--bg-0); border: 1px solid var(--line); }
.ach-i { font-size: 20px; width: 28px; text-align: center; }
.ach-t { display: grid; gap: 1px; font-size: 12.5px; color: var(--subtle); }
.ach-t b { font-size: 14px; color: var(--text); font-weight: 650; }

/* ---- businesses: each against its next rung ---- */
/* As many columns as businesses (up to four), so the strip is always full. */
.hub-biz { display: grid; grid-template-columns: repeat(var(--bn, 3), minmax(0, 1fr)); gap: 12px; }
.hub-biz.n-1 { --bn: 1; } .hub-biz.n-2 { --bn: 2; } .hub-biz.n-3 { --bn: 3; } .hub-biz.n-4 { --bn: 4; }
.hub-biz a:has(.v.unknown) { align-content: start; }
@media (max-width: 1023px) { .hub-biz.n-3 { --bn: 1; } .hub-biz.n-4 { --bn: 2; } }
.hub-biz a { display: grid; gap: 10px; padding: 16px 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg-0); text-decoration: none; color: inherit; transition: border-color .15s; }
.hub-biz a:hover { border-color: var(--accent-line); }
.hub-biz .hd { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.hub-biz .k { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text); display: flex; align-items: center; gap: 7px; }
.hub-biz .k i { width: 8px; height: 8px; border-radius: 3px; display: inline-block; }
.hub-biz .g { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--subtle-2); }
.hub-biz .num { display: flex; align-items: baseline; gap: 8px; }
.hub-biz .v { font-size: clamp(30px, 3.6vw, 40px); font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.hub-biz .v.unknown { font-size: clamp(22px, 2.6vw, 28px); color: var(--subtle-2); font-weight: 700; line-height: 1.25; }
.prog.prog-none { background: repeating-linear-gradient(90deg, rgba(255,255,255,.07) 0 8px, transparent 8px 12px); }
.hub-biz .of { font-size: 17px; font-weight: 700; color: var(--subtle-2); font-variant-numeric: tabular-nums; }
.hub-biz .pct { margin-left: auto; font-size: 20px; font-weight: 800; color: var(--accent-soft); font-variant-numeric: tabular-nums; }
.hub-biz .cells { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hub-biz .c { display: grid; gap: 2px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.hub-biz .c b { font-size: 15px; font-weight: 750; font-variant-numeric: tabular-nums; }
.hub-biz .c.goal b { color: var(--accent-soft); }
.hub-biz .c em { font-style: normal; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--subtle-2); }

/* ---- destination tiles ----
   Each row is an even grid with as many columns as it has tiles (hub.js
   TILE_ROWS), never spans. Tablets fold rows to two across, phones to one. */
.hc-sec { margin: 22px 0 10px; font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--subtle); }
.hc-sec:first-child { margin-top: 4px; }
.hub-row { display: grid; gap: var(--gap); grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); }
.hub-row.cols-1 { --cols: 1; } .hub-row.cols-2 { --cols: 2; } .hub-row.cols-3 { --cols: 3; }
.hub-row.cols-4 { --cols: 4; } .hub-row.cols-5 { --cols: 5; } .hub-row.cols-6 { --cols: 6; }
@media (max-width: 1023px) { .hub-row.cols-4, .hub-row.cols-6, .hub-row.cols-3, .hub-row.cols-5 { --cols: 2; } }
@media (max-width: 640px) { .hub-row[class] { --cols: 1; } }

.tile {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  text-decoration: none; color: inherit; transition: border-color .18s ease, transform .18s ease;
}
.tile:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile-art { position: relative; aspect-ratio: 16 / 7; overflow: hidden; background: var(--bg-0); }
.tile-art img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .88; transition: transform 1.1s ease; }
.tile:hover .tile-art img { transform: scale(1.04); }
.tile-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(5, 5, 5, 0) 45%, var(--surface) 100%); }
.tile-body { flex: 1; display: grid; gap: 5px; align-content: start; padding: 12px 16px 16px; }
.tile-name { font-size: 17px; font-weight: 700; letter-spacing: -.2px; }
.tile-desc { margin: 0; color: var(--subtle); font-size: 13.5px; line-height: 1.45; }
@media (max-width: 640px) {
  /* One per row: a short art strip beside the words, not a tall poster. */
  .tile { flex-direction: row; align-items: stretch; }
  .tile-art { aspect-ratio: auto; width: 34%; flex: none; }
  .tile-art::after { background: linear-gradient(90deg, rgba(5, 5, 5, 0) 50%, var(--surface) 100%); }
  .tile-body { padding: 12px 14px; }
}

/* ---- closing banner ---- */
.hub-banner { position: relative; overflow: hidden; aspect-ratio: 4 / 1; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.hub-banner img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: 50% 52%; opacity: .9; }
@media (max-width: 720px) { .hub-banner { aspect-ratio: 16 / 9; } }

.hub-foot { margin-top: var(--section-gap); color: var(--subtle-2); font-size: 12.5px; max-width: 60ch; }

/* ---- Customize ---- */
.cz-list { list-style: none; margin: 14px 0 6px; padding: 0; display: grid; gap: 6px; }
.cz-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--bg-0); border: 1px solid var(--line); }
.cz-row.off .cz-lab span:last-child { color: var(--subtle-2); }
.cz-lab { flex: 1; display: flex; align-items: center; gap: 12px; font-weight: 600; cursor: pointer; min-height: 40px; }
.cz-row .iconbtn { width: 40px; height: 40px; padding: 0; font-size: 16px; }
.cz-row .iconbtn:disabled { opacity: .3; cursor: default; }

@media (prefers-reduced-motion: reduce) { .tile, .tile-art img, .prog > i { transition: none; } }

/* ---- phones ---- */
@media (max-width: 899px) { .home { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .hub-main { padding: 14px max(14px, env(safe-area-inset-right)) 40px max(14px, env(safe-area-inset-left)); }
  .home { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .hc { padding: 16px; }
  .hub-hero-in { padding: 20px; }
  .hs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hs-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .hub-biz[class] { --bn: 1; }
  .hc.wide .hs-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.hub-biz a { align-content: space-between; }

/* Today: the money goal, one line per focus business. */
.goal-line { display: flex; align-items: baseline; gap: 8px; font-size: 15px; font-weight: 650; margin-top: 4px; }
.goal-line i { width: 8px; height: 8px; border-radius: 3px; flex: none; align-self: center; }
.goal-line b { font-weight: 750; }
.goal-line span { margin-left: auto; color: var(--accent-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.goal-then { margin: -2px 0 4px 16px; font-size: 12px; }

/* ---- art bands between the tile rows ----
   The full-width frames from the original Home, one above each row. */
.hub-divider {
  position: relative; overflow: hidden; aspect-ratio: 48 / 11; margin: 22px 0 0;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.hub-divider img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: 50% 58%; opacity: .92; }
.hub-divider.second img { object-position: 50% 46%; }
.hub-divider.third img { object-position: 50% 82%; } /* the lone figure sits low; keep him in frame */
.hub-divider.fourth img { object-position: 50% 55%; }
.hub-divider::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(5, 5, 5, .3) 0%, rgba(5, 5, 5, 0) 40%, rgba(5, 5, 5, .55) 100%); }
.hub-divider + .hc-sec { margin-top: 14px; }
@media (max-width: 1023px) { .hub-divider { aspect-ratio: 32 / 11; } }
@media (max-width: 640px) { .hub-divider { aspect-ratio: 16 / 9; } }
/* Phones: Today's tiles stack, so the money goal lines read on one line each. */
@media (max-width: 560px) { .today-grid { grid-template-columns: minmax(0, 1fr); } .today-tile { min-height: 0; } }
