/* Modern Layout - CS Manchester Style */

/* CSS Reset and Base Styles */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    background: #fff;
}

/* Header */
.modern-header {
    background: linear-gradient(135deg, #660099 0%, #4d0073 100%);
    color: #fff;
    padding: 1rem 0 0 0;
}

/* Add bottom padding only when hero section is hidden (home page) */
body.home .modern-header {
    padding-bottom: 1rem;
    border-bottom: 3px solid #4d0073;
}

.modern-header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1.5rem;
    min-height: 70px;
}

.modern-logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    grid-column: 1;
}

.modern-logo img {
    height: 50px;
    display: block;
}

.header-title {
    text-align: center;
    justify-self: center;
    grid-column: 2;
}

.header-title h1 {
    font-size: 1.3rem;
    margin: 0;
    font-weight: 700;
    color: #fff;
}

.header-university-link {
    text-align: right;
    justify-self: end;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    grid-column: 3;
}

.header-university-link a {
    color: #fff;
    text-decoration: none;
    font-size: 0.9rem;
    white-space: nowrap;
    display: inline-block;
}

/* Navigation - Hidden (using left sidebar instead) */
.modern-nav {
    display: none;
}

/* Hero Section - Page subtitle */
.hero-section {
    background: linear-gradient(135deg, #660099 0%, #4d0073 100%);
    color: #fff;
    padding: 0.75rem 20px;
    text-align: center;
    border-bottom: 3px solid #4d0073;
}

.hero-section h1 {
    font-size: 1.1rem;
    margin: 0;
    font-weight: 600;
}

.hero-section p {
    font-size: 0.85rem;
    max-width: 700px;
    margin: 0.3rem auto 0 auto;
    line-height: 1.4;
}

/* Alternative: Show hero for description only */
.hero-section.with-description {
    display: block;
    background: transparent;
    color: #fff;
    padding: 0 20px 1.5rem 20px;
    text-align: center;
    margin-top: -1rem;
}

.hero-section.with-description h1 {
    display: none;
}

.hero-section.with-description p {
    font-size: 0.95rem;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.5;
}

/* Main Content Container */
.modern-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 2rem 20px;
}

/* Grid Layout - Left sidebar + Main + Right sidebar */
.content-grid {
    display: grid;
    /* Left menu at 200px, right news column compact */
    grid-template-columns: 200px 1fr minmax(180px, 220px);
    gap: 2rem;
    margin-top: 1rem;
}

@media (max-width: 900px) {
    .content-grid {
        /* Keep two columns; left menu stays at max 200px */
        grid-template-columns: minmax(150px, 200px) 1fr;
        gap: 1.25rem;
    }
    /* Keep left menu as a narrow column; move right sidebar below */
    .left-sidebar {
        order: initial;
        max-width: 200px;
        overflow: hidden;
    }
    .sidebar {
        grid-column: 1 / -1;
    }
}

/* Stack to single column on small screens */
@media (max-width: 768px) {
    .content-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .left-sidebar {
        max-width: 100%;
    }
}

/* Card Styles */
.card,
.content-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 0 2rem 2rem 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 2rem;
}

/* Ensure some space above the first title in the middle column content area */
.content-card { padding-top: 1.25rem; }

.card h1,
.content-card h1 {
    color: #660099;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-size: 14pt;
    font-weight: 700;
}

/* First h1 in the card should have no top margin */
.card h1:first-child,
.content-card h1:first-child {
    margin-top: 0;
}

.card h2,
.content-card h2 {
    color: #660099;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-size: 14pt;
    font-weight: 700;
}

.card h3,
.content-card h3 {
    color: #333;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 14pt;
    font-weight: 600;
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: 20px;
}

.left-sidebar {
    position: sticky;
    top: 20px;
    max-width: 200px;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.left-sidebar .card {
    background: #f9f9f9;
    padding: 0 0.5rem 0.5rem 0.5rem;
    overflow: hidden;
}

/* Reduce the gap above the first left menu link (left menu uses a <p> wrapper) */
.left-sidebar .card p { margin: 0.2rem 0; }

/* Ensure grid items can shrink and not impose intrinsic min-content widths */
.left-sidebar,
.sidebar,
.main-content {
    min-width: 0;
}

/* Add space above first heading in main content cards (home and similar pages) */
.main-content > .card { padding-top: 1.25rem; }

/* Fallback: when headings are direct children of main content (not wrapped in a content card) */
.main-content > h1:first-child,
.main-content > h2:first-child,
.main-content > h3:first-child { margin-top: 0.75rem; }

.sidebar .card {
    background: #f9f9f9;
    padding: 0 0.5rem 0.5rem 0.5rem;
}

.sidebar h3,
.left-sidebar h3 {
    color: #660099;
    font-size: 0.95rem;
    border-bottom: 2px solid #660099;
    padding-bottom: 0.3rem;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.sidebar ul,
.left-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar li,
.left-sidebar li {
    margin-bottom: 0.35rem;
}

.sidebar a,
.left-sidebar a {
    color: #214C9D;
    text-decoration: none;
    display: block;
    padding: 0.35rem 0.4rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    line-height: 1.3;
}

/* Reduce extra gap above the first left-menu link (e.g., "Home") across the site */
.left-sidebar .card ul:first-of-type li:first-child a { padding-top: 0.15rem; }

/* Featured News items in sidebar - underline the links */
.sidebar li a {
    text-decoration: underline;
    display: inline;
    padding: 0;
    background: transparent;
}

.sidebar li a:hover {
    color: #660099;
    background: transparent;
    padding: 0;
}

.sidebar a:hover,
.left-sidebar a:hover {
    background: #660099;
    color: #fff;
    padding-left: 0.7rem;
}

/* Submenu Styles */
.left-sidebar a.has-submenu {
    font-weight: 600;
    position: relative;
}

.left-sidebar a.has-submenu::after {
    content: " \25BC";
    font-size: 0.6rem;
    opacity: 0.6;
    margin-left: 0.2rem;
}

/* Keep parent styling when on submenu pages */
.left-sidebar a.active-parent {
    font-weight: 600;
    background: #e6d9f2;
    color: #660099;
    padding-left: 0.7rem;
}

.submenu-container {
    display: none;
    background: #e8d9f5;
    border-left: 3px solid #660099;
    margin: 0.2rem 0 0.3rem 0;
    padding: 0.15rem 0;
    border-radius: 0 4px 4px 0;
}

/* Level 3 submenu (nested submenu) */
.submenu-container.level-3 {
    background: #dcc7ed;
    border-left: 3px solid #8b4db8;
    margin: 0.15rem 0 0.15rem 0.5rem;
    padding: 0.15rem 0;
}

.left-sidebar a.submenu {
    padding: 0.3rem 0.4rem 0.3rem 1.2rem;
    font-size: 0.85rem;
    color: #4d0073;
    background: transparent;
}

/* Submenu section headers (non-clickable) */
.submenu-header {
    display: block;
    padding: 0.35rem 0.4rem 0.2rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: #660099;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 0.35rem;
}

.submenu-header:first-child {
    margin-top: 0;
}

/* Indented submenu items */
.left-sidebar a.submenu.indented {
    padding-left: 1.6rem;
}

.left-sidebar a.submenu.indented:hover {
    padding-left: 2rem;
}

/* Level 2 submenu items that have level 3 children */
.left-sidebar a.submenu.has-submenu {
    font-weight: 600;
    position: relative;
}

.left-sidebar a.submenu.has-submenu::after {
    content: " \25B6";
    font-size: 0.6rem;
    opacity: 0.6;
    margin-left: 0.3rem;
}

/* Level 3 submenu items */
.left-sidebar a.submenu.level-3 {
    padding: 0.25rem 0.4rem 0.25rem 1.6rem;
    font-size: 0.8rem;
    color: #5a3a70;
}

.left-sidebar a.submenu:hover {
    background: #660099;
    color: #fff;
    padding-left: 1.5rem;
}

.left-sidebar a.submenu.level-3:hover {
    background: #8b4db8;
    color: #fff;
    padding-left: 2rem;
}

/* News Items */
.news-item {
    border-left: 4px solid #660099;
    padding-left: 0.75rem;
    margin-bottom: 1rem;
}

.news-item h4 {
    margin: 0 0 0.35rem 0;
    color: #660099;
    font-size: 0.9rem;
    font-weight: 600;
}

.news-date {
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 0.35rem;
}

.news-item p {
    font-size: 0.875rem;
    line-height: 1.4;
}

/* News feed links in sidebar - only right sidebar, not left menu */
.sidebar p a {
    text-decoration: underline !important;
    font-size: 0.8rem;
    padding: 0 !important;
    display: inline !important;
    background: transparent !important;
}

.sidebar p a:hover {
    color: #660099;
    background: transparent !important;
}

.sidebar p a img {
    width: 14px;
    height: 14px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #660099;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn:hover {
    background: #4d0073;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 0, 153, 0.3);
}

.btn-secondary {
    background: #fff;
    color: #660099;
    border: 2px solid #660099;
}

.btn-secondary:hover {
    background: #660099;
    color: #fff;
}

/* Footer */
.modern-footer {
    background: #333;
    color: #fff;
    margin-top: 4rem;
    padding: 3rem 20px 1rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    color: #fff;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #660099;
    padding-bottom: 0.5rem;
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: #ccc;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-section a:hover {
    color: #fff;
}

.footer-bottom {
    border-top: 1px solid #555;
    padding-top: 1rem;
    text-align: center;
    font-size: 0.9rem;
    color: #999;
}

/* Footer Logos Section */
.footer-logos {
    background: #fff;
    padding: 2rem 1rem;
    text-align: center;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.footer-logos p {
    margin: 1rem 0;
    line-height: 1.8;
}

.footer-logos a {
    display: inline-block;
    margin: 0.5rem;
}

/* Breadcrumb */
.breadcrumb {
    padding: 1rem 0;
    font-size: 0.9rem;
    color: #666;
}

.breadcrumb a {
    color: #660099;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }

/* Responsive */
@media (max-width: 768px) {
    .modern-header-container {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 1rem;
    }
    
    .modern-logo,
    .header-title,
    .header-university-link {
        justify-self: center;
    }
    
    .modern-nav ul {
        flex-direction: column;
    }
    
    .modern-nav a {
        border-left: 3px solid transparent;
        border-bottom: none;
    }
    
    .modern-nav a:hover {
        border-left-color: #660099;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .hero-section p {
        font-size: 1rem;
    }
}

/* Research Menu Styles */
.research-menu h3 {
    color: #660099;
    font-size: 1.3rem;
    margin-top: 0;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #660099;
}

.research-menu .submenu-section {
    margin-bottom: 2rem;
}

.research-menu .submenu-section h4 {
    color: #4d0073;
    font-size: 1.1rem;
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.research-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.research-menu ul li {
    margin-bottom: 0.5rem;
}

.research-menu ul li a {
    color: #333;
    text-decoration: none;
    display: block;
    padding: 0.4rem 0.5rem;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.research-menu ul li a:hover {
    color: #660099;
    border-left-color: #660099;
    background: #f5f5f5;
    padding-left: 0.75rem;
}

.research-menu ul li a:active,
.research-menu ul li a.active {
    color: #660099;
    border-left-color: #660099;
    background: #f0e6f6;
    font-weight: 600;
}

/* Resources Menu Styles */
.resources-menu h3 {
    color: #660099;
    font-size: 1.3rem;
    margin-top: 0;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #660099;
}

.resources-menu .submenu-section {
    margin-bottom: 1.5rem;
}

.resources-menu .submenu-section h4 {
    color: #4d0073;
    font-size: 1.05rem;
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.resources-menu .submenu-section h4 a {
    color: #4d0073;
    text-decoration: none;
}

.resources-menu .submenu-section h4 a:hover {
    color: #660099;
    text-decoration: underline;
}

.resources-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.resources-menu ul li {
    margin-bottom: 0.35rem;
}

.resources-menu ul li a {
    color: #333;
    text-decoration: none;
    display: block;
    padding: 0.3rem 0.5rem;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

/* Prevent long labels from forcing width expansion in the left menu */
.left-navigation, .left-sidebar {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.resources-menu ul li a:hover {
    color: #660099;
    border-left-color: #660099;
    background: #f5f5f5;
    padding-left: 0.75rem;
}

.resources-menu ul li a:active,
.resources-menu ul li a.active {
    color: #660099;
    border-left-color: #660099;
    background: #f0e6f6;
    font-weight: 600;
}

/* Third level submenu for resources */
.resources-menu ul.sub-level-3 {
    margin-left: 1rem;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
}

.resources-menu ul.sub-level-3 li {
    margin-bottom: 0.25rem;
}

.resources-menu ul.sub-level-3 li a {
    font-size: 0.85rem;
    padding: 0.2rem 0.4rem;
    color: #666;
}

.resources-menu ul.sub-level-3 li a:hover {
    color: #660099;
    padding-left: 0.6rem;
}

/* Utility: compact headings inside a container */
.heading-compact h1 {
    font-size: 14pt;
    font-weight: normal;
    margin-top: 0.5rem;
    margin-bottom: 0.75rem;
}

/* Bold only the first/main h1 within compact sections */
.heading-compact h1:first-of-type {
    font-weight: 700;
}

.heading-compact h2 {
    font-size: 1rem;
    font-weight: normal;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    border: none;
    padding: 0;
}

.heading-compact h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-top: 0.75rem;
    margin-bottom: 0.35rem;
}

/* Content card list spacing - more space between bullet points */
.content-card ul li,
.card ul li {
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* Scoped table frames: apply only to containers opting in */
.table-framed table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #ccc;
    margin: 0.75rem 0 1rem 0;
}

.table-framed th,
.table-framed td {
    border: 1px solid #ccc;
    padding: 6px 8px;
    vertical-align: top;
}

/* Subtle header styling even if the first row is used as header */
.table-framed th {
    background: #f7f7f9;
    color: #333;
    font-weight: 600;
}

/* News list table: keep the date on one line and allocate a compact fixed width */
.news-list table th:first-child,
.news-list table td:first-child {
    white-space: nowrap;
    width: 12ch; /* fits YYYY-MM-DD with extra breathing room */
}

/* Prevent long titles from forcing the table off-screen */
.news-list table {
    table-layout: auto;
}

/* External collaboration page: thin lines between entries */
.collab-list table {
    width: 100%;
    border-collapse: collapse;
}

.collab-list table tr {
    border-bottom: 1px solid #e0e0e0;
}

.collab-list table tr:last-child {
    border-bottom: none;
}

.collab-list table td {
    padding: 0.75rem 0.5rem;
    vertical-align: top;
}