:root {
  --ink: #1A1A1A;
  --parchment: #F7F4ED;
  --paper: #FFFFFF;
  --muted: #6B6356;
  --rule: #1A1A1A;
  --rule-soft: rgba(26, 26, 26, 0.12);
  --slate: #3157C8;
  --slate-deep: #1F3FA3;
  --terracotta: #C8543A;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--parchment);
  color: var(--ink);
  font-feature-settings: "ss01", "kern";
  text-rendering: optimizeLegibility;
}

/* Grain texture overlay — adds tactile paper feel */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.1 0 0 0 0 0.1 0 0 0 0 0.1 0 0 0 0.4 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* Display headings — tighten Fraunces optical settings */
.font-display {
  font-family: "Fraunces", "Iowan Old Style", "Apple Garamond", Georgia, serif;
  font-optical-sizing: auto;
  font-variation-settings: "opsz" 144, "SOFT" 30, "WONK" 0;
  letter-spacing: -0.022em;
}

/* Italic display has a slightly different optical adjustment */
.font-display em,
.font-display .italic {
  font-style: italic;
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
  letter-spacing: -0.018em;
}

/* Eyebrow tag — magazine table-of-contents style */
.eyebrow {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Section number — large display digit used as decoration */
.section-no {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 144, "SOFT" 30;
  font-style: italic;
  font-weight: 400;
  color: var(--slate);
}

/* Hairline rule — thinner than browser default */
hr.hairline {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 0;
}

hr.hairline-soft {
  border: 0;
  border-top: 1px solid var(--rule-soft);
  margin: 0;
}

/* Tabular numerics for financial figures */
.tnum {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

/* Editorial underline for inline links — thin, with offset */
a.link {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  text-decoration-color: rgba(26, 26, 26, 0.35);
  transition: text-decoration-color 200ms ease;
}
a.link:hover {
  text-decoration-color: var(--slate);
}

/* Drop cap for long-form prose (Terms / Privacy) */
.dropcap > p:first-of-type::first-letter {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 144, "SOFT" 30;
  float: left;
  font-size: 5.2rem;
  line-height: 0.85;
  margin: 0.45rem 0.6rem 0 0;
  color: var(--slate);
}

/* Receipt mockup — rotated slightly, paper-textured card */
.receipt-card {
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  box-shadow:
    0 1px 0 rgba(26, 26, 26, 0.04),
    0 22px 40px -18px rgba(31, 63, 163, 0.22),
    0 50px 80px -40px rgba(26, 26, 26, 0.15);
  transform: rotate(-2.4deg);
  transition: transform 600ms cubic-bezier(0.22, 1, 0.36, 1);
}
.receipt-card:hover {
  transform: rotate(-1.2deg) translateY(-4px);
}

/* Perforated edges on the receipt card */
.receipt-perforated {
  position: relative;
}
.receipt-perforated::before,
.receipt-perforated::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 12px;
  background:
    radial-gradient(circle at 6px 6px, var(--parchment) 4px, transparent 4.5px) repeat-x;
  background-size: 12px 12px;
}
.receipt-perforated::before { top: -6px; }
.receipt-perforated::after { bottom: -6px; transform: rotate(180deg); }

/* Pricing card — inverted variant */
.plan-featured {
  background: var(--ink);
  color: var(--parchment);
  border-color: var(--ink);
}
.plan-featured .plan-divider {
  border-color: rgba(247, 244, 237, 0.18);
}
.plan-featured .plan-price {
  color: var(--parchment);
}
.plan-featured .plan-muted {
  color: rgba(247, 244, 237, 0.65);
}

/* Stagger reveal on initial load */
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.reveal {
  opacity: 0;
  animation: rise 720ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.reveal-1 { animation-delay: 80ms; }
.reveal-2 { animation-delay: 180ms; }
.reveal-3 { animation-delay: 280ms; }
.reveal-4 { animation-delay: 400ms; }
.reveal-5 { animation-delay: 540ms; }

@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal-1, .reveal-2, .reveal-3, .reveal-4, .reveal-5 {
    opacity: 1; animation: none; transform: none;
  }
  .receipt-card { transition: none; }
  html { scroll-behavior: auto; }
}

/* Sticky TOC for legal pages — desktop only */
.toc-rail {
  position: sticky;
  top: 6rem;
  align-self: start;
}
.toc-rail a {
  display: block;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--muted);
  padding: 0.15rem 0;
  border-left: 2px solid transparent;
  padding-left: 0.75rem;
  margin-left: -0.75rem;
  transition: color 160ms ease, border-color 160ms ease;
}
.toc-rail a:hover {
  color: var(--ink);
  border-left-color: var(--slate);
}

/* Long-form body styles for legal pages */
.prose-legal { color: var(--ink); max-width: 65ch; }
.prose-legal p,
.prose-legal ul,
.prose-legal ol {
  font-size: 1.0625rem;
  line-height: 1.78;
  color: #2a2a2a;
}
.prose-legal p + p { margin-top: 1.1rem; }
.prose-legal ul, .prose-legal ol {
  margin-top: 1rem;
  padding-left: 1.4rem;
}
.prose-legal ul { list-style: square; }
.prose-legal ol { list-style: decimal; }
.prose-legal li + li { margin-top: 0.5rem; }
.prose-legal h2 {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 144, "SOFT" 30;
  font-size: 1.85rem;
  letter-spacing: -0.02em;
  margin-top: 3rem;
  margin-bottom: 0.5rem;
  scroll-margin-top: 6rem;
}
.prose-legal h2 .h2-no {
  font-style: italic;
  color: var(--slate);
  margin-right: 0.6rem;
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
}
.prose-legal h3 {
  font-family: "DM Sans", sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  margin-top: 1.6rem;
  margin-bottom: 0.4rem;
  letter-spacing: -0.005em;
}
.prose-legal strong { font-weight: 600; }
.prose-legal a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--slate);
}

/* ─── App Store button ─── */
.app-store-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 1.2rem 0.7rem 1rem;
  background: var(--ink);
  color: var(--parchment);
  border: 1px solid var(--ink);
  text-decoration: none;
  transition: background 220ms ease, transform 220ms ease;
}
.app-store-btn:hover {
  background: var(--slate);
  transform: translateY(-1px);
}
.app-store-btn .apple-mark {
  flex-shrink: 0;
  width: 1.55rem;
  height: 1.55rem;
}
.app-store-btn .apple-mark svg { display: block; }
.app-store-btn-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
  text-align: left;
}
.app-store-btn-eyebrow {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 0.35rem;
}
.app-store-btn-label {
  font-family: "Fraunces", "Noto Serif HK", serif;
  font-variation-settings: "opsz" 144, "SOFT" 30;
  font-weight: 500;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}
html[lang^="zh"] .app-store-btn-label {
  letter-spacing: -0.005em;
}

/* Inverted variant — used on dark/featured backgrounds */
.app-store-btn.inverted {
  background: var(--parchment);
  color: var(--ink);
  border-color: var(--parchment);
}
.app-store-btn.inverted:hover {
  background: var(--paper);
}

/* Larger size for closing-CTA section */
.app-store-btn.lg {
  padding: 0.95rem 1.55rem 0.95rem 1.3rem;
  gap: 1.1rem;
}
.app-store-btn.lg .apple-mark { width: 2rem; height: 2rem; }
.app-store-btn.lg .app-store-btn-label { font-size: 1.4rem; }
.app-store-btn.lg .app-store-btn-eyebrow { font-size: 0.62rem; }

/* ─── Closing "Available now" CTA ─── */
.cta-final {
  position: relative;
  background: var(--ink);
  color: var(--parchment);
  overflow: hidden;
}
.cta-final .eyebrow { color: rgba(247, 244, 237, 0.6); }
.cta-final .cta-meta {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(247, 244, 237, 0.6);
}
.cta-final::after {
  content: "$";
  position: absolute;
  font-family: "Fraunces", serif;
  font-style: italic;
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
  font-size: 26rem;
  line-height: 0.78;
  color: rgba(247, 244, 237, 0.045);
  right: -3rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  user-select: none;
}
@media (max-width: 768px) {
  .cta-final::after { font-size: 16rem; right: -2rem; }
}

/* ─── Privacy pill (hero badge) ─── */
.privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--ink);
  background: var(--paper);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
}
.privacy-pill .dot {
  width: 0.55rem; height: 0.55rem;
  background: var(--slate);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(49, 87, 200, 0.12);
  animation: pulse 2.6s ease-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(49, 87, 200, 0.12); }
  50%      { box-shadow: 0 0 0 8px rgba(49, 87, 200, 0.04); }
}
@media (prefers-reduced-motion: reduce) {
  .privacy-pill .dot { animation: none; }
}
.privacy-pill .strike-zero {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ─── Flow diagram (Privacy by Architecture) ─── */
.flow-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 768px) {
  .flow-grid {
    grid-template-columns: 1fr 2.4rem 1.35fr 2.4rem 1fr;
    gap: 0.5rem;
    align-items: stretch;
  }
}
.flow-node {
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: 1.4rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  position: relative;
}
.flow-node.central {
  background: transparent;
  border-style: dashed;
}
.flow-node-eyebrow {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.flow-node-label {
  font-family: "Fraunces", "Noto Serif HK", serif;
  font-size: 1.35rem;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.flow-node-meta {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.5;
}
.flow-arrows {
  display: flex;
  flex-direction: row;
  gap: 3rem;
  align-items: stretch;
  justify-content: center;
  padding: 0.4rem 0;
}
@media (min-width: 768px) {
  .flow-arrows {
    flex-direction: column;
    gap: 0.6rem;
    align-items: center;
    padding: 0;
  }
}
.flow-arrow-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  min-height: 3.5rem;
}
@media (min-width: 768px) {
  .flow-arrow-row {
    flex-direction: row;
    width: 100%;
    min-width: 5rem;
    min-height: 0;
  }
}
.flow-line {
  flex: 1;
  width: 1px;
  min-height: 2rem;
  background: var(--ink);
  position: relative;
}
@media (min-width: 768px) {
  .flow-line {
    width: auto;
    height: 1px;
    min-height: 0;
  }
}
.flow-arrow-head {
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 6px solid var(--ink);
}
.flow-arrow-head.reverse {
  border-top: 0;
  border-bottom: 6px solid var(--ink);
}
@media (min-width: 768px) {
  .flow-arrow-head {
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-right: 0;
    border-left: 6px solid var(--ink);
  }
  .flow-arrow-head.reverse {
    border-left: 0;
    border-right: 6px solid var(--ink);
  }
}
.flow-strike {
  margin-top: 0.4rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--rule-soft);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.flow-strike-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  color: var(--muted);
}
.flow-strike-row .crossed {
  text-decoration: line-through;
  text-decoration-color: var(--terracotta);
  text-decoration-thickness: 1.5px;
}
.flow-strike-row svg { color: var(--terracotta); flex-shrink: 0; }

/* Big zero callout */
.zero-callout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.5rem;
  align-items: center;
}
.zero-callout .big-zero {
  font-family: "Fraunces", "Noto Serif HK", serif;
  font-variation-settings: "opsz" 144, "SOFT" 30;
  font-weight: 400;
  font-size: clamp(7rem, 17vw, 13rem);
  line-height: 0.8;
  color: var(--slate);
  letter-spacing: -0.04em;
}

/* ─── Steps (How it works) ─── */
.step-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 768px) {
  .step-row { grid-template-columns: 6rem 1fr; gap: 2rem; align-items: start; }
}
.step-no {
  font-family: "Fraunces", "Noto Serif HK", serif;
  font-style: italic;
  font-size: clamp(3.5rem, 6vw, 4.8rem);
  line-height: 0.9;
  color: var(--slate);
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
}
html[lang^="zh"] .step-no { font-style: normal; font-variation-settings: "opsz" 144, "SOFT" 30; }

/* ─── FAQ ─── */
.faq-item {
  border-top: 1px solid var(--rule-soft);
  padding: 1.5rem 0;
}
.faq-item:last-child { border-bottom: 1px solid var(--rule-soft); }
.faq-item[open] { padding-bottom: 1.8rem; }
.faq-q {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 1.3rem;
  font-family: "Fraunces", "Noto Serif HK", serif;
  font-size: clamp(1.15rem, 2.2vw, 1.55rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  position: relative;
  padding-right: 2.4rem;
  line-height: 1.3;
}
.faq-q::-webkit-details-marker { display: none; }
.faq-q::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 0;
  font-family: "JetBrains Mono", monospace;
  font-weight: 300;
  font-size: 1.75rem;
  color: var(--slate);
  transition: transform 240ms ease;
  line-height: 1;
}
.faq-item[open] .faq-q::after { content: "−"; }
.faq-no {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--muted);
  font-weight: 400;
  min-width: 1.8rem;
}
.faq-a {
  margin-top: 0.9rem;
  padding-left: 3.1rem;
  font-size: 1.0625rem;
  line-height: 1.72;
  color: #3a3a3a;
  max-width: 62ch;
}

/* ─── Language toggle (in nav) ─── */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding-left: 1rem;
  margin-left: 0.25rem;
  border-left: 1px solid var(--rule-soft);
}
.lang-toggle .current { color: var(--ink); }
.lang-toggle .other   { color: var(--muted); transition: color 160ms ease; }
.lang-toggle .other:hover { color: var(--ink); }
.lang-toggle .sep     { color: rgba(26, 26, 26, 0.18); }

/* ─── CJK / Hong Kong Traditional Chinese adjustments ─── */
html[lang^="zh"] body {
  font-family: "DM Sans", "Noto Sans HK", "PingFang HK", "Hiragino Sans GB",
               "Microsoft JhengHei HK", sans-serif;
}

html[lang^="zh"] .font-display {
  font-family: "Fraunces", "Noto Serif HK", "Songti HK", "Songti TC",
               "PingFang HK", "Apple LiSung", "MingLiU_HKSCS", serif;
  letter-spacing: -0.005em;
  font-variation-settings: "opsz" 144, "SOFT" 30, "WONK" 0;
}

/* CJK doesn't italicize naturally — use slate color for emphasis instead */
html[lang^="zh"] .font-display em,
html[lang^="zh"] .font-display .italic {
  font-style: normal;
  color: var(--slate);
  font-variation-settings: "opsz" 144, "SOFT" 30;
}

html[lang^="zh"] .eyebrow,
html[lang^="zh"] .toc-rail a {
  letter-spacing: 0.1em;
}

/* Drop cap: a single CJK character looks heavy at huge sizes — scale down */
html[lang^="zh"] .dropcap > p:first-of-type::first-letter {
  font-size: 3.6rem;
  margin: 0.6rem 0.45rem 0 0;
  line-height: 0.9;
}

/* Legal prose — more line-height for CJK readability */
html[lang^="zh"] .prose-legal p,
html[lang^="zh"] .prose-legal ul,
html[lang^="zh"] .prose-legal ol {
  line-height: 1.92;
  font-size: 1.0625rem;
}
html[lang^="zh"] .prose-legal h2 {
  letter-spacing: -0.005em;
}

/* Italic-looking H2 numbering in legal pages: keep italic only on the digit */
html[lang^="zh"] .prose-legal h2 .h2-no {
  font-style: italic;
}
