* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --background: #f4f7fb;
    --text-primary: #151a22;
    --text-secondary: #091d45;
    --card-background: rgba(255, 255, 255, 0.90);
    --border: rgba(255, 255, 255, 0.8);
    --shadow: 0 15px 40px rgba(15, 23, 42, 0.12);
    --shadow-hover: 0 30px 70px rgba(15, 23, 42, 0.22);
    --transition: all 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

body {
    min-height: 100vh;

    font-family:
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;

    color: var(--text-primary);

    /* Imagen de fondo */
    background-image:
        linear-gradient(
            rgba(255, 255, 255, 0.474),
            rgb(255, 255, 255)
        ),
        url("../img/fondo.jpeg");

    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;

    overflow-x: hidden;
}

.background-animation {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.background-animation span {
    position: absolute;
    display: block;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    filter: blur(2px);
    animation: floating 18s infinite ease-in-out;
}

.background-animation span:nth-child(1) { top: 10%; left: 5%; animation-delay: 0s; }
.background-animation span:nth-child(2) { top: 60%; left: 80%; width: 300px; height: 300px; animation-delay: 3s; }
.background-animation span:nth-child(3) { top: 70%; left: 20%; width: 150px; height: 150px; animation-delay: 5s; }
.background-animation span:nth-child(4) { top: 5%; left: 70%; width: 120px; height: 120px; animation-delay: 7s; }
.background-animation span:nth-child(5) { top: 40%; left: 45%; width: 100px; height: 100px; animation-delay: 2s; }

@keyframes floating {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(40px, -50px) scale(1.15); }
}

.portal-container {
    position: relative;
    z-index: 1;
    width: min(1200px, 92%);
    min-height: 100vh;
    margin: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 0;
}

.portal-header {
    text-align: center;
    margin-bottom: 55px;
    animation: fadeDown 0.9s ease forwards;
}

.portal-icon {
    width: 65px;
    height: 65px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    color: white;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.30);
    font-size: 28px;
}

.portal-header h1 {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 15px;
}

.portal-header p {
    max-width: 650px;
    margin: auto;
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.7;
}

.portal-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.portal-card {
    position: relative;
    min-height: 400px;
    padding: 35px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    text-align: center;
    text-decoration: none;
    color: var(--text-primary);
    background: var(--card-background);
    border: 1px solid var(--border);
    border-radius: 30px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    overflow: hidden;
    transition: var(--transition);
    animation: cardAppear 0.8s ease forwards;
    opacity: 0;
}

.portal-card:nth-child(1) { animation-delay: 0.15s; }
.portal-card:nth-child(2) { animation-delay: 0.30s; }
.portal-card:nth-child(3) { animation-delay: 0.45s; }

.portal-card:hover {
    transform: translateY(-15px);
    box-shadow: var(--shadow-hover);
    color: var(--text-primary);
}

.card-glow {
    position: absolute;
    width: 180px;
    height: 180px;
    top: -80px;
    right: -80px;
    border-radius: 50%;
    background: rgba(17, 88, 202, 0.633);
    transition: var(--transition);
}

.portal-card:hover .card-glow {
    transform: scale(2.5);
    opacity: 0.8;
}

.logo-container {
    position: relative;
    width: 290px;
    height: 290px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.75);
    transition: var(--transition);
}

.portal-card:hover .logo-container {
    transform: scale(1.08) rotate(2deg);
    box-shadow: 0 15px 35px rgba(15, 23, 42, 0.15);
}

.service-logo {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
    transition: var(--transition);
}

.portal-card:hover .service-logo {
    transform: scale(1.10);
}

.card-content {
    position: relative;
    z-index: 2;
    width: 100%;
}

.card-content h2 {
    margin-top: 25px;
    margin-bottom: 10px;
    font-size: 1.4rem;
    font-weight: 700;
}

.card-content p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.access-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #334155;
    background: #f1f5f9;
    transition: var(--transition);
}

.access-button i {
    transition: transform 0.3s ease;
}

.portal-card:hover .access-button {
    color: white;
    background: #2563eb;
}

.portal-card:hover .access-button i {
    transform: translateX(5px);
}

.portal-footer {
    text-align: center;
    margin-top: 50px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

@keyframes fadeDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes cardAppear {
    from { opacity: 0; transform: translateY(40px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 992px) {
    .portal-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 650px) {
    .portal-container { padding: 40px 0; }
    .portal-header { margin-bottom: 35px; }
    .portal-grid {
        grid-template-columns: 1fr;
        gap: 22px;
    }
    .portal-card { min-height: 360px; }
    .logo-container {
        width: 160px;
        height: 160px;
    }
}

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