/* ============================================================
   APP.CSS -- Core public styles
   Extracted from shop.css (Polymer pattern), adapted for core
   Only: header, drawer, forms, buttons, toast, spinner, responsive
   ============================================================ */

/* -- Variables ------------------------------------------------ */

:root {
    --app-primary: #202020;
    --app-secondary: #595959;
    --app-accent: #172C50;
    --app-bg: #fff;
    --app-bg-alt: #f5f5f5;
    --app-border: #e0e0e0;
    --app-radius: 0;
    --app-max-width: 1200px;
    --app-header-height: 64px;
    --app-font: system-ui, -apple-system, 'Segoe UI', sans-serif;
    --app-success: #16a34a;
    --app-error: #dc2626;
    --app-warning: #d97706;
    --z-header: 100;
    --z-drawer-overlay: 200;
    --z-drawer: 201;
    --z-toast: 500;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* -- Language panel ------------------------------------------- */

.app-lang-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.3);
    z-index: 400; opacity: 0; pointer-events: none;
    transition: opacity 0.2s ease;
}
.app-lang-overlay.is-open { opacity: 1; pointer-events: auto; }

.app-lang-panel {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: #fff; border-radius: 0;
    padding: 20px 24px 32px; z-index: 401;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    border-top: 1px solid var(--app-border);
    pointer-events: none; visibility: hidden;
}
.app-lang-panel.is-open {
    transform: translateY(0); pointer-events: auto; visibility: visible;
}

.app-lang-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 0; border-bottom: 1px solid var(--app-border);
    font-size: 15px; color: var(--app-primary); text-decoration: none;
}
.app-lang-item:last-child { border-bottom: none; }
.app-lang-item:hover { color: var(--app-accent); }
.app-lang-item.is-active { font-weight: 600; }

@media (min-width: 769px) {
    .app-lang-panel {
        position: fixed; bottom: auto; top: 56px; right: 16px;
        left: auto; width: 200px; border-radius: 0;
        padding: 16px 20px 20px;
        transform: translateY(-10px); opacity: 0;
        transition: transform 0.2s ease, opacity 0.2s ease;
        pointer-events: none; visibility: hidden;
        border: 1px solid var(--app-border);
    }
    .app-lang-panel.is-open {
        transform: translateY(0); opacity: 1;
        pointer-events: auto; visibility: visible;
    }
}

/* -- Mobile drawer -------------------------------------------- */

.app-drawer-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: var(--z-drawer-overlay);
}
.app-drawer-overlay.is-open { display: block; }

.app-drawer {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 280px; background: var(--app-bg);
    z-index: var(--z-drawer);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    padding: 24px 20px;
    overflow-y: auto;
}
.app-drawer.is-open { transform: translateX(0); }

.app-drawer a {
    display: block; padding: 0 16px; line-height: 44px;
    color: var(--app-primary); text-decoration: none;
    font-size: 14px; font-weight: 500;
}
.app-drawer a:hover,
.app-drawer a.is-active {
    color: var(--app-accent); font-weight: 600;
}

.app-drawer__langs {
    display: flex;
    gap: 8px;
    border-top: 1px solid var(--app-border);
    margin-top: 12px;
    padding-top: 16px;
}

.app-drawer__lang-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    padding: 6px 12px;
    border: 1px solid var(--app-border);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    color: var(--app-secondary);
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.app-drawer__lang-pill:hover {
    color: var(--app-accent);
    border-color: var(--app-accent);
}

/* `.app-drawer .` prefix: out-specific the nav-link rule `.app-drawer a.is-active`
   (0,2,1) that would otherwise repaint the pill text navy-on-navy → invisible. */
.app-drawer .app-drawer__lang-pill.is-active {
    background: var(--app-accent);
    border-color: var(--app-accent);
    color: #fff;
    font-weight: 600;
}

/* -- Field (floating label) ----------------------------------- */

.app-field {
    position: relative;
    padding-top: 20px;
    margin-bottom: 12px;
}

.app-input {
    width: 100%;
    font-size: 1em;
    font-weight: 300;
    padding: 8px 0;
    border: none;
    border-bottom: 1px solid #ccc;
    background-color: transparent;
    color: var(--app-primary);
    outline: none;
    background-image: linear-gradient(var(--app-accent), var(--app-accent));
    background-size: 0% 2px;
    background-position: center bottom;
    background-repeat: no-repeat;
    transition: background-size 0.2s ease-in;
}

.app-input::placeholder { color: transparent; }

/* Reset Firefox default invalid style */
.app-input:invalid { box-shadow: none; }

.app-input:focus {
    border-bottom-color: transparent;
    background-size: 100% 2px;
}

.app-field > label {
    position: absolute; left: 0; top: 28px;
    font-size: 1em; font-weight: 300;
    color: var(--app-secondary); opacity: 0.5;
    pointer-events: none; transform-origin: 0 0;
    transition: transform 0.15s ease-out, opacity 0.15s ease-out, color 0.15s ease-out;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}

.app-field > .app-input:focus ~ label {
    opacity: 1; transform: translate3d(0, -1.9em, 0) scale(0.8);
    color: var(--app-accent);
}

.app-field > .app-input:not(:placeholder-shown) ~ label {
    opacity: 1; transform: translate3d(0, -1.9em, 0) scale(0.8);
}

/* Validation -- via aria-invalid attribute (set by JS on submit attempt) */
.app-field > .app-input[aria-invalid='true']:not(:valid) {
    border-bottom-color: transparent;
    background-image: linear-gradient(#dd2c00, #dd2c00);
    background-size: 100% 2px;
}

.app-field > .app-input[aria-invalid='true']:not(:valid) ~ label {
    color: #dd2c00;
}

.app-field > .app-input[aria-invalid='true']:not(:valid) ~ .app-field-error {
    display: block;
}

.app-field-error {
    display: none; font-size: 0.65em; color: #dd2c00; margin-top: 2px;
}

/* Select styling */
.app-field > select.app-input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image:
        linear-gradient(var(--app-accent), var(--app-accent)),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23595959' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-size: 0% 2px, 12px;
    background-position: center bottom, right 0 center;
    background-repeat: no-repeat;
    padding-right: 20px;
    cursor: pointer;
}

.app-field > select.app-input:focus {
    background-size: 100% 2px, 12px;
}

/* Textarea */
.app-field > textarea.app-input {
    min-height: 80px;
    resize: vertical;
}

/* Input rows (side by side) */
.app-input-row {
    display: flex; align-items: flex-end; gap: 8px;
}
.app-input-row > * { flex: 1; }

/* -- Form actions row (wraps submit button, centered, spaced) - */

.app-form-actions {
    margin-top: 2rem;
    text-align: center;
}

/* -- Button (Polymer style) ----------------------------------- */

.app-button {
    display: inline-block;
}

.app-button > a,
.app-button > button {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    box-sizing: border-box;
    border: 2px solid #000; background: #fff;
    font-size: 14px; font-weight: 500;
    color: var(--app-primary);
    margin: 0; padding: 8px 44px;
    text-align: center; text-decoration: none;
    text-transform: uppercase; border-radius: 0;
    outline: none; cursor: pointer;
    -webkit-appearance: none;
    transition: background-color 0.15s, color 0.15s;
}

.app-button > a:focus,
.app-button > button:focus { background: #c5cad3; }

.app-button > a:active,
.app-button > button:active { background: #000; color: #fff; }

.app-button > button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Primary (filled) */
.app-button--primary > a,
.app-button--primary > button {
    background: var(--app-accent);
    border-color: var(--app-accent);
    color: #fff;
}

.app-button--primary > a:active,
.app-button--primary > button:active { background: #0e1b33; }

/* -- Button states (spinner -> check/x -> idle) --------------- */

.app-btn-spinner {
    display: inline-block; width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff; border-radius: 50%;
    animation: appSpin 0.6s linear infinite;
    vertical-align: middle;
}

.app-button:not(.app-button--primary) button .app-btn-spinner {
    border-color: rgba(0,0,0,0.15);
    border-top-color: #000;
}

/* -- Spinner -------------------------------------------------- */

.app-spinner {
    position: fixed;
    top: calc(50% - 20px); left: calc(50% - 20px);
    width: 40px; height: 40px;
    border: 3px solid var(--app-border);
    border-top-color: var(--app-accent);
    border-radius: 50%;
    animation: appSpin 0.8s linear infinite;
    z-index: 300;
}

@keyframes appSpin { to { transform: rotate(360deg); } }

/* -- Toast ---------------------------------------------------- */

.app-toast {
    position: fixed; bottom: 24px; left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--app-primary); color: #fff;
    padding: 12px 24px; border-radius: 0;
    font-size: 14px; font-weight: 500;
    z-index: var(--z-toast); opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    border: 1px solid rgba(255,255,255,0.1);
}

.app-toast.is-visible {
    opacity: 1; transform: translateX(-50%) translateY(0);
}

/* -- Image lazy load + shimmer -------------------------------- */

.app-image {
    position: relative;
    overflow: hidden;
    background-color: var(--app-bg-alt);
}

.app-image::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.06) 50%, transparent 100%);
    background-size: 200% 100%;
    animation: appShimmer 1.2s ease-in-out infinite;
    z-index: 1;
    transition: opacity 0.3s ease;
}

.app-image.is-loaded::before {
    opacity: 0;
    pointer-events: none;
}

.app-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.app-image.is-loaded img {
    opacity: 1;
}

@keyframes appShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* -- Gallery grid images --------------------------------------- */

.gallery-grid__img {
    display: block;
    aspect-ratio: 4/3;
}

.gallery-grid__img img {
    transition: opacity 0.5s ease, transform 0.3s ease;
}

a.gallery-grid__img:hover img {
    transform: scale(1.04);
}

/* -- Hero image section ---------------------------------------- */

.hero-image {
    position: relative;
    min-height: 80vh;
    display: flex;
    align-items: center;
    width: 100%;
    background: #0f172a;
    overflow: hidden;
}

.hero-image__bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.hero-image__bg.is-loaded {
    opacity: 1;
}

/* LQIP blur-up (ADR-0019 / patrón canónico images-presentation-processing §2):
   la miniatura ≤400px se pinta AL INSTANTE muy desenfocada como placeholder de
   PRECARGA — no es un efecto, evita el hueco vacío mientras baja la imagen full.
   Va DEBAJO de `__bg` (que arranca opacity:0); cuando la full carga, funde encima
   (`.is-loaded`). Ambas comparten `object-position:{focal}` (inline) para reencuadrar
   igual. `scale` oculta los bordes que el blur deja transparentes. */
.hero-image__lqip {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(24px);
    transform: scale(1.08);
}

/* Hero imagen `inline` (setting image_display): la imagen va EN FLUJO a su ratio natural
   (no full-bleed que recorta), con el contenido debajo y sin overlay — para cuando la imagen
   ES contenido (producto, ilustración) y no un fondo decorativo. Alternativa a `background`. */
.hero-image--inline {
    display: block;
    min-height: 0;
    background: transparent;
}
.hero-image--inline .hero-image__lqip { display: none; }
.hero-image--inline .hero-image__bg {
    position: relative;
    inset: auto;
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
}
.hero-image--inline .hero-image__content {
    padding: 2rem;
}

/* Hero imagen `motion: kenburns` — zoom/paneo LENTO y continuo que da vida al hero SIN
   depender del scroll (a diferencia del parallax). Zoom hacia un punto descentrado (60%/40%)
   para sensación de paneo sin revelar bordes. No aplica en `inline` (object-fit:contain
   revelaría bordes) ni con reduced-motion (accesibilidad). */
.hero-image--kenburns:not(.hero-image--inline) .hero-image__bg {
    transform-origin: 60% 40%;
    animation: heroKenBurns 24s ease-in-out infinite alternate;
}
@keyframes heroKenBurns {
    from { transform: scale(1); }
    to   { transform: scale(1.14); }
}
@media (prefers-reduced-motion: reduce) {
    .hero-image--kenburns .hero-image__bg { animation: none; }
}

/* Variante `parallax`: el `<img>` de fondo se DESPLAZA con el scroll (transform vía JS en
   la plantilla) más lento que el contenido → profundidad real. Se hace más alto que la
   sección (130%, sobresale 15% arriba/abajo) para que el desplazamiento no revele bordes.
   `will-change` para que el navegador lo componga en GPU (scroll fluido). Sin JS o con
   reduced-motion, queda estático cubriendo la sección (top/height se ignoran visualmente
   porque object-fit:cover + overflow:hidden del contenedor lo recortan). */
.hero-image--parallax .hero-image__bg {
    top: -20%;
    bottom: auto;
    height: 140%;
    will-change: transform;
}

/* Slideshow: las imágenes rotan reutilizando el efecto del carousel. El contenedor
   crea su propio contexto de apilado (`isolation`) para que los z-index del efecto
   (hasta 1001 en archive-x) NO tapen el overlay ni el contenido del hero. */
.hero-image__slides {
    position: absolute;
    inset: 0;
    isolation: isolate;
    z-index: 0;
    background: #0f172a; /* fallback mientras cargan las imágenes: nunca se ve blanco */
}
.hero-image__dots {
    position: absolute;
    bottom: 1.5rem;
    left: 0;
    right: 0;
    z-index: 3;
    display: flex;
    gap: .5rem;
    justify-content: center;
}
.hero-image__dots button {
    width: .55rem;
    height: .55rem;
    border-radius: 50%;
    border: none;
    padding: 0;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.45);
    transition: background 0.25s ease, width 0.25s ease;
}
.hero-image__dots button.is-active {
    width: 1.5rem;
    border-radius: 0.3rem;
    background: #fff;
}

.hero-image__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    pointer-events: none;
    z-index: 1;
}

.hero-image__content {
    position: relative;
    z-index: 2;
    padding: calc(var(--app-header-height) + 3rem) 2rem 4rem;
    width: 100%;
}

.hero-image__title {
    font-size: 2.5rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 1rem;
    line-height: 1.1;
}

.hero-image__subtitle {
    font-size: 1.125rem;
    color: rgba(255,255,255,0.8);
    margin-bottom: 2rem;
    max-width: 540px;
}

.hero-image--center { text-align: center; }
.hero-image--center .hero-image__subtitle {
    margin-left: auto;
    margin-right: auto;
}

.hero-image__cta {
    display: inline-block;
    padding: 0.75rem 1.75rem;
    background: #fff;
    color: #0f172a;
    font-weight: 700;
    border-radius: 0;
    text-decoration: none;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    transition: background-color 0.15s, transform 0.15s;
}

.hero-image__cta:hover {
    background: #f1f5f9;
    transform: translateY(-1px);
}

/* ── Carousel / slideshow — motor de transición COMPARTIDO ──────────────────
   Un único motor de rotación de slides para gallery/carousel, hero/slideshow y
   cualquier sección futura que rote contenido. Las clases las dirige `slideClass(i)`
   del factory Alpine `czCarousel` (templates/sections/_partials/carousel-engine.html).
   'fade' = cross-fade · 'archive-x' = efecto "WhatsApp" de Adán (byte-canónico entre
   verticales). Estas clases SOLO animan; el markup de cada consumidor decide qué pinta
   cada slide (imagen+overlay en gallery · fondo+LQIP en hero). Antes vivían duplicadas
   e inline como `.cz1-*` (gallery) y `.hs-*` (hero) — ya divergían (autoplay 4000 vs
   5000 ms); esta es su única fuente. */
.cz-slide { position:absolute; top:0; left:0; right:0; bottom:0; opacity:0; pointer-events:none; overflow:hidden; }
.cz-slide.is-on { pointer-events:auto; }
.cz-fade { transition:opacity .9s ease; }
.cz-fade.is-on { opacity:1; z-index:10; }
/* archive-x: al avanzar, la vieja se encoge y la nueva entra deslizando; al retroceder, inverso. */
.cz-ax.is-on     { opacity:1; z-index:2; }
.cz-ax.navOutNext { z-index:1;    opacity:1; animation:czScaleHalfDownX  .7s forwards cubic-bezier(.7,0,.3,1); }
.cz-ax.navInNext  { z-index:1001; opacity:1; animation:czSlideInFromLeftX .7s forwards cubic-bezier(.7,0,.3,1); }
.cz-ax.navOutPrev { z-index:1001; opacity:1; animation:czSlideOutToLeftX  .7s forwards cubic-bezier(.7,0,.3,1); }
.cz-ax.navInPrev  { z-index:1;             animation:czScaleHalfUpX     .7s forwards cubic-bezier(.7,0,.3,1); }
.cz-ax::before, .cz-ax::after { content:''; position:absolute; inset:0; pointer-events:none; background:rgba(0,0,0,.6); transition:opacity .7s cubic-bezier(.7,0,.3,1); z-index:5; }
.cz-ax::before { opacity:0; } .cz-ax::after { opacity:1; }
.cz-ax.is-on::after { opacity:0; }
.cz-ax.navOutNext::before { opacity:1; }
.cz-ax.navInNext::after, .cz-ax.navInPrev::after { opacity:0; }
.cz-ax.navInNext::after { transition:none; }
@keyframes czScaleHalfDownX  { to   { transform:scale(.6); opacity:0; } }
@keyframes czSlideInFromLeftX { from { transform:translateX(-100%); } to { transform:translateX(0); } }
@keyframes czSlideOutToLeftX  { to   { transform:translateX(-100%); } }
@keyframes czScaleHalfUpX     { from { opacity:0; transform:scale(.6); } to { opacity:1; transform:scale(1); } }
@media (prefers-reduced-motion: reduce) { .cz-ax { animation:none !important; } .cz-ax.is-on { opacity:1; } }

/* Hero slideshow — imágenes de fondo por slide (LQIP blur-up por slide, ADR-0019).
   El slide usa las clases compartidas `.cz-*` para la transición; estas reglas sólo
   dimensionan las dos <img> (miniatura desenfocada de precarga + full que funde encima). */
.hero-image__slides .cz-slide img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; display:block; }
.hero-image__slide-lqip { filter:blur(18px); transform:scale(1.08); }
.hero-image__slide-full { opacity:0; transition:opacity .5s ease; }
.hero-image__slide-full.is-loaded { opacity:1; }

/* -- Site header (intelligent: transparent over hero, solid otherwise) */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-header);
    background: transparent;
    color: #f8fafc;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.3s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}

.site-header.is-solid {
    background: #0f172a;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.site-header.is-hidden {
    transform: translateY(-100%);
}

/* Offset main content below fixed header (pages without hero) */
#main-content {
    margin-top: var(--app-header-height);
}

/* Full-bleed pages: hero slides under the header */
#main-content.full-bleed {
    margin-top: 0;
    /* Sin lona oscura: cada tramo pone su propio fondo — el hero es oscuro por su
       clase (`.hero-image { background:#0f172a }`) y el footer también. Forzar aquí
       `background:#0f172a` era REDUNDANTE para el hero y teñía de oscuro las secciones
       de contenido TRANSPARENTES (content/team/…) → texto oscuro sobre oscuro, ilegible
       (regresión de la unificación del motor). El body claro (#f8fafc) cubre cualquier
       hueco flex bajo la última sección sin costura visible contra hero/footer. */
}

.site-header h1 {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: .05em;
}

.site-header h1 a {
    color: inherit;
    text-decoration: none;
}

.site-header nav a {
    position: relative;
    color: #cbd5e1;
    text-decoration: none;
    font-size: .85rem;
    margin-left: .75rem;
    padding-bottom: 4px;
    transition: color .2s ease;
}

.site-header nav a::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 0;
    height: 1px;
    background: currentColor;
    transform: translateX(-50%);
    transition: width .25s ease;
}

.site-header nav a:hover,
.site-header nav a.active {
    color: #fff;
}

.site-header nav a:hover::after,
.site-header nav a.active::after {
    width: 100%;
}

.site-header nav form {
    display: inline;
    margin-left: .75rem;
}

.site-header nav button {
    background: none;
    border: none;
    color: #cbd5e1;
    font-size: .85rem;
    cursor: pointer;
    padding: 0;
}

.site-header nav button:hover {
    color: #f8fafc;
}

.site-header .badge {
    font-size: .7rem;
    background: #334155;
    color: #94a3b8;
    padding: .15rem .4rem;
    border-radius: .25rem;
    margin-left: .35rem;
}

.site-header #menuToggle {
    display: none;
    background: none;
    border: none;
    color: #f8fafc;
    cursor: pointer;
    padding: 8px;
}

/* Right-side cluster = public "topbar.end" zone (nav links + language switch +
   future module icons like cart/wishlist, gated by module state — see the
   module-slot-pattern canon). Keeps language reachable on mobile in one tap,
   without opening the drawer. */
.site-header__actions { display: flex; align-items: center; gap: .75rem; }
.site-header__actions .lang-drop { margin-left: 0; }

@media (max-width: 767px) {
    .site-header #menuToggle { display: block; }
    .site-header nav { display: none; }
    /* Clean globe-only next to the hamburger: hide autonym + caret, and size the
       globe to sit level with the 24px hamburger (outline reads ~equal at 22px). */
    .site-header__actions .lang-drop summary span { display: none; }
    .site-header__actions .lang-drop summary { padding: 8px; }
    .site-header__actions .lang-drop__globe { width: 22px; height: 22px; }
}

/* -- View Transitions API ------------------------------------- */

::view-transition-old(root) {
    animation: vtFadeOut 0.15s ease-out both;
}
::view-transition-new(root) {
    animation: vtFadeIn 0.2s ease-in both;
}
@keyframes vtFadeOut { to { opacity: 0; } }
@keyframes vtFadeIn  { from { opacity: 0; } }

/* Header persists across navigations — no flash */
.site-header { view-transition-name: header; }
::view-transition-group(header) { animation: none; }

/* -- Transitions ---------------------------------------------- */

.app-fade-in { animation: appFadeIn 0.25s ease; }
@keyframes appFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* -- Responsive ----------------------------------------------- */

@media (max-width: 767px) {
    .app-input-row {
        flex-direction: column; align-items: stretch; gap: 0;
    }

    /* Responsive button: full-width fixed bottom */
    .app-button--responsive {
        position: fixed; bottom: 0; left: 0; right: 0;
        height: 64px; z-index: 50;
    }
    .app-button--responsive > a,
    .app-button--responsive > button {
        background: var(--app-accent); border: none; color: #fff;
        width: 100%; height: 100%; padding: 20px; font-size: 15px;
    }
}

/* -- Accessibility -------------------------------------------- */

.app-sr-only {
    position: fixed; height: 0; overflow: hidden;
}

/* -- Pricing grid --------------------------------------------- */

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.pricing-card {
    border: 1px solid #e2e8f0;
    padding: 2rem 1.5rem;
    position: relative;
}

.pricing-card--featured {
    border: 2px solid var(--app-accent);
}

.pricing-badge {
    position: absolute;
    top: -0.75rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--app-accent);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.75rem;
}

.pricing-card h3 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: #0f172a;
}

.pricing-price {
    font-size: 2rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 1.25rem;
    line-height: 1;
}

.pricing-price span {
    font-size: 0.875rem;
    font-weight: 400;
    color: #64748b;
}

.pricing-card ul {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
}

.pricing-card li {
    padding: 0.4rem 0;
    font-size: 0.875rem;
    color: #475569;
    border-bottom: 1px solid #f1f5f9;
}

.pricing-card li:last-child {
    border-bottom: none;
}

.pricing-cta {
    display: block;
    text-align: center;
    padding: 0.75rem;
    border: 2px solid var(--app-accent);
    color: var(--app-accent);
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    text-decoration: none;
    letter-spacing: 0.03em;
    transition: background-color 0.15s, color 0.15s;
}

.pricing-cta:hover {
    background: var(--app-accent);
    color: #fff;
}

.pricing-card--featured .pricing-cta {
    background: var(--app-accent);
    color: #fff;
}

.pricing-card--featured .pricing-cta:hover {
    background: #0e1b33;
}

/* -- Feature alternating (zig-zag service sections) ----------- */

.feature-alt {
    padding: 5rem 1.5rem;
}

.feature-alt__inner {
    display: flex;
    align-items: center;
    gap: 3rem;
    max-width: 1100px;
    margin: 0 auto;
}

.feature-alt__text {
    flex: 1;
    min-width: 0;
}

.feature-alt__title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 1rem;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.feature-alt__body {
    font-size: 1rem;
    color: #475569;
    line-height: 1.7;
    margin-bottom: 1.25rem;
}

.feature-alt__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.feature-alt__tags li {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #0f172a;
    padding: 0.35rem 0.75rem;
    border: 1px solid #e2e8f0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.feature-alt__icon {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.feature-alt__icon svg {
    max-width: 100%;
    height: auto;
}

/* SVG illustration layer stacking (multi-layer icons) */
.service-icon__layers {
    display: inline-block;
    position: relative;
    width: 100%;
    max-width: 15rem;
    height: auto;
}

.service-icon__layers svg {
    width: 100%;
    height: auto;
}

/* Layer stacking: first SVG is static, subsequent are absolute */
.service-icon__layers svg:not(:first-child) {
    position: absolute;
    inset: 0;
}

/* Initial hidden state — layers stagger in on reveal */
.service-icon__layers svg {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* Stagger delay per layer */
.service-icon__layers svg:nth-child(1) { transition-delay: 0s; }
.service-icon__layers svg:nth-child(2) { transition-delay: 0.12s; }
.service-icon__layers svg:nth-child(3) { transition-delay: 0.24s; }
.service-icon__layers svg:nth-child(4) { transition-delay: 0.36s; }
.service-icon__layers svg:nth-child(5) { transition-delay: 0.48s; }
.service-icon__layers svg:nth-child(6) { transition-delay: 0.6s; }
.service-icon__layers svg:nth-child(7) { transition-delay: 0.72s; }

/* Active state — triggered by IntersectionObserver adding .is-visible */
.service-icon.is-visible .service-icon__layers svg {
    opacity: 1;
    transform: none;
}

@media (max-width: 767px) {
    .feature-alt__inner {
        flex-direction: column;
        gap: 2rem;
    }

    .feature-alt__text,
    .feature-alt__icon {
        order: unset !important;
    }

    .feature-alt__icon {
        max-width: 280px;
        margin: 0 auto;
    }

    .feature-alt {
        padding: 3rem 1.5rem;
    }
}

/* ── App launcher (F5 «índice de módulos activos» → /apps, front) ── */
.launcher-page { max-width: var(--app-max-width); margin: 0 auto; padding: 2.5rem 1.25rem 4rem; }
.launcher-head { margin-bottom: 2rem; }
.launcher-head__title { font-size: 1.5rem; font-weight: 700; color: var(--app-primary); margin: 0 0 .35rem; }
.launcher-head__sub { color: var(--app-secondary); margin: 0; }
.launcher-group { margin-bottom: 2.25rem; }
.launcher-group__title { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--app-secondary); margin: 0 0 1rem; }
.launcher-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.launcher-tile { position: relative; background: var(--app-bg); border: 1px solid var(--app-border); border-radius: var(--app-radius); padding: 1.25rem; display: flex; flex-direction: column; gap: .85rem; transition: border-color .15s, box-shadow .15s, transform .15s; }
.launcher-tile:hover { border-color: var(--app-accent); box-shadow: 0 6px 20px rgba(0,0,0,.08); transform: translateY(-2px); }
.launcher-tile__icon { width: 44px; height: 44px; border-radius: var(--app-radius); background: var(--app-bg-alt); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.launcher-tile__icon svg { width: 22px; height: 22px; stroke: var(--app-accent); fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.launcher-tile__meta { display: flex; flex-direction: column; gap: 2px; }
.launcher-tile__name { font-weight: 600; font-size: .95rem; color: var(--app-primary); text-decoration: none; }
/* stretched link: el enlace del nombre cubre toda la tarjeta (tile clicable) */
.launcher-tile__name::after { content: ""; position: absolute; inset: 0; }
.launcher-tile__cat { font-size: .7rem; color: var(--app-secondary); }
.launcher-tile__desc { font-size: .8rem; color: var(--app-secondary); line-height: 1.5; flex: 1; margin: 0; }
.launcher-tile__footer { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.launcher-tile__open { display: inline-flex; align-items: center; gap: 3px; font-size: .8rem; font-weight: 600; color: var(--app-accent); }
.launcher-tile__open svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.launcher-tile:hover .launcher-tile__open svg { transform: translateX(2px); }
/* el chip Admin va POR ENCIMA del enlace estirado → clic independiente */
.launcher-tile__admin { position: relative; z-index: 1; font-size: .7rem; font-weight: 500; color: var(--app-secondary); text-decoration: none; padding: 2px .5rem; border: 1px solid var(--app-border); border-radius: var(--app-radius); transition: color .15s, border-color .15s; }
.launcher-tile__admin:hover { color: var(--app-primary); border-color: var(--app-secondary); }
.launcher-empty { text-align: center; padding: 4rem 1.25rem; color: var(--app-secondary); }
.launcher-empty svg { width: 40px; height: 40px; stroke: currentColor; fill: none; stroke-width: 1.5; opacity: .5; margin-bottom: 1rem; }
/* ── Header del front: clúster de iconos (waffle · idioma · usuario) ── */
/* icono genérico en el header (waffle de apps): mismo tamaño y color que el resto */
.site-header__icon { display: inline-flex; align-items: center; color: #cbd5e1; transition: color .15s; }
.site-header__icon:hover { color: #fff; }
.site-header__icon svg { width: 20px; height: 20px; display: block; }
/* menú de usuario (avatar → nombre + Perfil + Salir), mismo popover que el idioma */
.user-drop { position: relative; display: inline-flex; }
.user-drop summary { display: inline-flex; align-items: center; gap: .35rem; list-style: none; cursor: pointer; user-select: none; }
.user-drop summary::-webkit-details-marker { display: none; }
.user-drop__avatar { width: 30px; height: 30px; border-radius: 50%; background: #6366f1; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; text-transform: uppercase; }
.user-drop__chev { width: 11px; height: 11px; flex-shrink: 0; color: #cbd5e1; opacity: .8; transition: transform .15s ease; }
.user-drop[open] .user-drop__chev { transform: rotate(180deg); }
.user-drop__menu { position: absolute; right: 0; top: calc(100% + .45rem); background: #1e293b; border: 1px solid #334155; border-radius: .4rem; min-width: 190px; z-index: 50; padding: .3rem; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.user-drop__who { display: block; padding: .35rem .6rem .5rem; font-size: .75rem; color: #94a3b8; border-bottom: 1px solid #334155; margin-bottom: .25rem; white-space: nowrap; }
.user-drop__menu a, .user-drop__logout { display: flex; align-items: center; gap: .5rem; width: 100%; padding: .5rem .6rem; font-size: .85rem; color: #cbd5e1; text-decoration: none; border: 0; background: none; cursor: pointer; border-radius: .25rem; text-align: left; font: inherit; }
.user-drop__menu a:hover, .user-drop__logout:hover { color: #fff; background: #334155; }
.user-drop__logout svg { width: 16px; height: 16px; flex-shrink: 0; }
.user-drop__menu form { margin: 0; }
