/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1e3a8a;
    --primary-dark: #1e40af;
    --secondary-color: #3b82f6;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --bg-light: #f9fafb;
    --border-color: #e5e7eb;
    --accent-color: #2563eb;
    --navy-deep: #14275e;
    --gold: #c9952b;
    --gold-light: #e8c77a;
    --paper: #fbfaf7;
    --font-sans: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    /* Navy gradient with a faint double-helix motif, shared by sidebar and footer */
    --navy-texture:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='40'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.06' stroke-width='1.5'%3E%3Cpath d='M0 10 Q20 -2 40 10 T80 10'/%3E%3Cpath d='M0 30 Q20 42 40 30 T80 30'/%3E%3C/g%3E%3C/svg%3E"),
        linear-gradient(180deg, var(--primary-color) 0%, var(--navy-deep) 100%);
}

/* Stop the vertical rubber-band bounce past the page edges (y only, so
   swipe-back navigation still works). Browsers that ignore this (iOS Safari
   before 16) still bounce, so the canvas is navy to match the footer,
   sidebar and homepage hero instead of flashing a light strip. */
html {
    overscroll-behavior-y: none;
    background-color: var(--navy-deep);
}

body {
    font-family: var(--font-sans);
    line-height: 1.7;
    color: var(--text-color);
    background-color: var(--paper);
    font-size: 16px;
    margin: 0;
    padding: 0;
}

body.homepage {
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Main Content */
main {
    min-height: calc(100vh - 250px);
}

body.homepage main {
    min-height: 100vh;
    padding: 0;
}

/* Page Layout with Sidebar (for all pages) */
.page-layout {
    display: flex;
    gap: 0;
    max-width: 100%;
    margin: 0;
    padding: 0;
    align-items: stretch;
    min-height: 100vh;
    position: relative;
}

/* Homepage Layout with Sidebar */
.homepage-layout {
    display: flex;
    gap: 0;
    max-width: 100%;
    margin: 0;
    padding: 0;
    align-items: stretch;
    min-height: 100vh;
    height: 100vh;
    position: relative;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: rgba(20, 39, 94, 0.95);
    border: 2px solid var(--gold);
    border-radius: 6px;
    width: 50px;
    height: 50px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    padding: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.mobile-menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Sidebar Styles */
.sidebar {
    flex: 0 0 280px;
    background: var(--navy-texture);
    border-radius: 0;
    padding: 0;
    box-shadow: 2px 0 12px rgba(0,0,0,0.2);
    position: relative;
    min-height: 100vh;
    height: auto; /* stretch to the full page height so the menu reaches the footer */
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 10;
    border-right: 3px solid var(--gold);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    min-height: 100%;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--gold);
    border-radius: 3px;
}

.sidebar-brand {
    display: block;
    text-decoration: none;
    margin-bottom: 1.5rem;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.brand-name {
    display: block;
    font-family: var(--font-serif);
    font-size: 1.9rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.5px;
    line-height: 1.1;
}

.brand-year {
    color: var(--gold-light);
    margin-left: 0.35rem;
}

.brand-meta {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.65);
}

.sidebar-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
}

.sidebar-nav ul li {
    margin-bottom: 0.2rem;
}

.sidebar-nav ul li a {
    display: block;
    padding: 0.6rem 1rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    border-radius: 0 6px 6px 0;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    font-size: 0.93rem;
    border-left: 3px solid transparent;
}

.sidebar-nav ul li a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-left-color: rgba(232, 199, 122, 0.6);
}

.sidebar-nav ul li a.active {
    background-color: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    font-weight: 600;
    border-left-color: var(--gold);
}

/* Page Main Content (for all pages) */
.page-main {
    flex: 1;
    min-width: 0;
    width: 100%;
    position: relative;
    overflow-y: auto;
    padding: 2rem 2rem 4rem; /* bottom padding replaces the old footer margin */
}

/* Homepage Main Content */
.homepage-main {
    flex: 1;
    min-width: 0;
    width: 100%;
    position: relative;
}

/* Photo Slideshow */
.photo-slideshow {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 100vh;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
}

.photo-slideshow .slide {
    overflow: hidden;
}

.photo-slideshow .slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
}

.photo-slideshow .slide.active {
    opacity: 1;
}

.photo-slideshow .slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scale(1);
    transition: transform 8s ease-out;
}

.photo-slideshow .slide.active img {
    transform: scale(1.06);
}

.photo-slideshow::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg, rgba(20, 39, 94, 0.55) 0%, rgba(20, 39, 94, 0.15) 50%, rgba(0, 0, 0, 0.45) 100%);
    pointer-events: none;
    z-index: 1;
}

/* Conference Info Box - kept above collaborator banner */
.conference-info-box {
    position: absolute;
    top: calc(50% - 90px);
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(820px, 90%);
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: rgba(20, 39, 94, 0.72);
    backdrop-filter: blur(10px);
    padding: 3rem 3.5rem;
    border-radius: 4px;
    text-align: center;
    z-index: 50;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-top: 4px solid var(--gold);
}

.conference-info-box .hero-kicker {
    color: var(--gold-light);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin: 0 0 0.8rem 0;
}

.conference-info-box h1 {
    color: #fff;
    font-family: var(--font-serif);
    font-size: 3.2rem;
    font-weight: 700;
    line-height: 1.1;
    margin: 0 0 1.5rem 0;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
    margin: 0 0 2rem 0;
}

.hero-meta span {
    color: #fff;
    font-size: 0.95rem;
    padding: 0.35rem 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
}

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

.btn {
    display: inline-block;
    padding: 0.75rem 1.6rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: var(--gold);
    color: var(--navy-deep);
}

.btn-primary:hover {
    background: var(--gold-light);
}

.btn-ghost {
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* Collaborator Banner */
.collaborator-banner {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    padding: 2rem 2rem;
    z-index: 100;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.banner-content {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 3rem;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 2rem;
}

.logo-item {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 300px;
    height: 100px;
}

.logo-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: grayscale(20%);
    opacity: 0.9;
    transition: opacity 0.3s ease, filter 0.3s ease;
}

.logo-item img:hover {
    opacity: 1;
    filter: grayscale(0%);
}

article {
    max-width: 900px;
    margin: 0 auto;
}

article h1,
article h2,
article h3 {
    font-family: var(--font-serif);
    color: var(--primary-color);
    line-height: 1.25;
}

article h1 {
    font-size: 2.8rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

article h2 {
    font-size: 1.9rem;
    margin-top: 2.8rem;
    margin-bottom: 1.2rem;
    font-weight: 600;
}

article h2::after {
    content: '';
    display: block;
    width: 48px;
    height: 3px;
    margin-top: 0.6rem;
    background: var(--gold);
}

/* The page's opening heading acts as its title */
article > h2:first-child {
    font-size: 2.6rem;
    font-weight: 700;
    margin-top: 1rem;
    margin-bottom: 2rem;
}

article > h2:first-child::before {
    content: 'ICGEC-2026';
    display: block;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    color: var(--gold);
    margin-bottom: 0.4rem;
}

article > h2:first-child::after {
    width: 72px;
    margin-top: 0.9rem;
}

article h3 {
    font-size: 1.45rem;
    margin-top: 2rem;
    margin-bottom: 0.8rem;
    font-weight: 600;
}

article h4 {
    font-size: 0.85rem;
    margin-top: 1.5rem;
    margin-bottom: 0.6rem;
    color: var(--text-light);
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

article p {
    margin-bottom: 1.2rem;
    color: var(--text-color);
    line-height: 1.8;
}

article ul, article ol {
    margin-left: 2rem;
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

article li {
    margin-bottom: 0.6rem;
    color: var(--text-color);
}

article li::marker {
    color: var(--gold);
}

article a {
    color: var(--accent-color);
    text-decoration: underline;
    text-decoration-color: rgba(37, 99, 235, 0.3);
    text-underline-offset: 3px;
    transition: color 0.2s, text-decoration-color 0.2s;
}

article a:hover {
    color: var(--primary-dark);
    text-decoration-color: var(--gold);
}

article strong {
    color: var(--primary-dark);
    font-weight: 600;
}

/* Superseded deadlines stay readable but step back */
article del {
    color: var(--text-light);
    opacity: 0.7;
}

article hr {
    border: none;
    height: 1px;
    margin: 2.5rem 0;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

article blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    background: #fff;
    border-left: 4px solid var(--gold);
    border-radius: 0 6px 6px 0;
}

article img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 6px 20px rgba(20, 39, 94, 0.15);
}

/* Footer */
footer {
    background: var(--navy-texture);
    border-top: 3px solid var(--gold);
    color: #e5e7eb;
    padding: 2.5rem 0;
    margin-top: 0; /* footer sits flush against the sidebar/content, no white gap */
    text-align: center;
}

footer .container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

footer p {
    margin: 0;
    color: rgba(255, 255, 255, 0.8);
}

footer a {
    color: var(--gold-light);
    text-decoration: none;
    transition: color 0.3s;
}

footer a:hover {
    color: #fff;
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .page-layout,
    .homepage-layout {
        flex-direction: column;
        gap: 0;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .sidebar {
        flex: 1;
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        max-width: 85%;
        min-height: 100vh;
        min-height: 100dvh;
        height: 100vh;
        height: 100dvh;
        bottom: 0;
        transform: translateX(-100%);
        z-index: 1000;
        box-shadow: 4px 0 20px rgba(0,0,0,0.3);
        transition: transform 0.3s ease;
        padding-top: 70px; /* Add top padding to avoid hamburger button */
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Overlay when sidebar is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 999;
        backdrop-filter: blur(2px);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .homepage-main {
        width: 100%;
        margin-left: 0;
    }

    /* Add top padding to page content to avoid hamburger button when sidebar is closed */
    .page-main {
        padding-top: 80px;
    }

    .photo-slideshow {
        width: 100%;
    }

    .photo-slideshow {
        height: 100vh;
        min-height: 100vh;
    }

    .conference-info-box {
        padding: 2.5rem 3rem;
        max-width: 85%;
    }

    .conference-info-box h1 {
        font-size: 2.6rem;
    }

    .collaborator-banner {
        padding: 1rem 1.5rem;
    }

    .banner-content {
        gap: 3rem;
        padding: 0 1rem;
    }

    .logo-item {
        max-width: 220px;
        height: 80px;
    }
}

@media (max-width: 768px) {
    .page-layout,
    .homepage-layout {
        padding: 0;
        position: relative;
    }

    .photo-slideshow {
        height: 100vh;
        min-height: 100vh;
    }

    .conference-info-box {
        padding: 1.5rem 1.5rem;
        max-width: 95%;
        margin: 0 auto;
    }

    .conference-info-box h1 {
        font-size: 2rem;
        margin-bottom: 1rem;
    }

    .conference-info-box .hero-kicker {
        font-size: 0.75rem;
    }

    .hero-meta {
        margin-bottom: 1.4rem;
    }

    .hero-meta span {
        font-size: 0.85rem;
    }

    article > h2:first-child {
        font-size: 2rem;
    }

    .collaborator-banner {
        padding: 1rem 0.5rem;
    }

    .banner-content {
        flex-direction: row;
        gap: 1rem;
        padding: 0 0.5rem;
        justify-content: space-around;
        align-items: center;
    }

    .logo-item {
        max-width: 140px;
        min-height: 60px;
        height: auto;
        flex: 1;
        display: flex;
        align-items: center;
    }

    .sidebar-nav ul li a {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
        touch-action: manipulation;
    }

    .sidebar-nav ul li {
        min-height: 44px;
    }

    article h1 {
        font-size: 2rem;
    }

    article h2 {
        font-size: 1.6rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    article h1 {
        font-size: 1.75rem;
    }

    .conference-info-box {
        padding: 1.2rem 1rem;
        max-width: 98%;
    }

    .conference-info-box h1 {
        font-size: 1.6rem;
    }

    .hero-meta span {
        font-size: 0.75rem;
        padding: 0.25rem 0.7rem;
    }

    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
    }

    .collaborator-banner {
        padding: 0.8rem 0.5rem;
    }

    .banner-content {
        flex-direction: row;
        gap: 0.5rem;
        padding: 0 0.25rem;
        justify-content: space-around;
        align-items: center;
    }

    .logo-item {
        max-width: 120px;
        min-height: 55px;
        height: auto;
        flex: 1;
        display: flex;
        align-items: center;
    }

    /* Improve image loading on mobile */
    .photo-slideshow img {
        object-fit: cover;
        width: 100%;
        height: 100%;
    }

    /* Better spacing for conference info on very small screens */
    .conference-info-box {
        line-height: 1.4;
    }

    .sidebar {
        width: 260px;
        padding: 1rem;
        padding-top: 65px; /* Add top padding to avoid hamburger button */
    }

    /* Overlay when sidebar is open */
    .sidebar.open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
    }

    .sidebar-nav ul li a {
        padding: 0.5rem 0.7rem;
        font-size: 0.85rem;
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
        touch-action: manipulation;
    }

    /* Improve touch targets on mobile */
    .sidebar-nav ul li {
        min-height: 44px;
    }

    /* Prevent text selection on mobile menu toggle */
    .mobile-menu-toggle,
    .mobile-menu-toggle span {
        user-select: none;
        -webkit-user-select: none;
    }

    .mobile-menu-toggle {
        width: 45px;
        height: 45px;
        top: 10px;
        left: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .photo-slideshow .slide,
    .photo-slideshow .slide img,
    .btn {
        transition: none;
    }

    .photo-slideshow .slide.active img {
        transform: none;
    }
}
