/* Landing pública /oposicion/{slug} — mobile-first */

.opp-landing {
    --opp-accent: #6366f1;
    --opp-accent-soft: rgba(99, 102, 241, 0.12);
    --opp-hero-from: #0f172a;
    --opp-hero-to: #1e1b4b;
    --opp-surface: #ffffff;
    --opp-surface-muted: #f8fafc;
    --opp-border: #e2e8f0;
    --opp-text: #0f172a;
    --opp-text-muted: #64748b;
    --opp-section-scroll: calc(var(--public-nav-offset, 80px) + 3.5rem);
}

.opp-landing[data-theme="blue"] {
    --opp-accent: #3b82f6;
    --opp-accent-soft: rgba(59, 130, 246, 0.15);
    --opp-hero-to: #1e3a5f;
}
.opp-landing[data-theme="green"] {
    --opp-accent: #10b981;
    --opp-accent-soft: rgba(16, 185, 129, 0.15);
    --opp-hero-to: #064e3b;
}
.opp-landing[data-theme="purple"] {
    --opp-accent: #8b5cf6;
    --opp-accent-soft: rgba(139, 92, 246, 0.15);
    --opp-hero-to: #4c1d95;
}
.opp-landing[data-theme="amber"] {
    --opp-accent: #f59e0b;
    --opp-accent-soft: rgba(245, 158, 11, 0.15);
    --opp-hero-to: #78350f;
}
.opp-landing[data-theme="rose"] {
    --opp-accent: #f43f5e;
    --opp-accent-soft: rgba(244, 63, 94, 0.15);
    --opp-hero-to: #881337;
}
.opp-landing[data-theme="cyan"] {
    --opp-accent: #06b6d4;
    --opp-accent-soft: rgba(6, 182, 212, 0.15);
    --opp-hero-to: #164e63;
}

/* —— Hero —— */
.opp-hero {
    background: linear-gradient(160deg, var(--opp-hero-from) 0%, var(--opp-hero-to) 50%, #1e293b 100%);
    color: #fff;
    padding: 2.5rem 0 2rem;
    position: relative;
    overflow: hidden;
}

.opp-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 50% at 100% 0%, var(--opp-accent-soft), transparent 60%);
    pointer-events: none;
}

.opp-hero-inner {
    position: relative;
    z-index: 1;
}

.opp-breadcrumb {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: 1.25rem;
}

.opp-breadcrumb a {
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
}

.opp-breadcrumb a:hover {
    color: #fff;
}

.opp-hero-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.opp-hero h1 {
    font-size: clamp(1.65rem, 5vw, 2.5rem);
    font-weight: 900;
    line-height: 1.12;
    margin: 0;
    color: #fff;
}

.opp-hero-lead {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.65;
    margin: 0.85rem 0 1.25rem;
    max-width: 36rem;
}

.opp-hero-actions {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.opp-hero-actions .btn-glow {
    width: 100%;
    justify-content: center;
}

/* Stats: scroll horizontal en móvil */
.opp-stat-grid {
    display: flex;
    gap: 0.65rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0.25rem 0 0.5rem;
    margin: 0 -0.25rem;
}

.opp-stat-grid::-webkit-scrollbar {
    display: none;
}

.opp-stat-card {
    flex: 0 0 min(72%, 200px);
    scroll-snap-align: start;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 0.85rem 1rem;
}

.opp-stat-card .opp-stat-icon {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: 0.3rem;
}

.opp-stat-card strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.3;
    color: #fff;
}

.opp-stat-card span {
    display: block;
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.2rem;
}

/* —— Menú secciones —— */
.opp-page-nav {
    position: sticky;
    top: var(--public-nav-offset, 80px);
    z-index: 40;
    background: #fff;
    border-bottom: 1px solid var(--opp-border);
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.04);
}

.opp-page-nav-inner {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 0.6rem 0;
    -webkit-overflow-scrolling: touch;
    mask-image: linear-gradient(90deg, transparent, #000 8px, #000 calc(100% - 8px), transparent);
}

.opp-page-nav-inner::-webkit-scrollbar {
    display: none;
}

.opp-page-nav-link {
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--opp-text-muted);
    text-decoration: none;
    white-space: nowrap;
    border: 1px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.opp-page-nav-link:hover {
    color: var(--opp-accent);
    background: var(--opp-accent-soft);
}

.opp-page-nav-link.is-active {
    color: #fff;
    background: var(--opp-accent);
    border-color: var(--opp-accent);
}

.opp-nav-short {
    display: none;
}

/* —— Contenido principal —— */
.opp-main {
    background: #f1f5f9;
    padding-bottom: 1rem;
}

.opp-content {
    padding: 1.25rem 0 2.5rem;
    color: var(--opp-text);
}

.opp-block {
    scroll-margin-top: var(--opp-section-scroll);
    margin-bottom: 1.25rem;
}

.opp-block-head {
    margin-bottom: 1rem;
}

.opp-section-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--opp-text);
    margin: 0 0 0.25rem;
    letter-spacing: -0.02em;
}

.opp-section-sub {
    color: var(--opp-text-muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

/* —— Convocatoria —— */
.opp-conv-block {
    margin-bottom: 1.5rem;
}

.opp-conv-card {
    background: var(--opp-surface);
    border: 1px solid var(--opp-border);
    border-radius: 16px;
    padding: 1.15rem 1.2rem;
    box-shadow: 0 2px 16px rgba(15, 23, 42, 0.05);
    border-top: 3px solid #cbd5e1;
}

.opp-conv-card.estado-abierta { border-top-color: #10b981; }
.opp-conv-card.estado-prevista { border-top-color: #f59e0b; }
.opp-conv-card.estado-cerrada { border-top-color: #94a3b8; }
.opp-conv-card.estado-sin_convocatoria { border-top-color: #cbd5e1; }

.opp-conv-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.65rem;
}

.opp-conv-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
}

.opp-conv-badge.estado-abierta { background: #ecfdf5; color: #047857; }
.opp-conv-badge.estado-prevista { background: #fffbeb; color: #b45309; }
.opp-conv-badge.estado-cerrada { background: #f1f5f9; color: #475569; }
.opp-conv-badge.estado-sin_convocatoria { background: #f8fafc; color: #64748b; }

.opp-conv-year {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--opp-text-muted);
    background: var(--opp-surface-muted);
    padding: 0.25rem 0.6rem;
    border-radius: 8px;
}

.opp-conv-card-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--opp-text);
    margin: 0 0 0.5rem;
    line-height: 1.3;
}

.opp-conv-card-notes {
    font-size: 0.9rem;
    color: var(--opp-text-muted);
    line-height: 1.6;
    margin: 0 0 0.75rem;
}

.opp-conv-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.opp-conv-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #334155;
    background: var(--opp-surface-muted);
    border: 1px solid var(--opp-border);
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
}

.opp-conv-chip i {
    color: var(--opp-accent);
    font-size: 0.78rem;
}

.opp-conv-card-foot {
    border-top: 1px solid var(--opp-border);
    padding-top: 0.85rem;
    margin-top: 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.opp-conv-dates-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
}

.opp-conv-date-box {
    background: var(--opp-surface-muted);
    border: 1px solid var(--opp-border);
    border-radius: 10px;
    padding: 0.55rem 0.7rem;
}

.opp-conv-date-label {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    font-weight: 700;
    margin-bottom: 0.15rem;
}

.opp-conv-date-box strong {
    font-size: 0.88rem;
    color: #334155;
}

.opp-conv-link-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.7rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--opp-accent);
    background: var(--opp-accent-soft);
    border: 1px solid color-mix(in srgb, var(--opp-accent) 25%, transparent);
    text-decoration: none;
    transition: background 0.15s;
}

.opp-conv-link-btn:hover {
    background: color-mix(in srgb, var(--opp-accent) 18%, #fff);
    color: var(--opp-accent);
}

/* —— Sobre / requisitos —— */
.opp-about-panel {
    background: var(--opp-surface);
    border: 1px solid var(--opp-border);
    border-radius: 16px;
    padding: 1.25rem 1.2rem;
    box-shadow: 0 2px 16px rgba(15, 23, 42, 0.04);
}

.opp-about-panel .text-secondary {
    color: #475569 !important;
    font-size: 0.95rem;
    line-height: 1.75;
}

.opp-exam-timeline {
    margin: 0;
    padding: 0;
}

.opp-exam-step {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.85rem;
    background: var(--opp-surface-muted);
    border: 1px solid var(--opp-border);
    border-radius: 12px;
    margin-bottom: 0.5rem;
}

.opp-exam-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--opp-accent);
    color: #fff;
    font-weight: 800;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.opp-exam-text {
    color: #334155;
    font-weight: 500;
    line-height: 1.5;
    font-size: 0.9rem;
}

.opp-req-card {
    background: var(--opp-surface-muted);
    border: 1px solid var(--opp-border);
    border-radius: 14px;
    padding: 1.15rem;
    margin-top: 1.25rem;
}

.opp-req-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.opp-req-card li {
    display: flex;
    gap: 0.6rem;
    padding: 0.45rem 0;
    font-size: 0.9rem;
    color: #334155;
    border-bottom: 1px solid #e2e8f0;
}

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

.opp-req-card li i {
    color: var(--opp-accent);
    margin-top: 0.2rem;
    flex-shrink: 0;
}

/* —— Tests —— */
.opp-tests-section {
    padding-top: 0.25rem;
}

.opp-tests-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.opp-tests-count {
    align-self: flex-start;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--opp-accent);
    background: var(--opp-accent-soft);
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
}

.opp-tests-toolbar {
    margin-bottom: 1rem;
}

.opp-tests-search {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 1rem;
    background: var(--opp-surface);
    border: 1px solid var(--opp-border);
    border-radius: 12px;
    margin: 0;
}

.opp-tests-search i {
    color: #94a3b8;
}

.opp-filter-input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 1rem; /* evita zoom en iOS */
    background: transparent;
}

.opp-tests-all-link {
    display: inline-block;
    margin-top: 0.65rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--opp-accent);
    text-decoration: none;
}

.opp-test-col--hidden {
    display: none;
}

.opp-test-card {
    background: var(--opp-surface);
    border: 1px solid var(--opp-border);
    border-radius: 14px;
    padding: 1.1rem 1.15rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

.opp-test-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    margin: 0 0 0.4rem;
    padding-right: 0.5rem;
}

.opp-test-desc {
    font-size: 0.82rem;
    color: var(--opp-text-muted);
    line-height: 1.5;
    margin-bottom: 0.65rem;
}

.opp-test-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.opp-test-chip {
    font-size: 0.72rem;
    font-weight: 600;
    color: #475569;
    background: var(--opp-surface-muted);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
}

.opp-test-card .btn-opp {
    margin-top: auto;
    align-self: stretch;
    justify-content: center;
    background: var(--opp-accent);
    color: #fff;
    padding: 0.6rem 1rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    pointer-events: none;
}

.opp-test-hit {
    z-index: 2;
}

.opp-show-more-btn {
    width: 100%;
    max-width: 320px;
    border-radius: 12px;
    font-weight: 600;
    padding: 0.65rem 1.25rem;
}

/* —— Ventajas y CTA —— */
.opp-why-section {
    background: var(--opp-surface);
    border: 1px solid var(--opp-border);
    border-radius: 16px;
    padding: 1.25rem 1.2rem;
}

.opp-why-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.opp-why-item {
    background: var(--opp-surface-muted);
    border: 1px solid var(--opp-border);
    border-radius: 12px;
    padding: 1rem;
}

.opp-why-item i {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--opp-accent-soft);
    color: var(--opp-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.65rem;
}

.opp-cta {
    background: linear-gradient(135deg, var(--opp-accent), #6366f1);
    border-radius: 16px;
    padding: 2rem 1.25rem;
    text-align: center;
    color: #fff;
    margin-bottom: 0.5rem;
}

.opp-cta h2 {
    font-size: 1.35rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 0.5rem;
}

.opp-cta p {
    font-size: 0.92rem;
    opacity: 0.92;
    margin: 0 auto 1.25rem;
    max-width: 28rem;
}

.opp-cta .btn {
    width: 100%;
    max-width: 280px;
    border-radius: 12px;
    font-weight: 700;
}

.opp-cta .d-flex {
    flex-direction: column;
    align-items: center;
    gap: 0.65rem !important;
}

/* —— CTA móvil fija —— */
.opp-mobile-cta {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: flex;
    gap: 0.5rem;
    padding: 0.6rem 0.85rem calc(0.6rem + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-top: 1px solid var(--opp-border);
    box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.1);
    transform: translateY(100%);
    transition: transform 0.22s ease;
}

.opp-mobile-cta.is-visible {
    transform: translateY(0);
}

.opp-mobile-cta a {
    flex: 1;
    text-align: center;
    padding: 0.75rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
}

.opp-mobile-cta-primary {
    background: var(--opp-accent);
    color: #fff;
}

.opp-mobile-cta-secondary {
    flex: 0 0 auto;
    min-width: 4.5rem;
    background: var(--opp-surface-muted);
    color: var(--opp-text);
    border: 1px solid var(--opp-border);
}

body.page-oposicion-landing:has(.opp-mobile-cta.is-visible) {
    padding-bottom: calc(4.25rem + env(safe-area-inset-bottom, 0px));
}

/* —— Tablet —— */
@media (min-width: 576px) {
    .opp-hero {
        padding: 3rem 0 2.5rem;
    }

    .opp-hero-icon {
        width: 64px;
        height: 64px;
        font-size: 1.6rem;
    }

    .opp-hero-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .opp-hero-actions .btn-glow {
        width: auto;
    }

    .opp-stat-card {
        flex: 0 0 calc(50% - 0.35rem);
    }

    .opp-conv-dates-row {
        max-width: 360px;
    }
}

/* —— Desktop —— */
@media (min-width: 768px) {
    .opp-nav-long {
        display: inline;
    }

    .opp-nav-short {
        display: none;
    }

    .opp-content {
        padding: 1.75rem 0 3rem;
    }

    .opp-block {
        margin-bottom: 2rem;
    }

    .opp-section-title {
        font-size: 1.55rem;
    }

    .opp-stat-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        overflow: visible;
        padding: 0;
        margin: 0;
    }

    .opp-stat-card {
        flex: unset;
    }

    .opp-stat-card strong {
        font-size: 1.1rem;
    }

    .opp-conv-card {
        padding: 1.35rem 1.5rem;
    }

    .opp-conv-card-title {
        font-size: 1.25rem;
    }

    .opp-about-panel {
        padding: 1.75rem 1.5rem;
    }

    .opp-req-card {
        margin-top: 0;
        position: sticky;
        top: calc(var(--public-nav-offset, 80px) + 3.5rem);
    }

    .opp-tests-header {
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
    }

    .opp-tests-toolbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
    }

    .opp-tests-search {
        flex: 1;
        max-width: 400px;
    }

    .opp-tests-all-link {
        margin-top: 0;
    }

    .opp-test-card:hover {
        box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
        transform: translateY(-2px);
    }

    .opp-why-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }

    .opp-cta {
        padding: 2.5rem 2rem;
    }

    .opp-cta h2 {
        font-size: 1.65rem;
    }

    .opp-cta .btn {
        width: auto;
    }

    .opp-cta .d-flex {
        flex-direction: row;
        justify-content: center;
    }

    .opp-mobile-cta {
        display: none !important;
    }
}

@media (max-width: 767px) {
    .opp-nav-long {
        display: none;
    }

    .opp-nav-short {
        display: inline;
    }
}

@media (prefers-reduced-motion: reduce) {
    .opp-test-card,
    .opp-mobile-cta,
    .opp-page-nav-link {
        transition: none;
    }
}
