/* ─── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── Custom properties — pulled exactly from Theme.swift ────── */
:root {
  --paper:      #F7F3EA;
  --surface:    #FFFFFF;
  --ink:        #262420;
  --ink-soft:   #38352F;
  --moss:       #5B6E58;
  --moss-tint:  #E4E9DE;
  --moss-deep:  #465244;
  --slate:      #46586B;
  --gold:       #B98A4E;
  --gold-tint:  #F3E7D3;
  --plum:       #7A5C6E;
  --teal:       #4F7A72;
  --clay-bg:    #F1DFD5;
  --clay-text:  #8A4A34;
  --border:     #E4DDD0;
  --border-mid: #D8CFBE;
  --secondary:  #8A8272;
  --tertiary:   #A29A88;
  --chip:       #EFEAE0;
  --dashed:     #B7AF9E;

  --serif: ui-serif, 'New York', Georgia, 'Times New Roman', serif;
  --mono:  ui-monospace, 'SF Mono', Menlo, 'Courier New', monospace;
  --sans:  -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

  --pad: clamp(20px, 5vw, 64px);
  --max: 1100px;
}

/* ─── Base ───────────────────────────────────────────────────── */
html {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  background: var(--paper);
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }
a   { color: inherit; text-decoration: none; }

/* ─── Eyebrow — the family's mono label ──────────────────────── */
.eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--secondary);
  line-height: 1.4;
}

/* ─── Reveal animation (hero only, above fold) ───────────────── */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: var(--d, 0s);
}

@keyframes rise {
  to { opacity: 1; transform: none; }
}

/* ─── Navigation ─────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0;
  inset-inline: 0;
  z-index: 200;
  border-bottom: 1px solid transparent;
  transition: background 0.35s, backdrop-filter 0.35s, border-color 0.35s;
}

.nav.is-scrolled {
  background: rgba(247, 243, 234, 0.88);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border-color: var(--border);
}

.nav-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 9px;
}

.nav-icon {
  border-radius: 6px;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.nav-wordmark {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.nav-back {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink);
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 100px;
  transition: border-color 0.2s, background 0.2s;
}
.nav-back b { color: #3e9e5f; font-weight: 500; }
.nav-back-arrow { color: var(--tertiary); transition: transform 0.2s; }
.nav-back:hover { border-color: var(--border-mid); background: rgba(38, 36, 32, 0.04); }
.nav-back:hover .nav-back-arrow { transform: translateX(-2px); }

.nav-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  flex-shrink: 0;
}

.nav-end {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-x {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--secondary);
  transition: color 0.2s;
}
.nav-x:hover { color: var(--ink); }

.nav-badge {
  display: flex;
  align-items: center;
  opacity: 0.85;
  transition: opacity 0.2s;
}
.nav-badge:hover { opacity: 1; }
.nav-badge img { width: auto; }

/* ─── Hero ───────────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding-top: 56px;
}

.motes-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hero-glow {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: min(900px, 130vw);
  height: 600px;
  background: radial-gradient(ellipse 60% 50% at 50% 0%, rgba(185, 138, 78, 0.10) 0%, transparent 70%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  width: 100%;
  margin: 0 auto;
  padding: 64px var(--pad) 80px;
  display: grid;
  grid-template-columns: 1fr 403px;
  align-items: center;
  gap: clamp(32px, 5vw, 64px);
}

.hero-h1 {
  font-family: var(--serif);
  font-size: clamp(42px, 6.5vw, 78px);
  font-weight: 400;
  line-height: 1.08;
  color: var(--ink);
  letter-spacing: -0.015em;
  margin-top: 20px;
}

/* Gold accents stay roman — italic serif is Nox's voice, not Basis's */
.hero-h1 em {
  font-style: normal;
  color: var(--gold);
}

.hero-body {
  font-size: clamp(15px, 1.8vw, 17px);
  color: var(--secondary);
  line-height: 1.8;
  margin-top: 24px;
  max-width: 46ch;
}

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

.badge-hero {
  width: auto;
  height: 44px;
  opacity: 0.9;
  transition: opacity 0.2s;
}
.badge-hero:hover { opacity: 1; }

.link-x {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--secondary);
  transition: color 0.2s;
}
.link-x:hover { color: var(--ink); }

/* Framed screenshots — the PNGs carry their own device frame */
.hero-phone {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
}

.phone-shot {
  width: 100%;
  display: block;
  filter: drop-shadow(0 20px 40px rgba(38, 36, 32, 0.16));
}

.phone-shot--hero {
  filter:
    drop-shadow(0 32px 64px rgba(38, 36, 32, 0.20))
    drop-shadow(0 0 44px rgba(185, 138, 78, 0.10));
}

.phone-shot--featured {
  filter:
    drop-shadow(0 32px 64px rgba(38, 36, 32, 0.20))
    drop-shadow(0 0 52px rgba(185, 138, 78, 0.14));
}

/* Baseline rule at hero bottom */
.hero-arc {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  pointer-events: none;
}
.hero-arc svg { width: 100%; height: 1px; display: block; }

/* ─── Step cards — the loop, folded into the bento ───────────── */
/* Grid math (6 cols): steps 2+2+2 / step+scan+charts 2+2+2 /
   privacy 4 + periods 2 / buckets 6. Every row closes. */
.box-card--step { grid-column: span 2; }

.step-label {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.step-num {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--gold);
}

/* Step 1: save-first ring */
.p-ring-mini {
  position: relative;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
}

.p-ring-mini svg { width: 100%; height: 100%; }

.p-ring-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--gold);
}

/* Step 2: category chips */
.p-category-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: flex-start;
}

.p-cat-chip {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.95);
  padding: 6px 13px;
  border-radius: 100px;
  line-height: 1.4;
}

.p-cat-chip--add {
  background: var(--chip);
  color: var(--secondary);
  padding-inline: 15px;
}

/* Step 3: pace bars — mirrors the dashboard category cards */
.p-pace-bars {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.p-pace-row {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  align-items: center;
  gap: 12px;
}

.p-pace-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p-pace-track {
  height: 6px;
  background: var(--chip);
  border-radius: 999px;
  overflow: hidden;
}

.p-pace-fill {
  height: 100%;
  border-radius: 999px;
}

.p-pace-amt {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  text-align: right;
  white-space: nowrap;
}

.p-pace-amt i {
  font-style: normal;
  font-weight: 400;
  color: var(--tertiary);
}

/* Step 4: settle choices */
.p-settle-choice {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.p-choice {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: 100px;
  background: var(--chip);
  color: var(--secondary);
  border: 1.5px solid transparent;
  line-height: 1.4;
}

.p-choice--selected {
  background: var(--gold-tint);
  color: var(--ink);
  border-color: var(--gold);
}

/* ─── The whole app — one bento ──────────────────────────────── */
.box {
  padding: 100px 0 80px;
  position: relative;
}

.box-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.box-header {
  max-width: 560px;
  margin-bottom: 48px;
}

.box-h2 {
  font-family: var(--serif);
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 400;
  line-height: 1.22;
  color: var(--ink);
  margin-top: 12px;
}

.box-h2 em {
  font-style: normal;
  color: var(--gold);
}

.box-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 20px;
}

.box-card {
  grid-column: span 2;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.box-title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.25;
  margin-top: auto;
}

.box-desc {
  font-size: 13px;
  line-height: 1.7;
  color: var(--secondary);
}

/* Buckets card — full-width finale */
.box-card--buckets {
  grid-column: span 6;
  flex-direction: row;
  align-items: center;
  gap: clamp(32px, 5vw, 64px);
  padding: 32px 36px;
}

.bk-visual {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-shrink: 0;
}

.bk-ring {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  background: conic-gradient(var(--gold) 0 60%, var(--moss) 60% 82%, var(--slate) 82% 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bk-ring-hole {
  width: 74%;
  height: 74%;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
}

/* Numbers are sans-serif, like the app itself — SF, not New York */
.bk-ring-num {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.bk-ring-cap {
  font-size: 10.5px;
  color: var(--secondary);
}

.bk-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bk-lrow {
  display: flex;
  align-items: center;
  font-size: 13px;
  color: var(--ink);
  gap: 9px;
  white-space: nowrap;
}

.bk-lrow i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.bk-lrow b { font-weight: 600; margin-left: 4px; }

.bk-text {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 54ch;
}

.bk-text .box-title { margin-top: 0; }

/* Privacy card — the one dark card, wide */
.box-card--privacy {
  grid-column: span 4;
  background: var(--ink);
  border-color: var(--ink);
}

.box-card--privacy .privacy-rows {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 20px;
}

.privacy-pill {
  align-self: flex-start;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid rgba(185, 138, 78, 0.45);
  border-radius: 100px;
  padding: 5px 13px;
}

.privacy-rows {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.privacy-rows li {
  font-size: 13px;
  line-height: 1.5;
  color: #D8D1C2;
  padding-left: 18px;
  position: relative;
}

.privacy-rows li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
}

.box-title--light { color: #F7F3EA; }
.box-desc--light  { color: #B5AD9C; }

/* Receipt scan card */
.scan-visual {
  position: relative;
  align-self: center;
  padding: 4px 0;
}

.scan-receipt {
  width: 168px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  transform: rotate(-2deg);
  box-shadow: 0 8px 20px rgba(38, 36, 32, 0.08);
  font-family: var(--mono);
  font-size: 9.5px;
  line-height: 2;
  color: var(--secondary);
  display: flex;
  flex-direction: column;
}

.scan-receipt b {
  text-align: center;
  color: var(--ink);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
}

.scan-receipt span { display: flex; }
.scan-receipt span i { margin-left: auto; font-style: normal; }

.scan-receipt .scan-total {
  border-top: 1px dashed var(--border-mid);
  margin-top: 4px;
  padding-top: 4px;
  color: var(--ink);
  font-weight: 700;
}

.scan-beam {
  position: absolute;
  left: -12px;
  right: -12px;
  top: 46%;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(180deg,
    rgba(185, 138, 78, 0) 0%, rgba(185, 138, 78, 0.20) 45%,
    rgba(185, 138, 78, 0.48) 50%, rgba(185, 138, 78, 0.20) 55%,
    rgba(185, 138, 78, 0) 100%);
  pointer-events: none;
}

/* Charts card */
.chart-visual {
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

/* Flexible periods card */
.period-visual {
  display: flex;
  background: var(--chip);
  border-radius: 100px;
  padding: 4px;
  align-self: flex-start;
}

.period-visual span {
  font-size: 12px;
  font-weight: 500;
  color: var(--secondary);
  padding: 7px 14px;
  border-radius: 100px;
  line-height: 1.3;
  white-space: nowrap;
}

.period-visual .period-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(38, 36, 32, 0.12);
}

/* "Also in the box" chips */
.box-chips {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.box-chip {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--secondary);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 8px 16px;
  background: transparent;
}

/* ─── Screenshots — podium (mirrors Nox) ─────────────────────── */
.screens {
  padding: 90px 0 80px;
  overflow: hidden;
  position: relative;
}

.screens::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border), transparent);
}

.screens-header {
  max-width: var(--max);
  margin: 0 auto 56px;
  padding: 0 var(--pad);
}

.screens-h2 {
  font-family: var(--serif);
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 400;
  line-height: 1.22;
  color: var(--ink);
  margin-top: 12px;
}

.screens-h2 em {
  font-style: normal;
  color: var(--gold);
}

.screens-track {
  max-width: 1020px;
  margin: 0 auto;
  padding: 0 var(--pad);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(14px, 2.5vw, 28px);
}

.phone-fig {
  flex: 1;
  max-width: 270px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.phone-fig.phone-center {
  max-width: 310px;
  transform: translateY(-40px);
}

.screen-cap { text-align: center; color: var(--tertiary); }

/* ─── Builder strip ──────────────────────────────────────────── */
.builder {
  padding: 30px var(--pad) 70px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.builder-line {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.locale-badge {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  padding: 8px 16px;
  background: var(--chip);
  border-radius: 100px;
  line-height: 1;
}

.builder-text {
  font-size: 13.5px;
  color: var(--tertiary);
  line-height: 1.7;
  max-width: 52ch;
  margin-inline: auto;
}

/* ─── Closing ────────────────────────────────────────────────── */
.close {
  padding: 120px var(--pad) 140px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.close::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border), transparent);
}

.close-glow {
  position: absolute;
  bottom: -80px;
  left: 50%;
  transform: translateX(-50%);
  width: min(700px, 110vw);
  height: 500px;
  background: radial-gradient(ellipse 60% 50% at 50% 100%, rgba(185, 138, 78, 0.10) 0%, transparent 70%);
  pointer-events: none;
}

.close-inner {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.close-h2 {
  font-family: var(--serif);
  font-size: clamp(48px, 8.5vw, 96px);
  font-weight: 400;
  line-height: 1.05;
  color: var(--ink);
  letter-spacing: -0.015em;
}

.close-h2 em {
  font-style: normal;
  color: var(--gold);
}

.close-sub { color: var(--tertiary); margin-top: -4px; }

.badge-close {
  width: auto;
  height: 50px;
  margin-top: 8px;
  opacity: 0.88;
  transition: opacity 0.2s;
}
.badge-close:hover { opacity: 1; }

.close-note { color: var(--tertiary); }

/* ─── Footer ─────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 26px var(--pad);
}

.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer-brand {
  font-family: var(--serif);
  font-size: 14px;
  color: var(--secondary);
  display: flex;
  align-items: center;
  gap: 7px;
}

.footer-links { display: flex; gap: 24px; }

.footer-link {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--secondary);
  transition: color 0.2s;
}
.footer-link:hover { color: var(--ink); }

/* ─── JS-driven scroll reveal ────────────────────────────────── */
.sr { opacity: 0; transform: translateY(20px); }
.sr.in-view { opacity: 1; transform: none; }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 960px) {
  .box-grid { grid-template-columns: repeat(2, 1fr); }
  .box-card { grid-column: span 1; }
  .box-card--step { grid-column: span 1; }
  .box-card--buckets { grid-column: span 2; }
  .box-card--privacy { grid-column: span 2; }
}

@media (max-width: 900px) {
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 44px;
    padding-bottom: 64px;
    text-align: center;
  }

  .hero-body { margin-inline: auto; }
  .hero-actions { justify-content: center; }

  .hero-phone { order: -1; }
  .hero-phone img { width: clamp(210px, 55vw, 300px); }

  .box-card--buckets { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 720px) {
  .box-grid { grid-template-columns: 1fr; }
  .box-card,
  .box-card--step,
  .box-card--buckets,
  .box-card--privacy { grid-column: span 1; }
  .bk-visual { align-self: center; }
  .box-card--privacy .privacy-rows { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .hero-actions { flex-direction: column; align-items: center; gap: 14px; }

  .screens { padding: 60px 0; }

  .screens-track {
    padding: 0 20px 0 24px;
    justify-content: flex-start;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .screens-track::-webkit-scrollbar { display: none; }

  .phone-fig { flex: 0 0 auto; width: 195px; max-width: 195px; scroll-snap-align: center; }
  .phone-fig.phone-center { width: 215px; max-width: 215px; transform: translateY(-20px); }

  .close { padding: 80px var(--pad) 100px; }

  .nav-x { display: none; }
  .nav-sep { display: none; }
  .nav-left { gap: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; opacity: 1; transform: none; }
  .sr { transition: none !important; }
}
