/* ─────────────────────────────────────────────
   ralabz — alto contraste: crema + negro,
   acento amarillo. Modo claro/oscuro, header fijo.
   ───────────────────────────────────────────── */

:root {
  --bg: #f1f1ef;          /* gris muy claro */
  --bg-soft: #ffffff;     /* tarjetas blancas */
  --text: rgba(0, 0, 0, 0.55);
  --heading: #111110;
  --border: rgba(0, 0, 0, 0.12);
  --border-strong: rgba(0, 0, 0, 0.28);
  --hover: rgba(0, 0, 0, 0.04);
  --accent: #111110;      /* monocromo, sin color */
  --accent-strong: #111110;
  --on-accent: #ffffff;

  --font: system-ui, sans-serif;

  --max-w: 45rem;
  --radius: 12px;
}

html.dark {
  --bg: #0e0e0e;          /* negro */
  --bg-soft: #1a1a1a;
  --text: rgba(255, 255, 255, 0.7);
  --heading: #ffffff;
  --border: rgba(255, 255, 255, 0.14);
  --border-strong: rgba(255, 255, 255, 0.3);
  --hover: rgba(255, 255, 255, 0.05);
  --accent: #ffffff;
  --accent-strong: #ffffff;
  --on-accent: #111110;
}

html {
  color-scheme: light;
  overflow-y: scroll;
  scroll-behavior: smooth;
  scroll-padding-top: 8rem;
}

html.dark {
  color-scheme: dark;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

/* ─── Container ─── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* ─── Header / Nav ─── */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding: 1.25rem 0;
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  backdrop-filter: blur(8px) saturate(180%);
  -webkit-backdrop-filter: blur(8px) saturate(180%);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1rem;
  font-weight: 600;
  color: var(--heading);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-links a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.nav-links a:hover {
  color: var(--heading);
}

.nav-links a.active {
  color: var(--heading);
  box-shadow: inset 0 -2px 0 var(--accent);
  padding-bottom: 2px;
}

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.theme-toggle:hover {
  color: var(--on-accent);
  border-color: var(--accent);
  background: var(--accent);
}

.theme-toggle .sun {
  display: none;
}

.theme-toggle .moon {
  display: block;
}

html.dark .theme-toggle .sun {
  display: block;
}

html.dark .theme-toggle .moon {
  display: none;
}

/* ─── Main ─── */
main {
  flex: 1;
  padding-top: 9rem;
  padding-bottom: 5rem;
}

/* ─── Prose (cuerpo) ─── */
.prose section + section {
  margin-top: 2rem;
}

.prose h1 {
  font-family: var(--font);
  font-weight: 600;
  font-size: clamp(2rem, 6vw, 2.6rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--heading);
  margin-bottom: 1.25rem;
}

.prose h2 {
  font-family: var(--font);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  color: var(--heading);
  margin: 2.25rem 0 0.75rem;
}

.prose p,
.prose li {
  font-family: var(--font);
  font-size: 1.05rem;
  line-height: 1.75;
}

.prose p {
  margin-bottom: 1rem;
}

.prose ul {
  list-style: disc;
  margin: 0 0 1rem;
  padding-left: 1.4rem;
}

.prose ul li {
  margin-bottom: 0.4rem;
  padding-left: 0.3rem;
}

.prose ul li::marker {
  color: var(--text);
}

.prose a {
  color: var(--heading);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.prose a:hover {
  opacity: 0.7;
}

.lead {
  font-family: var(--font);
  font-size: 1.15rem;
  line-height: 1.7;
}

.muted-date {
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.note {
  font-family: var(--font);
  font-size: 0.95rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 1.5rem 0;
}

/* Fila contacto / política */
.prose p.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.95rem;
}

/* ─── Section heading row ─── */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 3rem 0 1rem;
}

.section-head h2 {
  font-family: var(--font);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--heading);
  letter-spacing: -0.01em;
}

.section-head a {
  font-size: 0.9rem;
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s ease;
}

.section-head a:hover {
  color: var(--heading);
}

/* ─── Link card (app / project style) ─── */
.link-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  background: var(--bg-soft);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.link-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.link-card img {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 22.37%; /* radio de ícono de iOS */
}

/* Fallback universal: squircle = superelipse de Lamé (n≈5, look iOS).
   polygon() en % escala con el elemento y corre en Safari/Firefox/Chrome. */
.app-head img,
.link-card img {
  -webkit-clip-path: polygon(
    100.00% 50.00%, 99.83% 72.14%, 99.31% 79.12%, 98.44% 84.05%, 97.20% 87.89%,
    95.58% 91.00%, 93.53% 93.53%, 91.00% 95.58%, 87.89% 97.20%, 84.05% 98.44%,
    79.12% 99.31%, 72.14% 99.83%, 50.00% 100.00%, 27.86% 99.83%, 20.88% 99.31%,
    15.95% 98.44%, 12.11% 97.20%, 9.00% 95.58%, 6.47% 93.53%, 4.42% 91.00%,
    2.80% 87.89%, 1.56% 84.05%, 0.69% 79.12%, 0.17% 72.14%, 0.00% 50.00%,
    0.17% 27.86%, 0.69% 20.88%, 1.56% 15.95%, 2.80% 12.11%, 4.42% 9.00%,
    6.47% 6.47%, 9.00% 4.42%, 12.11% 2.80%, 15.95% 1.56%, 20.88% 0.69%,
    27.86% 0.17%, 50.00% 0.00%, 72.14% 0.17%, 79.12% 0.69%, 84.05% 1.56%,
    87.89% 2.80%, 91.00% 4.42%, 93.53% 6.47%, 95.58% 9.00%, 97.20% 12.11%,
    98.44% 15.95%, 99.31% 20.88%, 99.83% 27.86%
  );
  clip-path: polygon(
    100.00% 50.00%, 99.83% 72.14%, 99.31% 79.12%, 98.44% 84.05%, 97.20% 87.89%,
    95.58% 91.00%, 93.53% 93.53%, 91.00% 95.58%, 87.89% 97.20%, 84.05% 98.44%,
    79.12% 99.31%, 72.14% 99.83%, 50.00% 100.00%, 27.86% 99.83%, 20.88% 99.31%,
    15.95% 98.44%, 12.11% 97.20%, 9.00% 95.58%, 6.47% 93.53%, 4.42% 91.00%,
    2.80% 87.89%, 1.56% 84.05%, 0.69% 79.12%, 0.17% 72.14%, 0.00% 50.00%,
    0.17% 27.86%, 0.69% 20.88%, 1.56% 15.95%, 2.80% 12.11%, 4.42% 9.00%,
    6.47% 6.47%, 9.00% 4.42%, 12.11% 2.80%, 15.95% 1.56%, 20.88% 0.69%,
    27.86% 0.17%, 50.00% 0.00%, 72.14% 0.17%, 79.12% 0.69%, 84.05% 1.56%,
    87.89% 2.80%, 91.00% 4.42%, 93.53% 6.47%, 95.58% 9.00%, 97.20% 12.11%,
    98.44% 15.95%, 99.31% 20.88%, 99.83% 27.86%
  );
}

/* Squircle nativo donde se soporte (Chrome 139+, Safari reciente):
   borde y sombra reales, sin recorte. */
@supports (corner-shape: squircle) {
  .app-head img,
  .link-card img {
    corner-shape: squircle;
    -webkit-clip-path: none;
    clip-path: none;
  }

  .app-head img {
    filter: none;
    border: 1px solid var(--border);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  }
}

.link-card .card-title {
  font-family: var(--font);
  font-weight: 600;
  font-size: 1rem;
  color: var(--heading);
  margin-bottom: 0.15rem;
}

.link-card .card-desc {
  font-family: var(--font);
  font-size: 0.95rem;
  line-height: 1.5;
}

.link-card .arrow {
  margin-left: auto;
  color: var(--text);
  font-size: 1.2rem;
  flex-shrink: 0;
  transition: transform 0.2s ease, color 0.2s ease;
}

.link-card:hover .arrow {
  color: var(--accent-strong);
  transform: translateX(3px);
}

/* ─── App header (icon + title) ─── */
.app-head {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-bottom: 1.75rem;
}

.app-head img {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  border-radius: 22.37%; /* radio de ícono de iOS */
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.22));
}

.app-head h1 {
  font-family: var(--font);
  font-weight: 700;
  font-size: clamp(1.7rem, 5.5vw, 2.2rem);
  letter-spacing: -0.035em;
  line-height: 1.15;
  color: var(--heading);
}

/* ─── Google Play badge ─── */
.badge-link {
  display: block;
  width: fit-content;
  margin: 1.25rem auto 0;
  transition: opacity 0.2s ease, transform 0.15s ease;
}

.badge-link:hover {
  opacity: 0.85;
  transform: translateY(-2px);
}

.badge-link img {
  height: 78px;
  width: auto;
  display: block;
}

/* ─── Screenshots ─── */
.screenshots {
  display: flex;
  justify-content: center;
  gap: 1rem;
  overflow-x: auto;
  margin-top: 1.5rem;
  padding-bottom: 0.75rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

/* Cuando hay scroll horizontal, mantener centrado sin recortar el inicio */
.screenshots::before,
.screenshots::after {
  content: "";
  margin: auto;
}

.screenshots img {
  height: 340px;
  width: auto;
  border-radius: 16px;
  scroll-snap-align: start;
  flex-shrink: 0;
  cursor: zoom-in;
  transition: transform 0.2s ease;
}

.screenshots img:hover {
  transform: scale(1.02);
}

/* Mostrar solo las capturas que coinciden con el tema activo */
html:not(.dark) .screenshots img[data-theme="dark"] {
  display: none;
}

html.dark .screenshots img[data-theme="light"] {
  display: none;
}

/* ─── Lightbox ─── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  cursor: zoom-out;
}

.lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  transform: scale(0.96);
  transition: transform 0.25s ease;
}

.lightbox.open img {
  transform: scale(1);
}

.lightbox-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  color: var(--heading);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

/* ─── Contact ─── */
.contact {
  padding: 4rem 0;
}

.contact a.email {
  display: inline-block;
  margin-top: 1rem;
  font-family: var(--font);
  font-size: 1.2rem;
  color: var(--heading);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.contact a.email:hover {
  opacity: 0.7;
}

/* ─── Footer ─── */
footer {
  padding: 1.5rem 0;
  font-size: 0.85rem;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.visit-count {
  opacity: 0.7;
}

#back-to-top {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s ease, opacity 0.3s ease;
}

#back-to-top:hover {
  color: var(--heading);
}

/* ─── Entrance animation ─── */
.js .animate {
  opacity: 0;
  transform: translateY(0.75rem);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.js .animate.show {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .js .animate {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ─── Responsive ─── */
@media (max-width: 600px) {
  main {
    padding-top: 7.5rem;
  }

  .nav-links {
    gap: 1rem;
  }

  .screenshots img {
    height: 280px;
  }
}
