/* Prothesio web: base, cabecera, pie y esqueleto de secciones (fase 2).
   Colores siempre desde tokens.css; nada de hex sueltos aquí. */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  scrollbar-color: rgb(var(--ds-line-strong)) rgb(var(--ds-canvas));
}

body {
  margin: 0;
  min-height: 100vh;
  background: rgb(var(--ds-canvas));
  color: rgb(var(--ds-ink));
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  accent-color: rgb(var(--ds-brand));
  caret-color: rgb(var(--ds-brand));
}

::selection { background: rgb(var(--ds-brand-soft)); color: rgb(var(--ds-ink)); }

img, svg { display: block; max-width: 100%; }

/* hidden siempre gana a los display de componente (formulario de demo, menú móvil) */
[hidden] { display: none !important; }

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 650;
  line-height: 1.08;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

p { margin: 0; text-wrap: pretty; }

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

:focus-visible {
  outline: 2px solid rgb(var(--ds-brand));
  outline-offset: 3px;
  border-radius: 6px;
}

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

.skip-link {
  position: absolute;
  left: 16px; top: -100px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius-control);
  background: rgb(var(--ds-ink));
  color: rgb(var(--ds-surface));
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.icon {
  width: 20px; height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Botones (píldora, como en la app) ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: 600 0.9375rem/1 var(--font-body);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms ease-out, border-color 150ms ease-out, transform 120ms ease-out;
}
.btn:active { transform: scale(0.98); }

.btn--primary { background: rgb(var(--cta-bg)); color: rgb(var(--cta-ink)); }
.btn--primary:hover { background: rgb(var(--cta-bg-hover)); }

.btn--secondary {
  background: rgb(var(--ds-surface));
  border-color: rgb(var(--ds-line));
  color: rgb(var(--ds-ink));
}
.btn--secondary:hover { border-color: rgb(var(--ds-line-strong)); }

.btn--lg { min-height: 52px; padding: 0 26px; font-size: 1rem; }
.btn--block { width: 100%; }

.link-quiet {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 999px;
  color: rgb(var(--ds-ink-muted));
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 150ms ease-out;
}
.link-quiet:hover { color: rgb(var(--ds-ink)); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  padding: 0;
  border: 1px solid rgb(var(--ds-line));
  border-radius: 999px;
  background: rgb(var(--ds-surface));
  color: rgb(var(--ds-ink));
  cursor: pointer;
}

/* ---------- Cabecera ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgb(var(--ds-canvas) / 0.85);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid transparent;
  transition: border-color 200ms ease-out;
}
.site-header.is-scrolled { border-bottom-color: rgb(var(--ds-line) / 0.8); }

.site-header__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  max-width: var(--content-max);
  height: var(--header-h);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.brand { justify-self: start; display: inline-flex; padding: 6px 0; }
.brand__logo { width: auto; height: 28px; }

@media (prefers-color-scheme: dark) {
  /* El logo es azul marino sobre transparente: en oscuro se pinta en blanco */
  .brand__logo { filter: brightness(0) invert(1); }
}

.nav-pill {
  display: flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid rgb(var(--ds-line));
  border-radius: 999px;
  background: rgb(var(--ds-surface));
}
.nav-pill a {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  color: rgb(var(--ds-ink-muted));
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 150ms ease-out, color 150ms ease-out;
}
.nav-pill a:hover { background: rgb(var(--ds-surface-subtle)); color: rgb(var(--ds-ink)); }
.nav-pill a[aria-current="true"] { background: rgb(var(--ds-ink)); color: rgb(var(--ds-surface)); }

.site-header__actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 4px;
}

.menu-toggle { display: none; }
.menu-toggle .icon--close { display: none; }
.menu-toggle[aria-expanded="true"] .icon--open { display: none; }
.menu-toggle[aria-expanded="true"] .icon--close { display: block; }

.mobile-menu {
  padding: 8px var(--gutter) 24px;
  border-top: 1px solid rgb(var(--ds-line));
  background: rgb(var(--ds-canvas));
}
.mobile-menu nav { display: grid; }
.mobile-menu nav a {
  display: flex;
  align-items: center;
  min-height: 52px;
  border-bottom: 1px solid rgb(var(--ds-line));
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  text-decoration: none;
}
.mobile-menu__actions { display: grid; gap: 10px; margin-top: 20px; }

@media (max-width: 899px) {
  .site-header__inner { grid-template-columns: 1fr auto; }
  .nav-pill, .site-header__actions .link-quiet { display: none; }
  .menu-toggle { display: inline-flex; margin-left: 6px; }
}
@media (max-width: 479px) {
  .site-header__actions > .btn--primary { display: none; }
}
@media (min-width: 900px) {
  .mobile-menu { display: none; }
}

/* Cabecera de las páginas legales: logo, volver y demo, sin píldora ni menú */
.site-header__inner--simple { grid-template-columns: 1fr auto; }
@media (max-width: 899px) {
  .site-header__inner--simple .site-header__actions .link-quiet { display: inline-flex; }
}

/* ---------- Secciones: ver sections.css ---------- */

.fine-print { margin-top: 28px; color: rgb(var(--ds-ink-muted)); font-size: 0.875rem; }

.faq { max-width: 760px; border-top: 1px solid rgb(var(--ds-line)); }
.faq details { border-bottom: 1px solid rgb(var(--ds-line)); }
.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
  padding: 14px 0;
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  flex: none;
  width: 10px; height: 10px;
  border-right: 1.8px solid rgb(var(--ds-ink-muted));
  border-bottom: 1.8px solid rgb(var(--ds-ink-muted));
  transform: translateY(-3px) rotate(45deg);
  transition: transform 200ms var(--ease-out);
}
.faq details[open] summary::after { transform: translateY(2px) rotate(225deg); }
.faq details p { max-width: 62ch; padding-bottom: 20px; color: rgb(var(--ds-ink-muted)); }

/* ---------- Pie ---------- */

.site-footer {
  padding: 56px 0 40px;
  border-top: 1px solid rgb(var(--ds-line));
  background: rgb(var(--ds-surface));
  font-size: 0.9375rem;
}

.site-footer__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 40px 64px;
}

.site-footer__brand p { margin-top: 14px; max-width: 32ch; color: rgb(var(--ds-ink-muted)); }

.site-footer__nav { display: flex; flex-wrap: wrap; gap: 32px 56px; }
.site-footer__nav h2 {
  margin-bottom: 12px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0;
}
.site-footer__nav ul { margin: 0; padding: 0; list-style: none; }
.site-footer__nav li + li { margin-top: 4px; }
.site-footer__nav a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: rgb(var(--ds-ink-muted));
  text-decoration: none;
}
.site-footer__nav a:hover { color: rgb(var(--ds-ink)); text-decoration: underline; }

.site-footer__legal {
  grid-column: 1 / -1;
  padding-top: 24px;
  border-top: 1px solid rgb(var(--ds-line));
  color: rgb(var(--ds-ink-muted));
  font-size: 0.875rem;
}

@media (max-width: 719px) {
  .site-footer__inner { grid-template-columns: 1fr; }
}

/* ---------- Páginas legales ---------- */

.legal { padding: clamp(48px, 8vw, 96px) 0; }
.legal .container { max-width: 760px; }
.legal h1 { font-size: clamp(2.25rem, 5vw, 3.25rem); margin-bottom: 12px; }
.legal h2 { margin: 40px 0 12px; font-size: 1.375rem; }
.legal p, .legal li { color: rgb(var(--ds-ink-muted)); }
.legal p + p { margin-top: 12px; }
.legal ul { padding-left: 1.25em; }
.legal a { color: rgb(var(--ds-ink)); }
.legal__updated { color: rgb(var(--ds-ink-muted)); font-size: 0.875rem; }

.notice {
  margin: 28px 0 8px;
  padding: 16px 18px;
  border: 1px solid rgb(var(--ds-line-strong));
  border-radius: var(--radius-control);
  background: rgb(var(--ds-surface));
  color: rgb(var(--ds-ink));
}

.pending {
  padding: 0 4px;
  border-radius: 4px;
  background: rgb(var(--ds-brand-soft));
  color: rgb(var(--ds-ink));
  font-weight: 500;
}

/* ---------- Movimiento reducido ---------- */

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

.actions-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
