/* ═══════════════════════════════════════════════════════════════════════════
   Orvix — style.css
   Liquid Glass  ·  Técnica del artículo kube.io/blog/liquid-glass-css-svg

   El efecto tiene 4 capas superpuestas (igual que Apple WWDC 2025):

   1. TRANSMISIÓN  backdrop-filter blur + saturate + brightness
      → simula el paso de luz a través del vidrio

   2. REFRACCIÓN   SVG feDisplacementMap (superficie squircle convexo)
      → y = ⁴√(1-(1-x)⁴)  ← perfil que Apple favorece
      → Red = desplazamiento X, Green = Y, 128 = neutro (sin desplazamiento)
      → .glass-refract activa el filtro #liq (solo Chrome)

   3. SPECULAR     ::before radial-gradient en borde superior
      → el brillo de la cima de la lente convexa
      → imita el "specular map" que el artículo calcula por separado

   4. BEZEL        inset box-shadow + ::after gradiente inferior
      → el grosor físico del borde de la lente (borde superior claro,
        borde inferior oscuro, como una pastilla de cristal real)
   ════════════════════════════════════════════════════════════════════════════ */

/* ── Tokens ───────────────────────────────────────────────────────────────── */
:root {
  --bg-light:      #dce8ff;
  --bg-dark:       #07090f;

  /* Colores de vidrio — modo claro */
  --glass-bg:       rgba(255, 255, 255, 0.22);
  --glass-border:   rgba(255, 255, 255, 0.58);
  --glass-rim-top:  rgba(255, 255, 255, 0.90);  /* specular superior */
  --glass-rim-bot:  rgba(180, 200, 255, 0.20);  /* sombra inferior */
  --glass-shadow:   rgba(80, 110, 200, 0.16);

  /* Colores de vidrio — modo oscuro */
  --glass-bg-dk:      rgba(16, 24, 50, 0.45);
  --glass-border-dk:  rgba(255, 255, 255, 0.09);
  --glass-rim-top-dk: rgba(255, 255, 255, 0.12);
  --glass-rim-bot-dk: rgba(0, 0, 0, 0.45);
  --glass-shadow-dk:  rgba(0, 0, 0, 0.50);

  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 13px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

/* ── Body ─────────────────────────────────────────────────────────────────── */
body {
  font-family: var(--font);
  background: var(--bg-light);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background .35s, color .35s;
}

/* ── Dark mode base ───────────────────────────────────────────────────────── */
body.dark { background: var(--bg-dark); color: #e0e8ff; }

/* ── Fondo con malla de gradientes (mesh gradient) ───────────────────────── *
 *  Tres blobs de colores posicionados estratégicamente para dar profundidad.  *
 *  El blur extremo los mezcla en un degradado suave tipo macOS.               *
 * ────────────────────────────────────────────────────────────────────────── */
.bg-light {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
.bg-light::before {
  content: '';
  position: absolute;
  width: 900px; height: 900px;
  background: radial-gradient(circle at 40% 35%, #89b4ff 0%, transparent 60%);
  filter: blur(110px);
  top: -300px; left: -200px;
  opacity: .80;
}
.bg-light::after {
  content: '';
  position: absolute;
  width: 700px; height: 700px;
  background: radial-gradient(circle at 60% 60%, #c084fc 0%, transparent 60%);
  filter: blur(120px);
  bottom: -200px; right: -160px;
  opacity: .60;
}
/* Tercer blob rosa — da calidez al centro */
body:not(.dark) .bg-light {
  background:
    radial-gradient(ellipse 50% 35% at 65% 15%, rgba(255,180,220,0.35) 0%, transparent 100%);
}
body.dark .bg-light::before {
  background: radial-gradient(circle at 40% 35%, #1e3a6e 0%, transparent 60%);
  opacity: .90;
}
body.dark .bg-light::after {
  background: radial-gradient(circle at 60% 60%, #2d1b4e 0%, transparent 60%);
  opacity: .70;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CLASE .glass — Liquid Glass base
   ═══════════════════════════════════════════════════════════════════════════

   Capa 1 — TRANSMISIÓN (backdrop-filter)
   Capa 3 — SPECULAR    (::before)
   Capa 4 — BEZEL       (::after + inset box-shadow)
   Capa 2 — REFRACCIÓN  (ver .glass-refract debajo — solo Chrome)
   ─────────────────────────────────────────────────────────────────────────── */
.glass {
  position: relative;
  /* Capa 1: Transmisión de luz a través del vidrio */
  background: var(--glass-bg);
  backdrop-filter: blur(32px) saturate(1.8) brightness(1.06);
  -webkit-backdrop-filter: blur(32px) saturate(1.8) brightness(1.06);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  /* Capa 4a: Bezel — rim óptico del borde de la lente */
  box-shadow:
    0 20px 60px var(--glass-shadow),
    0  2px  8px rgba(80, 110, 200, 0.07),
    inset 0  1.5px 0 var(--glass-rim-top),   /* borde superior brillante */
    inset 0 -1px   0 var(--glass-rim-bot);   /* borde inferior oscuro    */
  overflow: hidden;
  isolation: isolate;
}

/* Capa 3: Specular highlight convexo
   ─────────────────────────────────────────────────────────────────────────
   El artículo calcula el specular con la función squircle:
     y = ⁴√(1-(1-x)⁴)
   El gradiente radial aproxima esa curva: máximo en el borde superior y
   decayendo suavemente hacia el interior — idéntico al specular map del demo.
   El segundo gradiente lineal añade un toque diagonal (luz cenital izquierda).
   ─────────────────────────────────────────────────────────────────────────── */
.glass::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    /* Specular principal: brillo en el borde superior */
    radial-gradient(
      ellipse 70% 22% at 50% 0%,
      rgba(255, 255, 255, 0.65) 0%,
      rgba(255, 255, 255, 0.15) 50%,
      transparent 100%
    ),
    /* Toque diagonal izquierda (fuente de luz cenital) */
    linear-gradient(
      148deg,
      rgba(255, 255, 255, 0.22) 0%,
      rgba(255, 255, 255, 0.04) 35%,
      transparent 60%
    );
  pointer-events: none;
  z-index: 0;
}

/* Capa 4b: Sombra interior del bisel (borde inferior más oscuro) */
.glass::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(
      ellipse 85% 25% at 50% 100%,
      rgba(80, 110, 220, 0.12) 0%,
      transparent 100%
    );
  pointer-events: none;
  z-index: 0;
}

/* Hijos sobre las capas de efecto */
.glass > * { position: relative; z-index: 1; }

/* ── Dark mode .glass ─────────────────────────────────────────────────────── */
body.dark .glass {
  background: var(--glass-bg-dk);
  border-color: var(--glass-border-dk);
  box-shadow:
    0 24px 64px var(--glass-shadow-dk),
    0  2px  8px rgba(0,0,0,0.3),
    inset 0  1.5px 0 var(--glass-rim-top-dk),
    inset 0 -1px   0 var(--glass-rim-bot-dk);
}
body.dark .glass::before {
  background:
    radial-gradient(
      ellipse 70% 20% at 50% 0%,
      rgba(255, 255, 255, 0.10) 0%,
      transparent 100%
    ),
    linear-gradient(148deg, rgba(255,255,255,0.06) 0%, transparent 40%);
}
body.dark .glass::after {
  background:
    radial-gradient(ellipse 85% 25% at 50% 100%,
      rgba(0, 0, 0, 0.25) 0%, transparent 100%);
}

/* ── Capa 2: Refracción real con feDisplacementMap (solo Chrome) ──────────── *
 *                                                                              *
 *  El SVG filter #liq (en index.html) aplica el mapa de desplazamiento        *
 *  generado con la superficie squircle convexo calculada via Snell's law.     *
 *  backdrop-filter: url(#liq) solo funciona en Chromium.                      *
 *                                                                              *
 *  El @supports garantiza que en Firefox/Safari el efecto no se rompe —       *
 *  simplemente se usa el backdrop-filter normal como fallback.                *
 * ────────────────────────────────────────────────────────────────────────── */
@supports (backdrop-filter: url(#liq)) {
  .glass {
    backdrop-filter: url(#liq) blur(28px) saturate(1.8) brightness(1.06);
    -webkit-backdrop-filter: url(#liq) blur(28px) saturate(1.8) brightness(1.06);
  }
  body.dark .glass {
    backdrop-filter: url(#liq) blur(28px) saturate(1.5) brightness(1.02);
    -webkit-backdrop-filter: url(#liq) blur(28px) saturate(1.5) brightness(1.02);
  }
}

/* ── Topbar ───────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
  margin: 14px 14px 0;
  border-radius: var(--radius-lg);
  /* Topbar tiene specular más pronunciado — es la "pill" estilo Apple */
  box-shadow:
    0 8px 32px rgba(80, 110, 200, 0.13),
    0 1px  4px rgba(80, 110, 200, 0.07),
    inset 0  2px 0 rgba(255, 255, 255, 0.95),
    inset 0 -1px 0 rgba(160, 190, 255, 0.28);
}

.logo {
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
  color: inherit;
  letter-spacing: -.3px;
  white-space: nowrap;
}

.back-btn {
  text-decoration: none;
  color: inherit;
  font-size: 13.5px;
  opacity: .60;
  font-weight: 500;
  transition: opacity .2s;
  white-space: nowrap;
}
.back-btn:hover { opacity: 1; }

#darkToggle {
  background: none;
  border: none;
  font-size: 19px;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  transition: transform .3s cubic-bezier(.34, 1.56, .64, 1), opacity .2s;
  flex-shrink: 0;
}
#darkToggle:hover { transform: rotate(20deg) scale(1.2); opacity: .8; }

/* ── Search ───────────────────────────────────────────────────────────────── */
#search {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.30);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  font-size: 13.5px;
  width: 210px;
  outline: none;
  color: inherit;
  font-family: var(--font);
  /* Specular mínimo en el search */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    inset 0 -1px 0 rgba(120, 150, 255, 0.12);
  transition: width .3s ease, background .2s, box-shadow .2s;
}
#search::placeholder { color: rgba(40, 60, 120, 0.40); }
#search:focus {
  width: 270px;
  background: rgba(255, 255, 255, 0.46);
  box-shadow:
    0 0 0 3px rgba(100, 150, 255, 0.20),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}
body.dark #search {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.12);
  color: #e0e8ff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}
body.dark #search::placeholder { color: rgba(200, 220, 255, 0.28); }
body.dark #search:focus {
  background: rgba(255, 255, 255, 0.10);
  box-shadow: 0 0 0 3px rgba(120, 160, 255, 0.18);
}

/* ── Grid ─────────────────────────────────────────────────────────────────── */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 14px;
  padding: 22px 14px 44px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TARJETA — lente liquid glass individual
   ═══════════════════════════════════════════════════════════════════════════
   Cada tarjeta es una pastilla de cristal convexa con:
   · ::before = specular de borde superior (squircle profile)
   · Hover    = levita + intensifica specular + escala suave
   · Active   = se hunde (feedback táctil)
   ─────────────────────────────────────────────────────────────────────────── */
.tool-card {
  padding: 24px 12px 18px;
  text-align: center;
  text-decoration: none;
  color: #1a2550;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  /* Vidrio individual */
  background: rgba(255, 255, 255, 0.26);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: var(--radius-md);
  /* Bezel de tarjeta */
  box-shadow:
    0 5px 20px rgba(80, 110, 200, 0.09),
    0 1px  4px rgba(80, 110, 200, 0.05),
    inset 0  1.5px 0 rgba(255, 255, 255, 0.92),
    inset 0 -1px   0 rgba(160, 180, 255, 0.15);
  position: relative;
  overflow: hidden;
  isolation: isolate;
  /* Transición con spring (resorte) */
  transition:
    transform  .30s cubic-bezier(.34, 1.56, .64, 1),
    box-shadow .28s ease,
    background .22s ease;
  transform-style: preserve-3d;
}

/* Specular convexo en tarjeta (borde superior brillante) */
.tool-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    ellipse 75% 28% at 50% 0%,
    rgba(255, 255, 255, 0.68) 0%,
    rgba(255, 255, 255, 0.12) 55%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 0;
  transition: opacity .22s;
}

/* Refracción en tarjeta (Chrome) */
@supports (backdrop-filter: url(#liq)) {
  .tool-card {
    backdrop-filter: url(#liq) blur(20px) saturate(1.5);
    -webkit-backdrop-filter: url(#liq) blur(20px) saturate(1.5);
  }
}

.tool-card > * { position: relative; z-index: 1; }

/* Hover: levita + intensifica todo */
.tool-card:hover {
  transform: translateY(-6px) scale(1.035);
  background: rgba(255, 255, 255, 0.36);
  box-shadow:
    0 22px 55px rgba(80, 110, 200, 0.22),
    0  4px 14px rgba(80, 110, 200, 0.10),
    inset 0  2px 0 rgba(255, 255, 255, 1.0),
    inset 0 -1px 0 rgba(160, 180, 255, 0.28);
}
/* Specular más brillante en hover */
.tool-card:hover::before {
  background: radial-gradient(
    ellipse 75% 28% at 50% 0%,
    rgba(255, 255, 255, 0.85) 0%,
    rgba(255, 255, 255, 0.18) 55%,
    transparent 100%
  );
}

/* Active: presión táctil */
.tool-card:active {
  transform: translateY(-1px) scale(0.982);
  transition-duration: .08s;
  box-shadow:
    0 4px 12px rgba(80, 110, 200, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

/* Dark mode tarjetas */
body.dark .tool-card {
  color: #d8e4ff;
  background: rgba(18, 28, 60, 0.50);
  border-color: rgba(255, 255, 255, 0.09);
  box-shadow:
    0 5px 22px rgba(0, 0, 0, 0.38),
    inset 0  1.5px 0 rgba(255, 255, 255, 0.10),
    inset 0 -1px   0 rgba(0, 0, 0, 0.35);
}
body.dark .tool-card::before {
  background: radial-gradient(
    ellipse 75% 25% at 50% 0%,
    rgba(255, 255, 255, 0.10) 0%, transparent 100%
  );
}
body.dark .tool-card:hover {
  background: rgba(28, 44, 90, 0.62);
  box-shadow:
    0 22px 55px rgba(0, 0, 0, 0.50),
    inset 0  2px 0 rgba(255, 255, 255, 0.15),
    inset 0 -1px 0 rgba(0, 0, 0, 0.40);
}

/* ── Icono ─────────────────────────────────────────────────────────────────── */
.tool-icon {
  font-size: 32px;
  filter: drop-shadow(0 2px 6px rgba(80, 110, 220, 0.20));
  transition: transform .28s cubic-bezier(.34, 1.56, .64, 1);
  line-height: 1;
}
.tool-card:hover .tool-icon {
  transform: scale(1.16) translateY(-3px);
}

/* ── Nombre ────────────────────────────────────────────────────────────────── */
.tool-name {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -.1px;
  line-height: 1.3;
}

/* ── Páginas de herramienta ────────────────────────────────────────────────── */
.tool-page {
  max-width: 650px;
  margin: 32px auto;
  padding: 36px;
  font-size: 16px;
}

/* ── Info explainer boxes ──────────────────────────────────────────────────── */
.info-explainer {
  background: rgba(100, 150, 255, 0.07);
  border: 1px solid rgba(100, 150, 255, 0.26);
  border-radius: 14px;
  padding: 14px 17px;
  font-size: 13.5px;
  line-height: 1.65;
  /* Specular mínimo en el info box */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.50);
}
.info-explainer .ie-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 7px;
  color: rgba(70, 115, 255, 0.95);
}
.info-explainer code {
  background: rgba(0, 0, 0, 0.09);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12.5px;
}

/* ── Google AdSense ────────────────────────────────────────────────────────── */
.ad-banner-wrap {
  max-width: 970px;
  margin: 0 auto 8px;
  padding: 0 14px;
  text-align: center;
  min-height: 90px;
}
.ad-rect-wrap { display: flex; justify-content: center; padding: 20px 20px 4px; }
.ad-banner    { display: block; width: 100%; min-height: 90px; }
.ad-rect      { display: inline-block; width: 300px; height: 250px; }
@media (max-width: 360px) { .ad-banner-wrap { display: none; } }

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(100, 150, 255, 0.25); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(100, 150, 255, 0.48); }

/* ── Focus ring ────────────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid rgba(100, 150, 255, 0.60);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .topbar    { margin: 10px 10px 0; padding: 10px 14px; gap: 8px; }
  .tool-grid { padding: 14px 10px 32px; gap: 10px; }
  .tool-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
  #search    { width: 140px; font-size: 13px; }
  #search:focus { width: 190px; }
  .tool-page { padding: 24px; }
}
