/* ==========================================================================
   AILSS — Design tokens
   ========================================================================== */
:root {
    --teal: #2C928C;
    --teal-light: #3ACEC5;
    --teal-pale: #e9f8f7;
    --maroon: #5A180A;
    --ink: #0f172a;
    --ink-soft: #334155;
    --muted: #64748b;
    --border: #e2e8f0;
    --surface: #ffffff;
    --surface-alt: #f8fafc;
    --dark: #0b1220;
    --dark-alt: #141d33;

    --radius-sm: 0.5rem;
    --radius-md: 0.9rem;
    --radius-lg: 1.5rem;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 45px rgba(15, 23, 42, 0.12);

    --font-body: 'Titillium Web', system-ui, sans-serif;
    --font-display: 'Outfit', system-ui, sans-serif;
    --max-width: 1120px;
}

/* ==========================================================================
   Reset & base
   ========================================================================== */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--ink);
    background: var(--surface);
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: inherit; }

h1, h2, h3, h4 {
    font-family: var(--font-display);
    margin: 0;
    line-height: 1.15;
}

p { line-height: 1.65; color: var(--ink-soft); }

.wrap {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--teal);
    background: var(--teal-pale);
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    text-transform: uppercase;
}

.badge-upcoming { background: #fef3c7; color: #92400e; }
.badge-award { background: #fce7f3; color: #9d174d; }
.badge-year { background: var(--teal-pale); color: var(--teal); }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.75rem 1.4rem;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.btn-primary {
    background: var(--teal);
    color: white;
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: #237872; transform: translateY(-2px); box-shadow: var(--shadow-md); }

.btn-ghost {
    background: rgba(255,255,255,0.15);
    color: white;
    border: 1.5px solid rgba(255,255,255,0.55);
    backdrop-filter: blur(6px);
}
.btn-ghost:hover { background: rgba(255,255,255,0.28); transform: translateY(-2px); }

.btn-outline {
    background: transparent;
    color: var(--teal);
    border: 1.5px solid var(--teal);
}
.btn-outline:hover { background: var(--teal-pale); }

/* ==========================================================================
   Navbar
   ========================================================================== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.nav-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 4.25rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--ink);
    font-family: var(--font-display);
    font-weight: 700;
}

.logo-img { height: 2.1rem; width: 2.1rem; border-radius: 6px; }
.logo-text { font-size: 1.3rem; letter-spacing: 0.02em; }
.logo-sub { font-size: 0.68rem; color: var(--muted); font-weight: 500; display: block; margin-top: -2px; }

.desktop-nav { display: flex; align-items: center; gap: 0.25rem; }

.nav-item {
    position: relative;
    padding: 0.6rem 0.9rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ink-soft);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: color 0.15s ease, background-color 0.15s ease;
}

.nav-item:hover { color: var(--teal); background: var(--teal-pale); }

.nav-item.active { color: var(--teal); }
.nav-item.active::after {
    content: '';
    position: absolute;
    left: 0.9rem;
    right: 0.9rem;
    bottom: 0.15rem;
    height: 2px;
    background: var(--teal);
    border-radius: 2px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    width: 2.25rem;
    height: 2.25rem;
    position: relative;
}

.mobile-menu-btn span,
.mobile-menu-btn span::before,
.mobile-menu-btn span::after {
    content: '';
    position: absolute;
    left: 0.4rem;
    right: 0.4rem;
    height: 2px;
    background: var(--ink);
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.mobile-menu-btn span { top: 50%; transform: translateY(-50%); }
.mobile-menu-btn span::before { top: -7px; }
.mobile-menu-btn span::after { top: 7px; }
.mobile-menu-btn.open span { background: transparent; }
.mobile-menu-btn.open span::before { top: 0; transform: rotate(45deg); }
.mobile-menu-btn.open span::after { top: 0; transform: rotate(-45deg); }

.mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
    border-top: 1px solid var(--border);
    background: var(--surface);
}
.mobile-menu.open { max-height: 20rem; }

.mobile-nav-item {
    display: block;
    padding: 0.9rem 1.5rem;
    font-weight: 600;
    color: var(--ink-soft);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
}
.mobile-nav-item.active { color: var(--teal); }

@media (max-width: 820px) {
    .desktop-nav { display: none; }
    .mobile-menu-btn { display: block; }
}

/* ==========================================================================
   Hero (home)
   ========================================================================== */
.hero {
    position: relative;
    background: linear-gradient(160deg, var(--dark) 0%, #10263b 55%, var(--teal) 165%);
    color: white;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url('../assets/imgs/bg.png');
    background-size: cover;
    background-position: center;
    opacity: 0.16;
}

.hero-inner {
    position: relative;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 6rem 1.5rem 5rem;
}

.hero-inner h1 {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    margin: 1rem 0 1.25rem;
    max-width: 50rem;
}

.hero-inner h1 span { color: var(--teal-light); }

.hero-inner p {
    color: rgba(255,255,255,0.82);
    font-size: 1.15rem;
    max-width: 38rem;
    margin-bottom: 2.25rem;
}

.hero-actions { display: flex; gap: 0.9rem; flex-wrap: wrap; }

.hero-stats {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: rgba(255,255,255,0.14);
    border-top: 1px solid rgba(255,255,255,0.14);
}

.hero-stat {
    background: rgba(11, 18, 32, 0.55);
    padding: 1.75rem 1.5rem;
    text-align: center;
}

.hero-stat strong {
    display: block;
    font-family: var(--font-display);
    font-size: 2.35rem;
    color: var(--teal-light);
}

.hero-stat span { font-size: 1.05rem; color: rgba(255,255,255,0.75); }

/* ==========================================================================
   Section shell
   ========================================================================== */
.section { padding: 5rem 0; }
.section-compact { padding: 2.5rem 0; }
.section-alt { background: var(--surface-alt); }
.section-head { max-width: 50rem; margin-bottom: 2.75rem; }
.section-head h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); margin: 0.75rem 0 0.75rem; }
.section-head p { font-size: 1.05rem; }

/* ==========================================================================
   Research topic cards (home)
   ========================================================================== */
.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

.topic-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.6rem;
    text-align: left;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    font: inherit;
}

.topic-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--teal-light);
}

.topic-icon {
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius-sm);
    background: var(--teal-pale);
    color: var(--teal);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.topic-card p { color: var(--ink); font-size: 1.02rem; margin: 0; font-weight: 500; }

.topic-cta {
    margin-top: auto;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--teal);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
    background: var(--dark);
    color: white;
    padding: 4rem 0 2rem;
}

.footer-top {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 3rem;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.footer-brand { max-width: 26rem; }

.footer-brand .logo { color: white; margin-bottom: 1rem; }

.footer-brand p { color: rgba(255,255,255,0.65); font-size: 0.95rem; }

.footer-cols { display: flex; gap: 4rem; flex-wrap: wrap; }

.footer-col h4 {
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.5);
    margin-bottom: 1rem;
}

.footer-col a {
    display: block;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 0.35rem 0;
    font-size: 0.95rem;
}

.footer-col a:hover { color: var(--teal-light); }

.footer-bottom {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1.5rem 1.5rem 0;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.45);
}

/* ==========================================================================
   Generic inner-page header
   ========================================================================== */
.page-header {
    background: linear-gradient(160deg, var(--dark) 0%, #10263b 100%);
    color: white;
    padding: 3.5rem 0 3rem;
}

.page-header .eyebrow { background: rgba(58,206,197,0.16); color: var(--teal-light); }
.page-header h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); margin: 0.9rem 0 0.6rem; }
.page-header p { color: rgba(255,255,255,0.75); max-width: 40rem; font-size: 1.05rem; }

/* ==========================================================================
   Modal (research topic detail)
   ========================================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 12, 22, 0.6);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    z-index: 200;
}

.modal-overlay.hidden { display: none; }

.modal-box {
    background: white;
    border-radius: var(--radius-lg);
    max-width: 40rem;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    padding: 1.75rem;
    box-shadow: var(--shadow-lg);
}

.modal-box-header {
    display: flex;
    justify-content: flex-end;
}

.modal-close {
    background: var(--surface-alt);
    border: none;
    border-radius: 999px;
    width: 2.2rem;
    height: 2.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--muted);
}
.modal-close:hover { background: var(--border); }

.modal-gallery {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface-alt);
    margin-top: 0.5rem;
}

.modal-gallery img { width: 100%; max-height: 46vh; object-fit: contain; }

.modal-nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(15, 23, 42, 0.55);
    color: white;
    border: none;
    border-radius: 999px;
    width: 2.4rem;
    height: 2.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.3rem;
}
.modal-nav-button.prev { left: 0.75rem; }
.modal-nav-button.next { right: 0.75rem; }

.modal-image-count { text-align: center; font-size: 0.85rem; color: var(--muted); margin-top: 0.6rem; }
.modal-box-text { margin-top: 1rem; font-size: 1.05rem; color: var(--ink); }

/* ==========================================================================
   Publications page
   ========================================================================== */
.pub-toolbar {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2.25rem;
}

.pub-search {
    flex: 1 1 18rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.65rem 1rem;
}

.pub-search input {
    border: none;
    outline: none;
    font: inherit;
    font-size: 0.95rem;
    width: 100%;
    background: transparent;
}

.pub-search .iconify { color: var(--muted); font-size: 1.1rem; }

.pub-filters { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.pub-filter-chip {
    border: 1px solid var(--border);
    background: var(--surface);
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink-soft);
    cursor: pointer;
    transition: all 0.15s ease;
}

.pub-filter-chip:hover { border-color: var(--teal-light); }
.pub-filter-chip.active { background: var(--teal); border-color: var(--teal); color: white; }

.pub-year-group { margin-bottom: 2.75rem; }
.pub-year-heading {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 1.1rem;
}
.pub-year-heading h3 { font-size: 1.4rem; color: var(--ink); }
.pub-year-heading::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.pub-list { display: flex; flex-direction: column; gap: 0.9rem; }

.pub-card {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.4rem;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

a.pub-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--teal-light);
}

.pub-card-icon {
    flex-shrink: 0;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 999px;
    background: var(--teal-pale);
    color: var(--teal);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.15rem;
}

.pub-card-body { flex: 1; min-width: 0; }

.pub-card-badges { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.45rem; }

.pub-card h4 { font-size: 1.08rem; color: var(--ink); margin-bottom: 0.35rem; font-weight: 700; }
.pub-card .pub-authors { font-size: 0.92rem; color: var(--ink-soft); margin-bottom: 0.15rem; }
.pub-card .pub-venue { font-size: 0.85rem; color: var(--muted); font-style: italic; }

.pub-empty { color: var(--muted); padding: 2rem 0; text-align: center; }

/* ==========================================================================
   People page
   ========================================================================== */
.people-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
}

.person-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.person-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.person-avatar {
    width: 4.2rem;
    height: 4.2rem;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--teal-light), var(--teal));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.3rem;
}

.person-card.pi .person-avatar { background: linear-gradient(135deg, var(--teal), var(--maroon)); }

.person-name { font-size: 1.02rem; font-weight: 700; color: var(--ink); margin-bottom: 0.2rem; }
.person-title { font-size: 0.85rem; color: var(--muted); }

.alumni-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.9rem;
}

.alumni-card {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.1rem;
    font-weight: 600;
    color: var(--ink-soft);
    font-size: 0.95rem;
}

/* ==========================================================================
   Join page
   ========================================================================== */
.prereq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 3rem;
}

.prereq-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.prereq-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--radius-sm);
    background: var(--teal-pale);
    color: var(--teal);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.prereq-title { font-size: 1.02rem; color: var(--ink); margin-bottom: 0.3rem; }
.prereq-subtitle { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.9rem; }

.syllabus-button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: none;
    border: none;
    color: var(--teal);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0;
}

.cta-panel {
    background: linear-gradient(160deg, var(--dark) 0%, #10263b 100%);
    color: white;
    border-radius: var(--radius-lg);
    padding: 2.5rem;
}

.cta-panel h2 { font-size: 1.5rem; margin-bottom: 0.9rem; }
.cta-panel p { color: rgba(255,255,255,0.78); margin-bottom: 1rem; }
.cta-panel a.btn { margin-top: 0.5rem; }

.syllabus-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.9rem; }
.syllabus-list li { border-bottom: 1px solid var(--border); padding-bottom: 0.9rem; }
.syllabus-item-title { font-size: 0.98rem; font-weight: 700; color: var(--ink); margin: 0 0 0.25rem; }
.syllabus-item-homework { font-size: 0.88rem; color: var(--muted); margin: 0; }
.modal-intro { color: var(--ink-soft); margin-bottom: 1.25rem; }

/* ==========================================================================
   Contact page
   ========================================================================== */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 2.5rem;
    align-items: start;
}

@media (max-width: 860px) {
    .contact-grid { grid-template-columns: 1fr; }
}

.contact-info { display: flex; flex-direction: column; gap: 1.25rem; }

.contact-info-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.contact-info-card h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin-bottom: 0.6rem;
}

.contact-info-card a { color: var(--teal); font-weight: 600; text-decoration: none; }
.contact-info-card a:hover { text-decoration: underline; }

.contact-form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
}

.form-group { margin-bottom: 1.25rem; }
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--ink-soft);
    margin-bottom: 0.4rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    font: inherit;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-alt);
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--teal-light);
    background: white;
}

.form-group textarea { min-height: 8rem; resize: vertical; }

.success-message, .error-message {
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
}

.success-message { background: var(--teal-pale); border: 1px solid var(--teal-light); }
.success-message h2 { color: var(--teal); margin-bottom: 0.5rem; font-size: 1.3rem; }
.success-message button { margin-top: 1rem; }

.error-message { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; font-weight: 600; }

/* ==========================================================================
   Utility
   ========================================================================== */
.hidden { display: none !important; }

@media (max-width: 640px) {
    .section { padding: 3.5rem 0; }
    .section-compact { padding: 1.5rem 0; }
    .hero-inner { padding: 4rem 1.5rem 3.5rem; }
    .hero-stats { grid-template-columns: 1fr; }
    .footer-cols { gap: 2rem; }
}
