:root {
  color-scheme: dark light;
  --bg: #14151F;
  --surface: #1E2233;
  --surface-alt: #191C2B;
  --border: #2B3047;
  --text: #EDEFF7;
  --muted: #9AA0B4;
  --accent: #2EC4B6;
  --accent-soft: #9BE7DF;
  --on-accent: #14151F;
  --badge-bg: #2B3047;
  --radius: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* La marca (hero) es siempre oscura, también en modo claro */
  --brand-bg: #14151F;
  --brand-water: #10111A;
  --brand-line: #3A405A;
  --brand-text: #EDEFF7;
  --brand-muted: #9AA0B4;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #F6F5F1;
    --surface: #FFFFFF;
    --surface-alt: #EFEDE7;
    --border: #E3E1DA;
    --text: #1E2233;
    --muted: #5A5F73;
    --accent: #13877C;
    --accent-soft: #1FA597;
    --on-accent: #FFFFFF;
    --badge-bg: #ECEAE3;
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--font);
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-soft); }

.wordmark {
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: lowercase;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--muted);
  font-size: 0.8rem;
}

/* ---------- Hero (portada) ---------- */

.hero {
  display: flex;
  flex-direction: column;
  min-height: min(72vh, 640px);
  background: var(--brand-bg);
  color: var(--brand-text);
}
.hero-above {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--brand-line); /* la línea de agua */
}
.hero-below {
  background: var(--brand-water);
  padding: 32px 0 36px;
}

.hero-nav {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  padding: 20px 16px 0;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  font-size: 0.9rem;
}
.hero-nav a, .hero-nav span {
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--brand-muted);
  text-decoration: none;
}
.hero-nav a:hover { color: var(--brand-text); }
.hero-nav [aria-current] { color: var(--brand-text); background: rgba(255, 255, 255, 0.08); }

.hero-top {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 18px;
  padding: 32px 16px;
  text-align: center;
}
.hero-top img { width: clamp(96px, 16vw, 132px); height: auto; }
.hero h1 { margin: 0; font-size: clamp(1.9rem, 6vw, 3rem); line-height: 1.1; }

.hero-apps {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
}
.hero-apps a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 8px;
  border: 1px solid var(--brand-line);
  border-radius: 999px;
  color: var(--brand-text);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.03);
}
.hero-apps a:hover { border-color: var(--brand-muted); }
.hero-apps img { width: 28px; height: 28px; border-radius: 8px; }

/* ---------- Escaparate de apps ---------- */

.showcase {
  padding: 80px 0;
  border-bottom: 1px solid var(--border);
}
.showcase:nth-of-type(even) { background: var(--surface-alt); }

/* Texto y capturas comparten contenedor: mismos bordes en todas las apps */
.showcase-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 56px;
  align-items: center;
}
.showcase.reverse .showcase-inner { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); }
.showcase.reverse .showcase-text { order: 2; }

.showcase-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.showcase-head img { width: 64px; height: 64px; border-radius: 16px; flex: none; }
.showcase-head h2 { margin: 0; font-size: 1.9rem; line-height: 1.2; }
.showcase-head p { margin: 2px 0 0; color: var(--muted); }
.lead { font-size: 1.12rem; margin: 0 0 18px; }

.features { margin: 0 0 22px; padding: 0; list-style: none; display: grid; gap: 10px; }
.features li { position: relative; padding-left: 26px; }
.features li::before {
  content: "";
  position: absolute;
  left: 4px; top: 0.62em;
  width: 9px; height: 9px;
  border-radius: 3px;
  background: var(--app-accent, var(--accent));
}

.facts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.facts span {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.9rem;
}
.facts strong { font-weight: 600; }

.cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--app-accent, var(--accent));
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}
.cta:hover { color: #fff; filter: brightness(1.08); }
.cta svg { width: 18px; height: 18px; fill: currentColor; }

/* Carrusel de capturas: se ven dos, el resto deslizando o con las flechas */
.gallery { min-width: 0; }
.phones {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding: 4px 2px 22px;
}
.phones::-webkit-scrollbar { display: none; }
.phone {
  flex: 0 0 calc((100% - 18px) / 2);
  scroll-snap-align: start;
  margin: 0;
  border-radius: 30px;
  padding: 7px;
  background: #0B0C12;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.55);
}
.phone img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 720 / 1443;
  border-radius: 23px;
  background: #1E2233;
}
.gallery-nav { display: flex; justify-content: center; gap: 10px; }
.gallery-nav button {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
.gallery-nav button:hover:not(:disabled) { border-color: var(--app-accent, var(--accent)); }
.gallery-nav button:disabled { opacity: 0.35; cursor: default; }
@media (prefers-reduced-motion: reduce) { .phones { scroll-behavior: auto; } }

/* App en desarrollo: en lugar de capturas, un panel con su sello */
.teaser {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  border-radius: 28px;
  border: 1px solid var(--border);
  background: radial-gradient(circle at 50% 46%, #231B3D 0%, #150F26 45%, #0C0A12 100%);
}
.teaser img { width: min(38%, 200px); height: auto; border-radius: 22%; }
.dev-badge { margin-top: 4px; }
/* GlyphLine: fondo pergamino, el mismo que su icono. */
.teaser-parchment { background: radial-gradient(circle at 50% 46%, #FFFDF8 0%, #FBF6EB 50%, #EEE4CF 100%); }

@media (max-width: 860px) {
  .showcase { padding: 56px 0; }
  .showcase-inner,
  .showcase.reverse .showcase-inner { grid-template-columns: 1fr; gap: 32px; }
  .showcase.reverse .showcase-text { order: 0; }
  .phones { margin: 0 -16px; padding: 4px 16px 18px; scroll-padding-inline: 16px; }
  .phone { flex-basis: 62%; }
}

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

.page-hero {
  background: var(--brand-bg);
  color: var(--brand-text);
  border-bottom: 1px solid var(--brand-line); /* la misma línea de agua que la portada */
}
.page-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 46rem;
  margin: 0 auto;
  padding: 20px 16px 0;
}
.page-bar .home { display: inline-flex; align-items: center; gap: 12px; color: var(--brand-text); text-decoration: none; }
.page-bar .home img { width: 36px; height: 36px; }
.page-bar .hero-nav { padding: 0; margin: 0; width: auto; }
.page-title {
  max-width: 46rem;
  margin: 0 auto;
  padding: 44px 16px 36px;
}
.page-title h1 { margin: 0 0 10px; font-size: clamp(1.7rem, 5vw, 2.3rem); line-height: 1.2; }
.page-title .meta { margin: 0 0 18px; color: var(--brand-muted); }
.applies { display: flex; flex-wrap: wrap; gap: 8px; }
.applies a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 5px 5px;
  border: 1px solid var(--brand-line);
  border-radius: 999px;
  color: var(--brand-text);
  text-decoration: none;
  font-size: 0.92rem;
}
.applies img { width: 24px; height: 24px; border-radius: 7px; }

.doc {
  width: 100%;
  max-width: 46rem;
  margin: 0 auto;
  padding: 32px 16px 64px;
}
.doc h2 {
  position: relative;
  font-size: 1.15rem;
  margin: 2.2em 0 0.5em;
  padding-left: 16px;
  scroll-margin-top: 16px;
}
.doc h2::before {
  content: "";
  position: absolute;
  left: 0; top: 0.2em; bottom: 0.2em;
  width: 4px;
  border-radius: 2px;
  background: var(--accent);
}
.doc .meta { color: var(--muted); margin-top: 0; }
.doc .note { color: var(--muted); font-size: 0.92rem; font-style: italic; }
.doc code { background: var(--badge-bg); padding: 0.1em 0.35em; border-radius: 4px; font-size: 0.9em; }

.toc {
  margin: 0 0 8px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.toc p { margin: 0 0 8px; font-weight: 600; }
.toc ol { margin: 0; padding-left: 1.3em; columns: 2 14rem; column-gap: 28px; }
.toc li { break-inside: avoid; padding: 2px 0; }
.toc a { color: var(--text); text-decoration: none; }
.toc a:hover { color: var(--accent); text-decoration: underline; }

.steps { list-style: none; counter-reset: step; padding: 0; margin: 1em 0; display: grid; gap: 10px; }
.steps li {
  counter-increment: step;
  position: relative;
  padding: 14px 16px 14px 58px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 14px; top: 12px;
  width: 30px; height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 0.95rem;
}

.contact-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
  margin: 2.5em 0 0;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.contact-card p { margin: 0; }
.contact-card .cta { --app-accent: var(--accent); color: var(--on-accent); }
.contact-card .cta:hover { color: var(--on-accent); }

.table-wrap { overflow-x: auto; margin: 1em 0; border: 1px solid var(--border); border-radius: 14px; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { border-bottom: 1px solid var(--border); padding: 0.65em 0.8em; text-align: left; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { background: var(--surface); }

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

footer {
  margin-top: auto;
  padding: 32px 16px 40px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}
footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 20px; margin-bottom: 12px; }
footer a { color: var(--muted); display: inline-block; padding: 6px 2px; }
footer a:hover { color: var(--text); }
footer p { margin: 4px 0; }
