/* ─── Auto Theme (Time-Based Dark / Light Mode) ──────────
   Dark  : 18:00 – 05:59  → [data-theme="dark"]  on <body>
   Light : 06:00 – 17:59  → [data-theme="light"] on <body>
────────────────────────────────────────────────────────── */

/* Light Mode Variables */
body[data-theme="light"] {
    --portal-bg:            #e8f4fd;
    --portal-overlay:       rgba(0, 30, 80, 0.38);
    --portal-title-bg:      var(--color-primary-700);
    --portal-subtitle-bg:   var(--color-primary-600);
    --portal-label-color:   #fff;
    --portal-label-shadow:  0 1px 4px rgba(0, 0, 0, 0.45);
    --portal-icon-bg:       rgba(255, 255, 255, 0.92);
    --portal-icon-hover-bg: #ffffff;
    --portal-footer-bg:     var(--color-primary-700);
    --portal-footer-color:  #e0eaff;
    --portal-indicator-color: #f59e0b;
    --portal-indicator-label: "☀️ Mode Siang";
}

/* Dark Mode Variables */
body[data-theme="dark"] {
    --portal-bg:            #050d1a;
    --portal-overlay:       rgba(0, 5, 20, 0.72);
    --portal-title-bg:      rgba(10, 20, 60, 0.85);
    --portal-subtitle-bg:   rgba(20, 40, 100, 0.75);
    --portal-label-color:   #c7dfff;
    --portal-label-shadow:  0 1px 8px rgba(0, 0, 0, 0.85);
    --portal-icon-bg:       rgba(15, 30, 70, 0.80);
    --portal-icon-hover-bg: rgba(30, 60, 120, 0.95);
    --portal-footer-bg:     rgba(5, 10, 35, 0.95);
    --portal-footer-color:  #8fb8e8;
    --portal-indicator-color: #60a5fa;
    --portal-indicator-label: "🌙 Mode Malam";
}

/* ─── Theme Transition ───────────────────────────────── */
body {
    transition: background 0.8s ease, color 0.8s ease;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
}

body {
    font-family: 'Inter', sans-serif;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--portal-bg, var(--color-slate-900));
    overflow-x: hidden;
}

/* ─── Hero ─────────────────────────────────────────────── */
.portal-hero {
    position: relative;
    flex: 1 0 auto;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    /* Removed overflow: hidden to allow dropdowns to show over footer */
}

.portal-hero-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    z-index: 0;
}

.portal-hero-overlay {
    display: none;
}

.portal-content {
    position: relative;
    z-index: 20;
    display: flex;
    gap: 40px;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 820px;
}

/* Top logo — transparan, tanpa background */
.portal-top-logo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: -15px;
    filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.45));
}

.portal-top-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Judul & subtitle pills */
.portal-title {
    background: var(--portal-title-bg, var(--color-primary-700));
    color: var(--color-white);
    font-size: clamp(1.05rem, 3vw, 1.45rem);
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 12px 36px;
    border-radius: 50px;
    text-align: center;
    transition: background 0.8s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.portal-subtitle {
    background: var(--portal-subtitle-bg, var(--color-primary-600));
    color: var(--color-slate-100);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    padding: 7px 28px;
    border-radius: 50px;
    text-align: center;
    transition: background 0.8s ease;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* Icon grid */
.portal-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px 16px;
    width: 100%;
    max-width: 960px;
    margin-bottom: 0;
    position: relative;
}

/* Grid variants */
.portal-grid-main {
    gap: 22px 18px;
    margin-top: 4px;
}

.portal-grid-quick {
    gap: 14px 14px;
    margin-top: -4px; /* rapatkan ke Menu Utama */
}

.portal-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    cursor: pointer;
    position: relative;
    transition: z-index 0.3s;
    width: 140px;
}

.portal-item--main {
    width: 190px;
}

.portal-item--main .portal-icon-wrap {
    width: 112px;
    height: 112px;
    border-radius: 28px;
    padding: 10px;
}

.portal-item--main .portal-item-label {
    font-size: 0.95rem;
    letter-spacing: 0.04em;
}

.portal-item--quick {
    width: 120px;
}

.portal-item--quick .portal-icon-wrap {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    padding: 8px;
}

.portal-item--quick .portal-icon-wrap i {
    font-size: 2.1rem;
}

.portal-item--quick .portal-item-label {
    font-size: 0.78rem;
}

.portal-item.active {
    z-index: 1000;
}

.portal-icon-wrap {
    width: 88px;
    height: 88px;
    border-radius: 22px;
    background: var(--portal-icon-bg, rgba(255, 255, 255, 0.92));
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.22s ease, background 0.5s ease, box-shadow 0.22s ease;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    padding: 8px;
}

.portal-icon-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.portal-icon-wrap i {
    font-size: 2.6rem;
    color: var(--color-primary-700);
}

.portal-item:hover .portal-icon-wrap,
.portal-item.active .portal-icon-wrap {
    background: var(--portal-icon-hover-bg, var(--color-white));
    transform: translateY(-5px);
    box-shadow: 0 8px 28px color-mix(in srgb, var(--color-primary-700) 35%, transparent);
}

.portal-item-label {
    color: var(--portal-label-color, #fff);
    font-size: 0.82rem;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.3;
    text-shadow: var(--portal-label-shadow, 0 1px 4px rgba(0, 0, 0, 0.5));
    transition: color 0.8s ease;
}

/* Dark Mode: warna ikon lebih terang */
body[data-theme="dark"] .portal-icon-wrap i {
    color: #60a5fa;
}

body[data-theme="dark"] .portal-item:hover .portal-icon-wrap i,
body[data-theme="dark"] .portal-item.active .portal-icon-wrap i {
    color: #93c5fd;
}

/* ─── Dropdown Speech Box ─────────────────────────────── */
.portal-dropdown {
    position: absolute;
    top: calc(100% + 20px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    width: 280px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    display: none;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    cursor: default;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 10001;
}

.portal-item.active .portal-dropdown {
    display: block;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* Arrow (Speech Box) */
.portal-dropdown::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 12px solid var(--color-primary-700);
}

.portal-dropdown-header {
    background: var(--color-primary-700);
    color: #fff;
    padding: 14px 20px;
    border-radius: 16px 16px 0 0;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.portal-dropdown-header-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex-shrink: 0;
}

.portal-dropdown-list {
    list-style: none;
    padding: 8px 0;
    margin: 0;
    max-height: 320px;
    overflow-y: auto;
}

.portal-dropdown-list li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--color-slate-700);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    border-bottom: 1px solid var(--color-slate-100);
}

.portal-dropdown-list li:last-child a {
    border-bottom: none;
}

.portal-dropdown-list li a:hover {
    background: var(--color-slate-50);
    color: var(--color-primary-700);
    padding-left: 28px;
}

.portal-dropdown-list li a i {
    font-size: 0.75rem;
    color: var(--color-primary-600);
}

.portal-dropdown-empty {
    padding: 20px;
    color: var(--color-slate-400);
    font-style: italic;
    text-align: center;
    display: block;
}

/* Tombol beranda */
.portal-btn {
    display: inline-block;
    background: var(--color-primary-600);
    color: var(--color-white);
    font-size: 1rem;
    font-weight: 600;
    padding: 14px 48px;
    border-radius: 50px;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
    box-shadow: 0 4px 18px color-mix(in srgb, var(--color-primary-600) 40%, transparent);
}

.portal-btn:hover {
    background: var(--color-primary-700);
    transform: translateY(-2px);
    color: var(--color-white);
}

/* ─── Footer ───────────────────────────────────────────── */
.portal-footer {
    background: var(--portal-footer-bg, var(--color-primary-700));
    color: var(--portal-footer-color, #e0eaff);
    text-align: center;
    padding: 28px 20px;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
    transition: background 0.8s ease, color 0.8s ease;
}

.portal-footer-title {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
    color: var(--color-white);
}

.portal-footer-contact {
    font-size: 0.9rem;
    margin-bottom: 12px;
    color: rgba(255, 255, 255, 0.85);
}

.portal-footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.portal-footer-socials {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
}

.portal-footer-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1.5px solid rgba(255, 255, 255, 0.45);
    border-radius: 50px;
    padding: 6px 16px;
    font-size: 0.85rem;
    color: var(--color-white);
    text-decoration: none;
    transition: background 0.2s ease;
}

.portal-footer-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--color-white);
}



/* ─── Responsive ──────────────────────────────────────── */

/* Tablet (641px–991px): Menu Utama 2×2 */
@media (min-width: 641px) and (max-width: 991px) {
    .portal-grid-main {
        gap: 18px 14px;
        max-width: 520px;
    }

    .portal-item--main {
        width: calc(50% - 10px);
    }

    .portal-item--main .portal-icon-wrap {
        width: 96px;
        height: 96px;
        border-radius: 24px;
    }

    .portal-item--main .portal-item-label {
        font-size: 0.88rem;
    }
}

@media (max-width: 640px) {
    .portal-grid {
        gap: 14px 10px;
    }

    .portal-grid-quick {
        gap: 10px 6px;
        margin-top: 0;
    }

    .portal-item--main {
        width: calc(50% - 10px);
        max-width: none;
    }

    .portal-item--main .portal-icon-wrap {
        width: 86px;
        height: 86px;
        border-radius: 22px;
    }

    .portal-item--main .portal-item-label {
        font-size: 0.86rem;
    }

    /* Menu Akses Cepat — lebih kecil di mobile */
    .portal-item--quick {
        width: calc(25% - 8px);
        min-width: 64px;
        gap: 6px;
    }

    .portal-item--quick .portal-icon-wrap {
        width: 48px;
        height: 48px;
        border-radius: 13px;
        padding: 5px;
    }

    .portal-item--quick .portal-icon-wrap i {
        font-size: 1.35rem;
    }

    .portal-item--quick .portal-item-label {
        font-size: 0.62rem;
        letter-spacing: 0.02em;
        line-height: 1.2;
    }

    .portal-title {
        padding: 10px 22px;
    }

    .portal-dropdown {
        width: calc(100vw - 48px);
        position: fixed;
        top: auto;
        bottom: 20px;
        left: 24px;
        right: 24px;
        transform: translateY(110%);
        margin-left: 0;
    }

    .portal-item.active .portal-dropdown {
        transform: translateY(0);
    }

    .portal-dropdown::before {
        display: none;
    }
}

@media (max-width: 400px) {
    .portal-grid-quick {
        gap: 8px 4px;
    }

    .portal-item--quick {
        width: calc(25% - 6px);
        min-width: 56px;
    }

    .portal-item--quick .portal-icon-wrap {
        width: 42px;
        height: 42px;
        border-radius: 11px;
        padding: 4px;
    }

    .portal-item--quick .portal-icon-wrap i {
        font-size: 1.15rem;
    }

    .portal-item--quick .portal-item-label {
        font-size: 0.56rem;
    }

    .portal-item--main .portal-icon-wrap {
        width: 76px;
        height: 76px;
        border-radius: 20px;
    }

    .portal-item--main .portal-item-label {
        font-size: 0.78rem;
    }
}