:root {
  /* Brand palette */
  --color-mist: #BABFD1;    /* muted blue-gray — borders, dark-mode secondary text */
  --color-violet: #52537B;  /* buttons and links (light mode) */
  --color-ink: #2F4858;     /* dark slate — primary text, dark-mode background */
  --color-teal: #1B998B;    /* brand mark (logo) + dark-mode checkmark highlight */
  --color-gold: #FFC759;    /* checkmark highlight (light mode) + dark-mode buttons/links */
  --color-gold-deep: #AC9459; /* gold darkened for use as a small icon stroke on a light chip */

  /* No near-white was given in this palette, so the page background is a light tint mixed
     from --color-mist rather than a flat white, to keep the site's cool, muted character. */
  --bg: #eeeff4;
  --bg-elevated: #ffffff;
  --text: var(--color-ink);
  --text-muted: #526676; /* --color-ink blended toward --color-mist, tuned for AA contrast on --bg */
  --border: var(--color-mist);

  --accent: var(--color-violet);
  --accent-hover: #4d5176;
  --accent-ink: #ffffff; /* text color placed on top of --accent */

  --highlight: var(--color-gold);
  --highlight-ink: var(--color-ink); /* text/icon color placed on top of --highlight */

  --brand-mark: var(--color-teal); /* logo only — a logotype is exempt from text-contrast rules */

  --heading-gradient: linear-gradient(90deg, var(--color-violet), var(--color-teal));
  --shadow-color: 47, 72, 88; /* --color-ink as an r,g,b triple, for rgba() shadows */

  --radius: 10px;
  --max-width: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--color-ink);
    --bg-elevated: #445a6a;
    --text: #ffffff;
    --text-muted: var(--color-mist);
    --border: #596c7c;

    /* --color-violet is too dark to read against a dark background, so gold takes over as the
       primary accent in dark mode; teal (freed up from that role) becomes the checkmark color
       instead so highlights stay visually distinct from buttons/links. */
    --accent: var(--color-gold);
    --accent-hover: #e0b459;
    --accent-ink: var(--color-ink);

    --highlight: var(--color-teal);
    --highlight-ink: #ffffff;

    --heading-gradient: linear-gradient(90deg, var(--color-gold), var(--color-mist));
    --shadow-color: 0, 0, 0;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--accent); }

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

header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
}

@supports (backdrop-filter: blur(1px)) {
  header {
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    backdrop-filter: blur(10px);
  }
}

header nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

header .logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

header .logo img {
  height: 32px;
  width: auto;
  display: block;
}

.hero-logo {
  height: 112px;
  width: auto;
  margin-bottom: 1.5rem;
}

.language-switcher {
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
}

.language-switcher:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 5rem 0 4rem;
  text-align: center;
}

.hero.home-hero {
  padding-top: 2rem;
}

.hero.home-hero p.subhead {
  padding-bottom: 0rem;
}

.hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -30% -10% auto -10%;
  height: 160%;
  background:
    radial-gradient(circle at 18% 25%, color-mix(in srgb, var(--color-violet) 30%, transparent), transparent 60%),
    radial-gradient(circle at 82% 20%, color-mix(in srgb, var(--color-teal) 26%, transparent), transparent 55%),
    radial-gradient(circle at 50% 90%, color-mix(in srgb, var(--color-gold) 22%, transparent), transparent 50%);
  filter: blur(60px);
  pointer-events: none;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-gold) 18%, var(--bg-elevated));
  border: 1px solid color-mix(in srgb, var(--color-gold) 45%, transparent);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.eyebrow::before {
  content: "";
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  background: var(--color-gold);
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  margin: 0 0 1rem;
}

.hero h1.hero-title {
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
}

.gradient-text {
  background: var(--heading-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p.subhead {
  color: var(--text-muted);
  font-size: 1.15rem;
  max-width: 640px;
  margin: 0 auto 1rem;
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  font-weight: 700;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
}

.btn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 45%, transparent);
}

.btn:active { transform: translateY(0); }

.btn.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn.secondary:hover {
  background: var(--bg-elevated);
  box-shadow: 0 6px 16px rgba(var(--shadow-color), 0.08);
}

section {
  padding: 3rem 0;
  border-top: 1px solid var(--border);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.icon-badge {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(var(--shadow-color), 0.15);
}

.icon-badge svg { width: 24px; height: 24px; }

.icon-badge.violet { color: var(--color-violet); }
.icon-badge.teal { color: var(--color-teal); }
.icon-badge.gold { color: var(--color-gold-deep); }

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 1px 3px rgba(var(--shadow-color), 0.08);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 28px rgba(var(--shadow-color), 0.14);
}

.card h3 { margin-top: 0; }

.pricing-card {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 380px;
  margin: 2rem auto 0;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 1px 3px rgba(var(--shadow-color), 0.08);
}

.pricing-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 28px rgba(var(--shadow-color), 0.14);
}

.pricing-card.featured {
  border-color: var(--accent);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 25%, transparent);
}

.pricing-card.featured::before {
  content: "Most popular";
  position: absolute;
  top: -0.8rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--highlight);
  color: var(--highlight-ink);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  white-space: nowrap;
}

.price {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0.5rem 0;
}

.price span { font-size: 1rem; color: var(--text-muted); font-weight: 400; }

.price-amount { display: block; }

/* Stacked below the amount, e.g. "one-time purchase" — see .price-full above for the
   struck-through original-price line that can sit above this same .price block. */
.price-suffix {
  display: block;
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 400;
}

.pricing-card h3 { margin-bottom: 0; }

.pricing-card-subtitle {
  display: block;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.pricing-card-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.no-subscription-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--highlight-ink);
  background: var(--highlight);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  margin-bottom: 0.75rem;
}

.no-subscription-badge.hero-badge {
  font-size: 1.5rem;
  padding: 0.4rem 1.2rem;
  margin: 0.5rem 0 1.5rem;
}

/* Shown before .price when a pack/product has an optional discount (FullPriceUsd) — the
   struck-through original price sits right above the current one. */
.price-full {
  display: block;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--text-muted) 70%, transparent);
}

.feature-list {
  list-style: none;
  padding: 0;
  text-align: left;
  margin: 1.5rem 0;
}

.feature-list li {
  padding: 0.4rem 0;
  color: var(--text-muted);
  display: flex;
  align-items: flex-start;
  gap: 0.5em;
}

.feature-list li::before {
  content: "✓";
  color: var(--highlight-ink);
  background: var(--highlight);
  font-weight: 700;
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  line-height: 1.2em;
  text-align: center;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 0.15em;
}

footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.error-message {
  /* Deliberately outside the brand palette — a universally-recognizable error red so it
     doesn't get confused with the brand's own accent used throughout for CTAs/links. */
  color: #d43d51;
  margin-top: 1rem;
  display: none;
}

.success-message {
  /* Pairs with .error-message — same treatment, universally-recognizable green rather than
     a brand color, so status messages read unambiguously regardless of theme. */
  color: #1f8a5c;
  margin-top: 1rem;
  display: none;
}

.narrow-card {
  max-width: 420px;
  margin: 2rem auto 0;
}

.form-group {
  text-align: left;
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

.form-group input,
.form-group select,
.payment-element-mount {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}

.form-group input:focus-visible,
.form-group select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Stripe.js mounts an iframe inside this div — padding/border here frame it consistently with
   the plain inputs above it; the Payment Element's own Appearance API (see portal.js
   stripeElementsAppearance) matches its internal colors/font to the site's theme. */
.payment-element-mount {
  padding: 0.75rem 0.85rem;
}

.payment-element-mount.StripeElement--focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.payment-element-error {
  color: #d43d51;
  font-size: 0.85rem;
  margin-top: 0.5rem;
  min-height: 1.2em;
}

.auto-recharge-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.device-list {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.device-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.device-row .btn.secondary {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* Indeterminate — there's no real percentage to show (the wait is usually near-instant, but can
   run up to ~60s on a cold-started database), so this signals "still working" rather than progress. */
.progress-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.progress-bar-fill {
  width: 40%;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  animation: progress-indeterminate 1.2s ease-in-out infinite;
}

@keyframes progress-indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}

/* In-page replacement for window.alert()/window.confirm() — see portal.js showAlertModal /
   showConfirmModal. */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(var(--shadow-color), 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 100;
}

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 16px 40px rgba(var(--shadow-color), 0.25);
}

.modal-message {
  margin: 0 0 1.5rem;
  color: var(--text);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.modal-actions .btn {
  padding: 0.6rem 1.25rem;
  font-size: 0.95rem;
  box-shadow: none;
}

.draft-notice {
  max-width: 720px;
  margin: 0 auto 2.5rem;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--color-gold) 14%, var(--bg-elevated));
  border: 1px solid color-mix(in srgb, var(--color-gold) 45%, transparent);
  font-size: 0.95rem;
  line-height: 1.6;
}

.legal-content {
  max-width: 720px;
  margin: 0 auto;
}

.legal-content h2 {
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}

.legal-content h2:first-child {
  margin-top: 0;
}

.legal-content p,
.legal-content li {
  line-height: 1.7;
  color: var(--text);
}

.legal-content ul {
  padding-left: 1.25rem;
  margin: 0.75rem 0;
}

.legal-content .updated {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: -0.5rem;
}

.hero-pricing-line {
  color: var(--text-muted);
  font-size: 1rem;
  margin: -1rem 0 1.5rem;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.hero-fineprint {
  color: var(--text-muted);
  font-size: 0.85rem;
  max-width: 560px;
  margin: 0 auto;
}

.proof-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 2rem;
}

.proof-strip span {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.section-intro {
  max-width: 640px;
  margin: 0 auto 2rem;
  text-align: center;
}

.section-intro h2 {
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  margin: 0 0 0.75rem;
  text-wrap: balance;
}

.section-intro p {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin: 0;
}

.faq-list {
  max-width: 760px;
  margin: 2rem auto 0;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.faq-item summary {
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: "+";
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-item p {
  margin: 0;
  padding: 0 1.25rem 1.25rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.table-scroll {
  overflow-x: auto;
  margin: 2rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 640px;
}

.comparison-table th,
.comparison-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.comparison-table th {
  background: var(--bg-elevated);
  font-weight: 700;
  white-space: nowrap;
}

.comparison-table tbody tr:last-child td {
  border-bottom: none;
}

.comparison-table td:first-child,
.comparison-table th:first-child {
  font-weight: 600;
  position: sticky;
  left: 0;
  background: var(--bg-elevated);
}

.comparison-table th.brand {
  color: var(--accent);
}

.comparison-table td.center {
  text-align: center;
}

.comparison-table .yes {
  color: #1f8a5c;
  font-weight: 700;
  font-size: 1.1rem;
}

.comparison-table .no {
  color: var(--text-muted);
  opacity: 0.6;
}

.comparison-table tr.category-row td {
  background: var(--bg);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding-top: 1.1rem;
  padding-bottom: 0.5rem;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .card, .pricing-card {
    transition: none;
  }
  .btn:hover, .card:hover, .pricing-card:hover {
    transform: none;
  }
  .progress-bar-fill {
    animation: none;
    width: 100%;
  }
}
