/* Happily Spent: marketing page.
   Light theme takes its colours from the app icon (cream, plum, coral, amber).
   Dark theme and the recap band use the app's own palette (docs/brief.md). */

:root {
  color-scheme: light dark;

  --bg: #FFF7EA;
  --bg-deep: #FCEBD5;
  --surface: #FFFDF8;
  --line: rgba(58, 29, 50, 0.12);
  --text: #3A1D32;
  --text-2: #6A4F62;
  --accent-text: #B4402A;
  --coral: #F27D5E;
  --amber: #F5A524;
  --icon-wash: rgba(242, 125, 94, 0.14);
  --icon-ink: #C9502F;
  --glow: rgba(242, 125, 94, 0.28);

  /* The recap band always looks like the app */
  --band-bg: #121214;
  --band-surface: #1D1D21;
  --band-text: #F4F2EE;
  --band-text-2: #A6A29B;
  --band-accent: #F7CB73;
  --band-wash: rgba(242, 181, 68, 0.14);

  --bezel: #0C0C0E;
  --shadow: 0 30px 60px -20px rgba(58, 29, 50, 0.35), 0 12px 24px -12px rgba(58, 29, 50, 0.25);

  --font-display: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121214;
    --bg-deep: #17171A;
    --surface: #1D1D21;
    --line: #2A2A30;
    --text: #F4F2EE;
    --text-2: #A6A29B;
    --accent-text: #F7CB73;
    --icon-wash: rgba(242, 181, 68, 0.14);
    --icon-ink: #F2B544;
    --glow: rgba(242, 125, 94, 0.18);

    --band-bg: #1D1D21;
    --band-surface: #26262B;

    --bezel: #2A2A30;
    --shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.7), 0 12px 24px -12px rgba(0, 0, 0, 0.6);
  }
}

/* Base */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.55;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0; text-wrap: pretty; }

img { max-width: 100%; height: auto; }

a { color: inherit; }

svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; border-radius: 6px; }

.wrap {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: 24px;
}

.eyebrow {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--accent-text);
  margin-bottom: 12px;
}

section h2 { font-size: clamp(1.9rem, 1.3rem + 2.4vw, 2.75rem); font-weight: 700; }

/* Phone frame. The screenshot's own corners are ~13.7% of its width;
   the bezel adds 3.5% all round, so the outer radius follows from that. */

.phone {
  container-type: inline-size;
  margin: 0;
  width: 100%;
  max-width: 290px;
  background: var(--bezel);
  border-radius: 16.3% / 7.8%;
  box-shadow: var(--shadow);
}

.phone img {
  display: block;
  width: calc(100% - 7cqi);
  margin: 3.5cqi;
  border-radius: 12.8cqi;
}

/* Header */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
}

.brand img { width: 40px; height: 40px; border-radius: 22.5%; }

.site-nav { display: flex; gap: 28px; }

.site-nav a {
  text-decoration: none;
  color: var(--text-2);
  font-weight: 500;
  font-size: 0.975rem;
}

.site-nav a:hover { color: var(--text); }

/* Hero */

.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: 48px;
  padding-block: 48px 96px;
}

.hero h1 {
  font-size: clamp(2.6rem, 1.6rem + 4.4vw, 4.4rem);
  font-weight: 800;
  letter-spacing: -0.025em;
}

.lede {
  margin-top: 22px;
  font-size: clamp(1.1rem, 1rem + 0.4vw, 1.3rem);
  color: var(--text-2);
  max-width: 34em;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  margin-top: 32px;
}

.badge-soon {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px 22px 12px 18px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
}

.badge-soon svg { width: 22px; height: 22px; }

.text-link {
  font-weight: 600;
  color: var(--accent-text);
  text-decoration: none;
  padding-block: 12px;
}

.text-link::after { content: " ↓"; }
.text-link:hover { text-decoration: underline; text-underline-offset: 4px; }

.hero-phones {
  position: relative;
  display: grid;
  place-items: center;
  isolation: isolate;
}

.hero-phones > .phone { grid-area: 1 / 1; }

.hero-phones::before {
  content: "";
  position: absolute;
  inset: 8% -6% 0;
  background: radial-gradient(closest-side, var(--glow), transparent);
  z-index: -1;
}

.phone-front {
  max-width: 300px;
  transform: translateX(-20%) rotate(-3deg);
  z-index: 1;
}

.phone-back {
  max-width: 260px;
  transform: translate(26%, 3%) rotate(6deg);
}

/* Intro */

.intro {
  max-width: 820px;
  text-align: center;
  padding-block: 24px 96px;
}

.intro h2 { font-size: clamp(1.7rem, 1.2rem + 2vw, 2.4rem); }

.intro p {
  margin-top: 20px;
  font-size: 1.15rem;
  color: var(--text-2);
}

/* How it works */

.how { padding-bottom: 104px; }

.steps {
  list-style: none;
  margin: 48px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
}

.step { display: flex; flex-direction: column; align-items: center; }

.step .phone { max-width: 270px; }

.step-copy { margin-top: 32px; max-width: 320px; }

.step-num {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--amber);
  color: #1A1408;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 14px;
}

.step h3 { font-size: 1.4rem; font-weight: 700; }

.step p { margin-top: 8px; color: var(--text-2); }

/* Recap band */

.recap { padding-bottom: 104px; }

.band {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  align-items: center;
  gap: 56px;
  padding: 64px;
  border-radius: 36px;
  background: var(--band-bg);
  color: var(--band-text);
  position: relative;
  overflow: hidden;
}

.band::before {
  content: "";
  position: absolute;
  width: 520px;
  height: 520px;
  left: -160px;
  top: -120px;
  background: radial-gradient(closest-side, rgba(242, 181, 68, 0.16), transparent);
  pointer-events: none;
}

.band .phone {
  justify-self: center;
  max-width: 300px;
  background: #2A2A30;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.7);
  position: relative;
}

.band .eyebrow { color: var(--band-accent); }

.band-lede {
  margin-top: 18px;
  font-size: 1.15rem;
  color: var(--band-text-2);
  max-width: 30em;
}

.recap-parts {
  list-style: none;
  margin: 32px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.recap-parts li {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 18px 20px;
  border-radius: 18px;
  background: var(--band-surface);
}

.well {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--band-wash);
  color: #F2B544;
  flex: none;
}

.recap-parts h3 { font-size: 1.1rem; font-weight: 600; }

.recap-parts p { margin-top: 4px; color: var(--band-text-2); font-size: 1rem; }

/* Principles */

.principles { padding-bottom: 104px; }

.cards {
  margin-top: 40px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.card {
  padding: 28px 24px;
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.card svg {
  width: 44px;
  height: 44px;
  padding: 10px;
  border-radius: 12px;
  background: var(--icon-wash);
  color: var(--icon-ink);
  stroke-width: 1.6;
}

.card h3 { margin-top: 20px; font-size: 1.2rem; font-weight: 700; }

.card p { margin-top: 8px; color: var(--text-2); font-size: 1rem; }

/* Sources */

.sources { padding-bottom: 104px; }

.source-list {
  list-style: none;
  margin: 40px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  border-top: 1px solid var(--line);
}

.source-list li {
  display: flex;
  gap: 16px;
  padding-top: 28px;
}

.source-list svg { color: var(--icon-ink); width: 28px; height: 28px; margin-top: 1px; }

.source-list h3 {
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.source-list p { margin-top: 6px; color: var(--text-2); font-size: 1rem; }

.tag {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--icon-wash);
  color: var(--accent-text);
}

/* Closing */

.closing {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 24px;
  padding-block: 72px 96px;
  border-top: 1px solid var(--line);
}

/* Keep the dividing rules the same width as the content above them */
.closing, .site-footer { width: calc(100% - 48px); max-width: 1072px; padding-inline: 0; }

.closing img { border-radius: 22.5%; box-shadow: var(--shadow); }

.closing h2 { font-size: clamp(1.8rem, 1.3rem + 2vw, 2.6rem); max-width: 16em; }

/* Footer */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding-block: 28px 40px;
  border-top: 1px solid var(--line);
  color: var(--text-2);
  font-size: 0.9rem;
}

/* Tablet */

@media (max-width: 980px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .band { padding: 48px 40px; gap: 40px; }
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 56px; padding-block: 24px 80px; }
  .phone-front { max-width: 260px; }
  .phone-back { max-width: 228px; }

  .steps { grid-template-columns: 1fr; gap: 72px; }
  .step .phone { max-width: 250px; }
  .step-copy { text-align: center; }

  .band { grid-template-columns: 1fr; }
  .band .phone { max-width: 260px; order: 2; }

  .source-list { grid-template-columns: 1fr; gap: 0; }
  .source-list li { padding-block: 24px; border-bottom: 1px solid var(--line); }
  .source-list li:last-child { border-bottom: 0; }
}

/* Phone */

@media (max-width: 600px) {
  body { font-size: 1rem; }
  .wrap { padding-inline: 20px; }
  .closing, .site-footer { width: calc(100% - 40px); padding-inline: 0; }
  .site-nav { display: none; }

  .phone-front { max-width: 220px; }
  .phone-back { max-width: 190px; }

  .intro { text-align: left; padding-bottom: 80px; }
  .how, .recap, .principles, .sources { padding-bottom: 80px; }

  .band { padding: 36px 20px 40px; border-radius: 28px; margin-inline: -4px; }
  .recap-parts li { padding: 16px; }

  .cards { grid-template-columns: 1fr; }
}

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