/* ==========================================================================
   Elkin Varal — Portafolio de apps móviles
   Hoja de estilos principal. CSS3 moderno, sin dependencias.
   Temas claro/oscuro con variables CSS. Mobile-first y responsive.
   ========================================================================== */

/* ---------- Tokens de diseño ---------- */
:root {
  /* Colores base (tema claro por defecto) */
  --bg: #ffffff;
  --bg-soft: #f5f6f9;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --border: #e6e8ee;
  --text: #12141a;
  --text-soft: #4a5160;
  --text-muted: #808896;
  --accent: #5b6cff;
  --accent-hover: #4a5aee;
  --accent-soft: rgba(91, 108, 255, 0.12);
  --success: #12b886;
  --warning: #f08c00;
  --info: #4dabf7;
  --shadow-sm: 0 1px 2px rgba(16, 20, 32, 0.06);
  --shadow-md: 0 6px 24px rgba(16, 20, 32, 0.08);
  --shadow-lg: 0 20px 60px rgba(16, 20, 32, 0.12);

  /* Tipografía */
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --fs-h1: clamp(2.2rem, 5vw, 3.6rem);
  --fs-h2: clamp(1.6rem, 3.5vw, 2.4rem);
  --fs-h3: clamp(1.15rem, 2vw, 1.4rem);

  /* Layout */
  --maxw: 1140px;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --gap: 24px;
  --nav-h: 68px;

  /* Transiciones */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 0.35s;
}

/* Tema oscuro */
[data-theme="dark"] {
  --bg: #0c0e14;
  --bg-soft: #12151d;
  --bg-elev: #161a24;
  --surface: #14171f;
  --border: #262b38;
  --text: #f2f4f8;
  --text-soft: #b8c0cf;
  --text-muted: #7b8494;
  --accent: #7f8cff;
  --accent-hover: #97a2ff;
  --accent-soft: rgba(127, 140, 255, 0.16);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.55);
}

/* ---------- Reset ligero ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 0.4em; }
p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; }

/* ---------- Utilidades ---------- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 22px; }
.section { padding: clamp(56px, 9vw, 110px) 0; }
.section-sm { padding: clamp(40px, 6vw, 70px) 0; }
.eyebrow {
  display: inline-block; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 12px;
}
.lead { font-size: 1.12rem; color: var(--text-soft); max-width: 60ch; }
.center { text-align: center; margin-inline: auto; }
.text-muted { color: var(--text-muted); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Botones ---------- */
.btn {
  --btn-bg: var(--accent); --btn-fg: #fff;
  display: inline-flex; align-items: center; gap: 9px; justify-content: center;
  padding: 12px 22px; border-radius: 999px; font-weight: 600; font-size: 0.95rem;
  border: 1px solid transparent; cursor: pointer; background: var(--btn-bg); color: var(--btn-fg);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
  white-space: nowrap;
}
.btn:hover { background: var(--accent-hover); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn--ghost { --btn-bg: transparent; --btn-fg: var(--text); border-color: var(--border); }
.btn--ghost:hover { --btn-bg: var(--bg-soft); background: var(--bg-soft); }
.btn--soft { --btn-bg: var(--accent-soft); --btn-fg: var(--accent); }
.btn--soft:hover { background: var(--accent-soft); filter: brightness(0.97); }
.btn--sm { padding: 9px 16px; font-size: 0.85rem; }
.btn--block { width: 100%; }

/* Botones de tienda */
.store-btn {
  display: inline-flex; align-items: center; gap: 10px; padding: 10px 18px;
  border-radius: 12px; background: #12141a; color: #fff; border: 1px solid #12141a;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
[data-theme="dark"] .store-btn { background: #f2f4f8; color: #0c0e14; border-color: #f2f4f8; }
.store-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.store-btn i { font-size: 1.5rem; }
.store-btn .store-btn__label { display: flex; flex-direction: column; line-height: 1.05; text-align: left; }
.store-btn .store-btn__label small { font-size: 0.62rem; opacity: 0.8; }
.store-btn .store-btn__label span { font-size: 0.95rem; font-weight: 600; }
.store-btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }

/* ---------- Header / Navegación ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--nav-h);
  backdrop-filter: saturate(160%) blur(14px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--border);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: var(--nav-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -0.02em; font-size: 1.05rem; }
.brand .brand__mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #9b5bff); color: #fff; font-size: 0.9rem;
}
.nav__links { display: flex; align-items: center; gap: 4px; list-style: none; }
.nav__links a {
  padding: 8px 14px; border-radius: 10px; font-weight: 500; color: var(--text-soft);
  font-size: 0.95rem; transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.nav__links a:hover, .nav__links a[aria-current="page"] { color: var(--text); background: var(--bg-soft); }
.nav__actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); display: grid; place-items: center;
  cursor: pointer; transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.icon-btn:hover { background: var(--bg-soft); }
.theme-toggle .fa-sun { display: none; }
[data-theme="dark"] .theme-toggle .fa-sun { display: block; }
[data-theme="dark"] .theme-toggle .fa-moon { display: none; }
.nav__burger { display: none; }

/* Menú móvil */
@media (max-width: 860px) {
  .nav__links {
    position: fixed; inset: var(--nav-h) 0 auto 0; flex-direction: column; align-items: stretch;
    gap: 2px; padding: 14px 22px 22px; background: var(--bg); border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg); transform: translateY(-140%); transition: transform var(--dur) var(--ease);
  }
  .nav__links.open { transform: translateY(0); }
  .nav__links a { padding: 12px 14px; }
  .nav__burger { display: grid; }
}

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: clamp(60px, 10vw, 120px) 0 clamp(40px, 7vw, 90px); }
.hero::before {
  content: ""; position: absolute; inset: -20% 30% auto -10%; height: 520px;
  background: radial-gradient(closest-side, var(--accent-soft), transparent 70%);
  filter: blur(10px); z-index: -1;
}
.hero__inner { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 48px; align-items: center; }
.hero h1 { font-size: var(--fs-h1); }
.hero h1 .grad {
  background: linear-gradient(120deg, var(--accent), #9b5bff 60%, #12b886);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .lead { font-size: 1.18rem; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.hero__stats { display: flex; gap: 28px; margin-top: 34px; flex-wrap: wrap; }
.hero__stats div strong { display: block; font-size: 1.6rem; }
.hero__stats div span { font-size: 0.85rem; color: var(--text-muted); }

/* Mockup de teléfono en el hero */
.phone {
  width: 250px; margin-inline: auto; aspect-ratio: 9 / 19; border-radius: 34px;
  background: var(--bg-elev); border: 1px solid var(--border); padding: 12px;
  box-shadow: var(--shadow-lg); position: relative; transition: transform var(--dur) var(--ease);
}
.phone::before {
  content: ""; position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  width: 78px; height: 6px; border-radius: 99px; background: var(--border);
}
.phone__screen {
  height: 100%; border-radius: 24px; overflow: hidden; background: var(--bg-soft);
  display: grid; place-items: center; text-align: center; padding: 22px;
}
.phone:hover { transform: translateY(-8px) rotate(-1deg); }

/* ---------- Chips / tech ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 9px; padding: 10px 16px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  font-weight: 500; font-size: 0.92rem; box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.chip:hover { transform: translateY(-3px); border-color: var(--accent); }
.chip i { color: var(--accent); }

/* ---------- Grid de apps ---------- */
.apps-toolbar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 36px; }
.filter-btn {
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-soft); font-weight: 500; font-size: 0.9rem; cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.filter-btn:hover { border-color: var(--accent); color: var(--text); }
.filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.apps-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--gap);
}
.app-card {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.app-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.app-card__head { display: flex; gap: 14px; align-items: center; padding: 20px 20px 0; }
.app-card__icon {
  width: 60px; height: 60px; border-radius: 15px; flex: none; box-shadow: var(--shadow-sm);
  background: var(--bg-soft); object-fit: cover;
}
.app-card__title { flex: 1; min-width: 0; }
.app-card__title h3 { margin: 0; font-size: 1.2rem; }
.app-card__title p { margin: 2px 0 0; font-size: 0.85rem; color: var(--text-muted); }
.app-card__body { padding: 14px 20px 18px; flex: 1; }
.app-card__desc { font-size: 0.95rem; color: var(--text-soft); margin: 0 0 14px; }
.app-card__shots { display: flex; gap: 8px; margin-bottom: 4px; overflow: hidden; }
.app-card__shots img { width: 33%; border-radius: 10px; border: 1px solid var(--border); aspect-ratio: 9/16; object-fit: cover; }
.app-card__foot { padding: 0 20px 20px; display: flex; flex-direction: column; gap: 12px; }
.app-card__stores { display: flex; gap: 8px; flex-wrap: wrap; }
.app-card__stores .store-btn { padding: 8px 12px; }
.app-card__stores .store-btn i { font-size: 1.25rem; }

/* Badges de estado y meta */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--available { color: var(--success); background: color-mix(in srgb, var(--success) 14%, transparent); }
.badge--coming-soon { color: var(--warning); background: color-mix(in srgb, var(--warning) 16%, transparent); }
.badge--in-development { color: var(--info); background: color-mix(in srgb, var(--info) 16%, transparent); }
.badge--cat { color: var(--text-muted); background: var(--bg-soft); }
.badge--cat::before { display: none; }
.app-card__meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Feature grid ---------- */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--gap); }
.feature {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow-sm); transition: transform var(--dur) var(--ease);
}
.feature:hover { transform: translateY(-4px); }
.feature__ico {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-size: 1.2rem; margin-bottom: 14px;
}
.feature h3 { font-size: 1.08rem; }
.feature p { margin: 0; color: var(--text-soft); font-size: 0.95rem; }

/* ---------- Detalle de app ---------- */
.app-hero { display: grid; grid-template-columns: auto 1fr; gap: 26px; align-items: center; }
.app-hero__icon { width: 104px; height: 104px; border-radius: 24px; box-shadow: var(--shadow-md); }
.app-hero h1 { font-size: clamp(2rem, 4vw, 2.8rem); margin-bottom: 6px; }
.app-hero__tagline { font-size: 1.15rem; color: var(--text-soft); }
.app-hero__stores { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }

.gallery { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 240px); gap: 16px; overflow-x: auto; padding-bottom: 12px; scroll-snap-type: x mandatory; }
.gallery img { border-radius: 18px; border: 1px solid var(--border); scroll-snap-align: start; box-shadow: var(--shadow-sm); }

.video-wrap { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-md); aspect-ratio: 16/9; border: 1px solid var(--border); }
.video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Acordeón FAQ */
.faq { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.faq details { border-bottom: 1px solid var(--border); }
.faq details:last-child { border-bottom: 0; }
.faq summary {
  padding: 18px 22px; cursor: pointer; font-weight: 600; list-style: none; display: flex;
  justify-content: space-between; align-items: center; gap: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "\002B"; font-size: 1.3rem; color: var(--accent); transition: transform var(--dur) var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 22px 20px; margin: 0; color: var(--text-soft); }

/* Historial de versiones */
.timeline { list-style: none; position: relative; padding-left: 28px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline li { position: relative; padding-bottom: 22px; }
.timeline li::before { content: ""; position: absolute; left: -28px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline strong { font-size: 1rem; }
.timeline .date { color: var(--text-muted); font-size: 0.85rem; margin-left: 8px; }

/* ---------- Formularios ---------- */
.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: clamp(22px, 4vw, 38px); box-shadow: var(--shadow-sm); }
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 7px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit; font-size: 0.95rem;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { resize: vertical; min-height: 130px; }
.form-note { font-size: 0.85rem; color: var(--text-muted); }
.form-status { margin-top: 12px; font-size: 0.92rem; }
.form-status.ok { color: var(--success); }
.form-status.err { color: #e03131; }

/* ---------- Content pages (privacidad, términos) ---------- */
.prose { max-width: 760px; }
.prose h2 { font-size: var(--fs-h3); margin-top: 1.8em; }
.prose h3 { font-size: 1.1rem; margin-top: 1.4em; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1em; }
.prose li { margin-bottom: 0.4em; color: var(--text-soft); }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.doc-meta { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 2em; }

/* Lista de políticas */
.link-list { display: grid; gap: 12px; }
.link-list a {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); transition: all var(--dur) var(--ease);
}
.link-list a:hover { border-color: var(--accent); transform: translateX(4px); }

/* ---------- Callout / CTA ---------- */
.callout {
  text-align: center; padding: clamp(40px, 6vw, 70px); border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--accent), #9b5bff);
  color: #fff; box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
}
.callout h2 { color: #fff; }
.callout p { color: rgba(255,255,255,0.9); max-width: 56ch; margin-inline: auto; }
.callout .btn { background: #fff; color: var(--accent); margin-top: 18px; }
.callout .btn:hover { background: #fff; filter: brightness(0.95); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-soft); margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; padding: 56px 0 36px; }
.footer-grid h4 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.footer-grid ul { list-style: none; display: grid; gap: 8px; }
.footer-grid a { color: var(--text-soft); font-size: 0.95rem; }
.footer-grid a:hover { color: var(--accent); }
.footer-social { display: flex; gap: 10px; margin-top: 14px; }
.footer-social a { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); display: grid; place-items: center; background: var(--surface); transition: all var(--dur) var(--ease); }
.footer-social a:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-3px); }
.footer-bottom { border-top: 1px solid var(--border); padding: 20px 0; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-size: 0.88rem; color: var(--text-muted); }

/* ---------- Section header ---------- */
.section-head { max-width: 640px; margin: 0 auto 44px; text-align: center; }
.section-head h2 { font-size: var(--fs-h2); }
.section-head p { color: var(--text-soft); font-size: 1.05rem; }

/* Breadcrumb */
.crumbs { display: flex; gap: 8px; font-size: 0.88rem; color: var(--text-muted); margin-bottom: 20px; flex-wrap: wrap; }
.crumbs a:hover { color: var(--accent); }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Estados de carga / vacío ---------- */
.loading, .empty { text-align: center; color: var(--text-muted); padding: 40px 0; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; margin: 0 auto 14px; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero__inner { grid-template-columns: 1fr; text-align: center; }
  .hero .lead { margin-inline: auto; }
  .hero__cta, .hero__stats { justify-content: center; }
  .hero__aside { order: -1; }
  .app-hero { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .app-hero__stores { justify-content: center; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
}
@media (max-width: 560px) {
  .footer-grid { grid-template-columns: 1fr; }
  .apps-grid { grid-template-columns: 1fr; }
  .hero__stats { gap: 20px; }
}
