/* Reset, typography and shared components for every landing page */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body, h1, h2, h3, h4, p, ul, ol, figure, blockquote, dl, dd { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

body {
  font: var(--text-body);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  overflow-wrap: break-word;
}

h1, h2, h3 { font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
h1 { font: var(--text-hero); letter-spacing: -0.02em; }
h2 { font: var(--text-title); letter-spacing: -0.02em; }
h3 { font: var(--text-section); }
@media (min-width: 1024px) {
  h2 { font: var(--text-title-wide); letter-spacing: -0.02em; }
}

a { color: var(--color-link); text-underline-offset: 2px; }
.muted { color: var(--color-text-muted); }
.small { font: var(--text-small); }
.num { font-variant-numeric: tabular-nums; }
code, kbd, .mono { font-family: var(--font-mono); }

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

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.container {
  width: 100%;
  max-width: calc(var(--content-max) + 2 * var(--space-4));
  margin-inline: auto;
  padding-inline: var(--space-4);
}
@media (min-width: 600px) {
  .container { padding-inline: var(--space-6); max-width: calc(var(--content-max) + 2 * var(--space-6)); }
}

/* Buttons: one primary action, secondary is outlined */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 44px; padding: 0 var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font: var(--text-strong);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--color-accent); color: var(--color-on-accent); }
.btn-secondary { background: transparent; color: var(--color-accent); border-color: var(--color-accent); }
.btn-text { background: transparent; color: var(--color-link); padding-inline: var(--space-3); }
.btn-sm { min-height: 36px; padding: 0 var(--space-4); font: var(--text-small); font-weight: 600; }
@media (pointer: coarse) { .btn-sm { min-height: 44px; } }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-6);
}

.badge {
  display: inline-block;
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  font: var(--text-caption);
  background: var(--color-catch-fill);
  color: var(--color-on-catch);
}

/* Segmented control: language switch and period switch */
.segmented {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  background: var(--color-surface-2);
}
.segmented > button {
  min-height: 32px; min-width: 40px;
  padding: 0 var(--space-3);
  border: 0; border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-text-muted);
  font: var(--text-small); font-weight: 600;
}
@media (pointer: coarse) { .segmented > button { min-height: 44px; } }
.segmented > button[aria-pressed="true"],
.segmented > button[aria-checked="true"] {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 0 0 1px var(--color-border-strong);
}

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-text);
}

/* Header and footer shared by all pages */
.site-header {
  position: sticky; top: 0; z-index: 10;
  height: var(--header-h);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}
.site-header .container { display: flex; align-items: center; gap: var(--space-4); height: 100%; }
.wordmark { font-weight: 700; font-size: 18px; letter-spacing: -0.02em; color: var(--color-text); text-decoration: none; }
.site-header nav { display: none; gap: var(--space-5); }
.site-header nav a { color: var(--color-text-muted); text-decoration: none; font: var(--text-small); font-weight: 600; }
.site-header .spacer { flex: 1; }
@media (min-width: 600px) { .site-header nav { display: flex; } }

.site-footer {
  margin-top: var(--space-12);
  padding-block: var(--space-10);
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font: var(--text-small);
}
.site-footer a { color: var(--color-link); }

/* Native dialog for the checkout */
dialog {
  width: min(480px, calc(100vw - 2 * var(--space-4)));
  padding: var(--space-6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  color: var(--color-text);
}
dialog::backdrop { background: rgb(0 0 0 / .45); }
dialog[open] { max-height: calc(100dvh - 2 * var(--space-4)); overflow-y: auto; }

/* Checkout form inside the dialog */
.checkout-form > * + * { margin-top: var(--space-4); }
.checkout-form h2 { margin-top: var(--space-1); }
.checkout-periods { border: 0; padding: 0; margin-inline: 0; display: grid; gap: var(--space-2); }
.checkout-periods legend { padding: 0; margin-bottom: var(--space-2); }
.period-row, .check-row { display: flex; align-items: center; gap: var(--space-3); min-height: 44px; cursor: pointer; }
.period-row {
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
}
.period-row:has(input:checked) { border-color: var(--color-accent); box-shadow: inset 0 0 0 1px var(--color-accent); }
.period-row .num { margin-left: auto; font-weight: 600; }
.check-row { align-items: flex-start; min-height: 0; }
.check-row input, .period-row input { width: 20px; height: 20px; flex: none; accent-color: var(--color-accent); }
.check-row input { margin-top: 2px; }
.checkout-total { display: flex; justify-content: space-between; align-items: baseline; font: var(--text-strong); }
.checkout-total strong { font-size: 24px; }
.checkout-error { color: var(--color-danger); font-weight: 600; }
.checkout-keep > * + * { margin-top: var(--space-3); }
.checkout-keep .keep-link { overflow-wrap: anywhere; font-weight: 600; }
.checkout-actions .btn { flex: 1 1 auto; }
.checkout-form .btn-text { white-space: normal; padding-inline: 0; min-height: 44px; text-align: left; justify-content: flex-start; }

@media (prefers-reduced-motion: no-preference) {
  .btn, .segmented > button, .icon-btn, a { transition: background-color 150ms ease-out, color 150ms ease-out, border-color 150ms ease-out, box-shadow 150ms ease-out; }
}

/* Layout helpers */
.stack > * + * { margin-top: var(--space-4); }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.page-main { padding-block: var(--space-8) var(--space-12); }
