/* Capas globales: preloader, cabecera, menú, cursor, vista previa al pasar el cursor, cortina de transición, progreso y diálogos */

/* ---------- Preloader ---------- */
.preloader { position: fixed; inset: 0; z-index: 800; pointer-events: none; color: var(--paper); }
.preloader__half { position: absolute; left: 0; right: 0; height: 50.2%; background: var(--ink); will-change: transform; }
.preloader__half--top { top: 0; }
.preloader__half--bot { bottom: 0; }
.preloader__ui { position: absolute; inset: 0; display: grid; grid-template-rows: auto 1fr auto; padding: var(--gutter) var(--edge); z-index: 2; }
.preloader__meta { display: flex; justify-content: space-between; opacity: .7; }
.preloader__name { align-self: center; justify-self: center; overflow: hidden; }
.preloader__name > span { display: block; font-size: clamp(1.1rem, 2.4vw, 2.2rem); letter-spacing: .04em; }
.preloader__count { overflow: hidden; line-height: .8; align-self: end; justify-self: start; }
.preloader__count > span { display: block; font-size: clamp(6rem, 24vw, 22rem); font-variant-numeric: tabular-nums; }
html:not(.is-loading) .preloader { display: none; }

/* ---------- Cabecera ---------- */
.hdr { position: fixed; top: 0; left: 0; right: 0; z-index: 300; height: var(--header-h); padding-inline: var(--edge); display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--fg); pointer-events: none; }
.hdr > * { pointer-events: auto; }
/* Fondo de la cabecera: el contenido que pasa por debajo no se mezcla con los enlaces */
.hdr::before { content: ""; position: absolute; inset: 0; z-index: -1; background: color-mix(in srgb, var(--bg) 90%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--fg) 10%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); pointer-events: none; }
.hdr__brand { font: 800 1.02rem var(--font-sans); font-variation-settings: "wdth" 112; letter-spacing: -.02em; text-transform: uppercase; display: inline-flex; align-items: center; gap: 10px; }
.hdr__logo { width: 30px; height: 30px; flex: none; display: block; transition: transform .6s var(--ease-expo); }
.hdr__brand:hover .hdr__logo { transform: rotate(-8deg) scale(1.06); }
.hdr__tabs { display: none; gap: clamp(18px, 2.4vw, 40px); position: relative; }
.hdr__tabs a { padding-block: 8px; position: relative; opacity: .62; transition: opacity .4s var(--ease-smooth); }
.hdr__tabs a:hover, .hdr__tabs a.is-on { opacity: 1; }
.hdr__line { position: absolute; bottom: 2px; left: 0; height: 1px; width: 0; background: currentColor; transition: transform .7s var(--ease-expo), width .7s var(--ease-expo); }
.hdr__menu { display: inline-flex; align-items: center; gap: 12px; padding: 10px 0; }
.hdr__menu .bars { display: inline-grid; gap: 5px; width: 22px; }
.hdr__menu .bars i { display: block; height: 1px; background: currentColor; transition: transform .6s var(--ease-expo); transform-origin: right; }
.hdr__menu:hover .bars i:first-child { transform: scaleX(.6); }
.hdr__menu:hover .bars i:last-child { transform: scaleX(.8); }
@media (min-width: 960px) { .hdr__tabs { display: flex; } }
.hdr__actions { display: flex; align-items: center; gap: clamp(14px, 2vw, 26px); }
/* Modo claro / oscuro: círculo medio lleno que gira media vuelta al cambiar */
.theme-toggle { display: grid; place-items: center; width: 36px; height: 36px; margin: -6px 0; border-radius: 50%; color: inherit; transition: background-color .3s; }
.theme-toggle:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
.theme-toggle svg { width: 20px; height: 20px; transition: transform .7s var(--ease-expo); }
html[data-theme="dark"] .theme-toggle svg { transform: rotate(180deg); }
html.has-motion .hdr { opacity: 0; }

/* ---------- Menú a pantalla completa ---------- */
.menu { position: fixed; inset: 0; z-index: 400; background: var(--ink); color: var(--paper); clip-path: inset(0 0 100% 0); visibility: hidden; overflow: hidden; }
.menu.is-open { visibility: visible; }
.menu__top { position: absolute; top: 0; left: 0; right: 0; height: var(--header-h); padding-inline: var(--edge); display: flex; align-items: center; justify-content: space-between; z-index: 3; }
.menu__inner { position: relative; z-index: 2; height: 100%; padding: calc(var(--header-h) + 2vh) var(--edge) var(--gutter); display: grid; grid-template-rows: 1fr auto; }
.menu__list { align-self: center; counter-reset: m; }
/* La máscara de cada línea deja aire arriba para las tildes (CATÁLOGO, GUÍAS) sin separar más las líneas */
.menu__item { overflow: hidden; display: block; font-size: clamp(1.9rem, min(8.2vh, 11vw), 6.4rem); padding-top: .16em; margin-top: -.16em; }
.menu__link { display: flex; align-items: baseline; gap: clamp(12px, 2vw, 28px); font-size: 1em; padding-block: .02em; transition: transform .6s var(--ease-smooth), opacity .4s; will-change: transform; }
.menu__link .n { font: 500 .79rem var(--font-mono); letter-spacing: .08em; transform: translateY(-.5em); opacity: .55; }
.menu__link .t { display: inline-block; }
.menu__list:hover .menu__link { opacity: .28; }
.menu__list .menu__link:hover, .menu__list .menu__link:focus-visible { opacity: 1; transform: translateX(clamp(8px, 1.4vw, 24px)); }
.menu__link.is-on .t { color: var(--red); }
.menu__foot { display: flex; flex-wrap: wrap; gap: 14px 32px; justify-content: space-between; align-items: flex-end; padding-top: 20px; border-top: 1px solid rgb(239 236 230 / .22); }
.menu__foot a { opacity: .75; } .menu__foot a:hover { opacity: 1; }
.menu__plates { position: absolute; right: var(--edge); top: 50%; width: min(34vw, 520px); aspect-ratio: 4/5; transform: translateY(-50%); z-index: 1; pointer-events: none; display: none; }
.menu__plate { position: absolute; inset: 0; opacity: 0; clip-path: inset(100% 0 0 0); will-change: clip-path, opacity; }
@media (min-width: 960px) { .menu__plates { display: block; } }

/* ---------- Cursor personalizado ---------- */
.cursor { position: fixed; left: 0; top: 0; z-index: 950; pointer-events: none; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--fg); box-shadow: 0 0 0 1.5px var(--bg); opacity: 0; will-change: transform; display: grid; place-items: center; transition: width .35s var(--ease-smooth), height .35s var(--ease-smooth), margin .35s var(--ease-smooth), background .3s; }
.cursor__label { font: 600 .6rem var(--font-mono); letter-spacing: .1em; color: #000; opacity: 0; transition: opacity .25s; white-space: nowrap; }
.cursor.is-visible { opacity: 1; }
.cursor.is-link { width: 38px; height: 38px; margin: -19px 0 0 -19px; }
.cursor.is-label { width: 92px; height: 92px; margin: -46px 0 0 -46px; background: var(--red); box-shadow: none; }
.cursor.is-link { background: transparent; box-shadow: inset 0 0 0 1.5px var(--fg), 0 0 0 1.5px var(--bg); }
.cursor.is-label .cursor__label { opacity: 1; color: var(--paper); }
.cursor.is-down { transform-origin: center; }
html:not(.has-cursor) .cursor { display: none; }
html.has-cursor, html.has-cursor a, html.has-cursor button, html.has-cursor [data-cursor] { cursor: none; }
html.has-cursor input, html.has-cursor textarea, html.has-cursor select, html.has-cursor dialog { cursor: auto; }
html.has-cursor dialog button, html.has-cursor dialog a, html.has-cursor dialog label { cursor: pointer; }

/* ---------- Vista previa flotante que sigue al cursor ---------- */
.hoverimg { position: fixed; left: 0; top: 0; z-index: 250; width: clamp(200px, 22vw, 340px); aspect-ratio: 4/5; pointer-events: none; will-change: transform; opacity: 0; }
.hoverimg__item { position: absolute; inset: 0; opacity: 0; clip-path: inset(100% 0 0 0); will-change: clip-path, opacity, transform; }
html:not(.has-cursor) .hoverimg { display: none; }

/* ---------- Cortina de transición entre páginas ---------- */
.curtain { position: fixed; inset: 0; z-index: 700; pointer-events: none; visibility: hidden; }
.curtain.is-on { pointer-events: all; visibility: visible; }
/* La posición de los paneles la controla solo GSAP (yPercent). Un translateY en CSS se leía como un desplazamiento
   fijo en px que se sumaba a la animación y el panel nunca llegaba a cubrir la pantalla. Fuera de transición,
   la cortina está oculta (visibility) y los paneles no se ven aunque estén en su sitio. */
.curtain__red, .curtain__ink { position: absolute; inset: 0; will-change: transform; }
.curtain:not(.is-on) .curtain__red, .curtain:not(.is-on) .curtain__ink { visibility: hidden; }
.curtain__red { background: var(--red); }
.curtain__ink { background: var(--ink); color: var(--paper); display: grid; place-items: center; overflow: hidden; }
/* Nombre del apartado durante la transición: tamaño contenido, sin máscara (entra y sale con un fundido) */
.curtain__label { display: block; font-size: clamp(2rem, 5.5vw, 5.2rem); line-height: 1; padding: .16em 0 .08em; letter-spacing: -.03em; }
.curtain__label > span { display: block; }
/* Pie del panel de transición: qué es GamsterAPK y los derechos, alineados al margen del sitio */
.curtain__meta { position: absolute; left: var(--edge); right: var(--edge); bottom: clamp(28px, 6vh, 56px); display: flex; justify-content: space-between; align-items: flex-end; gap: 18px 48px; padding-top: 18px; border-top: 1px solid rgb(246 245 242 / .2); }
.curtain__desc { flex: 0 1 46ch; max-width: 46ch; font-size: clamp(.95rem, .85rem + .35vw, 1.15rem); line-height: 1.45; opacity: .82; }
.curtain__copy { opacity: .6; white-space: nowrap; }
@media (max-width: 720px) { .curtain__meta { flex-direction: column; align-items: flex-start; } .curtain__copy { white-space: normal; } }

/* ---------- Progreso ---------- */
.progress { position: fixed; right: var(--edge); bottom: 10px; z-index: 290; display: flex; align-items: center; gap: 12px; color: var(--fg); pointer-events: none; }
.progress__bar { width: 64px; height: 1px; background: color-mix(in srgb, currentColor 30%, transparent); position: relative; overflow: hidden; }
.progress__bar i { position: absolute; inset: 0; background: currentColor; transform: scaleX(0); transform-origin: left; }
html.has-motion .progress { opacity: 0; }
html:not(.has-motion) .progress { display: none; } /* sin animaciones la barra no avanza: no aporta nada */
/* En móvil el indicador flota sobre el texto: se compacta en una pastilla con el color del fondo */
@media (max-width: 767px) {
  .progress { bottom: 12px; padding: 7px 12px; border-radius: 999px; background: color-mix(in srgb, var(--bg) 86%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
  .progress__bar { width: 40px; }
  #progLabel { display: none; }
}

/* ---------- Diálogos (descarga y seguridad) ---------- */
dialog { border: 0; padding: 0; background: var(--ink); color: var(--paper); width: min(520px, calc(100% - 28px)); max-height: calc(100dvh - 28px); overflow: auto; }
dialog::backdrop { background: rgb(5 5 6 / .72); backdrop-filter: blur(6px); }
dialog[open] { animation: dlg-in .55s var(--ease-smooth); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(24px) scale(.98); } to { opacity: 1; transform: none; } }
.dlg { padding: clamp(22px, 4vw, 40px); }
.dlg h3 { font-size: clamp(1.8rem, 5vw, 2.8rem); }
.dlg .dlhead { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; }
.dlg .dlhead img { width: 60px; height: 60px; border-radius: 14px; object-fit: cover; background: #000; flex: none; }
.dlg .dlsub { font: 500 .75rem var(--font-mono); letter-spacing: .08em; text-transform: uppercase; opacity: .6; display: block; margin-top: 6px; }
.dlg input[type=email] { width: 100%; background: transparent; border: 0; border-bottom: 1px solid rgb(239 236 230 / .5); color: inherit; font: 500 1.15rem var(--font-sans); padding: 12px 0; outline: none; transition: border-color .3s; }
.dlg input[type=email]:focus { border-color: var(--red); }
.dlg .dlok { display: flex; gap: 12px; align-items: flex-start; font-size: .76rem; line-height: 1.5; opacity: .78; margin: 20px 0 8px; }
.dlg .dlok input { margin-top: 3px; flex: none; accent-color: var(--red); width: 16px; height: 16px; }
.dlg .dlok a { text-decoration: underline; text-underline-offset: 3px; }
.dlg #dlErr { color: #ff7a72; font-size: .82rem; min-height: 1.3em; margin: 6px 0 14px; }
.dlg .dlgo { display: flex; width: 100%; justify-content: space-between; align-items: center; background: var(--red); color: var(--paper); padding: 18px 22px; font: 600 .81rem var(--font-mono); letter-spacing: .1em; text-transform: uppercase; transition: background .4s; }
.dlg .dlgo:hover:not(:disabled) { background: var(--paper); color: var(--ink); }
.dlg .dlgo:disabled { opacity: .35; cursor: default; }
.dlg .dlcancel { display: block; margin: 14px auto 0; font: 500 .7rem var(--font-mono); letter-spacing: .08em; text-transform: uppercase; opacity: .6; }
.dlg .dlsent { font-size: 1.1rem; line-height: 1.4; margin-bottom: 10px; }
.dlg .dlhint { font-size: .8rem; opacity: .7; margin-bottom: 22px; }
.dlg .dlhint a { text-decoration: underline; }
#secDlg { width: min(640px, calc(100% - 28px)); }
#secDlg .seal { display: flex; align-items: center; gap: 18px; border: 1px solid rgb(239 236 230 / .28); padding: 16px 18px; margin: 16px 0 24px; }
#secDlg .seal b { font: 800 2.6rem/1 var(--font-sans); font-variation-settings: "wdth" 112; color: var(--paper); }
#secDlg .seal small { display: block; opacity: .62; font-size: .76rem; margin-top: 4px; }
#secDlg h4 { font: 500 .75rem var(--font-mono); letter-spacing: .1em; text-transform: uppercase; opacity: .6; margin: 22px 0 8px; }
#secDlg table { width: 100%; border-collapse: collapse; font-size: .84rem; }
#secDlg td { padding: 8px 0; border-top: 1px solid rgb(239 236 230 / .16); vertical-align: top; } #secDlg td:first-child { width: 42%; opacity: .75; padding-right: 12px; }
#secDlg .hash { font: 400 .72rem var(--font-mono); word-break: break-all; opacity: .8; border: 1px solid rgb(239 236 230 / .2); padding: 10px; }
#secDlg .noacc { font-size: .82rem; margin-top: 14px; color: #9de3a6; }
#secDlg .vt { display: inline-flex; margin-top: 18px; padding: 14px 18px; background: var(--red); font: 600 .7rem var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
#secDlg .acts { margin-top: 22px; }
