/* Look of the page. Every colour, font, space, radius and shadow comes from
   data/theme.json as a CSS variable (color.primary -> --color-primary); change the
   look there, not here. The page stays hidden until the theme has loaded, so only
   the background and text colours need a fallback for the first paint.
   Text pairs used here are contrast-checked by scripts/validate.mjs. */
:root {
  --color-background: #faf8f5;
  --color-text: #152922;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: var(--font-size-base, 16px);
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-background);
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

p { margin: 0; }

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

.icon { display: block; width: 24px; height: 24px; fill: currentColor; flex-shrink: 0; }

/* Focus: always visible, on every interactive element. */
a:focus-visible, button:focus-visible {
  outline: 3px solid var(--color-text);
  outline-offset: 3px;
}

/* ---- Page --------------------------------------------------------------- */
.page {
  max-width: var(--layout-max-width);
  margin: 0 auto;
  padding: 0 var(--space-m);
}

/* ---- Language switch: top right, in a slim bar that stays in view ------- */
/* A bar with the page background (not a floating pill) so content scrolls
   cleanly underneath instead of being partly covered. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: flex-end;
  margin: 0 calc(var(--space-m) * -1);
  padding: var(--space-xs) var(--space-m);
  background: var(--color-background);
}
.lang-switch {
  display: flex;
  padding: 2px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-soft);
}
.lang-switch__button {
  min-width: var(--button-min-height);
  min-height: var(--button-min-height);
  padding: 0 var(--space-s);
  font: inherit;
  font-weight: 700;
  color: var(--color-muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.lang-switch__button[aria-pressed="true"] {
  color: var(--color-on-primary);
  background: var(--color-primary);
}

/* ---- Profile ------------------------------------------------------------ */
.profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-s);
  margin-bottom: var(--space-l);
  text-align: center;
}
.profile__ring {
  display: block;
  width: 104px;
  height: 104px;
  padding: 4px;
  border-radius: var(--radius-photo);
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-light) 45%, var(--color-primary));
  box-shadow: var(--shadow-soft);
}
.profile__photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 3px solid var(--color-surface);
  border-radius: var(--radius-photo);
  background: var(--color-surface);
}
.profile__name {
  margin: var(--space-xs) 0 0;
  font-size: 1.625rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.profile__role {
  max-width: 100%;
  padding: 2px var(--space-m);
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-primary-soft);
  border: 1px solid var(--color-border-featured);
  border-radius: var(--radius-pill);
  text-wrap: balance;
}
.profile__bio {
  max-width: 22em;
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.4;
  text-wrap: balance;
}
.profile__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-xs) var(--space-s);
  font-weight: 500;
  color: var(--color-muted);
}
.profile__location { display: inline-flex; align-items: center; gap: var(--space-xs); }
.profile__pin { width: 18px; height: 18px; color: var(--color-accent); }
.profile__trust { font-weight: 600; color: var(--color-primary); }
.profile__trust::before { content: "\2022"; margin-right: var(--space-s); color: var(--color-muted); }

/* Round social icons */
.socials {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: var(--space-s) 0 0;
  padding: 0;
  list-style: none;
}
.social {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 50%;
  box-shadow: var(--shadow-soft);
  text-decoration: none;
}
.social .icon { width: 22px; height: 22px; }
.social.is-soon { opacity: 0.55; border-style: dashed; box-shadow: none; }

/* ---- Cards -------------------------------------------------------------- */
.cards {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.card {
  position: relative;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  transition: transform 0.12s ease-in-out;
}
a.card:active, button.card:active { transform: scale(0.985); }
/* A card that opens a form is a <button>: same look as a link card. */
button.card { width: 100%; font: inherit; text-align: left; cursor: pointer; }
button.card[aria-expanded="true"] { border-color: var(--color-primary); }
.card__thumb {
  display: block;
  width: 72px;
  height: 72px;
  border-radius: var(--radius-thumb);
}
.card__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card__title { font-size: 1.0625rem; font-weight: 700; line-height: 1.3; }
.card__subtitle { line-height: 1.4; color: var(--color-muted); }
.card__action { margin-top: 2px; font-weight: 600; line-height: 1.35; color: var(--color-primary); }
.card__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--color-primary);
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: 50%;
}
.card__arrow .icon { width: 18px; height: 18px; }

/* Featured: the free offer */
.card--featured {
  margin-top: 14px;
  border: 2px solid var(--color-border-featured);
  box-shadow: var(--shadow-featured);
}
.card--featured .card__arrow {
  color: var(--color-on-primary);
  background: var(--color-primary);
  border-color: var(--color-primary);
}
.card__flag {
  position: absolute;
  top: -15px;
  right: var(--space-m);
  padding: 1px 12px;
  font-weight: 700;
  line-height: 1.6;
  color: var(--color-on-accent);
  background: var(--color-accent);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-soft);
}

/* Premium: VIP with price row */
.card--premium { grid-template-columns: 72px minmax(0, 1fr); border-color: var(--color-border-premium); }
.card__tag {
  align-self: flex-start;
  margin-bottom: 2px;
  padding: 0 var(--space-s);
  font-weight: 700;
  color: var(--color-accent-text);
  background: var(--color-accent-soft);
  border-radius: 6px;
}
.card__footer {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-s) var(--space-m);
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}
.card__price { font-size: 1.125rem; font-weight: 700; color: var(--color-primary); }
.card__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--button-min-height);
  margin-left: auto;
  padding: 0 18px;
  font-weight: 700;
  text-align: center;
  color: var(--color-on-primary);
  background: var(--color-primary);
  border-radius: var(--radius-button);
}

/* Muted: coming soon */
.card--muted {
  color: var(--color-muted);
  background: transparent;
  border: 1.5px dashed var(--color-border-muted);
  box-shadow: none;
}
.card--muted { padding-block: 10px; }
.card--muted .card__thumb { justify-self: center; width: 48px; height: 48px; }
.card--muted .card__title { font-weight: 600; }
.card__soon {
  padding: 2px 10px;
  font-weight: 600;
  color: var(--color-muted);
  background: var(--color-surface-muted);
  border-radius: 8px;
}

/* Form panel under a whatsapp_form card (VIP) */
.wa-form {
  margin-top: var(--space-s);
  padding: var(--space-m);
  background: var(--color-surface);
  border: 1px solid var(--color-border-premium);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
}
.wa-form__form { display: flex; flex-direction: column; gap: var(--space-m); }
.wa-form__field { display: flex; flex-direction: column; gap: var(--space-xs); }
.wa-form__label { font-weight: 700; }
.wa-form__optional { font-weight: 400; color: var(--color-muted); }
.wa-form__input {
  width: 100%;
  min-height: var(--button-min-height);
  padding: 0 12px;
  font: inherit;
  font-size: 1rem; /* 16 px: iPhones do not zoom in */
  color: var(--color-text);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border-muted);
  border-radius: var(--radius-button);
}
.wa-form__input:focus-visible { outline: 3px solid var(--color-text); outline-offset: 2px; }
.wa-form__input[aria-invalid="true"] { border-color: var(--color-danger); border-width: 2px; }
.wa-form__error { font-weight: 600; color: var(--color-danger); }
.wa-form__actions { display: flex; flex-wrap: wrap; gap: var(--space-s); }
.wa-form__submit, .wa-form__close {
  min-height: var(--button-min-height);
  padding: 0 18px;
  font: inherit;
  font-weight: 700;
  border-radius: var(--radius-button);
  cursor: pointer;
}
.wa-form__submit {
  flex: 1 1 12rem;
  color: var(--color-on-primary);
  background: var(--color-primary);
  border: 0;
}
.wa-form__close {
  flex: 0 1 auto;
  color: var(--color-primary);
  background: var(--color-surface);
  border: 1.5px solid var(--color-primary);
}
.wa-form__privacy { color: var(--color-muted); line-height: 1.45; }

/* Not clickable yet (placeholder URL): looks the same, does not invite a tap. */
.is-missing { cursor: default; }

/* ---- WhatsApp fallback -------------------------------------------------- */
.wa-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-s);
  margin-top: var(--space-l);
  padding: var(--space-m);
  text-align: center;
  color: var(--color-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
}
.wa-fallback__number {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  user-select: all;
  -webkit-user-select: all;
}
.wa-fallback__copy {
  min-height: var(--button-min-height);
  padding: 0 var(--space-m);
  font: inherit;
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-surface);
  border: 1.5px solid var(--color-primary);
  border-radius: var(--radius-button);
  cursor: pointer;
}
.wa-fallback__status:empty { display: none; }

/* ---- Footer ------------------------------------------------------------- */
.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-s);
  margin-top: var(--space-xl);
  padding: var(--space-l) 0 var(--space-xl);
  text-align: center;
  color: var(--color-muted);
  border-top: 1px solid var(--color-border);
}
.footer__disclaimer { max-width: 30em; line-height: 1.5; }
.footer__credit a {
  display: inline-flex;
  align-items: center;
  min-height: var(--button-min-height);
  padding: 0 var(--space-s);
  font-weight: 600;
  color: var(--color-primary);
  text-underline-offset: 3px;
}

/* ---- Loading problem ---------------------------------------------------- */
.notice { padding: var(--space-xl) var(--space-m); text-align: center; }

/* ---- Small phones (320 px) ---------------------------------------------- */
@media (max-width: 359px) {
  .card { grid-template-columns: 56px minmax(0, 1fr) auto; gap: 10px; padding: 12px; }
  .card--premium { grid-template-columns: 56px minmax(0, 1fr); }
  .card__thumb { width: 56px; height: 56px; }
  .card--muted .card__thumb { width: 44px; height: 44px; }
  .card__arrow { width: 36px; height: 36px; }
  .profile__name { font-size: 1.5rem; }
}

/* ---- Reduced motion: no press effect, no transitions -------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  a.card:active { transform: none; }
}
