/* Homepage. Always dark (Dusk), built on the tokens in styles.css. */

.home {
  --loss: #E8894A;
  --gain: var(--l3);
  --phone-w: 300px;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(91, 104, 230, 0.22), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(60, 46, 140, 0.18), transparent 60%),
    var(--bg);
  background-repeat: no-repeat;
}

.home h2 {
  font-size: clamp(30px, 4.2vw, 46px);
  line-height: 1.04;
  letter-spacing: -0.03em;
  font-weight: 750;
  margin: 0 0 18px;
  text-wrap: balance;
}
.home p { text-wrap: pretty; }

/* Header */
.home .site-header { position: relative; z-index: 2; }
.nav { align-items: center; }
.nav-cta {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent) !important;
  font-weight: 600;
}

/* Hero */
.hero { padding: 8px 0 24px; }
.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 56px;
  align-items: center;
}
.hero h1 {
  font-size: clamp(46px, 7vw, 88px);
  line-height: 0.95;
  letter-spacing: -0.045em;
  font-weight: 800;
  margin: 0 0 22px;
  max-width: 9.5em;
}
.hero .lede {
  font-size: clamp(18px, 1.6vw, 20px);
  color: var(--text-2);
  max-width: 33em;
  margin: 0 0 30px;
}
.get { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.fine { margin: 18px 0 0; font-size: 14px; color: var(--text-3); }

.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 58px;
  padding: 0 22px 0 16px;
  border-radius: 14px;
  background: #000;
  color: #fff;
  text-decoration: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
  transition: transform 0.15s ease;
}
.store-badge:hover { transform: translateY(-1px); }
.store-badge svg { width: 30px; height: 30px; fill: currentColor; margin-top: -3px; }
.store-badge span { display: flex; flex-direction: column; font-size: 23px; font-weight: 600; line-height: 1; letter-spacing: -0.01em; }
.store-badge small { font-size: 11.5px; font-weight: 500; letter-spacing: 0.01em; margin-bottom: 3px; }

.qr {
  display: flex;
  align-items: center;
  gap: 12px;
}
.qr img {
  display: block;
  box-sizing: content-box;
  padding: 8px;
  background: #fff;
  border-radius: 12px;
}
.qr p { margin: 0; font-size: 14px; line-height: 1.35; color: var(--text-2); max-width: 11em; }

/* Phones */
.phone {
  margin: 0;
  width: var(--phone-w);
  flex: none;
  padding: 9px;
  border-radius: 50px;
  background: linear-gradient(160deg, #2C3163, #141730 55%, #1D2142);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.1),
    0 40px 90px -30px rgba(0, 0, 0, 0.75),
    0 0 0 1px rgba(0, 0, 0, 0.4);
}
.phone img { display: block; width: 100%; height: auto; border-radius: 41px; }
.hero-phone { --phone-w: 272px; margin-right: 24px; }

/* Year grid: the hero's centrepiece */
.year { margin: 40px 0 0; }
.year-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.year-title { margin: 0; font-family: var(--display); font-weight: 650; font-size: 20px; letter-spacing: -0.01em; }
.year-stats { display: flex; gap: 32px; margin: 0; }
.year-stats div { display: flex; flex-direction: column-reverse; }
.year-stats dt { font-size: 13px; color: var(--text-3); font-weight: 500; }
.year-stats dd {
  margin: 0;
  font-family: var(--rounded);
  font-weight: 700;
  font-size: 34px;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  min-width: 2.2ch;
}
#stat-streak { color: var(--l4); }

.year-scroll {
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 0 6px;
  margin: 0 -4px;
}
.year-scroll::-webkit-scrollbar { display: none; }
.year-grid { min-width: 700px; padding: 0 4px; }

.months, .tiles {
  display: grid;
  grid-template-columns: repeat(53, minmax(0, 1fr));
  column-gap: clamp(3px, 0.42vw, 5px);
}
.months { margin-bottom: 8px; font-size: 12px; color: var(--text-3); font-weight: 600; }
.months span { white-space: nowrap; }

.tiles {
  grid-template-rows: repeat(7, auto);
  grid-auto-flow: column;
  row-gap: clamp(3px, 0.42vw, 5px);
}
.tiles i {
  display: block;
  aspect-ratio: 1;
  border-radius: 22%;
  background: var(--l0);
}
.tiles i.pad { visibility: hidden; }
.tiles i.on { animation: tile-in 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.3) both; }
.tiles i.on[data-l="1"], .legend i[data-l="1"] { background: var(--l1); }
.tiles i.on[data-l="2"], .legend i[data-l="2"] { background: var(--l2); }
.tiles i.on[data-l="3"], .legend i[data-l="3"] { background: var(--l3); }
.tiles i.on[data-l="4"], .legend i[data-l="4"] { background: var(--l4); }
.tiles:not(.done) i:not(.on):not(.pad) { opacity: 0.55; }
.tiles.done i.today { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--text); }

@keyframes tile-in {
  from { transform: scale(0.3); filter: brightness(1.8); }
  to { transform: scale(1); filter: none; }
}

.legend { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 16px; font-size: 13px; color: var(--text-3); justify-content: flex-start; }
.legend .key { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* Works with */
.works { padding: 72px 0 24px; }
.works-inner { border-top: 1px solid var(--hairline); padding-top: 56px; }
.works h2 { max-width: 15em; }
.devices { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; padding: 0; margin: 8px 0 22px; }
.devices li {
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--hairline);
  font-weight: 600;
  font-size: 16px;
}
.works p { color: var(--text-2); max-width: 36em; margin: 0; }

/* Features */
.feature { padding: 80px 0; }
.feature-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 88px;
  align-items: center;
}
.feature.flip .feature-copy { order: 2; }
.feature-copy { max-width: 560px; }
.feature.flip .feature-inner { grid-template-columns: auto minmax(0, 1fr); }
.feature.flip .feature-copy { justify-self: end; }
.feature-copy > p { color: var(--text-2); font-size: 18px; margin: 0 0 24px; }
.feature .phone { --phone-w: 290px; }

.ticks { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.ticks li { position: relative; padding-left: 26px; color: var(--text); }
.ticks li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.42em;
  width: 13px;
  height: 13px;
  border-radius: 3px;
  background: var(--l4);
}

.score-table { width: 100%; border-collapse: collapse; margin: 4px 0 18px; font-size: 15px; }
.score-table thead th { text-align: left; font-size: 13px; font-weight: 500; color: var(--text-3); padding: 0 0 8px; }
.score-table thead th:last-child, .score-table .pts { text-align: right; }
.score-table tbody th, .score-table td { padding: 13px 0; border-top: 1px solid var(--hairline); vertical-align: top; }
.score-table tbody th { text-align: left; font-weight: 600; padding-right: 18px; white-space: nowrap; }
.score-table td { color: var(--text-2); }
.score-table .pts { font-family: var(--rounded); font-weight: 700; font-size: 20px; color: var(--l4); padding-left: 18px; line-height: 1.1; }
.note { color: var(--text-3); font-size: 15px; margin: 0; }

.habit-chart { margin: 0; padding: 22px 22px 16px; border-radius: 20px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--hairline); }
.hc-row { display: grid; grid-template-columns: 8.5em 1fr 3em; align-items: center; gap: 12px; padding: 7px 0; font-size: 15px; }
.hc-name { font-weight: 600; }
.hc-track { position: relative; height: 12px; }
.hc-track::before { content: ""; position: absolute; left: 50%; top: -6px; bottom: -6px; width: 1px; background: var(--hairline); }
.hc-bar { position: absolute; top: 0; height: 12px; border-radius: 4px; width: calc(var(--v) / 30 * 50%); }
.hc-bar.up { left: 50%; background: var(--gain); }
.hc-bar.down { right: 50%; background: var(--loss); }
.hc-val { text-align: right; font-family: var(--rounded); font-weight: 700; font-variant-numeric: tabular-nums; }
.hc-val.up { color: var(--gain); }
.hc-val.down { color: var(--loss); }
.habit-chart figcaption { margin-top: 10px; font-size: 13px; color: var(--text-3); }

/* Privacy */
.private { padding: 56px 0; }
.private-inner { text-align: center; }
.private h2 { margin-left: auto; margin-right: auto; }
.private p { color: var(--text-2); font-size: 18px; margin: 0 auto; max-width: 34em; }

/* FAQ */
.faq { padding: 56px 0 40px; }
.faq h2 { margin-bottom: 22px; }
.faq details { background: var(--surface); padding: 16px 20px; }
.faq summary { font-size: 17px; }
.faq details p { color: var(--text-2); }
.faq .more { color: var(--text-3); margin-top: 20px; }

/* Closing */
.closing { padding: 40px 0 96px; }
.closing-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 40px;
  padding: 48px 56px;
  border-radius: 32px;
  background:
    radial-gradient(500px 300px at 100% 0%, rgba(86, 211, 100, 0.12), transparent 70%),
    var(--surface);
  box-shadow: inset 0 0 0 1px var(--hairline);
}
.closing h2 { font-size: clamp(34px, 4.6vw, 54px); }
.closing-copy p { color: var(--text-2); font-size: 18px; max-width: 30em; margin: 0 0 28px; }
.qr-large { flex-direction: column; gap: 12px; flex: none; }
.qr-large img { padding: 14px; border-radius: 18px; }
.qr-large p { text-align: center; max-width: none; }

/* Footer */
.home .site-footer .wrap { padding-top: 4px; }

/* Phones can't scan their own screen, so drop the QR codes there. */
@media (max-width: 860px), (hover: none) and (pointer: coarse) {
  .hero .qr, .qr-large { display: none; }
}

@media (max-width: 960px) {
  .hero-inner, .feature-inner, .feature.flip .feature-inner { grid-template-columns: 1fr; gap: 48px; }
  .hero-phone { --phone-w: 260px; justify-self: center; }
  .feature { padding: 56px 0; }
  .feature.flip .feature-copy { order: 0; justify-self: start; }
  .feature .phone { --phone-w: 260px; justify-self: center; }
  .feature-copy { max-width: none; }
  .closing-inner { padding: 36px 28px; }
}

@media (max-width: 560px) {
  .nav a:not(.nav-cta):not([href="#faq"]) { display: none; }
  .hero { padding-top: 16px; }
  .year { margin-top: 48px; }
  .year-stats { gap: 22px; }
  .year-stats dd { font-size: 28px; }
  .score-table thead { display: none; }
  .score-table tbody th { display: block; padding-bottom: 2px; border-top: 1px solid var(--hairline); }
  .score-table td { border-top: 0; padding-top: 0; }
  .score-table tr { display: grid; grid-template-columns: 1fr auto; }
  .score-table tbody th { grid-column: 1; }
  .score-table .pts { grid-column: 2; grid-row: 1; border-top: 1px solid var(--hairline); padding-top: 13px; }
  .score-table td:not(.pts) { grid-column: 1 / -1; padding-bottom: 13px; }
  .hc-row { grid-template-columns: 7em 1fr 2.6em; gap: 8px; }
  .habit-chart { padding: 18px 16px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .tiles i.on { animation: none; }
  .store-badge { transition: none; }
}
