/* =========================================
   One Portal • site.css (modernized)
   - Theme variables (light/dark)
   - Responsive grid & cards
   - Glassy navbar
   - Accessible focus/skip link
   - Welcome overlay w/ 5s icon solo
   ========================================= */

:root {
    color-scheme: light dark;
    --bg: #0b0d10;
    --card: #12161b;
    --muted: #9aa4b2;
    --text: #e6edf3;
    --accent: #6aa3ff;
    --accent2: #7de3b2;
    --ring: #c6d3f8;
    --shadow: 0 10px 30px rgba(0,0,0,.35);
    --radius: 18px;
    --nav-bg: rgba(18, 22, 27, .6);
    --nav-stroke: 1px solid rgba(255,255,255,.10);
    --nav-text: #e6edf3;
    --nav-muted: #9aa4b2;
    --nav-accent: #6aa3ff;
    --brand-grad-a: #6aa3ff;
    --brand-grad-b: #7de3b2;
    --shadow-lg: 0 12px 40px rgba(0,0,0,.28);
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #f7f9fc;
        --card: #ffffff;
        --muted: #5b6573;
        --text: #0b0d10;
        --accent: #3b82f6;
        --accent2: #10b981;
        --ring: #1f2937;
        --shadow: 0 8px 22px rgba(2,8,23,.08);
        --nav-bg: rgba(255,255,255,.72);
        --nav-stroke: 1px solid rgba(2, 8, 23, .06);
        --nav-text: #0b0d10;
        --nav-muted: #5b6573;
        --nav-accent: #3b82f6;
        --shadow-lg: 0 10px 28px rgba(2,8,23,.08);
    }
}

html, body {
    height: 100%
}

body {
    background: linear-gradient(135deg, #f0fff4, #eafdf1 28%, #d9fbe8);
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
}

a {
    text-decoration: none;
    color: inherit
}

/* Skip link for keyboard users */
.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

    .skip-link:focus {
        left: 16px;
        top: 16px;
        width: auto;
        height: auto;
        background: #111;
        color: #fff;
        padding: .5rem .75rem;
        border-radius: .5rem;
        outline: 3px solid var(--ring);
    }

:focus-visible {
    outline: 3px solid var(--ring);
    outline-offset: 2px;
}

::selection {
    background: rgba(106,163,255,.35);
    color: var(--text);
}

/* Layout */
.wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

footer {
    color: var(--muted);
    font-size: .95rem;
    text-align: center;
    padding: 28px 0;
}

header + .hero {
    margin-top: 12px
}

/* Navbar (glassy) */
.portal-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    backdrop-filter: saturate(140%) blur(10px);
}

.portal-navbar {
    background: var(--nav-bg);
    border-bottom: var(--nav-stroke);
    box-shadow: var(--shadow-lg);
}

    .portal-navbar .navbar-brand {
        color: var(--nav-text);
        font-weight: 800;
        letter-spacing: .2px;
    }

        .portal-navbar .navbar-brand:hover {
            color: var(--nav-text);
            opacity: .95;
        }

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--brand-grad-a), var(--brand-grad-b));
    color: #0b0d10;
    font-weight: 900;
    font-size: .95rem;
    box-shadow: 0 8px 22px rgba(0,0,0,.22);
}

.portal-navbar .nav-link {
    color: var(--nav-muted);
    font-weight: 600;
    padding: .6rem .9rem;
    border-radius: 10px;
    transition: color .15s ease, background-color .15s ease, transform .08s ease;
}

    .portal-navbar .nav-link:hover {
        color: var(--nav-text);
        background: rgba(106,163,255,.10);
    }

    .portal-navbar .nav-link.active, .portal-navbar .nav-link[aria-current="page"] {
        color: var(--nav-text);
        background: rgba(106,163,255,.18);
    }

.portal-navbar .navbar-toggler {
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 10px;
    padding: .35rem .6rem;
}

@media (prefers-color-scheme: light) {
    .portal-navbar .navbar-toggler {
        border-color: rgba(2,8,23,.18);
    }
}

.portal-navbar .navbar-toggler:focus {
    box-shadow: 0 0 0 .2rem rgba(106,163,255,.35);
}

.portal-navbar .navbar-toggler-icon {
    filter: invert(1) grayscale(100%);
}

@media (prefers-color-scheme: light) {
    .portal-navbar .navbar-toggler-icon {
        filter: none;
    }
}

.navbar-brand {
    font-weight: 800
}

/* Hero */
.hero {
    text-align: center;
    padding: 56px 0 24px;
}

    .hero h1 {
        font-size: clamp(1.8rem, 2.2rem + 1vw, 3rem);
        line-height: 1.1;
        margin: 0 0 12px;
    }

    .hero p {
        margin: 0 auto;
        max-width: 60ch;
        color: var(--muted);
        font-size: clamp(.98rem, .9rem + .3vw, 1.05rem);
    }

/* Grid */
.grid {
    display: grid;
    gap: 18px;
    margin: 28px 0 12px;
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 640px) {
    .grid {
        grid-template-columns: repeat(2, minmax(0,1fr));
    }
}

@media (min-width: 992px) {
    .grid {
        grid-template-columns: repeat(3, minmax(0,1fr));
    }
}

/* Cards */
.card {
    position: relative;
    background: var(--card);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: .65rem;
    min-height: 160px;
    isolation: isolate;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.06);
    transition: transform .12s ease, box-shadow .2s ease, border-color .2s ease;
}

    .card:hover {
        transform: translateY(-2px);
        border-color: rgba(255,255,255,.18);
    }

    .card:focus-within {
        outline: 3px solid var(--ring);
        outline-offset: 3px;
    }

.badge {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .8rem;
    font-weight: 700;
    color: var(--muted);
}

.card h3 {
    margin: 2px 0 0;
    font-size: 1.18rem;
}

.card p {
    margin: 0;
    color: var(--muted);
}

.go {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-weight: 800;
    letter-spacing: .2px;
    background: rgba(106,163,255,.12);
    padding: .55rem .8rem;
    border-radius: 12px;
}

    .go svg {
        transition: transform .15s ease;
    }

.card:hover .go svg {
    transform: translateX(4px);
}

.compact .grid {
    gap: 12px;
}

.compact .card {
    padding: 18px;
    min-height: 140px;
}

.card img {
    border-radius: 12px;
    max-width: 100%;
    height: auto;
    box-shadow: 0 8px 18px rgba(0,0,0,.18);
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

/* Contrast */
@media (prefers-contrast: more) {
    .card, .portal-navbar {
        border: 1px solid rgba(255,255,255,.3);
    }

        .portal-navbar .nav-link:hover {
            background: rgba(106,163,255,.25);
        }
}

/* Scrollbars */
@supports selector(::-webkit-scrollbar) {
    ::-webkit-scrollbar {
        width: 10px;
        height: 10px;
    }

    ::-webkit-scrollbar-track {
        background: transparent;
    }

    ::-webkit-scrollbar-thumb {
        background: rgba(255,255,255,.18);
        border-radius: 10px;
    }

        ::-webkit-scrollbar-thumb:hover {
            background: rgba(255,255,255,.28);
        }
}

/* Print */
@media print {
    body {
        background: #fff;
        color: #000;
    }

    .portal-header, .hero, footer {
        display: none !important;
    }

    .card {
        box-shadow: none;
        border: 1px solid #bbb;
    }
}

.card .badge.year {
    display: inline-block;
    font-size: 1.2rem;
    font-weight: 600;
    color: #2563eb;
    border: 1px solid #bfdbfe;
    background: transparent;
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
}

.card h3 {
    font-size: 1.2rem;
    margin: 0;
}

/* ============================================================
   Welcome Blur Overlay (accessible, dismissible, modern)
   ============================================================ */

#welcome-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.15);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
    backdrop-filter: blur(10px) saturate(120%);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
}

    #welcome-overlay.is-visible {
        opacity: 1;
        pointer-events: auto;
        visibility: visible;
        animation: overlayLife 10s ease forwards;
    }

    /* Card */
    #welcome-overlay .welcome-card {
        --grad-a: var(--brand-grad-a, #6aa3ff);
        --grad-b: var(--brand-grad-b, #7de3b2);
        background: linear-gradient(135deg, var(--grad-a), var(--grad-b));
        color: #fff;
        border-radius: 16px;
        padding: 1.2rem 1.6rem 1.3rem;
        box-shadow: var(--shadow-lg);
        text-align: center;
        min-width: min(92vw, 640px);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        transform: translateY(10px) scale(.98);
        opacity: 0;
        animation: cardIn 10s cubic-bezier(.22,.75,.25,1) forwards;
    }

/* Skip button */
.welcome-skip {
    align-self: flex-end;
    margin-bottom: .25rem;
    background: rgba(255,255,255,.18);
    color: #fff;
    border: 0;
    border-radius: 10px;
    padding: .35rem .6rem;
    font-weight: 700;
    cursor: pointer;
}

    .welcome-skip:hover {
        background: rgba(255,255,255,.25);
    }

    .welcome-skip:focus-visible {
        outline: 3px solid #fff;
        outline-offset: 2px;
    }

/* Title */
.welcome-title {
    font-weight: 800;
    font-size: clamp(1.15rem, 1rem + 1vw, 1.6rem);
    margin: .25rem 0 .35rem;
    opacity: 0;
    transform: translateY(-16px);
    animation: dropText 2.3s ease forwards;
    animation-delay: 5.1s;
}

/* Icon (5s solo) */
.welcome-icon {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: .6rem 0 .7rem;
    opacity: 0;
    transform: translateY(-18px) scale(.95);
    animation: iconSolo 5s ease forwards;
    animation-delay: .05s;
}

/* Slogan */
.welcome-slogan {
    font-weight: 700;
    letter-spacing: .2px;
    display: inline-flex;
    flex-direction: column;
    gap: .15rem;
    font-size: clamp(1.15rem, 1.05rem + .9vw, 1.8rem);
    line-height: 1.15;
    margin-top: .2rem;
}

    .welcome-slogan .line {
        display: inline-block;
        opacity: 0;
        transform: translateY(-18px);
        animation: dropText 2.3s ease forwards;
    }

    .welcome-slogan .line-1 {
        animation-delay: 5.1s;
    }

    .welcome-slogan .line-2 {
        animation-delay: 5.3s;
    }

/* SVG styling */
.sys-svg {
    display: block;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,.25));
}

    .sys-svg .link {
        stroke: #fff;
        stroke-width: 3;
        stroke-linecap: round;
        stroke-dasharray: 28;
        stroke-dashoffset: 28;
        animation: drawLine 1.8s ease forwards;
    }

    .sys-svg .link-1 {
        animation-delay: .25s;
    }

    .sys-svg .link-2 {
        animation-delay: .45s;
    }

    .sys-svg .link-3 {
        animation-delay: .65s;
    }

    .sys-svg .link-4 {
        animation-delay: .85s;
    }

    .sys-svg .node {
        fill: #fff;
        transform-origin: center;
        opacity: 0;
        transform: scale(.6);
        animation: nodePop 0.8s cubic-bezier(.2,.8,.2,1) forwards;
    }

    .sys-svg .node-center {
        animation-delay: 1.2s;
    }

    .sys-svg .node-1 {
        animation-delay: 1.5s;
    }

    .sys-svg .node-2 {
        animation-delay: 1.7s;
    }

    .sys-svg .node-3 {
        animation-delay: 1.9s;
    }

    .sys-svg .node-4 {
        animation-delay: 2.1s;
    }

    .sys-svg .node-center {
        animation: nodePop 0.8s cubic-bezier(.2,.8,.2,1) forwards, nodePulse 1.6s ease 2.4s 1;
    }

/* Overlay lifecycle */
@keyframes overlayLife {
    0% {
        opacity: 1;
    }

    88% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }
}

/* Card presence throughout */
@keyframes cardIn {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(.98);
    }

    12% {
        opacity: 1;
        transform: translateY(0) scale(1.02);
    }

    88% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Text */
@keyframes dropText {
    0% {
        opacity: 0;
        transform: translateY(-18px);
    }

    22% {
        opacity: 1;
        transform: translateY(0);
    }

    72% {
        opacity: 1;
        transform: translateY(0);
    }

    100% {
        opacity: 0;
        transform: translateY(14px);
    }
}

/* Icon solo */
@keyframes iconSolo {
    0% {
        opacity: 0;
        transform: translateY(-18px) scale(.95);
    }

    12% {
        opacity: 1;
        transform: translateY(0) scale(1.04);
    }
    /* arrive */
    75% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    /* hold */
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    /* stay visible */
}

/* SVG helpers */
@keyframes drawLine {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes nodePop {
    0% {
        opacity: 0;
        transform: scale(.6);
    }

    60% {
        opacity: 1;
        transform: scale(1.12);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes nodePulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.12);
    }

    100% {
        transform: scale(1);
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    #welcome-overlay.is-visible {
        animation: none !important;
    }

    #welcome-overlay .welcome-card,
    .welcome-title, .welcome-icon, .welcome-slogan .line,
    .sys-svg .link, .sys-svg .node {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
        stroke-dasharray: none !important;
        stroke-dashoffset: 0 !important;
    }
}
