/*
Theme Name: CES - Center for Energy Storage
Theme URI: https://ces.hku.hk
Description: Official website theme for Center for Energy Storage (CES) at The University of Hong Kong.
Version: 1.0
Author: CES HKU
Author URI: https://ces.hku.hk
License: All Rights Reserved
*/

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang TC', 'PingFang SC', 'Microsoft JhengHei', 'Microsoft YaHei', 'Noto Sans TC', 'Noto Sans SC', sans-serif;
    color: #333;
    background-color: #fff;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
}

/* ===== Top Utility Bar ===== */
.top-bar {
    background-color: #1a5f7a;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    padding: 0.4rem 0;
}

.top-bar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.lang-switcher {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.lang-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.82rem;
    cursor: pointer;
    padding: 0.2rem 0.45rem;
    border-radius: 3px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.lang-btn:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.15);
}

.lang-btn.active {
    color: #fff;
    font-weight: 700;
    background-color: rgba(255, 255, 255, 0.2);
}

.lang-sep {
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.75rem;
}

.top-contact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.contact-sep {
    color: rgba(255, 255, 255, 0.35);
}

/* ===== Site Header (Logo Bar) ===== */
.site-header {
    background-color: #fff;
    padding: 1rem 0;
    border-bottom: 1px solid #e0e0e0;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo-link {
    flex-shrink: 0;
}

.hku-logo {
    height: 70px;
    width: auto;
}

.header-title {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.site-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1a5f7a;
    letter-spacing: 0.3px;
}

.site-subtitle {
    font-size: 1.3rem;
    font-weight: 700;
    color: #2a7a96;
}

/* ===== Main Navigation ===== */
.main-nav {
    background-color: #2a7a96;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-list {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    align-items: stretch;
}

.nav-item {
    flex: 1;
    display: flex;
    border-right: 1px solid rgba(255, 255, 255, 0.3);
}

.nav-item:last-child {
    border-right: none;
}

.nav-item a {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    padding: 1rem 1.5rem;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    min-height: 3.5rem;
    transition: background-color 0.25s ease;
}

.nav-item a:hover {
    background-color: #1a5f7a;
}

.nav-item.active a {
    background-color: #1a5f7a;
    box-shadow: inset 0 -3px 0 #fff;
}

.nav-highlight a {
    background: linear-gradient(135deg, #d4a017, #e8b828);
    color: #fff !important;
    font-size: 1.05rem;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.nav-highlight a:hover {
    background: linear-gradient(135deg, #c4920f, #d4a017) !important;
}

.nav-highlight.active a {
    background: linear-gradient(135deg, #b8860b, #c4920f);
    box-shadow: inset 0 -3px 0 #fff;
}

/* ===== Page Sections (SPA-style) ===== */
.page-section {
    display: none;
}

.page-section.active {
    display: block;
}

/* ===== Hero Banner ===== */
.hero-banner {
    position: relative;
    width: 100%;
    max-height: 400px;
    overflow: hidden;
}

.hero-img {
    width: 100%;
    height: 400px;
    object-fit: cover;
    display: block;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to right,
        rgba(26, 95, 122, 0.85) 0%,
        rgba(42, 122, 150, 0.5) 50%,
        transparent 100%
    );
    display: flex;
    align-items: center;
    padding-left: 4rem;
}

.hero-text {
    color: #fff;
    font-size: 2.8rem;
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    line-height: 1.3;
}

/* ===== Main Content ===== */
.site-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.content-section h2 {
    font-size: 1.8rem;
    color: #1a5f7a;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #2a7a96;
}

.content-section h2:first-child {
    margin-top: 0;
}

.content-section p {
    font-size: 1.05rem;
    color: #555;
    line-height: 1.9;
    margin-bottom: 1rem;
    text-align: justify;
}

.content-section p:last-child {
    margin-bottom: 0;
}

.goals-list {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 1rem 0;
}

.goals-list li {
    font-size: 1.05rem;
    color: #555;
    line-height: 1.9;
    padding: 0.5rem 0 0.5rem 1.5rem;
    position: relative;
}

.goals-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 1.05rem;
    width: 8px;
    height: 8px;
    background-color: #2a7a96;
    border-radius: 50%;
}

.goals-list li strong {
    color: #1a5f7a;
}

.goals-list li:empty {
    display: none;
}

.content-section h3:empty,
.content-section h2:empty {
    display: none;
}

/* ===== Subpage Banner ===== */
.subpage-banner {
    background-color: #2a7a96;
    padding: 2rem 2rem;
    text-align: center;
}

.subpage-banner h2 {
    color: #fff;
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: 0.5px;
}

/* ===== Subpage Layout (sidebar + content) ===== */
.subpage-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 0;
    min-height: 400px;
}

/* ===== Sub Navigation (left sidebar) ===== */
.sub-nav {
    border-right: 1px solid #e0e0e0;
    padding-top: 0.5rem;
}

.sub-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sub-nav-item {
    border-bottom: 1px solid #eee;
}

.sub-nav-item a {
    display: block;
    padding: 0.9rem 1.2rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: #555;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sub-nav-item a:hover {
    color: #1a5f7a;
    background-color: #f0f7fa;
}

.sub-nav-item.active a {
    color: #1a5f7a;
    font-weight: 700;
    background-color: #e8f4f8;
    border-left-color: #2a7a96;
}

/* ===== Sub Content (right panel) ===== */
.sub-content {
    padding: 2rem 2.5rem;
}

.sub-tab-panel {
    display: none;
}

.sub-tab-panel.active {
    display: block;
}

.sub-tab-panel h3 {
    font-size: 1.5rem;
    color: #1a5f7a;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #2a7a96;
}

.sub-tab-panel p {
    font-size: 1.05rem;
    color: #555;
    line-height: 1.9;
    margin-bottom: 1rem;
    text-align: justify;
}

/* ===== Service Tables ===== */
.service-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0 2rem 0;
    font-size: 0.95rem;
}

.service-table th {
    background-color: #2a7a96;
    color: #fff;
    font-weight: 600;
    padding: 0.75rem 1rem;
    text-align: left;
    border: 1px solid #238399;
}

.service-table td {
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    vertical-align: top;
    color: #555;
}

.service-table td:first-child {
    text-align: center;
    min-width: 160px;
}

.product-img {
    display: block;
    width: 140px;
    height: auto;
    margin: 0 auto 0.5rem auto;
    border-radius: 4px;
    border: 1px solid #eee;
}

.service-table td:first-child span {
    display: block;
    font-weight: 600;
    color: #1a5f7a;
    font-size: 0.9rem;
}

.service-table tbody tr:nth-child(even) {
    background-color: #f8fbfc;
}

.service-table tbody tr:hover {
    background-color: #eef6f9;
}

.feature-list {
    list-style: none !important;
    padding: 0;
    margin: 0;
}

.feature-list li {
    list-style: none !important;
    padding: 0.2rem 0 0.2rem 1rem;
    position: relative;
    line-height: 1.6;
    font-size: 0.9rem;
}

.feature-list li::before {
    content: '\2022';
    position: absolute;
    left: 0;
    color: #2a7a96;
    font-weight: bold;
}

.feature-list li::marker {
    content: '' !important;
    font-size: 0 !important;
}

.feature-list li.hidden-item,
.feature-list li:empty {
    display: none !important;
    padding: 0 !important;
    margin: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

.feature-list li.hidden-item::before,
.feature-list li.hidden-item::marker,
.feature-list li:empty::before,
.feature-list li:empty::marker {
    content: none !important;
    display: none !important;
}

/* ===== Custom Service Blocks ===== */
.custom-block {
    margin-bottom: 1.5rem;
    padding: 1.2rem 1.5rem;
    background-color: #f8fbfc;
    border-left: 4px solid #2a7a96;
    border-radius: 0 4px 4px 0;
}

.custom-block h4 {
    font-size: 1.05rem;
    color: #1a5f7a;
    margin-bottom: 0.5rem;
}

.custom-block p {
    margin-bottom: 0;
}

.custom-note {
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    background-color: #fffde7;
    border-left: 4px solid #fbc02d;
    border-radius: 0 4px 4px 0;
    font-size: 0.9rem;
}

.custom-note p {
    color: #666;
    margin: 0;
    font-size: 0.9rem;
}

/* ===== Sidebar Contact Box ===== */
.sidebar-contact-box {
    margin: 1.5rem 1rem;
    padding: 1.2rem 1rem;
    background: linear-gradient(135deg, #e8f4f8, #d0eaf2);
    border-radius: 8px;
    border: 1px solid #a0cfe0;
}

.sidebar-contact-box h4 {
    font-size: 0.95rem;
    color: #1a5f7a;
    margin-bottom: 0.6rem;
    border-bottom: 2px solid #2a7a96;
    padding-bottom: 0.4rem;
    line-height: 1.4;
}

.sidebar-contact-box p {
    margin-bottom: 0.3rem;
    font-size: 0.85rem;
    color: #444;
    line-height: 1.5;
}

.sidebar-contact-box a {
    color: #2a7a96;
}

.sidebar-contact-box a:hover {
    text-decoration: underline;
}

/* Click link lines */
.click-link-line {
    margin-top: 0.6rem;
    font-size: 0.95rem;
    color: #555;
}

.info-link {
    color: #d4a017;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s;
}

.info-link:hover {
    color: #b8860b;
}

/* Info Modal */
.info-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.info-modal-overlay.active {
    display: flex;
}

.info-modal {
    background: #fff;
    border-radius: 12px;
    padding: 2.5rem 3rem;
    max-width: 460px;
    width: 90%;
    position: relative;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
    animation: modalIn 0.25s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.info-modal-close {
    position: absolute;
    top: 0.8rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: #999;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.info-modal-close:hover {
    color: #333;
}

.info-modal-body .uc-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.info-modal-body h3 {
    font-size: 1.3rem;
    color: #1a5f7a;
    margin-bottom: 0.8rem;
}

.info-modal-body p {
    font-size: 1rem;
    color: #666;
    line-height: 1.6;
}

.sub-tab-panel h4 {
    font-size: 1.1rem;
    color: #1a5f7a;
    margin: 1.5rem 0 0.8rem 0;
    font-weight: 600;
}

/* ===== Under Construction ===== */
.under-construction {
    text-align: center;
    padding: 4rem 2rem;
}

.uc-icon {
    font-size: 4rem;
    color: #2a7a96;
    margin-bottom: 1rem;
    animation: spin 4s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.under-construction h2 {
    border-bottom: none;
    text-align: center;
}

.uc-text {
    font-size: 1.15rem;
    color: #888;
    text-align: center;
}

/* ===== Contact Page ===== */
.contact-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin-top: 1.5rem;
}

.contact-info-block {
    margin-bottom: 1.5rem;
}

.contact-info-block h3 {
    font-size: 1.3rem;
    color: #1a5f7a;
    margin-bottom: 0.3rem;
}

.contact-info-block h4 {
    font-size: 1rem;
    color: #1a5f7a;
    margin-bottom: 0.2rem;
    font-weight: 600;
}

.contact-info-block p {
    font-size: 1rem;
    color: #555;
    margin-bottom: 0;
}

.contact-info-block a {
    color: #2a7a96;
    transition: color 0.2s;
}

.contact-info-block a:hover {
    color: #1a5f7a;
    text-decoration: underline;
}

.contact-campus-img {
    margin-top: 1rem;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.contact-campus-img img {
    width: 100%;
    display: block;
}

/* ===== Contact Form ===== */
.contact-form-wrapper h3 {
    font-size: 1.3rem;
    color: #1a5f7a;
    margin-bottom: 0.3rem;
}

.form-desc {
    font-size: 0.95rem;
    color: #888;
    margin-bottom: 1.5rem;
}

.contact-form .form-group {
    margin-bottom: 1.2rem;
}

.contact-form label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: #444;
    margin-bottom: 0.3rem;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 0.65rem 0.8rem;
    font-size: 0.95rem;
    font-family: inherit;
    border: 1px solid #ccc;
    border-radius: 4px;
    transition: border-color 0.2s;
    background-color: #fafafa;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: #2a7a96;
    background-color: #fff;
}

.contact-form textarea {
    resize: vertical;
}

.form-submit {
    display: inline-block;
    padding: 0.7rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background-color: #2a7a96;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.25s;
}

.form-submit:hover {
    background-color: #1a5f7a;
}

.form-success {
    margin-top: 1.5rem;
    padding: 1rem 1.5rem;
    background-color: #e8f5e9;
    border-left: 4px solid #4caf50;
    border-radius: 4px;
}

.form-success p {
    color: #2e7d32;
    font-weight: 600;
    margin: 0;
}

/* ===== Footer ===== */
.site-footer {
    background-color: #1a5f7a;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    padding: 1.5rem 2rem;
    font-size: 0.9rem;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .top-bar-inner {
        flex-direction: column;
        gap: 0.3rem;
        padding: 0.2rem 1rem;
    }

    .header-inner {
        flex-direction: column;
        text-align: center;
        padding: 0.8rem 1rem;
    }

    .header-title {
        justify-content: center;
    }

    .site-title {
        font-size: 1.3rem;
    }

    .hku-logo {
        height: 55px;
    }

    .nav-list {
        flex-wrap: wrap;
    }

    .nav-item {
        flex: 1 1 50%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }

    .nav-item:nth-child(odd) {
        border-right: 1px solid rgba(255, 255, 255, 0.3);
    }

    .nav-item:nth-child(even) {
        border-right: none;
    }

    .hero-img {
        height: 200px;
    }

    .hero-text {
        font-size: 1.6rem;
    }

    .hero-overlay {
        padding-left: 2rem;
    }

    .site-content {
        padding: 2rem 1rem;
    }

    .contact-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .subpage-layout {
        grid-template-columns: 1fr;
    }

    .sub-nav {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        padding-top: 0;
    }

    .sub-nav-list {
        display: flex;
    }

    .sub-nav-item {
        flex: 1;
        border-bottom: none;
        border-right: 1px solid #eee;
    }

    .sub-nav-item:last-child {
        border-right: none;
    }

    .sub-nav-item a {
        text-align: center;
        border-left: none;
        border-bottom: 3px solid transparent;
        padding: 0.8rem 0.5rem;
        font-size: 0.85rem;
    }

    .sub-nav-item.active a {
        border-left-color: transparent;
        border-bottom-color: #2a7a96;
    }

    .sub-content {
        padding: 1.5rem 1rem;
    }

    .service-table {
        display: block;
        overflow-x: auto;
        font-size: 0.85rem;
    }

    .custom-block {
        padding: 1rem;
    }

    .sidebar-contact-box {
        margin: 1rem 0.5rem;
        padding: 1rem 0.8rem;
    }
}

@media (max-width: 480px) {
    .nav-item {
        flex: 1 1 100%;
        border-right: none;
    }

    .nav-item a {
        justify-content: center;
        text-align: center;
    }

    .hero-text {
        font-size: 1.3rem;
    }
}
