/* Visual layer for the public site.
   Colors come from styles.css. This file does not replace existing classes. */

:root {
    --z-content: 1;
    --z-section: 20;
    --z-bar: 30;
    --z-dock: 30;
    --z-top: 35;
    --z-nav: 60;
    --z-drawer: 70;
    --z-chat: 75;
    --z-modal: 80;
    --z-toast: 90;
}

/* ------------------------------------------------------------------ */
/* Scroll                                                              */
/* ------------------------------------------------------------------ */

html {
    scroll-padding-top: calc(var(--navbar-offset, 4.75rem) + 0.5rem);
    scrollbar-color: var(--color-brand) var(--color-surface-card);
    overflow-x: clip;
}

body.fx-public {
    min-height: 100dvh;
    overflow-x: clip;
}

body.fx-public > section,
body.fx-public > main {
    animation: fx-page-in 0.45s ease;
}

.fx-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    transform: scaleX(0);
    transform-origin: left center;
    background: var(--color-brand);
    z-index: calc(var(--z-nav) + 1);
    pointer-events: none;
}

header.sticky.fx-scrolled {
    background: rgba(248, 249, 254, 0.9);
    backdrop-filter: blur(16px);
    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.08),
        0 18px 36px rgba(0, 102, 255, 0.12);
}

header.sticky.fx-scrolled .nav-bar-row {
    min-height: 3.5rem;
}

header.sticky.fx-scrolled .site-brand > div:first-child {
    transform: scale(0.9);
    transform-origin: left center;
}

.fx-top {
    position: fixed;
    left: max(0.75rem, env(safe-area-inset-left, 0px));
    bottom: max(1rem, env(safe-area-inset-bottom, 0px));
    z-index: var(--z-top);
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 999px;
    color: #fff;
    background: var(--color-brand);
    box-shadow:
        0 8px 16px rgba(0, 0, 0, 0.16),
        0 0 0 4px rgba(0, 102, 255, 0.16);
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.fx-top.is-on {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

body.fx-public section h2.font-heading {
    position: relative;
    padding-bottom: 0.55rem;
    font-size: clamp(1.35rem, 1.05rem + 1.5vw, 1.875rem);
}

body.fx-public section h2.font-heading::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 2.75rem;
    height: 3px;
    border-radius: 999px;
    background: var(--color-brand);
    transform-origin: left center;
    animation: fx-line 0.6s ease both;
}

.ticker-seq > .ticker-item:first-child::before {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
    animation: fx-pulse 1.6s ease-out infinite;
    flex: none;
}

.fx-shimmer {
    color: transparent !important;
    border-radius: 0.75rem;
    min-height: 4.5rem;
    background: linear-gradient(90deg, var(--color-surface-card) 0%, var(--color-surface) 45%, var(--color-surface-card) 100%);
    background-size: 200% 100%;
    animation: fx-shimmer 1.1s linear infinite;
}

.fx-arrive {
    animation: fx-page-in 0.4s ease;
}

/* ------------------------------------------------------------------ */
/* Hover                                                               */
/* ------------------------------------------------------------------ */

::selection {
    background: rgba(0, 102, 255, 0.22);
    color: var(--color-ink);
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--color-surface-card);
}

::-webkit-scrollbar-thumb {
    background: var(--color-brand);
    border-radius: 999px;
}

body.fx-public :focus-visible {
    outline: 2px solid var(--color-brand);
    outline-offset: 2px;
}

@media (min-width: 1024px) {
    header nav > a {
        position: relative;
    }

    header nav > a::after {
        content: "";
        position: absolute;
        left: 50%;
        bottom: 0.15rem;
        width: 58%;
        height: 2px;
        border-radius: 999px;
        background: var(--color-brand);
        transform: translateX(-50%) scaleX(0);
        transform-origin: center;
        transition: transform 0.22s ease;
    }

    header nav > a:hover::after,
    header nav > a:focus-visible::after,
    header nav > a.fx-current::after {
        transform: translateX(-50%) scaleX(1);
    }
}

#mobileMenu a.fx-current,
header nav > a.fx-current {
    color: var(--color-brand);
}

@media (hover: hover) {
    body.fx-public a.bg-primary:not(.fixed):hover,
    body.fx-public button.bg-primary:not(.fixed):hover,
    #homeDeptGrid > div:hover,
    #eventsBoardGrid > div:hover,
    #noticeBoardGrid > div:hover,
    .gallery-item:hover {
        box-shadow:
            0 10px 18px rgba(0, 0, 0, 0.1),
            0 18px 36px rgba(0, 102, 255, 0.16);
    }

    #noticeBoardGrid > *:hover,
    #eventsBoardGrid > *:hover,
    #pastEventsGrid > *:hover {
        box-shadow: inset 3px 0 0 var(--color-brand);
    }
}

.fx-pill {
    border-radius: 999px;
    box-shadow: 0 0 0 1px rgba(0, 102, 255, 0.2), 0 0 16px rgba(0, 102, 255, 0.12);
}

body.fx-public input:focus,
body.fx-public select:focus,
body.fx-public textarea:focus {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.18);
}

body.fx-public input:user-valid,
body.fx-public select:user-valid,
body.fx-public textarea:user-valid {
    border-color: var(--color-brand);
}

body.fx-public input:user-invalid,
body.fx-public select:user-invalid,
body.fx-public textarea:user-invalid {
    border-color: var(--color-ink);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.12);
}

#gError:not(.hidden),
#gSuccess:not(.hidden) {
    border-radius: 1rem;
    padding: 0.9rem 1rem;
    box-shadow: 0 10px 24px rgba(0, 102, 255, 0.12);
    background: var(--color-surface-card);
}

#chatbotTriggerBtn,
#chatbotWindow {
    z-index: var(--z-chat);
}

#chatbotTriggerBtn {
    box-shadow:
        0 10px 20px rgba(0, 0, 0, 0.16),
        0 0 0 6px rgba(0, 102, 255, 0.14);
}

#chatbotWindow:not(.hidden) {
    display: flex;
    flex-direction: column;
    animation: fx-sheet 0.28s ease;
}

#chatbotMessages .rounded-2xl {
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
}

#chatbotMessages .id-typing .italic {
    font-size: 0;
}

#chatbotMessages .id-typing .italic::after {
    content: "";
    display: inline-block;
    width: 0.38rem;
    height: 0.38rem;
    margin-right: 1.15rem;
    border-radius: 999px;
    background: var(--color-brand);
    box-shadow: 0.55rem 0 0 rgba(0, 102, 255, 0.45), 1.1rem 0 0 rgba(0, 102, 255, 0.25);
    animation: fx-dots 0.9s ease-in-out infinite;
}

/* ------------------------------------------------------------------ */
/* Popup                                                               */
/* ------------------------------------------------------------------ */

#lightboxModal,
#deptModal,
#searchModal,
#videoModal,
dialog.campus-lightbox {
    z-index: var(--z-modal);
}

#lightboxModal:not(.hidden),
#deptModal:not(.hidden),
#searchModal:not(.hidden),
#videoModal:not(.hidden) {
    animation: fx-page-in 0.2s ease;
}

#lightboxModal:not(.hidden) img,
#lightboxModal:not(.hidden) video,
#lightboxModal:not(.hidden) iframe {
    animation: fx-zoom 0.28s ease;
}

.fx-lb-nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 999px;
    color: var(--color-ink);
    background: var(--color-surface);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
    transform: translateY(-50%);
}

.fx-lb-prev { left: max(0.75rem, env(safe-area-inset-left, 0px)); }
.fx-lb-next { right: max(0.75rem, env(safe-area-inset-right, 0px)); }

.fx-toast {
    position: fixed;
    top: calc(var(--navbar-offset, 4.75rem) + 0.75rem);
    left: 50%;
    z-index: var(--z-toast);
    width: min(28rem, calc(100vw - 1.5rem));
    max-height: 40dvh;
    overflow: auto;
    padding: 0.85rem 1rem;
    border-radius: 1rem;
    color: var(--color-ink);
    background: var(--color-surface);
    border: 1px solid rgba(0, 102, 255, 0.28);
    box-shadow:
        0 10px 24px rgba(0, 0, 0, 0.12),
        0 18px 40px rgba(0, 102, 255, 0.16);
    white-space: pre-wrap;
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.fx-toast.is-on {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

body.fx-modal-open {
    overflow: hidden;
}

/* ------------------------------------------------------------------ */
/* Mobile                                                              */
/* ------------------------------------------------------------------ */

#menuToggleBtn {
    min-width: 44px;
    min-height: 44px;
}

@media (max-width: 1023px) {
    #mobileMenuBackdrop {
        z-index: calc(var(--z-drawer) - 1);
    }

    #mobileMenu {
        z-index: var(--z-drawer);
    }
}

@media (max-width: 767px) {
    body.fx-public table {
        display: block;
        max-width: 100%;
        overflow-x: auto;
    }

    #deptModal,
    #searchModal,
    #videoModal {
        align-items: flex-end;
        padding: 0;
    }

    #deptModal > div,
    #searchModal > div,
    #videoModal > div {
        width: 100%;
        max-width: none;
        max-height: 92dvh;
        margin: 0;
        border-radius: 1.25rem 1.25rem 0 0;
        animation: fx-sheet 0.28s ease;
    }

    #deptModal > div::before,
    #searchModal > div::before,
    #videoModal > div::before {
        content: "";
        display: block;
        width: 2.5rem;
        height: 0.28rem;
        margin: 0 auto 0.75rem;
        border-radius: 999px;
        background: rgba(0, 102, 255, 0.35);
    }

    #lightboxModal {
        padding: 0;
    }

    dialog.campus-lightbox {
        width: 100vw;
        max-width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        margin: 0;
    }

    body.fx-has-dock {
        padding-bottom: calc(3.7rem + env(safe-area-inset-bottom, 0px));
    }

    body.fx-has-dock .fx-top {
        left: auto;
        right: max(0.75rem, env(safe-area-inset-right, 0px));
        bottom: calc(8.4rem + env(safe-area-inset-bottom, 0px));
    }

    body.fx-has-dock #chatbotTriggerBtn {
        bottom: calc(4.6rem + env(safe-area-inset-bottom, 0px));
    }

    body.fx-has-dock #chatbotWindow {
        bottom: calc(8.5rem + env(safe-area-inset-bottom, 0px));
        max-height: min(68dvh, calc(100dvh - 10.5rem - env(safe-area-inset-bottom, 0px)));
    }
}

.fx-dock {
    display: none;
}

@media (max-width: 767px) {
    body.fx-has-dock .fx-dock {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: var(--z-dock);
        display: flex;
        justify-content: space-around;
        gap: 0.25rem;
        padding: 0.35rem 0.5rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
        background: rgba(248, 249, 254, 0.96);
        border-top: 1px solid rgba(0, 102, 255, 0.18);
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
        backdrop-filter: blur(12px);
    }
}

.fx-dock a {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.8rem;
    border-radius: 999px;
    color: var(--color-brand);
    background: var(--color-surface-card);
}

@media (hover: none) {
    #homeDeptGrid > div:active,
    #deptContainer > div:active,
    .gallery-item:active,
    .card-hover-lift:active {
        transform: scale(0.985);
    }
}

/* Light polish for admin and sign-in. No layout changes. */
.cms-app button,
.cms-app a.bg-primary,
.dept-admin-app button,
.auth-page button,
.auth-page a {
    transition: box-shadow 0.2s ease, filter 0.2s ease;
}

.cms-app button:hover,
.dept-admin-app button:hover,
.auth-page button:hover {
    box-shadow: 0 8px 18px rgba(0, 102, 255, 0.14);
}

.cms-app :focus-visible,
.dept-admin-app :focus-visible,
.auth-page :focus-visible {
    outline: 2px solid var(--color-brand);
    outline-offset: 2px;
}

@keyframes fx-page-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fx-line {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

@keyframes fx-pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.65); }
    100% { box-shadow: 0 0 0 8px rgba(255, 255, 255, 0); }
}

@keyframes fx-shimmer {
    from { background-position: 100% 0; }
    to { background-position: -100% 0; }
}

@keyframes fx-zoom {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: none; }
}

@keyframes fx-sheet {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: none; }
}

@keyframes fx-dots {
    0%, 80%, 100% { opacity: 0.35; }
    40% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    body.fx-public > section,
    body.fx-public > main,
    body.fx-public section h2.font-heading::after,
    .fx-arrive,
    .fx-shimmer,
    #chatbotTriggerBtn,
    #chatbotWindow:not(.hidden),
    #lightboxModal:not(.hidden) img,
    #deptModal > div,
    .ticker-seq > .ticker-item:first-child::before {
        animation: none;
    }

    .fx-top,
    .fx-toast,
    header.sticky.fx-scrolled .site-brand > div:first-child {
        transition: none;
    }
}
