/**
 * Hub-/undersider (index2 teori, index3 programmer)
 */

body.portal-hub,
body.portal-hub * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.portal-hub {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f4c5c, #2a9d8f);
    color: white;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: max(16px, env(safe-area-inset-top)) 16px 16px;
    overflow-x: hidden;
}

body.portal-hub--theory {
    background: linear-gradient(135deg, rgba(155, 126, 32, 0.92), rgba(125, 102, 26, 0.92));
}

body.portal-hub .container {
    max-width: 1100px;
    width: 100%;
    text-align: center;
}

body.portal-hub .header {
    margin-bottom: 28px;
    animation: hubFadeIn 1s ease;
    position: relative;
}

body.portal-hub .header:has(.theme-toggle--header) {
    padding-right: 5.5rem;
}

body.portal-hub .logo {
    font-size: clamp(2.2rem, 8vw, 3rem);
    margin-bottom: 12px;
    color: white;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

body.portal-hub h1 {
    font-size: clamp(1.5rem, 5vw, 2.2rem);
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    line-height: 1.2;
}

body.portal-hub .subtitle {
    font-size: clamp(0.95rem, 2.5vw, 1.1rem);
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.5;
    padding: 0 4px;
}

body.portal-hub .info-box,
body.portal-hub--theory .instructions {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 18px;
    margin-bottom: 24px;
    border-left: 4px solid rgba(255, 255, 255, 0.3);
    text-align: left;
}

body.portal-hub .info-box h3,
body.portal-hub--theory .instructions h3 {
    font-size: 1.15rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

body.portal-hub .info-box p,
body.portal-hub--theory .instructions p {
    font-size: 0.95rem;
    line-height: 1.5;
    opacity: 0.9;
    text-align: center;
}

body.portal-hub--theory .instructions a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

body.portal-hub--theory .instructions a:hover {
    opacity: 1;
}

/* Ens knap-størrelse i grid */
body.portal-hub .button-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 28px;
    align-items: stretch;
    width: 100%;
}

body.portal-hub .nav-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 18px;
    padding: 22px 18px;
    text-decoration: none;
    color: white;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    height: 100%;
    min-height: 220px;
    -webkit-tap-highlight-color: transparent;
    animation: hubFadeIn 0.8s ease backwards;
}

body.portal-hub .nav-button:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-4px);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
}

body.portal-hub .nav-button:active {
    transform: translateY(-2px);
}

body.portal-hub .button-icon {
    font-size: 2.4rem;
    margin-bottom: 12px;
    color: white;
    flex-shrink: 0;
}

body.portal-hub .button-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.25;
    flex-shrink: 0;
}

body.portal-hub .button-description {
    font-size: 0.88rem;
    opacity: 0.9;
    line-height: 1.45;
    margin-bottom: 12px;
    flex: 1 1 auto;
    width: 100%;
    max-width: 320px;
}

body.portal-hub .feature-tag {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: auto;
    margin-bottom: 8px;
    flex-shrink: 0;
}

body.portal-hub .feature-tag span {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: bold;
}

body.portal-hub .badge {
    display: inline-block;
    background-color: rgba(255, 255, 255, 0.3);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: bold;
    margin-top: auto;
    flex-shrink: 0;
    max-width: 100%;
    line-height: 1.3;
}

body.portal-hub .badge-feature {
    background-color: rgba(255, 193, 7, 0.35);
    border: 1px solid rgba(255, 193, 7, 0.5);
}

body.portal-hub .hot-badge {
    background-color: rgba(255, 215, 0, 0.9);
    color: #333;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Gradienter */
body.portal-hub .button-marathon {
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.85), rgba(52, 152, 219, 0.85));
}
body.portal-hub .button-halfmarathon {
    background: linear-gradient(135deg, rgba(230, 126, 34, 0.85), rgba(241, 196, 15, 0.85));
}
body.portal-hub .button-10k {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.85), rgba(192, 57, 43, 0.85));
}
body.portal-hub .button-5k {
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.85), rgba(22, 160, 133, 0.85));
}
body.portal-hub .button-1 {
    background: linear-gradient(135deg, rgba(44, 62, 80, 0.85), rgba(52, 152, 219, 0.85));
}
body.portal-hub .button-2 {
    background: linear-gradient(135deg, rgba(192, 57, 43, 0.85), rgba(155, 89, 182, 0.85));
}
body.portal-hub .button-3 {
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.85), rgba(241, 196, 15, 0.85));
}
body.portal-hub .button-4 {
    background: linear-gradient(135deg, rgba(230, 126, 34, 0.85), rgba(142, 68, 173, 0.85));
}
body.portal-hub .button-5 {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.85), rgba(243, 156, 18, 0.85));
}
body.portal-hub .button-6 {
    background: linear-gradient(135deg, rgba(191, 111, 0, 0.9), rgba(255, 140, 0, 0.9));
}
body.portal-hub .button-7 {
    background: linear-gradient(135deg, rgba(22, 78, 99, 0.9), rgba(14, 116, 144, 0.9));
}
body.portal-hub .button-8 {
    background: linear-gradient(135deg, rgba(127, 29, 29, 0.9), rgba(185, 28, 28, 0.9));
}
body.portal-hub .button-9 {
    background: linear-gradient(135deg, rgba(67, 56, 202, 0.9), rgba(37, 99, 235, 0.9));
}
body.portal-hub .button-10 {
    background: linear-gradient(135deg, rgba(8, 145, 178, 0.9), rgba(14, 165, 233, 0.9));
}
body.portal-hub .button-11 {
    background: linear-gradient(135deg, rgba(101, 67, 33, 0.9), rgba(180, 130, 70, 0.9));
}

body.portal-hub .back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    color: white;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.2);
    padding: 12px 22px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 600;
    min-height: 44px;
    transition: background 0.2s ease, transform 0.2s ease;
}

body.portal-hub .back-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

body.portal-hub .footer {
    margin-top: 32px;
    padding-top: 20px;
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.9rem;
    opacity: 0.85;
    text-align: center;
}

@keyframes hubFadeIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body.portal-hub .nav-button:nth-child(1) { animation-delay: 0.05s; }
body.portal-hub .nav-button:nth-child(2) { animation-delay: 0.1s; }
body.portal-hub .nav-button:nth-child(3) { animation-delay: 0.15s; }
body.portal-hub .nav-button:nth-child(4) { animation-delay: 0.2s; }
body.portal-hub .nav-button:nth-child(5) { animation-delay: 0.25s; }
body.portal-hub .nav-button:nth-child(6) { animation-delay: 0.3s; }
body.portal-hub .nav-button:nth-child(7) { animation-delay: 0.35s; }
body.portal-hub .nav-button:nth-child(8) { animation-delay: 0.4s; }
body.portal-hub .nav-button:nth-child(9) { animation-delay: 0.45s; }
body.portal-hub .nav-button:nth-child(10) { animation-delay: 0.5s; }

/* Tablet: 2 ens kolonner */
@media (min-width: 600px) {
    body.portal-hub .button-container {
        grid-template-columns: repeat(2, 1fr);
    }

    body.portal-hub .nav-button {
        min-height: 240px;
    }
}

/* Desktop: 3 kolonner (teori) eller 2 (programmer med lange tekster) */
@media (min-width: 900px) {
    body.portal-hub .button-container {
        grid-template-columns: repeat(2, 1fr);
    }

    body.portal-hub--theory .button-container {
        grid-template-columns: repeat(3, 1fr);
    }

    body.portal-hub .nav-button {
        min-height: 260px;
        padding: 26px 20px;
    }
}

@media (min-width: 1100px) {
    body.portal-hub:not(.portal-hub--theory) .button-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 599px) {
    body.portal-hub .nav-button {
        min-height: 200px;
    }

    body.portal-hub .nav-button:hover {
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.portal-hub .nav-button,
    body.portal-hub .header {
        animation: none;
    }

    body.portal-hub .nav-button:hover {
        transform: none;
    }
}
