/*
 * The home page (2026-10-23): what Karmatica does, for people and for search engines. Builds
 * on styles.css's tokens. The Today illustration reuses the app's Today artboard: 18 px rows
 * with a hairline border, 44 px tinted tiles, the slim teal-to-blue bar and the round +1.
 * It lives in its own file because styles.css is cached for a week.
 */

:root {
  --track: #e1eaf4;
  --gradient: linear-gradient(90deg, #00e6c7, #007bff);
  --phone-frame: #0b1f4b;
  --plus-bg: #e8f6ff;
  --plus-text: #0063d6;
  --done: #00e6c7;
  --plan-plus: linear-gradient(160deg, #e8f6ff, #ddfaf4);
}

/* Dark follows the device unless someone picked a theme with the header button (theme.js,
   2026-11-23), which sets data-theme on <html>. The two blocks hold the same values. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --track: rgba(169, 187, 218, 0.22);
    --phone-frame: #000b24;
    --plus-bg: rgba(93, 177, 255, 0.16);
    --plus-text: #5db1ff;
    --plan-plus: linear-gradient(160deg, rgba(0, 123, 255, 0.22), rgba(0, 230, 199, 0.12));
  }
}

:root[data-theme='dark'] {
  --track: rgba(169, 187, 218, 0.22);
  --phone-frame: #000b24;
  --plus-bg: rgba(93, 177, 255, 0.16);
  --plus-text: #5db1ff;
  --plan-plus: linear-gradient(160deg, rgba(0, 123, 255, 0.22), rgba(0, 230, 199, 0.12));
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 30;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--action);
  color: var(--text-on-action);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

section[id] {
  scroll-margin-top: 16px;
}

/* Hero */

.hero-facts {
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-facts li {
  font-size: 14px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
}

/* The Today illustration */

.phone {
  margin: 0;
  justify-self: center;
  width: min(100%, 340px);
  padding: 10px;
  border-radius: 44px;
  background: var(--phone-frame);
  box-shadow: var(--shadow);
}

.phone-screen {
  border-radius: 34px;
  background: var(--bg);
  padding: 22px 14px 18px;
  display: grid;
  gap: 10px;
}

.ph-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ph-date {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.ph-karma {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.ph-greeting {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  line-height: 1.2;
}

.ph-sub {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.ph-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px;
}

.ph-summary {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ph-ring {
  flex-shrink: 0;
}

.ph-ring circle {
  fill: none;
  stroke-width: 7;
}

.ph-ring-track {
  stroke: var(--track);
}

.ph-ring-fill {
  stroke-linecap: round;
}

.ph-ring text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  fill: var(--text);
}

.ph-card-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.ph-karma-line {
  margin: 4px 0 0;
  font-size: 12px;
  font-weight: 700;
}

.ph-section {
  margin: 6px 0 0;
  font-size: 15px;
  font-weight: 700;
}

.ph-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 10px 10px 10px 12px;
}

.ph-tile {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.ph-tile svg,
.ph-done svg {
  fill: none;
  stroke: var(--text);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ph-text {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 3px;
}

.ph-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
}

.ph-muted {
  margin: 0;
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.3;
}

.ph-segments {
  display: flex;
  gap: 3px;
  margin-top: 2px;
}

.ph-segments i {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: var(--track);
}

.ph-segments i.on {
  background: var(--gradient);
}

.ph-bar {
  display: block;
  height: 5px;
  border-radius: 3px;
  background: var(--track);
  overflow: hidden;
  margin-top: 2px;
}

.ph-bar-fill {
  display: block;
  width: 75%;
  height: 100%;
  border-radius: 3px;
  background: var(--gradient);
}

.ph-plus {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--plus-bg);
  color: var(--plus-text);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.ph-percent {
  width: 40px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.ph-start {
  font-size: 12px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--action);
  color: var(--text-on-action);
  flex-shrink: 0;
}

.ph-done {
  width: 26px;
  height: 26px;
  margin: 5px;
  border-radius: 50%;
  background: var(--done);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.ph-done svg {
  stroke: #0b1f4b;
  stroke-width: 2.6;
}

.ph-title-done {
  color: var(--text-muted);
}

.ph-earned {
  font-size: 13px;
  font-weight: 700;
  color: var(--success);
  padding-right: 6px;
}

/* Sections */

.block {
  padding: 48px 0;
  border-top: 1px solid var(--border);
}

.block h2,
.closing h2 {
  font-size: clamp(28px, 5vw, 38px);
  line-height: 1.15;
  max-width: 22ch;
}

.block-lede {
  margin: 12px 0 0;
  max-width: 40rem;
  color: var(--text-muted);
  font-size: 18px;
}

h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
}

/* How a day works */

.steps {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
  display: grid;
  gap: 16px;
  counter-reset: step;
}

.step,
.feature,
.plan {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 22px;
  box-shadow: var(--shadow);
}

.step h3 {
  margin-top: 14px;
}

.step p,
.feature p {
  margin: 8px 0 0;
  font-size: 16px;
  color: var(--text-muted);
}

.step-icon,
.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-tile);
  display: grid;
  place-items: center;
}

.feature-icon {
  width: 44px;
  height: 44px;
}

.step-icon svg,
.feature-icon svg {
  fill: none;
  stroke: var(--text);
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Features and privacy */

.features,
.privacy {
  margin-top: 28px;
  display: grid;
  gap: 16px;
}

.feature h3 {
  margin-top: 14px;
}

/* Health spotlight */

.spotlight {
  display: grid;
  gap: 28px;
  align-items: center;
}

.spotlight-copy > p {
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 18px;
  max-width: 36rem;
}

.spotlight-art {
  display: grid;
  gap: 12px;
  padding: 24px;
  border-radius: var(--radius-card);
  background: var(--halo-one);
}

.ph-row-large {
  padding: 14px 14px 14px 16px;
}

.ph-row-large .ph-tile {
  width: 44px;
  height: 44px;
  border-radius: 14px;
}

.ph-row-large .ph-title {
  font-size: 16px;
}

.ph-row-large .ph-muted {
  font-size: 13px;
}

.ph-row-large .ph-bar {
  height: 6px;
}

.ph-row-large .ph-percent {
  width: 44px;
  font-size: 14px;
}

.checks {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.checks li {
  position: relative;
  padding-left: 30px;
  font-size: 16px;
}

/* A teal tick before each line, drawn in CSS so the list stays plain text. */
.checks li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--tint-health);
}

.checks li::after {
  content: '';
  position: absolute;
  left: 7px;
  top: 7px;
  width: 5px;
  height: 9px;
  border: solid var(--success);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.spotlight-copy > .fine-print {
  font-size: 14px;
}

/* Plans */

.plans {
  margin-top: 28px;
  display: grid;
  gap: 16px;
}

.plan h3 {
  font-family: var(--font-display);
  font-size: 22px;
}

.plan-lede {
  margin: 6px 0 0;
  color: var(--text-muted);
}

.plan-plus {
  background: var(--plan-plus);
}

/* FAQ */

.faq {
  margin-top: 24px;
  display: grid;
  gap: 10px;
  max-width: 48rem;
}

.faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0 18px;
}

.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 28px 16px 0;
  position: relative;
  font-weight: 600;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: '+';
  position: absolute;
  right: 0;
  top: 13px;
  font-size: 22px;
  line-height: 1;
  color: var(--action);
}

.faq details[open] summary::after {
  content: '−';
}

.faq details p {
  margin: 0 0 16px;
  color: var(--text-muted);
}

/* Closing */

.closing {
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
  padding: 56px 0 72px;
  border-top: 1px solid var(--border);
}

.closing h2 {
  max-width: none;
}

.closing p {
  margin: 0;
  color: var(--text-muted);
}

/* Wider screens */

@media (min-width: 640px) {
  .features,
  .privacy,
  .plans {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 860px) {
  .block {
    padding: 72px 0;
  }

  .steps,
  .features,
  .privacy {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
  }

  .spotlight {
    grid-template-columns: 1.15fr 1fr;
    gap: 48px;
  }

  .phone {
    width: 340px;
  }
}

/* Motion (2026-11-24, home.js). Nothing here hides anything by itself: home.js adds
   .reveal only to what's below the screen, and only when motion is welcome. */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.6s ease,
    transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.reveal-left {
  transform: translateX(-48px);
}

.reveal-in {
  opacity: 1;
  transform: none;
}

/* The Today picture ticking along: a glass of water, the steps goal, the day's totals. */

.ph-plus,
.ph-segments i,
.ph-karma,
.ph-ring {
  transition:
    transform 0.25s ease,
    background 0.4s ease;
}

.ph-bar-fill {
  transition: width 1s ease;
}

.ph-ring-fill {
  transition: stroke-dasharray 1s ease;
}

.demo-press .ph-plus {
  transform: scale(0.86);
}

.demo-water .ph-segments i.next {
  background: var(--gradient);
}

.demo-steps .ph-bar-fill {
  width: 100%;
}

.demo-done .ph-ring-fill {
  stroke-dasharray: 122.5 163.4;
}

.demo-done .ph-karma {
  animation: karma-pop 0.5s ease;
}

@keyframes karma-pop {
  40% {
    transform: scale(1.15);
  }
}

/* Cards lift a little under the pointer, and their icon tilts. */

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .feature,
  .step,
  .plan {
    transition:
      transform 0.2s ease,
      border-color 0.2s ease;
  }

  .feature:hover,
  .step:hover,
  .plan:hover {
    transform: translateY(-4px);
    border-color: var(--action);
  }

  .feature-icon,
  .step-icon {
    transition: transform 0.2s ease;
  }

  .feature:hover .feature-icon,
  .step:hover .step-icon {
    transform: rotate(-8deg) scale(1.1);
  }

  /* While a card is still arriving, the reveal's own timing wins. */
  .feature.reveal,
  .step.reveal,
  .plan.reveal {
    transition:
      opacity 0.6s ease,
      transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
}
