/* =========================
   Reset básico
   ========================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

html,
body {
  margin: 0;
  padding: 0;
}

/* =========================
   Base general
   ========================= */

:root {
  --legal-bg: #f3f6fb;
  --legal-card: #ffffff;
  --legal-text: #1e293b;
  --legal-muted: #475569;
  --legal-title: #0f172a;
  --legal-border: #dbe4ee;
  --legal-border-soft: #e7edf5;
  --legal-link: #2563eb;
  --legal-link-hover: #1d4ed8;
  --legal-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  --legal-radius: 20px;
  --legal-max: 920px;
}

body.legal-page {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  color: var(--legal-text);
  background:
    radial-gradient(circle at top, rgba(37, 99, 235, 0.05), transparent 35%),
    linear-gradient(180deg, #f8fbff 0%, var(--legal-bg) 100%);
}

/* =========================
   Layout principal
   ========================= */

.legal-main {
  width: min(100% - 32px, var(--legal-max));
  margin: 32px auto 56px;
  background: var(--legal-card);
  border: 1px solid var(--legal-border-soft);
  border-radius: var(--legal-radius);
  box-shadow: var(--legal-shadow);
  padding: 34px 34px 28px;
}

/* =========================
   Encabezado
   ========================= */

.legal-header {
  margin-bottom: 30px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--legal-border);
}

.legal-header h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 4vw, 2.6rem);
  line-height: 1.12;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--legal-title);
  overflow-wrap: anywhere;
}

.legal-header p {
  margin: 0;
  max-width: 760px;
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--legal-muted);
}

/* =========================
   Secciones
   ========================= */

.legal-section {
  margin-bottom: 28px;
}

.legal-section:last-of-type {
  margin-bottom: 0;
}

.legal-section h2 {
  margin: 0 0 12px;
  font-size: clamp(1.3rem, 2.6vw, 1.7rem);
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--legal-title);
  overflow-wrap: anywhere;
}

.legal-section h3 {
  margin: 18px 0 10px;
  font-size: 1.08rem;
  line-height: 1.35;
  font-weight: 700;
  color: var(--legal-title);
  overflow-wrap: anywhere;
}

.legal-section p {
  margin: 0 0 14px;
  font-size: 1.04rem;
  color: var(--legal-text);
  overflow-wrap: anywhere;
}

.legal-section p:last-child {
  margin-bottom: 0;
}

.legal-section ul,
.legal-section ol {
  margin: 0 0 14px;
  padding-left: 1.35rem;
}

.legal-section li {
  margin-bottom: 10px;
  color: var(--legal-text);
}

.legal-section li:last-child {
  margin-bottom: 0;
}

.legal-section strong {
  color: var(--legal-title);
  font-weight: 700;
}

/* =========================
   Enlaces
   ========================= */

.legal-page a {
  color: var(--legal-link);
  text-decoration: none;
  word-break: break-word;
}

.legal-page a:hover,
.legal-page a:focus-visible {
  color: var(--legal-link-hover);
  text-decoration: underline;
}

/* =========================
   Separaciones visuales suaves
   ========================= */

.legal-section + .legal-section {
  padding-top: 6px;
}

/* =========================
   Footer legal
   ========================= */

.legal-footer {
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--legal-border);
  text-align: center;
}

.legal-footer p {
  margin: 0;
  font-size: 0.96rem;
  color: var(--legal-muted);
}

/* =========================
   Botón o enlace final
   ========================= */

.legal-footer a,
.legal-back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.8rem 1.2rem;
  border-radius: 999px;
  border: 1px solid var(--legal-border);
  background: #f8fbff;
  color: var(--legal-link);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.legal-footer a:hover,
.legal-footer a:focus-visible,
.legal-back-link:hover,
.legal-back-link:focus-visible {
  background: #eef5ff;
  border-color: #c9dafc;
  text-decoration: none;
}

/* =========================
   Variantes opcionales
   ========================= */

body.legal-page--privacy .legal-header h1,
body.legal-page--terms .legal-header h1,
body.legal-page--refunds .legal-header h1 {
  color: var(--legal-title);
}

/* =========================
   Tablet
   ========================= */

@media (max-width: 900px) {
  .legal-main {
    width: min(100% - 24px, var(--legal-max));
    padding: 28px 24px 24px;
    margin: 24px auto 44px;
  }
}

/* =========================
   Móvil
   ========================= */

@media (max-width: 640px) {
  body.legal-page {
    font-size: 15px;
    line-height: 1.7;
  }

  .legal-main {
    width: min(100% - 16px, var(--legal-max));
    margin: 16px auto 28px;
    padding: 22px 16px 20px;
    border-radius: 16px;
  }

  .legal-header {
    margin-bottom: 22px;
    padding-bottom: 18px;
  }

  .legal-header h1 {
    margin-bottom: 10px;
  }

  .legal-header p {
    font-size: 0.98rem;
    line-height: 1.68;
  }

  .legal-section {
    margin-bottom: 22px;
  }

  .legal-section h2 {
    margin-bottom: 10px;
  }

  .legal-section h3 {
    font-size: 1rem;
    margin: 16px 0 8px;
  }

  .legal-section p,
  .legal-section li {
    font-size: 1rem;
    line-height: 1.7;
  }

  .legal-section ul,
  .legal-section ol {
    padding-left: 1.15rem;
  }

  .legal-footer {
    margin-top: 26px;
    padding-top: 18px;
  }

  .legal-footer a,
  .legal-back-link {
    width: 100%;
    max-width: 280px;
  }
}