/* Ruptline · hubs de categoría y contraste del shell público */

body.has-rl-public-app {
    --rl-app-bg: #ececea;
    --rl-app-surface: #fbfbfa;
    --rl-app-panel: #ffffff;
    --rl-app-soft: #f1f1ef;
    --rl-app-text: #0b0b0b;
    --rl-app-muted: #686866;
    --rl-app-line: #dededb;
    --rl-app-line-strong: #cfcfcb;
    --rl-app-accent: #111111;
    --rl-app-accent-soft: rgba(0, 0, 0, 0.08);
    --rl-app-shadow: 0 20px 55px rgba(0, 0, 0, 0.07);
}

html[data-ally-theme="dark"] body.has-rl-public-app {
    --rl-app-bg: #090909;
    --rl-app-surface: #101010;
    --rl-app-panel: #171717;
    --rl-app-soft: #1e1e1e;
    --rl-app-text: #f7f7f5;
    --rl-app-muted: #a1a19d;
    --rl-app-line: #292929;
    --rl-app-line-strong: #3a3a38;
    --rl-app-accent: #f7f7f5;
    --rl-app-accent-soft: rgba(255, 255, 255, 0.1);
    --rl-app-shadow: 0 24px 65px rgba(0, 0, 0, 0.3);
}

/* Las vistas internas son el contenedor de desplazamiento real de la app.
   La portada conserva su lienzo fijo mediante las reglas .is-home existentes. */
.rl-public-app:not(.is-home) .rl-app-scroll {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-y: auto;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

.rl-public-app:not(.is-home) .rl-public-view {
    min-height: 100%;
    overflow: visible;
}

.rl-public-app::after {
    background: var(--rl-app-text);
}

.rl-app-surface {
    grid-template-rows: 64px minmax(0, 1fr);
}

.rl-app-scroll,
.rl-public-app.is-tools .rl-app-scroll {
    color: var(--rl-app-text);
    background: var(--rl-app-surface);
}

.rl-public-view {
    color: var(--rl-app-text);
    background: var(--rl-app-surface);
}

.rl-app-footer,
.rl-public-app.is-tools .rl-app-footer {
    border-top-color: var(--rl-app-line);
    color: var(--rl-app-muted);
    background: var(--rl-app-surface);
}

.rl-app-footer a:hover,
.rl-public-app.is-tools .rl-app-footer a:hover {
    color: var(--rl-app-text);
}

.rl-public-app .site-rail-nav a.is-active::before {
    background: var(--rl-app-text);
}

/* Hub principal de cada icono del menú */
.rl-section-hub {
    width: 100%;
    min-height: 100%;
    padding: clamp(32px, 5vw, 68px);
    color: var(--rl-app-text);
    background: var(--rl-app-surface);
}

.rl-section-hub-inner {
    width: min(100%, 1280px);
    margin: 0 auto;
}

.rl-section-hub-heading {
    max-width: 720px;
    margin-bottom: clamp(28px, 4vw, 46px);
}

.rl-section-hub-heading p {
    margin: 0 0 12px;
    color: var(--rl-app-muted);
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.rl-section-hub-heading h1 {
    max-width: 680px;
    margin: 0;
    color: var(--rl-app-text);
    font-family: inherit;
    font-size: clamp(27px, 3.3vw, 46px);
    font-weight: 450;
    line-height: 1.02;
    letter-spacing: -0.045em;
}

.rl-section-hub-heading div {
    max-width: 610px;
    margin-top: 14px;
    color: var(--rl-app-muted);
    font-size: 13px;
    line-height: 1.55;
    letter-spacing: 0;
}

.rl-hub-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.rl-hub-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rl-hub-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.rl-hub-card {
    position: relative;
    min-width: 0;
    min-height: 188px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    border: 1px solid var(--rl-app-line);
    border-radius: 22px;
    color: var(--rl-app-text);
    background: var(--rl-app-panel);
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.02);
    overflow: hidden;
    isolation: isolate;
    transition: transform 170ms ease, border-color 170ms ease, background 170ms ease, box-shadow 170ms ease;
}

.rl-hub-card:hover,
.rl-hub-card:focus-visible {
    z-index: 2;
    color: var(--rl-app-text);
    border-color: var(--rl-app-line-strong);
    background: var(--rl-app-soft);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.08);
    transform: translateY(-3px);
    outline: 0;
}

html[data-ally-theme="dark"] .rl-hub-card:hover,
html[data-ally-theme="dark"] .rl-hub-card:focus-visible {
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
}

.rl-hub-card-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid var(--rl-app-line);
    border-radius: 13px;
    color: var(--rl-app-text);
    background: var(--rl-app-soft);
}

.rl-hub-card-icon svg,
.rl-hub-card-arrow svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.55;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.rl-hub-card-icon svg {
    width: 21px;
    height: 21px;
}

.rl-hub-card-copy {
    min-width: 0;
    margin-top: auto;
    padding-top: 28px;
    display: block;
}

.rl-hub-card-copy strong {
    display: block;
    color: var(--rl-app-text);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.16;
    letter-spacing: -0.02em;
}

.rl-hub-card-copy small {
    display: block;
    margin-top: 8px;
    padding-right: 22px;
    color: var(--rl-app-muted);
    font-size: 11px;
    font-weight: 400;
    line-height: 1.48;
    letter-spacing: 0;
}

.rl-hub-card-arrow {
    position: absolute;
    right: 18px;
    bottom: 18px;
    width: 25px;
    height: 25px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    color: var(--rl-app-muted);
    transition: color 170ms ease, transform 170ms ease;
}

.rl-hub-card-arrow svg {
    width: 16px;
    height: 16px;
}

.rl-hub-card:hover .rl-hub-card-arrow,
.rl-hub-card:focus-visible .rl-hub-card-arrow {
    color: var(--rl-app-text);
    transform: translateX(2px);
}

/* Páginas editoriales: mismas superficies en claro y oscuro. */
.rl-public-view > .page-section,
.rl-public-view .service-page,
.rl-public-view .about-page,
.rl-public-view .service-page .page-section,
.rl-public-view .about-page .page-section {
    color: var(--rl-app-text);
    background: var(--rl-app-surface);
}

.rl-public-view > .page-section .content-block p,
.rl-public-view .service-page p,
.rl-public-view .about-page p {
    color: var(--rl-app-muted);
}

.rl-public-view .service-hero-grid > div:first-child,
.rl-public-view .about-hero-grid > div:first-child,
.rl-public-view .home-product-card,
.rl-public-view .home-faq-item,
.rl-public-view .service-side-card,
.rl-public-view .about-founder-card {
    border-color: var(--rl-app-line);
    color: var(--rl-app-text);
    background: var(--rl-app-panel);
}

.rl-public-view .service-side-card h2,
.rl-public-view .about-founder-card h2,
.rl-public-view .home-product-card,
.rl-public-view .home-product-card h3,
.rl-public-view .home-faq-item h3 {
    color: var(--rl-app-text);
}

.rl-public-view .service-side-card span,
.rl-public-view .home-founder-avatar {
    color: var(--rl-app-panel);
    background: var(--rl-app-text);
    box-shadow: none;
}

.rl-public-view .home-product-card::after,
.rl-public-view .home-faq-item::after,
.rl-public-view .service-side-card::after,
.rl-public-view .about-founder-card::after {
    background: var(--rl-app-text);
}

/* Las herramientas conservan su identidad y sus colores originales.
   Las vistas AEO/sistemas conservan la adaptación de contraste del shell.
   El filtro monocromático no se aplica a .tool-page. */
.rl-public-view > .legal-page,
.rl-public-view > .ai-page,
.rl-public-view > .aeo-analyzer-page,
.rl-public-view > .bizsys-page {
    filter: grayscale(1);
}

html[data-ally-theme="dark"] .rl-public-view > .legal-page,
html:not([data-ally-theme="dark"]) .rl-public-view > .ai-page,
html:not([data-ally-theme="dark"]) .rl-public-view > .aeo-analyzer-page,
html:not([data-ally-theme="dark"]) .rl-public-view > .bizsys-page {
    filter: grayscale(1) invert(1);
}

html[data-ally-theme="dark"] .rl-public-view > .legal-page :is(img, picture, video, canvas),
html:not([data-ally-theme="dark"]) .rl-public-view > .ai-page :is(img, picture, video, canvas),
html:not([data-ally-theme="dark"]) .rl-public-view > .aeo-analyzer-page :is(img, picture, video, canvas),
html:not([data-ally-theme="dark"]) .rl-public-view > .bizsys-page :is(img, picture, video, canvas) {
    filter: invert(1);
}

html[data-ally-theme="dark"] .rl-public-view input,
html[data-ally-theme="dark"] .rl-public-view textarea,
html[data-ally-theme="dark"] .rl-public-view select {
    color-scheme: dark;
}

@media (max-width: 1180px) {
    .rl-hub-grid,
    .rl-hub-grid-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .rl-hub-grid-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .rl-hub-grid,
    .rl-hub-grid-2,
    .rl-hub-grid-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .rl-app-surface,
    .rl-public-app.is-home .rl-app-surface {
        grid-template-rows: 58px minmax(0, 1fr);
    }

    .rl-section-hub {
        padding: 26px 16px 34px;
    }

    .rl-section-hub-heading {
        margin-bottom: 24px;
    }

    .rl-section-hub-heading h1 {
        max-width: 520px;
        font-size: clamp(26px, 8vw, 38px);
    }

    .rl-hub-card {
        min-height: 174px;
        padding: 17px;
        border-radius: 18px;
    }

    .rl-hub-card-arrow {
        right: 14px;
        bottom: 14px;
    }
}

@media (max-width: 560px) {
    .rl-hub-grid,
    .rl-hub-grid-2,
    .rl-hub-grid-3 {
        grid-template-columns: 1fr;
    }

    .rl-hub-card {
        min-height: 158px;
    }

    .rl-hub-card-copy {
        padding-top: 22px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .rl-hub-card,
    .rl-hub-card-arrow {
        transition: none;
    }
}
