/* ---- Marco azul alrededor de la página ---- */
:root { --frame: 12px; --brand: #1654ff; }
@media (min-width: 768px) { :root { --frame: 20px; } }

body { padding: var(--frame); min-height: 100vh; min-height: 100svh; }
.frame {
  position: fixed; inset: 0; z-index: 60; pointer-events: none;
  border: var(--frame) solid var(--brand);
}
.dark .frame { border-color: #0a33b5; }
/* svh = alto visible real en móviles (sin la barra del navegador), así el contenido queda centrado */
.shell { min-height: calc(100vh - var(--frame) * 2); min-height: calc(100svh - var(--frame) * 2); padding-bottom: var(--footer-h); }
:root { --footer-h: 3rem; }
/* Pie fijo dentro del marco: siempre visible abajo */
.site-footer { position: fixed; z-index: 25; left: var(--frame); right: var(--frame); bottom: var(--frame); height: var(--footer-h); }
.site-header { top: var(--frame); }

/* ---- Idioma: se muestra solo el texto del idioma activo ---- */
html[data-lang="es"] [data-l="en"],
html[data-lang="en"] [data-l="es"] { display: none !important; }
html[data-lang="es"] .lang-opt[data-opt="es"],
html[data-lang="en"] .lang-opt[data-opt="en"] { color: var(--brand); font-weight: 700; }

/* ---- Navegación y botones ---- */
.nav-link { font-size: 12px; letter-spacing: .04em; color: #555; transition: color .2s; }
.nav-link:hover, .nav-link.is-active { color: var(--brand); }
.dark .nav-link { color: #94a3b8; }
.dark .nav-link:hover, .dark .nav-link.is-active { color: #5f86ff; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-width: 38px; height: 34px; padding: 0 10px; font-size: 11px;
  border: 1px solid #e5e5e5; color: #444; transition: all .2s;
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.dark .icon-btn { border-color: #1e293b; color: #cbd5e1; }
.dark .icon-btn:hover { border-color: #5f86ff; color: #5f86ff; }

.btn, .btn-outline {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 22px;
  font-size: 12px; letter-spacing: .08em; text-transform: uppercase; transition: all .2s;
}
.btn { background: var(--brand); color: #fff; border: 1px solid var(--brand); }
.btn:hover { background: #0a33b5; border-color: #0a33b5; }
.btn-outline { border: 1px solid currentColor; }
.btn-outline:hover { color: var(--brand); }

.drawer-title {
  margin: 2.5rem 0 1rem; font-size: 11px; font-weight: 700; letter-spacing: .25em;
  text-transform: uppercase; color: #141414;
}
.dark .drawer-title { color: #fff; }
.drawer.is-open { transform: translateX(0); }

/* ---- Títulos de sección ---- */
.section-title {
  display: flex; align-items: center; gap: 1rem; margin-bottom: 2.5rem;
  font-size: 13px; font-weight: 700; letter-spacing: .3em; text-transform: uppercase; color: #141414;
}
.section-title::after { content: ""; width: 48px; height: 2px; background: var(--brand); }
.dark .section-title { color: #fff; }

/* ---- Efecto glitch del nombre ---- */
.glitch { animation: glitch 4s infinite; }
@keyframes glitch {
  0%, 84%, 100% { text-shadow: none; transform: none; }
  86% { text-shadow: -3px 0 #00d0ff, 3px 0 var(--brand); transform: translate(1px, 0); }
  88% { text-shadow: 3px 0 #00d0ff, -3px 0 var(--brand); transform: translate(-1px, 1px) skewX(-4deg); }
  90% { text-shadow: -2px 0 #00d0ff, 2px 0 var(--brand); transform: none; }
  92% { text-shadow: 2px 1px #00d0ff, -2px -1px var(--brand); transform: translate(1px, -1px); }
}

/* ---- Máquina de escribir ---- */
.caret { display: inline-block; margin-left: 1px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---- Barras de habilidades ---- */
.bar > span { display: block; height: 100%; width: 0; background: var(--brand); transition: width 1.2s ease; }

/* ---- Aparición al hacer scroll ---- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .glitch, .caret { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---- Formularios ---- */
.field {
  width: 100%; padding: 12px 14px; font-size: 13px; background: transparent;
  border: 1px solid #e5e5e5; color: inherit; outline: none; transition: border-color .2s;
}
.field:focus { border-color: var(--brand); }
.dark .field { border-color: #1e293b; }
.dark .field:focus { border-color: #5f86ff; }

/* ---- Pestaña de privacidad y aviso de cookies ---- */
.privacy-tab {
  position: fixed; left: var(--frame); bottom: 0; z-index: 61; height: var(--frame);
  display: flex; align-items: center; padding: 0 12px; font-size: 10px; font-weight: 700;
  color: #fff; background: #0a33b5; white-space: nowrap;
}
.privacy-tab:hover { background: #122a70; }
@media (max-width: 767px) { .privacy-tab { display: none; } }

/* Aviso de cookies: recuadro azul abajo a la izquierda que entra deslizándose */
.cookie-box {
  position: fixed; z-index: 70; left: 15px; bottom: 15px; width: 300px; max-width: calc(100vw - 30px);
  padding: 25px 18px; text-align: center; font-size: 12px; line-height: 1.6; font-weight: 300;
  color: #fff; background: var(--brand); box-shadow: 0 20px 40px -12px rgba(10, 51, 181, .55);
  transform: translateY(calc(100% + 40px)); opacity: 0;
  transition: transform .7s cubic-bezier(.2, .9, .25, 1.15), opacity .5s ease;
}
.cookie-box.is-shown { transform: translateY(0); opacity: 1; }
.cookie-box[hidden] { display: none; }
.cookie-box__actions { margin-top: 14px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.cookie-box__accept {
  padding: 6px 18px; font-size: 11px; font-weight: 500; letter-spacing: .05em;
  color: var(--brand); background: #fff; border: 1px solid #fff; transition: all .2s;
}
.cookie-box__accept:hover { color: #fff; background: transparent; }
.cookie-box__more { font-size: 11px; font-weight: 700; color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.cookie-box__more:hover { opacity: .8; }
.dark .cookie-box { background: #0a33b5; }
@media (prefers-reduced-motion: reduce) { .cookie-box { transition: none; } }

/* ---- Filtros del portafolio ---- */
.filter-btn { font-size: 12px; letter-spacing: .04em; color: #777; padding-bottom: 2px; border-bottom: 2px solid transparent; transition: all .2s; }
.filter-btn:hover, .filter-btn.is-active { color: var(--brand); border-color: var(--brand); }
.dark .filter-btn { color: #94a3b8; }
.dark .filter-btn:hover, .dark .filter-btn.is-active { color: #5f86ff; border-color: #5f86ff; }
.project-card.is-hidden { display: none; }

/* ---- Textos legales ---- */
.legal h2 { margin: 2.5rem 0 .75rem; font-size: 13px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; color: #141414; }
.dark .legal h2 { color: #fff; }
.legal p, .legal ul { margin-bottom: .9rem; }
.legal ul { list-style: disc; padding-left: 1.25rem; }
.legal a { color: var(--brand); }
.legal a:hover { text-decoration: underline; }
.legal table { width: 100%; margin: 1rem 0 1.5rem; border-collapse: collapse; font-size: 12px; }
.legal th, .legal td { text-align: left; padding: 10px 12px; border: 1px solid #e5e5e5; vertical-align: top; }
.legal th { background: #eef3ff; color: #141414; }
.dark .legal th, .dark .legal td { border-color: #1e293b; }
.dark .legal th { background: #0f172a; color: #fff; }
.legal code { font-size: 11px; color: var(--brand); }

/* ---- Hero a pantalla completa (cabecera: 5rem) ---- */
/* Hero = alto de la ventana menos marco, cabecera (5rem) y pie fijo */
.hero-full {
  min-height: calc(100vh - var(--frame) * 2 - 5rem - var(--footer-h));
  min-height: calc(100svh - var(--frame) * 2 - 5rem - var(--footer-h));
  padding-top: 2rem; padding-bottom: 6.5rem;
}
html { scroll-behavior: smooth; }

/* ---- Indicador "desliza hacia abajo" ---- */
.scroll-cue {
  position: absolute; left: 50%; bottom: 1.25rem; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: #666; font-size: 10px; letter-spacing: .3em; text-transform: uppercase; transition: color .2s;
  animation: cue-in .8s ease .3s both;
}
.scroll-cue:hover { color: var(--brand); }
.scroll-cue__mouse { position: relative; width: 22px; height: 34px; border: 2px solid currentColor; border-radius: 12px; }
.scroll-cue__wheel {
  position: absolute; left: 50%; top: 6px; width: 3px; height: 7px; margin-left: -1.5px;
  border-radius: 2px; background: var(--brand); animation: cue-wheel 1.6s ease-in-out infinite;
}
.scroll-cue__arrow { color: var(--brand); animation: cue-bounce 1.6s ease-in-out infinite; }
@keyframes cue-wheel { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(12px); } }
@keyframes cue-bounce { 0%, 100% { transform: translateY(0); opacity: .5; } 50% { transform: translateY(5px); opacity: 1; } }
@keyframes cue-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
.scroll-cue.is-gone { opacity: 0; pointer-events: none; transition: opacity .4s; }
@media (max-height: 520px) { .scroll-cue { display: none; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scroll-cue, .scroll-cue__wheel, .scroll-cue__arrow { animation: none; }
}

/* ---- Contadores de la portada ---- */
.stat {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 2.5rem 1rem;
  font-size: 11px; letter-spacing: .15em; text-transform: uppercase; transition: background .2s;
  border-right: 1px solid #f5f5f5;
}
.stat span { font-size: 2rem; font-weight: 700; letter-spacing: 0; color: var(--brand); }
.stat:hover { background: #eef3ff; }
.dark .stat { border-color: #0f172a; }
.dark .stat:hover { background: #0f172a; }

/* ---- Estado de proyectos ---- */
.status-badge { display: inline-block; padding: 2px 8px; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; background: #fff; color: #555; }
.status-badge--live { background: #dcfce7; color: #166534; }
.status-badge--offline { background: #f1f5f9; color: #475569; }
.status-badge--private { background: #0a33b5; color: #fff; }
.status-badge--dev { background: #fef3c7; color: #92400e; }
.dark .scroll-cue { color: #94a3b8; }

/* ---- Secciones de la portada (adelanto de cada página) ---- */
.home-section { padding: 6rem 0; border-top: 1px solid #f5f5f5; }
.dark .home-section { border-color: #0f172a; }
@media (max-width: 767px) { .home-section { padding: 4.5rem 0; } }
