/* ==========================================================================
   Pumpful — shared site stylesheet
   Single source of truth for pumpful.app (landing page + legal pages).
   Design tokens mirror the iOS app (EPTracker/App/Theme.swift).
   Pure CSS: no frameworks, no web fonts, no tracking.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens — light theme (defaults)
   -------------------------------------------------------------------------- */
:root {
  /* Brand palette — light values from Theme.swift */
  --bg: #FAF6F0;
  --surface: #FFFFFF;
  --surface-2: #F2ECE3;
  --sage: #7C9A6A;
  --sage-dark: #8FB07A;
  --terra: #D98C7A;
  --terra-dark: #E59C88;
  --blush: #EBCEC4;
  --gold: #C9A96E;
  --text: #2A2722;
  --text-2: #6E6961;
  --line: #E7DECF;
  --today-wash: #F7E4DC;

  /* Semantic aliases */
  --accent: var(--sage);
  --accent-warm: var(--terra);
  /* Darkened sage that clears WCAG AA (>= 4.5:1) for text/links on --surface
     and --bg; the raw brand sage only reaches ~3.1:1. */
  --accent-ink: #5A7349;
  --link: var(--accent-ink);
  --on-accent: #FFFFFF;
  --focus-ring: var(--accent-ink);
  --header-bg: rgba(250, 246, 240, 0.92);

  /* Shape & elevation (radii from Theme.swift) */
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(42, 39, 34, 0.05), 0 6px 16px rgba(42, 39, 34, 0.06);
  --shadow-lg: 0 24px 60px rgba(42, 39, 34, 0.16);

  color-scheme: light;
}

/* Dark theme — dark values from Theme.swift; accents switch to the
   -dark variants (sage-dark / terra-dark) for contrast on dark surfaces. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17150F;
    --surface: #211E18;
    --surface-2: #2A2620;
    --blush: #5A3D36;
    --text: #F2EDE4;
    --text-2: #A89F92;
    --line: #3A332A;
    --today-wash: #3B2A24;

    --accent: var(--sage-dark);
    --accent-warm: var(--terra-dark);
    --accent-ink: var(--sage-dark);
    --link: var(--sage-dark);
    --on-accent: #17150F;
    --focus-ring: var(--sage-dark);
    --header-bg: rgba(23, 21, 15, 0.9);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 6px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);

    color-scheme: dark;
  }
}

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    Arial, sans-serif;
}

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

h1, h2, h3 {
  margin: 0 0 0.5em;
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    sans-serif;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

p { margin: 0 0 1rem; }
a { color: var(--link); }

/* --------------------------------------------------------------------------
   3. Accessibility helpers
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -64px;
  z-index: 100;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  background: var(--accent-ink);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; }

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------------------------------
   4. Layout primitives
   -------------------------------------------------------------------------- */
.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.section { padding: 80px 0; }

/* Alternating surface band to give long pages rhythm. */
.band {
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.section-head { max-width: 620px; margin: 0 auto 48px; text-align: center; }
.section-head h2 { font-size: clamp(1.8rem, 3.5vw, 2.4rem); }
.section-head p { color: var(--text-2); margin: 0; }

/* --------------------------------------------------------------------------
   5. Site header (shared by all pages)
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
}
.brand img { width: 32px; height: 32px; border-radius: 8px; }

.site-nav { display: flex; align-items: center; gap: 20px; margin-left: auto; }
.site-nav a { color: var(--text-2); font-size: 0.95rem; text-decoration: none; }
.site-nav a:hover { color: var(--link); }
.site-nav a[aria-current="page"] { color: var(--link); font-weight: 600; }

/* Language toggle — same control on every page. */
.lang-toggle { display: flex; gap: 4px; }
.lang-toggle button {
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.lang-toggle button[aria-pressed="true"] {
  background: var(--accent-ink);
  border-color: var(--accent-ink);
  color: var(--on-accent);
}

/* --------------------------------------------------------------------------
   6. Buttons & App Store badge
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.6rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn-primary { background: var(--accent-ink); color: var(--on-accent); }
.btn-outline { background: var(--surface); border-color: var(--line); color: var(--text); }

/* Self-drawn App Store badge (official-style black badge). */
.badge-appstore {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 22px;
  background: #000000;
  color: #FFFFFF;
  border: 1px solid #000000;
  border-radius: 14px;
  line-height: 1.2;
  text-decoration: none;
}
.badge-appstore svg { width: 26px; height: 26px; flex: none; fill: #FFFFFF; }
.badge-appstore .badge-small { display: block; font-size: 0.68rem; opacity: 0.85; }
.badge-appstore .badge-big {
  display: block;
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
@media (prefers-color-scheme: dark) {
  .badge-appstore { border-color: #4A443A; }
}

/* --------------------------------------------------------------------------
   7. Hero
   -------------------------------------------------------------------------- */
.hero { padding: 88px 0 64px; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 0.9rem;
  color: var(--accent-warm);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1 { font-size: clamp(2.3rem, 5vw, 3.4rem); }
.hero .sub { max-width: 32rem; color: var(--text-2); font-size: 1.18rem; }
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 1.8rem;
}
.hero-note { margin: 1.1rem 0 0; color: var(--text-2); font-size: 0.9rem; }
.hero-art .phone { max-width: 300px; margin: 0 auto; }

/* --------------------------------------------------------------------------
   8. Feature cards
   -------------------------------------------------------------------------- */
.grid-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: var(--today-wash);
  font-size: 1.35rem;
}

.card h3 { font-size: 1.08rem; margin-bottom: 0.35rem; }
.card p { margin: 0; color: var(--text-2); font-size: 0.97rem; }

/* --------------------------------------------------------------------------
   9. Screenshot gallery with phone frames
   -------------------------------------------------------------------------- */
.shots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px 28px; }
.shot { margin: 0; }
.shot figcaption {
  margin-top: 14px;
  color: var(--text-2);
  font-size: 0.92rem;
  text-align: center;
}

/* Phone frame — the screenshots already include the device bezel/status bar,
   so the frame is a simple dark rounded shell. */
.phone { padding: 10px; background: #17150F; border-radius: 44px; box-shadow: var(--shadow-lg); }
.phone img { display: block; width: 100%; height: auto; border-radius: 34px; }

/* --------------------------------------------------------------------------
   10. Pricing
   -------------------------------------------------------------------------- */
.plans {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 840px;
  margin: 0 auto;
}

.plan {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}
.plan-pro { position: relative; border: 2px solid var(--accent-warm); }

.plan-tag {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.25rem 0.9rem;
  background: var(--accent-warm);
  color: #2A2722;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.plan h3 { font-size: 1.25rem; }
.plan-price { margin: 0 0 0.25rem; font-size: 2.1rem; font-weight: 700; }
.plan-price small { color: var(--text-2); font-size: 1rem; font-weight: 400; }
.plan-sub { margin: 0 0 1.2rem; color: var(--text-2); font-size: 0.92rem; }

.plan ul { margin: 0 0 1.6rem; padding: 0; list-style: none; }
.plan li { position: relative; padding: 0.45rem 0 0.45rem 1.8rem; color: var(--text-2); }
.plan li::before {
  content: "✓";
  position: absolute;
  left: 0.2rem;
  color: var(--accent);
  font-weight: 700;
}
.plan .btn { margin-top: auto; }

.price-rows { display: flex; gap: 10px; margin: 0 0 1.2rem; }
.price-rows > div {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-align: center;
}
.price-rows strong { display: block; font-size: 1.2rem; }
.price-rows span { color: var(--text-2); font-size: 0.8rem; }

.pricing-note {
  max-width: 840px;
  margin: 20px auto 0;
  color: var(--text-2);
  font-size: 0.85rem;
  text-align: center;
}

/* --------------------------------------------------------------------------
   11. FAQ (native details/summary — keyboard accessible by default)
   -------------------------------------------------------------------------- */
.faq { max-width: 720px; margin: 0 auto; }
.faq details {
  margin-bottom: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.faq summary {
  position: relative;
  padding: 16px 48px 16px 20px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  right: 20px;
  top: 13px;
  color: var(--accent);
  font-size: 1.4rem;
  font-weight: 400;
  transition: transform 0.2s ease;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0; padding: 0 20px 18px; color: var(--text-2); }

/* --------------------------------------------------------------------------
   12. Site footer
   -------------------------------------------------------------------------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--line); }

.footer-inner {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 32px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 56px 24px 40px;
}

.footer-brand .brand { margin-bottom: 12px; }
.footer-brand p { margin: 0; color: var(--text-2); font-size: 0.92rem; max-width: 22rem; }

.footer-col h2 {
  margin: 0 0 0.8rem;
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
}
.footer-col ul { margin: 0; padding: 0; list-style: none; }
.footer-col li { margin-bottom: 0.5rem; }
.footer-col a { color: var(--text-2); text-decoration: none; }
.footer-col a:hover { color: var(--link); text-decoration: underline; }

.footer-bottom {
  padding: 0 24px 32px;
  color: var(--text-2);
  font-size: 0.85rem;
  text-align: center;
}
.footer-bottom p { margin: 0.2rem 0; }

/* --------------------------------------------------------------------------
   13. Legal / support pages (privacy, terms, support)
   -------------------------------------------------------------------------- */
.wrap { max-width: 720px; margin: 0 auto; padding: 56px 24px 96px; }

.tag {
  display: inline-block;
  margin-bottom: 1.5rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent-ink);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.prose h1 { font-size: 2rem; margin-bottom: 0.25rem; }
.prose .lead { margin: 0 0 2rem; color: var(--text-2); font-size: 1.05rem; }
.prose h2 { margin: 2.2rem 0 0.6rem; color: var(--accent-ink); font-size: 1.25rem; }
.prose p, .prose li { margin: 0 0 0.8rem; }
.prose ul { padding-left: 1.2rem; }
.prose hr { margin: 2.5rem 0; border: 0; border-top: 1px solid var(--line); }
.prose .footer-note { color: var(--text-2); font-size: 0.9rem; }

.contact-card {
  margin: 1rem 0;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

/* --------------------------------------------------------------------------
   14. Bilingual visibility — driven by <html lang>, persisted in pl_lang.
   Default markup is lang="en"; Chinese blocks render only under zh-Hans.
   -------------------------------------------------------------------------- */
html[lang="en"] .zh { display: none; }
html[lang="zh-Hans"] .en { display: none; }

/* --------------------------------------------------------------------------
   15. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .hero { padding: 56px 0 48px; }
  .hero-grid { grid-template-columns: 1fr; gap: 40px; text-align: center; }
  .hero .sub { margin-left: auto; margin-right: auto; }
  .hero-cta { justify-content: center; }
  .grid-features { grid-template-columns: repeat(2, 1fr); }
  .shots { grid-template-columns: repeat(2, 1fr); gap: 24px 20px; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .section { padding: 56px 0; }
  .site-nav a { display: none; }
  .grid-features, .plans, .footer-inner { grid-template-columns: 1fr; }
  .shots { grid-template-columns: 1fr 1fr; gap: 20px 14px; }
  .price-rows { flex-direction: column; }
}
