/* Tokens mirror LedgerApp/Ledger/DesignSystem/Theme.swift */
:root {
  --canvas: #f2f0ec;
  --surface: #ffffff;
  --fill: #ebe8e3;
  --ink: #2b2d33;
  --on-ink: #ffffff;
  --text: #1f2024;
  --text-2: #75767c;
  --text-3: #b4b5ba;
  --hairline: #edeae5;
  --accent: #ee6a5c;
  --accent-text: #c4493a;
  --positive: #2fae6e;
  --sky: #d7e5f0;
  --glass: rgba(248, 243, 234, .62);
  --glass-edge: rgba(255, 255, 255, .7);
  --card-shadow: 0 3px 10px rgba(0, 0, 0, .04);
  --tile-alpha: 14%;

  --blue: #5b8def;
  --green: #4cb782;
  --orange: #f5a04a;
  --purple: #9b7be6;
  --coral: #ef6f6c;
  --teal: #3db3b0;
  --grey: #9a9ca3;
  --indigo: #6e72e3;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;

  --font: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Heiti TC", system-ui, sans-serif;
  --rounded: ui-rounded, "SF Pro Rounded", -apple-system, "PingFang TC", "Noto Sans TC", sans-serif;
  --mono: ui-monospace, "SF Mono", "Noto Sans Mono", Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #111113;
    --surface: #1c1c1f;
    --fill: #2a2a2e;
    --ink: #f2f2f3;
    --on-ink: #1c1c1f;
    --text: #f2f2f3;
    --text-2: #9c9da3;
    --text-3: #5e5f65;
    --hairline: rgba(255, 255, 255, .08);
    --accent: #ff7b6e;
    --accent-text: #ff8a7e;
    --positive: #45c985;
    --sky: #1f2a37;
    --glass: rgba(43, 45, 51, .55);
    --glass-edge: rgba(255, 255, 255, .12);
    --card-shadow: none;
    --tile-alpha: 22%;
    --blue: #6f9cf5;
    --green: #5cc891;
    --orange: #f7ae62;
    --purple: #a98dec;
    --coral: #f5807d;
    --teal: #52c2bf;
    --grey: #8e9097;
    --indigo: #8285ea;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --canvas: #111113;
  --surface: #1c1c1f;
  --fill: #2a2a2e;
  --ink: #f2f2f3;
  --on-ink: #1c1c1f;
  --text: #f2f2f3;
  --text-2: #9c9da3;
  --text-3: #5e5f65;
  --hairline: rgba(255, 255, 255, .08);
  --accent: #ff7b6e;
  --accent-text: #ff8a7e;
  --positive: #45c985;
  --sky: #1f2a37;
  --glass: rgba(43, 45, 51, .55);
  --glass-edge: rgba(255, 255, 255, .12);
  --card-shadow: none;
  --tile-alpha: 22%;
  --blue: #6f9cf5;
  --green: #5cc891;
  --orange: #f7ae62;
  --purple: #a98dec;
  --coral: #f5807d;
  --teal: #52c2bf;
  --grey: #8e9097;
  --indigo: #8285ea;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--accent-text); text-underline-offset: 3px; }
p { margin: 0; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
}

.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 720px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; z-index: 10; background: var(--surface); padding: 8px 12px; border-radius: 10px; }

/* ── Navigation bar ─────────────────────────────── */

.topbar { padding: 16px 0; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--text); text-decoration: none; font-weight: 700; font-size: 17px;
}
.brand img { width: 36px; height: 36px; border-radius: 9px; }
.nav { display: flex; gap: 8px; }
.nav a {
  color: var(--text-2); text-decoration: none; font-size: 15px;
  padding: 6px 12px; border-radius: 999px;
}
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--card-shadow); }

/* Pushed-screen bar: round back button, centred title (as in 設定) */
.pushbar { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; padding: 14px 0 6px; }
.pushbar h1 { margin: 0; text-align: center; font-size: 17px; font-weight: 600; }
.circle-btn {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); color: var(--text); box-shadow: var(--card-shadow);
}
.circle-btn svg { width: 20px; height: 20px; }

/* ── Building blocks ────────────────────────────── */

.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--card-shadow);
}
.card-pad { padding: 20px; }

.section-header { font-size: 17px; font-weight: 600; margin: 32px 4px 10px; line-height: 1.4; }
.footnote { font-size: 13px; color: var(--text-2); margin: 8px 4px 0; line-height: 1.55; }

/* LedgerRow / FormRow */
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  position: relative;
}
.row + .row::before {
  content: "";
  position: absolute; top: 0; right: 0; left: 66px;
  border-top: .5px solid var(--hairline);
}
@media (min-resolution: 2dppx) { .row + .row::before { border-top-width: .5px; } }
.row-title { font-weight: 500; line-height: 1.4; }
.row-sub { font-size: 14px; color: var(--text-2); line-height: 1.5; margin-top: 2px; }
.row-trail { font-size: 15px; color: var(--text-2); text-align: right; }
.row a.row-link, a.row { color: inherit; text-decoration: none; }
a.row:hover { background: color-mix(in srgb, var(--fill) 45%, transparent); }
.row:first-child { border-radius: var(--r-lg) var(--r-lg) 0 0; }
.row:last-child { border-radius: 0 0 var(--r-lg) var(--r-lg); }
.chev { width: 8px; height: 13px; color: var(--text-3); }

/* IconTile: coloured glyph on a soft circle of the same colour */
.tile {
  --c: var(--grey);
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--c);
  background: color-mix(in srgb, var(--c) var(--tile-alpha), transparent);
}
.tile svg { width: 17px; height: 17px; }
.tile.lg { width: 48px; height: 48px; }
.tile.lg svg { width: 22px; height: 22px; }
.c-blue { --c: var(--blue); } .c-green { --c: var(--green); } .c-orange { --c: var(--orange); }
.c-purple { --c: var(--purple); } .c-coral { --c: var(--coral); } .c-teal { --c: var(--teal); }
.c-indigo { --c: var(--indigo); } .c-grey { --c: var(--grey); }

/* PillPicker */
.pills {
  display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 3px; border-radius: 999px; background: var(--fill);
}
.pills button {
  font: inherit; font-size: 14px; color: var(--text-2);
  border: 0; background: transparent; border-radius: 999px;
  min-height: 32px; padding: 0 16px; cursor: pointer;
}
.pills button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); font-weight: 600; }

/* StatusBadge-like capsule */
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 999px;
  background: var(--ink); color: var(--on-ink); font-size: 15px; font-weight: 600;
}
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* ── Home ───────────────────────────────────────── */

.hero {
  background: linear-gradient(180deg, var(--sky) 0%, color-mix(in srgb, var(--sky) 40%, var(--canvas)) 70%, var(--canvas) 100%);
  padding-bottom: 56px;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  gap: 48px; align-items: center; padding-top: 32px;
}
.hero h1 {
  font-size: clamp(38px, 6vw, 64px);
  line-height: 1.18; font-weight: 800; letter-spacing: .01em;
  margin: 0 0 20px;
}
.hero h1 .mascot-inline { display: inline-block; width: 1.05em; height: auto; vertical-align: -.12em; margin-left: .1em; }
.lede { font-size: 18px; color: var(--text-2); max-width: 30em; margin-bottom: 28px; }

/* The mascot's receipt, on the home screen's frosted glass */
.receipt-stage { position: relative; justify-self: center; width: 100%; max-width: 360px; }
.receipt {
  position: relative;
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  backdrop-filter: blur(20px) saturate(1.2);
  border: .75px solid var(--glass-edge);
  border-radius: var(--r-xl);
  padding: 22px 22px 18px;
}
.receipt-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.receipt-head img { width: 52px; height: 52px; }
.receipt-head b { display: block; font-size: 17px; }
.receipt-head span { font-size: 13px; color: var(--text-2); }
.receipt ul { list-style: none; margin: 0; padding: 0; font-size: 15px; }
.receipt li { display: flex; align-items: baseline; gap: 8px; padding: 5px 0; }
.receipt li .dots { flex: 1; border-bottom: 1.5px dotted color-mix(in srgb, var(--text-2) 45%, transparent); transform: translateY(-4px); }
.receipt li b { font-family: var(--rounded); font-weight: 600; font-size: 14px; }
.receipt hr { border: 0; border-top: 1.5px dashed color-mix(in srgb, var(--text-2) 40%, transparent); margin: 10px 0; }
.receipt .totals b { color: var(--accent-text); }

.receipt-stage { animation: rise 700ms cubic-bezier(.2, .8, .2, 1) 120ms both; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .receipt-stage { animation: none; } }

.page-section { padding-top: 40px; padding-bottom: 24px; }
.page-title { font-size: clamp(26px, 3.6vw, 34px); font-weight: 800; margin: 0 4px 6px; line-height: 1.3; }
.page-sub { color: var(--text-2); margin: 0 4px; max-width: 34em; }

.showcase {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 56px; align-items: start;
}
.phone {
  position: sticky; top: 24px;
  border-radius: 46px; padding: 9px;
  background: #2b2d33;
  box-shadow: 0 24px 48px -28px rgba(0, 0, 0, .45);
}
.phone img { border-radius: 37px; width: 100%; height: auto; }

.footer-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }

/* ── Legal pages ────────────────────────────────── */

.doc-intro { padding: 12px 4px 0; }
.doc-intro h2 { font-size: clamp(26px, 4vw, 32px); font-weight: 800; margin: 0 0 4px; line-height: 1.3; }
.doc-intro p { color: var(--text-2); font-size: 15px; }

.prose { padding: 18px 20px; }
.prose p + p, .prose p + ul, .prose ul + p, .prose p + .rows, .prose .rows + p { margin-top: 10px; }
.prose ul { margin: 0; padding-left: 1.3em; }
.prose li + li { margin-top: 6px; }
.prose strong { font-weight: 600; }
.legal h3.section-header { scroll-margin-top: 16px; }
.inset-rows { margin: 12px -20px; border-top: .5px solid var(--hairline); border-bottom: .5px solid var(--hairline); }
.inset-rows .row:first-child, .inset-rows .row:last-child { border-radius: 0; }

/* ── Footer ─────────────────────────────────────── */

.site-footer { padding: 40px 0 56px; }
.footer-card { display: grid; gap: 16px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: 14px; }
.footer-links a { color: var(--text-2); }
.copyright { font-size: 13px; color: var(--text-2); }
.appearance { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--text-2); }

@media (max-width: 860px) {
  .hero-grid, .showcase { grid-template-columns: minmax(0, 1fr); }
  .hero-grid { gap: 28px; padding-top: 8px; }
  .phone { position: static; max-width: 260px; margin: 0 auto 8px; }
}

@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  body { font-size: 16px; }
  .brand span { display: none; }
  .nav a { padding: 6px 10px; font-size: 14px; }
  .row { padding: 12px 14px; gap: 12px; }
  .row + .row::before { left: 62px; }
  .row-trail { display: none; }
  .pills button { padding: 0 12px; }
}

/* Screenshot follows the chosen appearance */
.shot-dark { display: none; }
:root[data-theme="dark"] .shot-light { display: none; }
:root[data-theme="dark"] .shot-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .shot-light { display: none; }
  :root:not([data-theme="light"]) .shot-dark { display: block; }
}

.tile b { font-family: var(--rounded); font-size: 14px; font-weight: 700; }
.toc .row { padding-top: 10px; padding-bottom: 10px; }
.toc .row-title { font-weight: 400; }
.summary { border-left: 0; }
.summary ul { padding-left: 1.2em; }
.summary li::marker { color: var(--accent); }
.prose ul.rows { padding-left: 0; }
.prose .rows li + li { margin-top: 0; }

/* ── Global nav: frosted bar, as on apple.com ── */
.globalnav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--canvas) 72%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid var(--hairline);
}
.globalnav .wrap { display: flex; align-items: center; justify-content: space-between; height: 52px; gap: 12px; }
.globalnav .brand { font-size: 17px; font-weight: 600; }
.globalnav .brand img { width: 28px; height: 28px; border-radius: 7px; }
.globalnav nav { display: flex; align-items: center; gap: 22px; font-size: 13px; }
.globalnav nav a { color: var(--text); text-decoration: none; opacity: .8; }
.globalnav nav a:hover, .globalnav nav a[aria-current="page"] { opacity: 1; }
.globalnav nav a[aria-current="page"] { font-weight: 600; }
.globalnav .cta {
  opacity: 1; background: var(--accent); color: #fff;
  padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
@media (max-width: 560px) {
  .globalnav nav { gap: 14px; }
  .globalnav .cta { display: none; }
}
.legal { padding-bottom: 96px; }
.legal .doc-intro h2 { font-size: clamp(36px, 6vw, 56px); font-weight: 700; }
