/* ==========================================================
   Shared stylesheet for mdoepke.github.io
   (book.htm keeps its own inline styles)
   ========================================================== */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #ffffff;
}

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

a {
    color: #1E3A5F;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ---------- Navigation Bar ---------- */
nav {
    background-color: #1E3A5F;
    padding: 0;
    margin-bottom: 30px;
}

nav ul {
    list-style: none;
    display: flex;
    padding: 0;
    max-width: 1000px;
    margin: 0 auto;
}

nav li {
    margin: 0;
}

nav a {
    display: block;
    color: white;
    text-decoration: none;
    padding: 15px 25px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background-color 0.3s;
}

nav a:hover {
    background-color: #2d4a6f;
}

nav a.active {
    background-color: #152d4a;
}

/* ---------- Page header (home & research) ---------- */
header {
    border-bottom: 3px solid #1E3A5F;
    padding-bottom: 25px;
    margin-bottom: 30px;
}

.header-content {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.profile-photo {
    width: 200px;
    flex-shrink: 0;
}

.profile-photo img {
    width: 100%;
    height: auto;
    display: block;
}

.header-text {
    flex: 1;
}

.header-text h1 {
    color: #1E3A5F;
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.header-text .title {
    color: #1E3A5F;
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.header-text .subtitle {
    color: #1E3A5F;
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.header-text .affiliation {
    color: #555;
    font-size: 1rem;
}

/* ---------- Simple page header (pictures, course pages) ---------- */
.page-header {
    padding-bottom: 20px;
}

.page-header h1 {
    color: #1E3A5F;
    font-size: 2.2rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.page-header .subtitle {
    color: #1E3A5F;
    font-size: 1.1rem;
}

.page-header .term {
    color: #555;
    font-size: 1rem;
}

/* ---------- Sections ---------- */
section {
    margin-bottom: 35px;
}

section h2 {
    color: #1E3A5F;
    font-size: 1.4rem;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e0e0e0;
}

/* ---------- Footer ---------- */
footer {
    text-align: center;
    padding: 20px 0;
    color: #666;
    font-size: 0.9rem;
    border-top: 2px solid #1E3A5F;
    margin-top: 40px;
}

/* ==========================================================
   Home page (index.html)
   ========================================================== */
.about-section {
    margin-bottom: 30px;
}

.about-section .research-statement {
    font-size: 1.1rem;
    font-style: italic;
    color: #444;
    line-height: 1.8;
    margin-bottom: 18px;
}

.about-section .roles {
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.profile-links {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.profile-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    color: #1E3A5F;
}

.profile-link svg {
    width: 20px;
    height: 20px;
    fill: #1E3A5F;
}

/* News, talks, and conference lists */
.news-list,
.past-conferences ul {
    list-style: none;
}

.news-list li,
.past-conferences li {
    margin-bottom: 15px;
    padding-left: 0;
    line-height: 1.6;
}

.section-divider {
    border: none;
    height: 1px;
    background: linear-gradient(to right, transparent, #1E3A5F, transparent);
    margin: 35px 0;
}

/* Featured book box */
.featured-book {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 30px;
    display: flex;
    gap: 25px;
    align-items: flex-start;
}

.featured-book img {
    width: 140px;
    height: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    flex-shrink: 0;
}

.featured-book-content {
    flex: 1;
}

.featured-book h3 {
    color: #1E3A5F;
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.featured-book h3 a {
    color: #1E3A5F;
}

.featured-book p {
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.featured-book .book-links {
    margin-top: 12px;
}

.featured-book .book-links a {
    display: inline-block;
    padding: 6px 14px;
    background-color: #1E3A5F;
    color: white;
    border-radius: 4px;
    font-size: 0.85rem;
    margin-right: 10px;
    transition: background-color 0.3s;
}

.featured-book .book-links a:hover {
    background-color: #152d4a;
    text-decoration: none;
}

.featured-book .award {
    display: inline-block;
    background-color: #d4edda;
    color: #155724;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 10px;
}

/* Contact card */
.contact-card {
    background-color: #f0f4f8;
    padding: 25px 30px;
    margin-top: 35px;
    border-radius: 8px;
    border-top: 4px solid #1E3A5F;
}

.contact-card h2 {
    color: #1E3A5F;
    font-size: 1.2rem;
    margin-bottom: 15px;
    padding: 0;
    border: none;
}

.contact-card p {
    margin-bottom: 5px;
    font-size: 0.95rem;
}

.contact-card .email {
    margin-top: 15px;
    font-weight: 500;
}

/* ==========================================================
   Research page (research.html)
   ========================================================== */
.scholar-badge {
    background-color: #f8f9fa;
    border-left: 4px solid #1E3A5F;
    padding: 15px 20px;
    margin-top: 15px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.scholar-badge svg {
    width: 24px;
    height: 24px;
    fill: #1E3A5F;
}

.scholar-badge a {
    color: #1E3A5F;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
}

.scholar-badge a:hover {
    text-decoration: underline;
}

.paper-list {
    list-style: none;
}

.paper-list li {
    margin-bottom: 15px;
}

.paper-item {
    line-height: 1.5;
}

.paper-item a {
    font-weight: 500;
}

.paper-authors,
.paper-venue {
    color: #666;
    font-size: 0.95rem;
}

.paper-date {
    color: #888;
    font-size: 0.9rem;
}

.separator {
    height: 2px;
    background-color: #1E3A5F;
    margin: 30px 0;
}

.paper-detail {
    padding: 1.5rem 0;
    border-bottom: 1px solid #e0e0e0;
}

.paper-detail:last-child {
    border-bottom: none;
}

.paper-detail h3 {
    color: #1E3A5F;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.paper-meta {
    color: #666;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.paper-meta .coauthors {
    margin-bottom: 0.25rem;
}

.paper-meta .publication {
    font-style: italic;
}

.abstract {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
    text-align: justify;
    border-left: 3px solid #1E3A5F;
}

.abstract-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.keywords {
    font-size: 0.9rem;
    color: #666;
    margin: 0.5rem 0;
}

.paper-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
}

.paper-links a {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    background-color: #1E3A5F;
    color: white;
    border-radius: 4px;
    font-size: 0.85rem;
    transition: background-color 0.2s;
}

.paper-links a:hover {
    background-color: #152d4a;
    text-decoration: none;
}

.paper-links a.secondary {
    background-color: #666;
}

.paper-links a.secondary:hover {
    background-color: #555;
}

.additional-info {
    margin-top: 1rem;
    font-size: 0.9rem;
}

.additional-info p {
    margin-bottom: 0.5rem;
}

.additional-info strong {
    color: #1E3A5F;
}

.media-coverage a {
    margin-right: 0.5rem;
}

.media-coverage a::after {
    content: " · ";
    color: #999;
}

.media-coverage a:last-child::after {
    content: "";
}

.details-header {
    text-align: center;
    color: #1E3A5F;
    margin-bottom: 2rem;
}

/* ==========================================================
   Book page (lovemoneyparenting.html)
   ========================================================== */
.book-header {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 3px solid #1E3A5F;
}

.book-cover {
    flex-shrink: 0;
}

.book-cover img {
    width: 200px;
    height: auto;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.book-info h1 {
    color: #1E3A5F;
    font-size: 2rem;
    margin-bottom: 5px;
}

.book-info .subtitle {
    color: #1E3A5F;
    font-size: 1.3rem;
    font-weight: 400;
    margin-bottom: 15px;
}

.book-info .authors {
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.book-info .award {
    display: inline-block;
    background-color: #d4edda;
    color: #155724;
    padding: 8px 15px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 15px;
}

:where(.page-book) section p {
    margin-bottom: 15px;
    text-align: justify;
}

.buy-section {
    background-color: #f8f9fa;
    padding: 20px 25px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.buy-section h2 {
    border: none;
    padding: 0;
    margin-bottom: 10px;
}

.buy-section p {
    margin-bottom: 10px;
    text-align: left;
}

.buy-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.buy-links a {
    display: inline-block;
    padding: 8px 16px;
    background-color: #1E3A5F;
    color: white;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

.buy-links a:hover {
    background-color: #152d4a;
    text-decoration: none;
}

.edition-links {
    font-size: 0.95rem;
}

.edition-links a {
    margin-right: 15px;
}

.endorsement {
    background-color: #f8f9fa;
    padding: 20px;
    border-left: 4px solid #1E3A5F;
    margin-bottom: 20px;
    border-radius: 0 8px 8px 0;
}

.endorsement p {
    font-style: italic;
    margin-bottom: 10px;
    text-align: left;
}

.endorsement .author {
    font-style: normal;
    font-weight: 600;
    color: #1E3A5F;
}

.coverage-section h3 {
    color: #1E3A5F;
    font-size: 1.1rem;
    margin: 20px 0 15px 0;
}

.coverage-list {
    list-style: none;
}

.coverage-list li {
    margin-bottom: 12px;
    line-height: 1.5;
}

.more-coverage {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.8;
    margin-bottom: 20px;
}

.more-coverage a {
    margin-right: 5px;
}

.blog-list,
.events-list {
    list-style: none;
}

.blog-list li,
.events-list li {
    margin-bottom: 10px;
}

.data-section {
    background-color: #f8f9fa;
    padding: 20px 25px;
    border-radius: 8px;
}

.data-section p {
    text-align: left;
}

.data-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.data-links a {
    display: inline-block;
    padding: 6px 12px;
    background-color: #1E3A5F;
    color: white;
    border-radius: 4px;
    font-size: 0.85rem;
}

.data-links a:hover {
    background-color: #152d4a;
    text-decoration: none;
}

/* ==========================================================
   Course pages (ec555.html)
   ========================================================== */
:where(.page-course) section p {
    margin-bottom: 15px;
}

.download-section {
    background-color: #f8f9fa;
    padding: 20px 25px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.download-section h3 {
    color: #1E3A5F;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.download-table {
    width: 100%;
    border-collapse: collapse;
}

.download-table th {
    text-align: left;
    padding: 8px 12px;
    background-color: #1E3A5F;
    color: white;
    font-weight: 500;
}

.download-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #e0e0e0;
}

.download-table tr:hover {
    background-color: #f0f4f8;
}

.download-table td.num {
    white-space: nowrap;
    width: 110px;
}

.download-table td.dl {
    width: 80px;
}

.download-table a {
    display: inline-block;
    padding: 4px 10px;
    background-color: #1E3A5F;
    color: white;
    border-radius: 4px;
    font-size: 0.85rem;
}

.download-table a:hover {
    background-color: #152d4a;
    text-decoration: none;
}

/* ==========================================================
   Pictures page (pictures.html)
   ========================================================== */
.gallery-intro {
    color: #555;
    margin: -10px 0 25px;
}

/* Justified rows: every photo in a row has the same height, widths follow
   each photo's shape (set via --ar = width / height), nothing is cropped. */
.gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 28px 16px;
}

.gallery::after {
    content: "";
    flex-grow: 1000;
}

.photo {
    margin: 0;
    flex-grow: calc(var(--ar) * 100);
    flex-basis: calc(var(--ar) * 185px);
    min-width: 0;
}

.photo a {
    display: block;
    overflow: hidden;
    border-radius: 6px;
    background-color: #e9edf2;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}

.photo img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: var(--ar);
    transition: transform 0.3s ease;
}

.photo a:hover img,
.photo a:focus-visible img {
    transform: scale(1.03);
}

.photo figcaption {
    margin-top: 8px;
    font-size: 0.88rem;
    line-height: 1.45;
    color: #444;
}

/* Lightbox */
.lightbox {
    border: none;
    padding: 0;
    background: transparent;
    max-width: 100vw;
    max-height: 100vh;
    width: 100vw;
    height: 100vh;
}

.lightbox::backdrop {
    background: rgba(10, 18, 30, 0.97);
}

.lightbox-inner {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 70px 30px;
}

.lightbox img {
    max-width: 100%;
    max-height: calc(100vh - 140px);
    object-fit: contain;
    border-radius: 4px;
}

.lightbox-caption {
    color: #e8ecf1;
    font-size: 1rem;
    margin-top: 14px;
    text-align: center;
}

.lightbox button {
    position: absolute;
    background: rgba(255,255,255,0.12);
    color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.lightbox button:hover {
    background: rgba(255,255,255,0.25);
}

.lightbox .lb-close { top: 16px; right: 16px; }
.lightbox .lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-next { right: 16px; top: 50%; transform: translateY(-50%); }

/* ==========================================================
   Small screens
   ========================================================== */
@media (max-width: 768px) {
    .container {
        padding: 15px 20px;
    }

    nav ul {
        flex-wrap: wrap;
    }

    nav a {
        padding: 12px 15px;
        font-size: 0.9rem;
    }

    .header-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .profile-photo {
        width: 150px;
    }

    .header-text h1 {
        font-size: 2rem;
    }

    .profile-links,
    .scholar-badge {
        justify-content: center;
    }

    .page-header h1 {
        font-size: 1.8rem;
    }

    .featured-book {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .featured-book img {
        width: 120px;
    }

    .paper-links {
        flex-direction: column;
    }

    .paper-links a {
        text-align: center;
    }

    .book-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .book-cover img {
        width: 160px;
    }

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

    .buy-links {
        justify-content: center;
    }

    .download-section {
        padding: 15px;
    }

    .download-table {
        font-size: 0.9rem;
    }

    .download-table td.num {
        width: auto;
    }

    .gallery {
        gap: 22px 12px;
    }

    .photo {
        flex-basis: calc(var(--ar) * 150px);
    }

    .lightbox-inner {
        padding: 60px 10px 20px;
    }

    .lightbox .lb-prev,
    .lightbox .lb-next {
        top: auto;
        bottom: 16px;
        transform: none;
    }
}
