/* ============================================================
   Ceustack — "Deep Tech del Estrecho"
   Tokens, base, componentes y estados de animación.
   Los efectos JS solo añaden clases; sin JS todo es visible.
   ============================================================ */
:root {
  --bg: #04060A;
  --bg-2: #0B1524;
  --bg-3: #101D30;
  --accent: #4DA8FF;
  --accent-2: #9EF3D8;
  --text: #F4EFE6;
  --dim: #8FA6BB;
  --line: rgba(143, 166, 187, 0.16);
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", monospace;
  --container: 76rem;
  --radius: 1rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent); text-underline-offset: 0.2em; }
a:hover { color: var(--accent); }
::selection { background: var(--accent); color: var(--bg); }

h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 0.5em; font-weight: 700; }
h1 { font-size: clamp(2.4rem, 6vw, 4.4rem); }
h2 { font-size: clamp(1.8rem, 4vw, 2.9rem); }
h3 { font-size: clamp(1.15rem, 2vw, 1.45rem); }
p { margin: 0 0 1em; }
.lead { font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--dim); max-width: 46rem; }
.mono { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; }
.eyebrow { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent); margin: 0 0 1rem; }
.eyebrow--foam { color: var(--accent-2); }

.container { width: min(var(--container), 92vw); margin-inline: auto; }
.section { padding-block: clamp(4rem, 9vw, 7.5rem); position: relative; }
.section--tight { padding-block: clamp(2.5rem, 5vw, 4rem); }
.section-head { display: grid; gap: 1rem; grid-template-columns: 1fr; margin-bottom: clamp(2rem, 5vw, 3.5rem); }
@media (min-width: 60rem) { .section-head { grid-template-columns: 1.2fr 1fr; align-items: end; } }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--bg); padding: 0.6rem 1rem; z-index: 10000; }
.skip-link:focus { left: 0.5rem; top: 0.5rem; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-body); font-weight: 600; font-size: 0.95rem;
  padding: 0.85rem 1.6rem; border-radius: 99px; text-decoration: none;
  border: 1px solid transparent; cursor: pointer;
  appearance: none; -webkit-appearance: none; background: transparent;
  transition: transform 0.35s var(--ease), background 0.25s, color 0.25s, border-color 0.25s;
  will-change: transform;
}
.btn--primary { background: var(--accent); color: #04263F; }
.btn--primary:hover { background: #71bcff; color: #04263F; }
.btn--ghost { border-color: color-mix(in srgb, var(--dim) 55%, transparent); color: var(--text); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }

/* ---------- Etiquetas de atribución ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.14em;
  padding: 0.4rem 0.8rem; border-radius: 6px; border: 1px solid var(--line); color: var(--dim);
}
.tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tag--own { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 45%, transparent); }
.tag--client { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset-inline: 0; top: 0; z-index: 100;
  transition: background 0.3s, border-color 0.3s, transform 0.4s var(--ease);
  border-bottom: 1px solid transparent;
}
.site-header.is-scrolled { background: color-mix(in srgb, var(--bg) 82%, transparent); border-color: var(--line); }
/* Blur en pseudo-elemento: backdrop-filter en el header crearía un containing block
   y rompería el posicionamiento fixed del menú móvil. */
.site-header::before { content: ""; position: absolute; inset: 0; z-index: -1; backdrop-filter: blur(14px); opacity: 0; transition: opacity 0.3s; }
.site-header.is-scrolled::before { opacity: 1; }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding-block: 1rem; }
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; font-family: var(--font-display); }
.brand__logo { height: 1.7rem; width: auto; display: block; }
.brand-hero { position: relative; width: min(320px, 58vw); }
.brand-hero::before { content: ""; position: absolute; inset: -35%; background: radial-gradient(circle, rgba(77, 168, 255, 0.16), transparent 65%); z-index: -1; pointer-events: none; }
.brand-hero img { width: 100%; height: auto; filter: drop-shadow(0 0 42px rgba(77, 168, 255, 0.28)); }
.brand__name { font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; }
.brand__coords { font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.14em; color: var(--dim); }
.site-nav { display: flex; align-items: center; gap: 1.8rem; }
.site-nav a:not(.btn) { text-decoration: none; font-size: 0.92rem; color: var(--dim); position: relative; }
.site-nav a:not(.btn):hover, .site-nav a[aria-current="page"] { color: var(--text); }
.site-nav a:not(.btn)::after {
  content: ""; position: absolute; left: 0; bottom: -4px; height: 1px; width: 100%;
  background: var(--accent); transform: scaleX(0); transform-origin: right; transition: transform 0.3s var(--ease);
}
.site-nav a:not(.btn):hover::after, .site-nav a[aria-current="page"]::after { transform: scaleX(1); transform-origin: left; }
.menu-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 0.55rem; cursor: pointer; }
.menu-toggle span { display: block; width: 20px; height: 2px; background: var(--text); margin: 4px 0; transition: transform 0.3s, opacity 0.3s; }
@media (max-width: 56rem) {
  html.js .menu-toggle { display: block; }
  html:not(.js) .site-nav { flex-wrap: wrap; justify-content: flex-end; gap: 0.9rem; font-size: 0.85rem; }
  html.js .site-nav {
    position: fixed; inset: 0; top: 0; flex-direction: column; justify-content: center;
    background: var(--bg-2); gap: 2rem; font-size: 1.3rem;
    transform: translateY(-100%); transition: transform 0.45s var(--ease); z-index: -1;
  }
  html.js .site-nav.is-open { transform: none; }
  body.nav-open { overflow: hidden; }
  .menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding-block: 3rem 2rem; background: var(--bg); }
.site-footer__grid { display: grid; gap: 2rem; grid-template-columns: 1fr; }
@media (min-width: 48rem) { .site-footer__grid { grid-template-columns: 2fr 1fr 1fr; } }
.site-footer nav { display: grid; gap: 0.5rem; }
.site-footer nav a { text-decoration: none; color: var(--dim); font-size: 0.9rem; }
.site-footer nav a:hover { color: var(--accent); }
.site-footer__legal { margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; color: var(--dim); font-size: 0.8rem; }

/* ---------- Separador "corriente" ---------- */
.current-divider { height: 1px; border: 0; margin: 0; background: linear-gradient(90deg, transparent, var(--accent), transparent); background-size: 200% 100%; animation: current-flow 6s linear infinite; opacity: 0.5; }
@keyframes current-flow { to { background-position: -200% 0; } }

/* ---------- Grids y cards ---------- */
.grid-2 { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
.grid-3 { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
@media (min-width: 48rem) { .grid-2 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.card {
  position: relative; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.8rem; overflow: hidden;
  transition: border-color 0.3s, transform 0.5s var(--ease);
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
a.card { text-decoration: none; color: inherit; }
a.card:hover { color: inherit; }
a.card:hover h3 { color: var(--accent); }
a.card h3 { transition: color 0.3s; }
.card > * { position: relative; z-index: 1; }
/* Tarjetas/bloques de proyecto completamente clicables (stretched link + CTA) */
.stretch-host { position: relative; }
.card__stretch { position: static; }
/* z-index 2 (no 1) para quedar por encima de .card > * { z-index:1 } y cubrir toda la tarjeta */
.card__stretch::after { content: ""; position: absolute; inset: 0; z-index: 2; }
.card > h3:has(.card__stretch) { position: static; }
.card-cta {
  display: inline-flex; align-items: center; gap: 0.5rem; margin-top: 1.25rem;
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent);
}
.card-cta::after { content: "→"; transition: transform 0.3s var(--ease); }
.card:hover .card-cta::after,
.stretch-host:hover .card-cta::after { transform: translateX(5px); }
[data-glow]::before {
  content: ""; position: absolute; inset: 0; z-index: 0; opacity: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(77, 168, 255, 0.12), transparent 65%);
  transition: opacity 0.35s;
}
[data-glow]:hover::before { opacity: 1; }
[data-tilt] { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform 0.18s ease-out; will-change: transform; }

.stat { display: grid; gap: 0.15rem; }
.stat strong { font-family: var(--font-display); font-size: clamp(1.6rem, 3vw, 2.4rem); color: var(--accent); line-height: 1; }
.stat span { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }

/* ---------- Hero ---------- */
.hero { min-height: 100svh; display: grid; align-items: center; position: relative; padding-top: 6rem; isolation: isolate; }
.hero__canvas { position: absolute; inset: 0; z-index: -1; }
.hero__canvas canvas { display: block; width: 100%; height: 100%; }
.hero--static .hero__canvas, .hero__fallback {
  background:
    radial-gradient(60% 50% at 72% 20%, rgba(77, 168, 255, 0.16), transparent 70%),
    radial-gradient(50% 45% at 15% 85%, rgba(158, 243, 216, 0.07), transparent 70%),
    var(--bg);
}
.hero__meta { display: flex; flex-wrap: wrap; gap: 2.2rem; margin-top: 3rem; padding-top: 1.6rem; border-top: 1px solid var(--line); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 2rem; }
.hero__scroll { position: absolute; bottom: 1.6rem; left: 50%; transform: translateX(-50%); color: var(--dim); font-family: var(--font-mono); font-size: 0.65rem; letter-spacing: 0.2em; animation: hero-bob 2.4s ease-in-out infinite; }
@keyframes hero-bob { 50% { transform: translate(-50%, 6px); } }

/* ---------- Reveal / split / counters (estados JS) ---------- */
html.js [data-reveal] { opacity: 0; transform: translateY(26px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); transition-delay: var(--rd, 0s); }
html.js [data-reveal].is-in { opacity: 1; transform: none; }
html.js [data-split] .w { display: inline-block; overflow: hidden; vertical-align: top; }
html.js [data-split] .w > span { display: inline-block; transform: translateY(110%); transition: transform 0.9s var(--ease); transition-delay: calc(var(--wi) * 45ms); }
html.js [data-split].is-in .w > span { transform: none; }

/* ---------- Cursor custom ---------- */
.cursor-dot, .cursor-ring { position: fixed; top: 0; left: 0; z-index: 9999; pointer-events: none; border-radius: 50%; opacity: 0; transition: opacity 0.3s; }
html.has-cursor .cursor-dot, html.has-cursor .cursor-ring { opacity: 1; }
.cursor-dot { width: 6px; height: 6px; background: var(--accent); }
.cursor-ring { width: 36px; height: 36px; border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent); display: grid; place-items: center; font-family: var(--font-mono); font-size: 0.55rem; letter-spacing: 0.1em; color: var(--accent); transition: width 0.25s, height 0.25s, background 0.25s, opacity 0.3s; }
.cursor-ring.is-hover { width: 56px; height: 56px; background: rgba(77, 168, 255, 0.08); }
.cursor-ring.is-label { width: 72px; height: 72px; background: rgba(77, 168, 255, 0.12); backdrop-filter: blur(2px); }
html.has-cursor { cursor: none; }
html.has-cursor a, html.has-cursor button { cursor: none; }

/* ---------- Transición de página ---------- */
.page-veil { position: fixed; inset: 0; z-index: 9000; background: var(--bg-2); transform: scaleY(0); transform-origin: bottom; pointer-events: none; }
html.is-leaving .page-veil { transform: scaleY(1); transition: transform 0.45s var(--ease); }
html.is-entering .page-veil { transform: scaleY(1); transform-origin: top; }
html.is-entering.is-ready .page-veil { transform: scaleY(0); transition: transform 0.55s var(--ease) 0.05s; }

/* ---------- Fotos duotono ---------- */
.photo-duo { position: relative; overflow: hidden; border-radius: var(--radius); }
.photo-duo img { width: 100%; filter: grayscale(1) contrast(1.06) brightness(0.92); }
.grid-2 .photo-duo img { aspect-ratio: 5 / 4; object-fit: cover; object-position: 50% 32%; }
.photo-duo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(165deg, rgba(77, 168, 255, 0.38), rgba(4, 6, 10, 0.25) 60%, rgba(158, 243, 216, 0.18)); mix-blend-mode: color; }
.photo-duo::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, transparent 55%, rgba(4, 6, 10, 0.65)); }
.photo-duo--wide img { aspect-ratio: 16 / 9; object-fit: cover; object-position: 50% 30%; }
.photo-duo__caption { position: absolute; z-index: 2; left: 1.2rem; bottom: 1rem; margin: 0; font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text); opacity: 0.85; }
.profile-card { padding: 0; }
.profile-card .photo-duo { border-radius: 0; }
.profile-card .photo-duo img { aspect-ratio: 1 / 1; object-fit: cover; object-position: 50% 38%; }
.profile-card__body { padding: 1.5rem 1.8rem 1.9rem; }

/* ---------- Marcos de dispositivo (mockups) ---------- */
.shot-browser { background: var(--bg-3); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45); }
.shot-browser__bar { display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--line); }
.shot-browser__bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.shot-browser__bar .mono { color: var(--dim); margin-left: 0.5rem; text-transform: none; letter-spacing: 0.05em; }

/* ---------- Prose (artículos de blog) ---------- */
.prose { max-width: 42rem; margin-inline: auto; font-size: 1.06rem; }
.prose h2 { margin-top: 2.2em; font-size: 1.7rem; }
.prose h3 { margin-top: 1.6em; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin-bottom: 0.4em; }
.prose blockquote { border-left: 2px solid var(--accent); margin: 1.5em 0; padding: 0.2em 0 0.2em 1.2em; color: var(--dim); font-style: italic; }
.prose strong { color: var(--accent-2); font-weight: 600; }
.article-meta { display: flex; align-items: center; gap: 0.9rem; margin-block: 1.5rem 2.5rem; }
.article-meta img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; filter: grayscale(1); }
.article-meta div { font-size: 0.85rem; color: var(--dim); line-height: 1.4; }
.read-progress { position: fixed; top: 0; left: 0; height: 2px; width: 0; background: var(--accent); z-index: 200; }

/* ---------- FAQ / detalles ---------- */
.faq details { border-bottom: 1px solid var(--line); padding-block: 1rem; }
.faq summary { cursor: pointer; font-family: var(--font-display); font-size: 1.05rem; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::after { content: "+"; color: var(--accent); font-size: 1.3rem; line-height: 1; transition: transform 0.3s; }
.faq details[open] summary::after { transform: rotate(45deg); }

/* ---------- Formulario ---------- */
.form-grid { display: grid; gap: 1.1rem; }
.form-grid label { display: grid; gap: 0.4rem; font-size: 0.85rem; color: var(--dim); }
.form-grid input, .form-grid textarea, .form-grid select {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); font: inherit; padding: 0.85rem 1rem;
}
.form-grid input:focus-visible, .form-grid textarea:focus-visible, .form-grid select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

/* ---------- Utilidades ---------- */
.text-dim { color: var(--dim); }
.list-check { list-style: none; padding: 0; display: grid; gap: 0.6rem; }
.list-check li { padding-left: 1.6rem; position: relative; }
.list-check li::before { content: "→"; position: absolute; left: 0; color: var(--accent); font-family: var(--font-mono); }
.banner-wip { display: inline-flex; align-items: center; gap: 0.6rem; font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.14em; color: var(--accent-2); border: 1px dashed color-mix(in srgb, var(--accent-2) 45%, transparent); padding: 0.6rem 1rem; border-radius: 8px; }
.banner-wip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

/* ---------- Reduced motion / no-JS ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  html.js [data-reveal], html.js [data-split] .w > span { opacity: 1; transform: none; }
}

/* ---------- Páginas legales ---------- */
.legal__body { max-width: 46rem; }
.legal__body h2 { font-size: clamp(1.25rem, 2.4vw, 1.6rem); margin-top: 2.4rem; }
.legal__body ul { padding-left: 1.2rem; color: var(--dim); }
.legal__body li { margin-bottom: 0.4rem; }
.legal__body a { color: var(--accent); }
.legal__body code { font-family: var(--font-mono); font-size: 0.85em; background: var(--bg-2); padding: 0.1em 0.4em; border-radius: 4px; }
.legal__table-wrap { overflow-x: auto; margin: 1.2rem 0; }
.legal__table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.legal__table th, .legal__table td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--line); }
.legal__table th { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-2); }
.legal__table td { color: var(--dim); vertical-align: top; }

/* ---------- Enlaces legales en el footer ---------- */
.site-footer__legal .site-footer__legal-links { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; }
.site-footer__legal .site-footer__legal-links a { color: var(--dim); text-decoration: none; font-size: 0.8rem; }
.site-footer__legal .site-footer__legal-links a:hover { color: var(--accent); }

/* ---------- Casilla de consentimiento del formulario ---------- */
.form-consent { display: flex; align-items: flex-start; gap: 0.6rem; font-size: 0.85rem; color: var(--dim); cursor: pointer; }
.form-consent input { width: 1.05rem; height: 1.05rem; margin-top: 0.15rem; accent-color: var(--accent); flex: 0 0 auto; }
.form-consent a { color: var(--accent); }

/* ---------- Banner de cookies ---------- */
.cookie-banner {
  position: fixed; inset-inline: 1rem; bottom: 1rem; z-index: 9000;
  max-width: 42rem; margin-inline: auto;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.9rem 1.5rem;
  padding: 1.1rem 1.3rem; border-radius: var(--radius);
  background: color-mix(in srgb, var(--bg-2) 94%, transparent);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  animation: cookie-in 0.5s var(--ease) both;
}
@keyframes cookie-in { from { opacity: 0; transform: translateY(1rem); } to { opacity: 1; transform: none; } }
.cookie-banner__text { margin: 0; flex: 1 1 18rem; font-size: 0.85rem; color: var(--dim); }
.cookie-banner__text a { color: var(--accent); }
.cookie-banner__actions { display: flex; gap: 0.6rem; flex: 0 0 auto; }
.cookie-banner .btn { padding: 0.6rem 1.25rem; font-size: 0.85rem; }
@media (max-width: 34rem) {
  .cookie-banner__actions { width: 100%; }
  .cookie-banner__actions .btn { flex: 1; justify-content: center; }
}

/* ---------- Ajustes móvil ---------- */
@media (max-width: 48rem) {
  /* Bloque legal del footer: apilado y alineado a la izquierda, no repartido */
  .site-footer__legal { flex-direction: column; align-items: flex-start; gap: 0.9rem; }
  /* El indicador "Scroll" del hero queda flotando raro en móvil */
  .hero__scroll { display: none; }
}
