/* ============================================
   CEUI GitHub Pages — Main Stylesheet
   ============================================ */

:root {
    --bg: #0a0f1a;
    --surface: #111827;
    --surface-2: #162032;
    --border: #1e293b;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --accent: #38bdf8;
    --accent-glow: rgba(56, 189, 248, 0.15);
    --accent-2: #818cf8;
    --gold: #fbbf24;
    --radius: 12px;
    --transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* === RESET === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    overflow-x: hidden;
}

/* === GRID BACKGROUND === */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(56, 189, 248, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(56, 189, 248, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

/* === TYPOGRAPHY === */
h1, h2, h3 { font-weight: 600; line-height: 1.2; }

a { color: inherit; }

/* === NAV === */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
    background: rgba(10, 15, 26, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.nav-inner {
    max-width: 1200px;
    margin: auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: var(--text);
}

.logo-img {
    height: 36px;
    width: 36px;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    gap: 0.1rem;
}

.logo-title {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text);
}

.logo-text strong {
    font-family: 'DM Sans', sans-serif;
    font-style: normal;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--accent);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.logo-text em {
    display: block;
    font-style: normal;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.nav-links {
    display: flex;
    gap: 1.4rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color var(--transition);
}

.nav-links a:hover,
.nav-links a:focus-visible,
.nav-links a.active { color: var(--accent); }

/* Mobile toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-muted);
    border-radius: 2px;
    transition: all var(--transition);
}

/* === HERO === */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 6rem 2rem 4rem;
}

.hero-glow {
    position: absolute;
    width: 700px;
    height: 700px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-glow), transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    animation: pulse 6s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.7; transform: translate(-50%, -50%) scale(1.1); }
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 820px;
}

.hero-eyebrow {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.hero h1 {
    font-family: 'DM Sans', sans-serif;
    font-style: normal;
    font-weight: 500;
    font-size: clamp(2.6rem, 6vw, 4.8rem);
    line-height: 1.1;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

.hero h1 .highlight {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-desc {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 560px;
    margin: 0 auto 2.5rem;
}

.hero-btns {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 2rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition);
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg);
}

.btn-primary:hover,
.btn-primary:focus-visible {
    box-shadow: 0 0 36px var(--accent-glow);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-outline:hover,
.btn-outline:focus-visible {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
}

/* === SECTIONS === */
section {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: auto;
    padding: 5rem 2rem;
}

.section-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

.section-title {
    font-family: 'DM Sans', sans-serif;
    font-size: clamp(1.6rem, 3.5vw, 2.4rem);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-2);
    margin-bottom: 1rem;
    line-height: 1.15;
}

.section-desc {
    color: var(--text-muted);
    max-width: 600px;
    margin-bottom: 3rem;
    font-size: 1rem;
}

/* === CARDS === */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    opacity: 0;
    transition: opacity var(--transition);
}

.card:hover,
.card:focus-within {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}

.card:hover::before,
.card:focus-within::before { opacity: 1; }

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: var(--accent-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 1.25rem;
}

.card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.65;
}

.card-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 1.25rem;
    transition: gap var(--transition);
}

.card-link:hover { gap: 0.7rem; }

/* === COURSE LIST === */
.course-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.course-item {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    transition: all var(--transition);
}

.course-item:hover {
    border-color: var(--accent);
    transform: translateX(6px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.course-code {
    font-family: 'DM Sans', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--gold);
    background: rgba(251, 191, 36, 0.1);
    padding: 0.35rem 0.9rem;
    border-radius: 6px;
    white-space: nowrap;
    border: 1px solid rgba(251, 191, 36, 0.2);
}

.course-info h3 {
    font-size: 1rem;
    font-weight: 600;
}

.course-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* === PEOPLE === */
.people-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.person {
    text-align: center;
    padding: 2rem 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--transition);
}

.person:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.person-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--bg);
}

.person-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.person h3 { font-size: 1rem; font-weight: 600; }

.person p {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.person-tags {
    font-size: 0.75rem !important;
    color: var(--accent) !important;
    margin-top: 0.5rem !important;
    opacity: 0.85;
}

/* === CONTACT LINKS === */
.contact-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: var(--text);
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    transition: all var(--transition);
}

.contact-link:hover {
    border-color: var(--accent);
    transform: translateX(4px);
}

.contact-link-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--accent-glow);
    border: 1px solid rgba(56,189,248,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: var(--accent);
    flex-shrink: 0;
}

.contact-link strong {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
}

.contact-link em {
    display: block;
    font-style: normal;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

/* === FOOTER === */
footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--border);
    padding: 3rem 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-inner {
    max-width: 1200px;
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    text-align: center;
}

.footer-logo {
    font-family: 'Instrument Serif', serif;
    font-size: 1.4rem;
    color: var(--accent);
    margin-bottom: 0.25rem;
}

footer a {
    color: var(--accent);
    text-decoration: none;
}

footer a:hover { text-decoration: underline; }

/* === PAGE LAYOUT (non-hero pages) === */
.page-hero {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: auto;
    padding: 8rem 2rem 3rem;
    border-bottom: 1px solid var(--border);
}

.page-hero .section-title { margin-bottom: 0.75rem; }
.page-hero .section-desc { margin-bottom: 0; }

.page-content {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: auto;
    padding: 3rem 2rem 5rem;
}

@media (max-width: 768px) {
    .page-hero { padding: 7rem 1.5rem 2.5rem; }
    .page-content { padding: 2.5rem 1.5rem 4rem; }
}

/* === SCROLL ANIMATIONS ===
   Elements are visible by default (no-JS safe).
   JS adds .js-animate to <body> before observing,
   which opts elements into the hidden→visible transition.
*/
.js-animate .fade-up {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.8s var(--transition), transform 0.8s var(--transition);
}

.js-animate .fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children inside a visible fade-up parent */
.js-animate .cards .card.fade-up:nth-child(2) { transition-delay: 0.1s; }
.js-animate .cards .card.fade-up:nth-child(3) { transition-delay: 0.2s; }
.js-animate .course-list .course-item.fade-up:nth-child(2) { transition-delay: 0.08s; }
.js-animate .course-list .course-item.fade-up:nth-child(3) { transition-delay: 0.16s; }
.js-animate .course-list .course-item.fade-up:nth-child(4) { transition-delay: 0.24s; }
.js-animate .people-grid .person.fade-up:nth-child(2) { transition-delay: 0.1s; }
.js-animate .people-grid .person.fade-up:nth-child(3) { transition-delay: 0.2s; }

/* === FOCUS VISIBLE === */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .nav-toggle { display: flex; }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(10, 15, 26, 0.97);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        gap: 0;
        padding: 1rem 0;
    }

    .nav-links.open { display: flex; }

    .nav-links li { width: 100%; }

    .nav-links a {
        display: block;
        padding: 0.85rem 2rem;
        font-size: 1rem;
    }

    .nav-toggle[aria-expanded="true"] span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }
    .nav-toggle[aria-expanded="true"] span:nth-child(2) {
        opacity: 0;
    }
    .nav-toggle[aria-expanded="true"] span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .hero { padding: 8rem 1.5rem 4rem; }

    .hero-glow { width: 400px; height: 400px; }

    .course-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    section { padding: 3rem 1.5rem; }

    .cards { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .logo-text { display: none; }
    .hero h1 { font-size: 2.75rem; }
    .btn { width: 100%; justify-content: center; }
    .hero-btns { flex-direction: column; }
}
