/* Flask page styles. Shared card and publication styles also live in
   css/style.css, which Flask serves alongside these additions. */

/* ---- Homepage notice popup ---- */
.notice-popup {
    width: fit-content;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.3);
    overflow: auto;
}
.notice-popup::backdrop { background: rgba(15, 23, 42, 0.55); }
.notice-popup-image {
    display: block;
    width: auto;
    height: auto;
    max-width: min(560px, calc(100vw - 24px));
    max-height: calc(100vh - 84px);
    max-height: calc(100dvh - 84px);
    margin: 0 auto;
}
.notice-popup-actions {
    display: flex;
    align-items: stretch;
    border-top: 1px solid #e5e7eb;
    background: #fff;
}
.notice-popup-actions button {
    min-height: 52px;
    padding: 12px 16px;
    border: 0;
    background: transparent;
    color: #334155;
    font: inherit;
    font-size: 14px;
    line-height: 1.5;
    cursor: pointer;
}
.notice-popup-actions [data-popup-hide-today] { flex: 1; }
.notice-popup-actions [data-popup-close] { border-left: 1px solid #e5e7eb; font-weight: 700; }
.notice-popup-actions button:hover { background: #f1f5f9; }
.notice-popup-actions button:focus-visible { outline: 2px solid #0463fa; outline-offset: -4px; }
html.notice-popup-open, html.notice-popup-open body { overflow: hidden; }

/* ---- Member section cards: postdoc / phd / ms / undergrad ---- */
.postdoc-section, .phd-section, .ms-section, .undergrad-section { padding: 40px 0; }
.postdoc-title, .phd-title, .ms-title, .undergrad-title { margin-bottom: 40px; text-align: center; }

.postdoc-item, .phd-item, .ms-item, .undergrad-item {
    margin-bottom: 30px;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    height: 300px;
}
.postdoc-container, .phd-container, .ms-container, .undergrad-container { display: flex; height: 100%; }
.postdoc-container.reverse, .phd-container.reverse, .ms-container.reverse, .undergrad-container.reverse { flex-direction: row-reverse; }

.postdoc-image, .phd-image, .ms-image, .undergrad-image {
    width: 280px;
    height: 330px;
    position: relative;
    overflow: hidden;
}
.postdoc-image img, .phd-image img, .ms-image img, .undergrad-image img {
    width: 100%; height: 100%; object-fit: cover;
}
.postdoc-content, .phd-content, .ms-content, .undergrad-content {
    width: 60%;
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.postdoc-container.reverse .postdoc-content,
.phd-container.reverse .phd-content,
.ms-container.reverse .ms-content,
.undergrad-container.reverse .undergrad-content { text-align: right; align-items: flex-end; }

.postdoc-name, .phd-name, .ms-name, .undergrad-name {
    font-size: 24px; font-weight: bold; margin-bottom: 15px; color: var(--dark);
}
.postdoc-info, .phd-info, .ms-info, .undergrad-info { margin-bottom: 10px; }
.postdoc-label, .phd-label, .ms-label, .undergrad-label {
    font-weight: bold; margin-bottom: 5px; color: var(--primary);
}
.postdoc-text, .phd-text, .ms-text, .undergrad-text { color: var(--dark); margin-bottom: 15px; }

@media (max-width: 768px) {
    .postdoc-container, .postdoc-container.reverse,
    .phd-container, .phd-container.reverse,
    .ms-container, .ms-container.reverse,
    .undergrad-container, .undergrad-container.reverse { flex-direction: column; height: auto; }
    .postdoc-image, .postdoc-content,
    .phd-image, .phd-content,
    .ms-image, .ms-content,
    .undergrad-image, .undergrad-content { width: 100%; }
    .postdoc-item, .phd-item, .ms-item, .undergrad-item { height: auto; }
    .postdoc-content, .postdoc-container.reverse .postdoc-content,
    .phd-content, .phd-container.reverse .phd-content,
    .ms-content, .ms-container.reverse .ms-content,
    .undergrad-content, .undergrad-container.reverse .undergrad-content { text-align: left; align-items: flex-start; }
}

/* ---- Alumni ---- */
.alumni-section { padding: 40px 0; }
.alumni-title { margin-bottom: 24px; text-align: center; }
.alumni-list { display: grid; gap: 8px; }
.alumni-item {
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
    display: grid;
    grid-template-columns: 1.2fr 1fr 1.4fr;
    gap: 12px;
    font-size: 15px;
}
.alumni-item strong { color: var(--dark); }
@media (max-width: 768px) { .alumni-item { grid-template-columns: 1fr; } }

/* ---- Patent status and country ---- */
.patent-header { flex-wrap: wrap; gap: 0.75rem; }
.patent-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.patent-status, .patent-country {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
}
.patent-status-filed { background: #e8f0ff; color: #1d4ed8; }
.patent-status-registered { background: #dcfce7; color: #166534; }
.patent-status-unknown, .patent-country { background: #f3f4f6; color: #4b5563; }

/* ---- Photo gallery ---- */
.gallery-section { max-width: 1200px; margin: 0 auto; padding: 20px; }
.category-carousel {
    position: relative;
    background: #f3f4f6;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
    width: 100%;
}
.category-container {
    display: flex;
    justify-content: center;
    gap: 1rem;
    overflow: hidden;
    position: relative;
    padding: 0 40px;
    transition: transform 0.3s ease;
    width: calc(100% - 80px);
    max-width: 800px;
}
.category-btn {
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 9999px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex: 0 0 auto;
    min-width: fit-content;
    text-align: center;
    font-size: 0.875rem;
}
.category-btn.active { background: #2563eb; color: white; }
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    z-index: 2;
}
.carousel-btn:hover { background: #f3f4f6; }
.carousel-btn.prev { left: 8px; }
.carousel-btn.next { right: 8px; }
.carousel-btn:disabled { cursor: not-allowed; opacity: 0.5; }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}
.gallery-item {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.3s ease;
    height: 360px;
    display: flex;
    flex-direction: column;
}
.gallery-item:hover { transform: translateY(-4px); }
.gallery-item-image { width: 100%; height: 260px; position: relative; overflow: hidden; }
.gallery-item-image img { width: 100%; height: 100%; object-fit: cover; position: absolute; top: 0; left: 0; }
.gallery-item-content { padding: 1rem; flex: 1; display: flex; flex-direction: column; justify-content: space-between; }
.gallery-item-title {
    font-size: 1.125rem; font-weight: 600; margin: 0;
    overflow: hidden; text-overflow: ellipsis;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.gallery-item-date { font-size: 0.875rem; color: #666; margin: 0; }

.modal {
    display: none;
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 1000;
    padding: 2rem;
}
.modal.active { display: flex; align-items: center; justify-content: center; }
.modal-content { background: white; border-radius: 8px; max-width: 900px; width: 100%; position: relative; }
.modal-image-container { position: relative; width: 100%; height: 500px; background: #f3f4f6; }
.modal-image { width: 100%; height: 100%; object-fit: contain; }
.modal-nav-btn {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: white; border: none; width: 40px; height: 40px; border-radius: 50%;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); z-index: 1;
}
.modal-nav-btn:hover { background: #f3f4f6; }
.modal-nav-btn.prev { left: 1rem; }
.modal-nav-btn.next { right: 1rem; }
.modal-close {
    position: absolute; top: 1rem; right: 1rem;
    background: white; border: none; width: 32px; height: 32px; border-radius: 50%;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); z-index: 1;
}
.modal-info { padding: 1.5rem; }
.modal-title { font-size: 1.5rem; font-weight: bold; margin: 0 0 0.5rem 0; }
.modal-date { font-size: 0.875rem; color: #666; margin-bottom: 1rem; }
.modal-text { color: #333; line-height: 1.5; }

@media (max-width: 1024px) { .category-container { max-width: 700px; } .category-btn { padding: 0.5rem 1.25rem; } }
@media (max-width: 768px) {
    .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
    .gallery-item { height: 320px; }
    .gallery-item-image { height: 220px; }
    .modal { padding: 1rem; }
    .modal-image-container { height: 300px; }
    .category-container { max-width: 500px; gap: 0.75rem; }
    .category-btn { padding: 0.5rem 1rem; font-size: 0.8125rem; }
}
@media (max-width: 480px) {
    .gallery-item { height: 300px; }
    .gallery-item-image { height: 200px; }
    .category-container { max-width: 300px; gap: 0.5rem; padding: 0 35px; }
    .category-btn { padding: 0.5rem 0.75rem; font-size: 0.75rem; }
    .carousel-btn { width: 28px; height: 28px; }
}

/* ---- Project page ---- */
.project-page { color: var(--dark); }
.project-intro {
    max-width: 820px;
    margin-bottom: 56px;
}
.project-kicker {
    display: inline-block;
    margin-bottom: 12px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(4, 99, 255, 0.08);
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.project-intro h2 {
    margin-bottom: 16px;
    font-size: clamp(2rem, 3vw, 3rem);
}
.project-intro p {
    margin: 0;
    color: #6b7280;
    font-size: 1.05rem;
    line-height: 1.8;
}
.project-block + .project-block { margin-top: 72px; }
.project-section-heading {
    margin-bottom: 28px;
}
.project-section-label {
    display: inline-block;
    margin-bottom: 10px;
    color: var(--primary);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.project-section-heading h3 {
    margin: 0;
    font-size: clamp(1.7rem, 2.4vw, 2.35rem);
}
.project-feature-card {
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
}
.project-feature-image {
    position: relative;
    height: 240px;
    overflow: hidden;
}
.project-feature-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.project-feature-card:hover .project-feature-image img { transform: scale(1.04); }
.project-status-badge {
    position: absolute;
    top: 18px;
    left: 18px;
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.85);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.project-feature-body {
    padding: 26px 24px 24px;
}
.project-feature-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    margin-bottom: 16px;
    color: #6b7280;
    font-size: 14px;
}
.project-feature-meta span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.project-feature-body h4 {
    margin-bottom: 14px;
    font-size: 1.25rem;
    line-height: 1.5;
}
.project-feature-body p {
    margin: 0;
    color: #6b7280;
    line-height: 1.75;
}
.project-list {
    display: grid;
    gap: 16px;
}
.project-list-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 24px 28px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 20px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
}
.project-list-copy h4 {
    margin-bottom: 8px;
    font-size: 1.1rem;
    line-height: 1.6;
}
.project-list-copy p {
    margin: 0;
    color: #6b7280;
}
.project-list-meta {
    min-width: 220px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    color: #374151;
    font-size: 14px;
    text-align: right;
}
.project-list-tag {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(4, 99, 255, 0.08);
    color: var(--primary);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.project-archive-group + .project-archive-group { margin-top: 36px; }
.project-archive-group h4 {
    margin-bottom: 16px;
    font-size: 1.25rem;
}
.project-archive-table {
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.08);
}
.project-archive-table thead th {
    padding: 18px 20px;
    border: 0;
    background: #f8fafc;
    color: #475569;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.project-archive-table tbody td {
    padding: 18px 20px;
    border-color: rgba(15, 23, 42, 0.08);
    background: #fff;
    vertical-align: top;
}
.project-archive-title {
    font-weight: 600;
    line-height: 1.65;
}
.project-archive-period,
.project-archive-agency {
    color: #6b7280;
}

@media (max-width: 991px) {
    .project-list-item {
        flex-direction: column;
        align-items: stretch;
    }
    .project-list-meta {
        min-width: 0;
        align-items: flex-start;
        text-align: left;
    }
}

@media (max-width: 767px) {
    .project-block + .project-block { margin-top: 56px; }
    .project-feature-image { height: 220px; }
    .project-feature-body,
    .project-list-item,
    .project-archive-table thead th,
    .project-archive-table tbody td { padding-left: 18px; padding-right: 18px; }
}
