/* ================================
   Feng Zhang Academic Website
   Custom CSS for Quarto Theme
   Overrides Quarto/Bootstrap defaults
   ================================ */

/* ---- Quarto Overrides ---- */

/* Hide the Quarto title banner on all pages */
.quarto-title-banner {
    display: none !important;
}

/* Remove Quarto's default title block */
#title-block-header {
    display: none !important;
}

/* Reset Quarto's content centering */
.quarto-body .content,
#quarto-content .content,
main.content {
    text-align: left;
}

/* Fix Quarto figure handling — remove captions from hero image */
.hero-image .quarto-figure,
.hero-image figure {
    margin: 0;
}

.hero-image .quarto-figure figcaption,
.hero-image figure figcaption,
.hero-image .figure-caption {
    display: none;
}

/* Override Quarto's default paragraph sizing */
.section p,
.research-card p,
.publication-item p,
.media-item p,
.teaching-card p,
.pub-content p {
    font-size: 1.05rem;
    font-weight: 400;
    line-height: 1.7;
}

/* Override Quarto heading defaults inside our components */
.research-card h3,
.research-card h4,
.pub-content h4,
.media-item h4,
.featured-media h3,
.teaching-card h3,
.chart-section h3 {
    border-bottom: none;
    padding-bottom: 0;
    margin-top: 0;
}

/* ---- Hero Section ---- */
.hero-section {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    padding: 4rem 0;
}

.hero-content {
    display: grid !important;
    grid-template-columns: 280px 1fr !important;
    gap: 4rem;
    align-items: center;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Center the hero section within the full page width */
.hero-section .container {
    display: flex;
    justify-content: center;
}

.hero-image img {
    width: 280px;
    height: 320px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    transition: transform 0.3s ease;
}

.hero-image img:hover {
    transform: translateY(-5px);
}

.hero-text h2 {
    color: #1a365d;
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: left;
}

.hero-text p {
    font-size: 1.15rem !important;
    color: #4a5568;
    line-height: 1.7;
    text-align: left;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

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

/* Force Quarto's content area to use full width */
#quarto-content > * {
    max-width: 100% !important;
}

#quarto-content .page-columns {
    max-width: 100% !important;
}

main.content,
.page-layout-custom .content {
    max-width: 1300px !important;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ---- Sections ---- */
.section {
    padding: 4rem 0;
}

.section-title {
    font-size: 2.1rem !important;
    color: #1a365d;
    margin-bottom: 3rem !important;
    text-align: center;
    font-weight: 700;
    position: relative;
    border-bottom: none !important;
    padding-bottom: 0.5rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: #0f4c8a;
    border-radius: 2px;
}

/* ---- Buttons ---- */
.btn {
    padding: 0.75rem 2rem;
    border-radius: 8px;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: #0f4c8a;
    color: white !important;
    border-color: #0f4c8a;
}

.btn-primary:hover {
    background: #1a365d;
    border-color: #1a365d;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(15, 76, 138, 0.3);
    color: white !important;
    text-decoration: none !important;
}

.btn-secondary {
    background: transparent;
    color: #0f4c8a !important;
    border-color: #0f4c8a;
}

.btn-secondary:hover {
    background: #0f4c8a;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(15, 76, 138, 0.2);
    text-decoration: none !important;
}

/* ---- Research Grid ---- */
.research-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 2rem;
    margin-bottom: 4rem;
}

.research-card {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    text-align: left;
}

.research-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

.research-card.featured {
    border-left: 4px solid #0f4c8a;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

.card-icon {
    font-size: 2rem;
    margin-bottom: 0.25rem;
    text-align: left;
    line-height: 1;
}

/* Override Quarto's p wrapping of card-icon emoji */
div.card-icon > p,
.research-card .card-icon p {
    margin-bottom: 0 !important;
    padding: 0 !important;
    font-size: 2rem !important;
    line-height: 1 !important;
}

.research-card h3 {
    color: #1a365d;
    margin-bottom: 0.5rem;
    font-size: 0.95rem !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
}

.research-card h4 {
    color: #1a365d;
    margin-bottom: 1rem;
    font-size: 1.2rem !important;
    line-height: 1.3;
    text-align: center;
}

.research-card p {
    color: #4a5568;
    line-height: 1.65;
    font-size: 1rem !important;
    text-align: left;
}

.card-footer {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Fix: Quarto wraps card-footer content in a <p> tag */
.card-footer p {
    margin-bottom: 0;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tag {
    background: #e2e8f0;
    color: #1a365d;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem !important;
    font-weight: 500;
    display: inline-block;
}

.status {
    background: #d1fae5;
    color: #047857;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem !important;
    font-weight: 500;
    display: inline-block;
}

/* ---- Research Areas ---- */
.research-areas {
    padding: 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.05);
}

.research-areas h3 {
    color: #1a365d;
    margin-bottom: 2rem;
    text-align: center;
    font-size: 1.3rem !important;
}

.areas-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 1.5rem;
}

.area-item {
    text-align: center;
    padding: 1.5rem;
    border-radius: 8px;
    background: #f8fafc;
    transition: all 0.3s ease;
}

.area-item:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
}

.area-item h4 {
    color: #1a365d;
    margin-bottom: 0.5rem;
    font-size: 1.1rem !important;
}

.area-item p {
    color: #64748b;
    font-size: 0.95rem !important;
    margin-bottom: 0;
}

/* ---- Collaborators ---- */
.collaborators-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.collaborator {
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 6px;
    border-left: 3px solid #0f4c8a;
    text-align: left;
}

.collaborator p {
    margin-bottom: 0.25rem !important;
    font-size: 0.85rem !important;
}

.collaborator strong {
    color: #1a365d;
    font-size: 0.9rem;
}

.small {
    color: #64748b;
    font-style: italic;
    font-size: 0.8rem !important;
}

.collab-link {
    color: #0f4c8a;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
}

.collab-link:hover {
    text-decoration: underline;
}

/* ---- Publications ---- */
.publications-section {
    background: white;
}

.publications-list {
    max-width: 800px;
    margin: 0 auto;
}

.publication-item {
    display: flex !important;
    flex-direction: row !important;
    gap: 2rem;
    padding: 1.5rem 2rem;
    margin-bottom: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 3px solid #0f4c8a;
    transition: all 0.3s ease;
    text-align: left;
}

.publication-item:hover {
    background: white;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.pub-year {
    color: #0f4c8a;
    font-weight: 700;
    font-size: 1rem;
    min-width: 50px;
    flex-shrink: 0;
}

/* Fix: Quarto wraps pub-year text in <p> */
.pub-year p {
    margin-bottom: 0;
    color: #0f4c8a;
    font-weight: 700;
    font-size: 1rem !important;
}

.pub-content {
    flex: 1;
}

.pub-content h4 {
    color: #1a365d;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    font-size: 1.15rem !important;
    text-align: left;
}

.pub-content p {
    color: #4a5568;
    margin-bottom: 0;
    font-size: 1rem !important;
    text-align: left;
}

.journal {
    color: #0f4c8a;
    font-weight: 500;
}

.publisher {
    color: #047857;
    font-weight: 500;
}

.doi-link {
    color: #0f4c8a;
    text-decoration: none;
    font-size: 0.85rem;
    margin-left: 0.75rem;
}

.doi-link:hover {
    text-decoration: underline;
}

.publications-cta {
    text-align: center;
    margin-top: 3rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Fix: Quarto wraps cta in <p> */
.publications-cta p {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* ---- Commentary / Media ---- */
.media-section {
    background: #f8fafc;
}

.media-featured {
    margin-bottom: 3rem;
}

.featured-media {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.1);
    text-align: center;
    border: 2px solid #0f4c8a;
}

.media-type {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem !important;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.media-type.podcast { background: #fef3c7; color: #92400e; }
.media-type.op-ed { background: #dbeafe; color: #1e40af; }
.media-type.analysis { background: #f3e8ff; color: #7c3aed; }
.media-type.commentary { background: #ecfdf5; color: #059669; }

.featured-media h3 {
    color: #1a365d;
    margin-bottom: 0.75rem;
    font-size: 1.25rem !important;
}

.featured-media p {
    color: #4a5568;
    font-size: 1rem !important;
    font-weight: 400;
    margin-bottom: 0.5rem;
}

.media-date {
    color: #64748b;
    font-style: italic;
    font-size: 0.9rem;
}

.media-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) !important;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.media-item {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    text-align: left;
}

.media-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.media-item h4 {
    color: #1a365d;
    margin-bottom: 0.5rem;
    line-height: 1.3;
    font-size: 1.1rem !important;
}

.media-item p {
    font-size: 1rem !important;
    margin-bottom: 0;
}

.outlet {
    color: #0f4c8a;
    font-weight: 500;
}

.media-outlets {
    text-align: center;
    margin-bottom: 3rem;
}

.media-outlets h4 {
    font-size: 1rem !important;
}

.outlets-list {
    display: flex !important;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.outlet-tag {
    background: #e2e8f0;
    color: #1a365d;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.95rem !important;
    font-weight: 500;
}

.media-cta {
    text-align: center;
}

/* ---- Teaching ---- */
.teaching-section {
    background: white;
}

.teaching-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 3rem;
    margin-bottom: 3rem;
}

.teaching-card {
    background: #f8fafc;
    padding: 2rem;
    border-radius: 12px;
    border-left: 4px solid #0f4c8a;
    text-align: left;
}

.teaching-card h3 {
    color: #1a365d;
    margin-bottom: 1.5rem;
    font-size: 1.3rem !important;
}

.teaching-note {
    color: #64748b;
    font-style: italic;
    font-size: 0.9rem;
}

.teaching-card li {
    margin-bottom: 0.5rem;
    color: #4a5568;
    font-size: 1rem !important;
}

.teaching-card ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.speaking-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.speaking-item {
    padding: 1rem;
    background: white;
    border-radius: 6px;
    border-left: 3px solid #10b981;
    text-align: left;
}

.speaking-item strong {
    color: #1a365d;
    display: block;
    margin-bottom: 0.25rem;
}

.speaking-item p {
    color: #64748b;
    font-size: 0.9rem !important;
    margin-bottom: 0;
}

.expertise-areas {
    text-align: center;
}

.expertise-areas h3 {
    color: #1a365d;
    margin-bottom: 2rem;
    font-size: 1.2rem !important;
}

.topics-grid {
    display: flex !important;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    max-width: 900px;
    margin: 0 auto;
}

/* Fix: Quarto wraps topic tags in a <p>, need to make it flex too */
.topics-grid p {
    display: contents;
}

.topic-tag {
    background: #0f4c8a;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem !important;
    font-weight: 500;
    white-space: nowrap;
}

/* ---- Data Landing Page ---- */
.data-intro {
    max-width: 800px;
    margin: 0 auto 3rem;
    text-align: center;
}

.data-intro p {
    color: #4a5568;
    font-size: 1.05rem !important;
    line-height: 1.7;
}

.data-projects-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)) !important;
    gap: 2rem;
    margin-bottom: 2rem;
}

.data-project-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.data-project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

.data-project-card a {
    text-decoration: none !important;
    color: inherit;
    display: block;
}

.card-banner {
    height: 8px;
}

.card-banner.red { background: linear-gradient(90deg, #dc2626, #ef4444); }
.card-banner.blue { background: linear-gradient(90deg, #0f4c8a, #2563eb); }
.card-banner.green { background: linear-gradient(90deg, #059669, #10b981); }
.card-banner.purple { background: linear-gradient(90deg, #7c3aed, #8b5cf6); }
.card-banner.orange { background: linear-gradient(90deg, #d97706, #f59e0b); }

.card-body {
    padding: 2rem;
}

.card-body h3 {
    color: #1a365d;
    font-size: 1.3rem !important;
    margin-bottom: 0.75rem;
}

.card-body p {
    color: #4a5568;
    font-size: 1rem !important;
    font-weight: 400 !important;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.card-meta {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.card-meta .meta-tag {
    background: #f1f5f9;
    color: #475569;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem !important;
    font-weight: 500;
}

.card-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: #0f4c8a;
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.coming-soon {
    opacity: 0.6;
}

.coming-soon .card-body::after {
    content: "Coming Soon";
    display: inline-block;
    background: #e2e8f0;
    color: #64748b;
    padding: 0.2rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ---- Data Dashboard (individual project pages) ---- */
.dashboard-intro {
    max-width: 800px;
    margin: 0 auto 3rem;
    text-align: center;
}

.dashboard-intro p {
    color: #4a5568;
    font-size: 1.05rem !important;
    line-height: 1.7;
}

.chart-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
}

.chart-section h3 {
    color: #1a365d;
    margin-bottom: 1rem;
    font-size: 1.3rem !important;
    text-align: center;
}

.chart-description {
    color: #4a5568;
    font-size: 0.9rem !important;
    margin-bottom: 1.5rem;
    text-align: center;
}

.chart-description p {
    font-size: 0.9rem !important;
}

.data-source {
    color: #64748b;
    font-size: 0.8rem !important;
    font-style: italic;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.data-source p {
    font-size: 0.8rem !important;
}

/* Compact OJS toggle controls */
.chart-section .observablehq {
    font-size: 0.85rem !important;
}

.chart-section .observablehq label {
    font-size: 0.85rem !important;
    font-weight: 500;
}

.chart-section form {
    display: inline-flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    align-items: center;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .research-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .areas-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .hero-content {
        grid-template-columns: 1fr !important;
        text-align: center;
        gap: 2rem;
    }

    .hero-image {
        margin: 0 auto;
    }

    .hero-text h2 {
        font-size: 2rem;
        text-align: center;
    }

    .hero-text p {
        text-align: center;
    }

    .hero-buttons {
        justify-content: center;
        flex-wrap: wrap;
    }

    .research-grid {
        grid-template-columns: 1fr !important;
    }

    .publication-item {
        flex-direction: column !important;
        gap: 1rem;
    }

    .media-grid {
        grid-template-columns: 1fr !important;
    }

    .teaching-grid {
        grid-template-columns: 1fr !important;
    }

    .areas-grid {
        grid-template-columns: 1fr !important;
    }

    .data-projects-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ---- Custom Footer (matching original) ---- */

/* Hide Quarto's default footer */
.nav-footer {
    display: none !important;
}

.site-footer {
    background: #1a365d;
    color: white;
    padding: 3rem 0 1rem;
}

.site-footer .footer-content {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 2rem;
    margin-bottom: 2rem;
}

.site-footer .footer-section h4 {
    color: white;
    margin-bottom: 1.5rem;
    font-size: 1.1rem !important;
    border-bottom: none;
}

.site-footer .contact-info p {
    color: #a0aec0;
    margin-bottom: 1rem;
    line-height: 1.6;
    font-size: 0.95rem !important;
}

.site-footer .email a {
    color: #90cdf4;
    text-decoration: none;
}

.site-footer .email a:hover {
    color: white;
    text-decoration: underline;
}

.site-footer .footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.site-footer .footer-links a {
    color: #a0aec0;
    text-decoration: none;
    transition: color 0.3s ease;
    font-size: 0.95rem;
}

.site-footer .footer-links a:hover {
    color: white;
}

.site-footer .footer-bottom {
    border-top: 1px solid #4a5568;
    padding-top: 2rem;
    text-align: center;
    color: #a0aec0;
}

.site-footer .footer-bottom p {
    margin-bottom: 0.5rem;
    font-size: 0.9rem !important;
}

.site-footer .footer-bottom a {
    color: #90cdf4;
    text-decoration: none;
}

.site-footer .footer-bottom a:hover {
    color: white;
}

@media (max-width: 1024px) {
    .site-footer .footer-content {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .site-footer .footer-content {
        grid-template-columns: 1fr !important;
        text-align: center;
    }

    .site-footer .footer-links {
        align-items: center;
    }
}

/* ---- Animations ---- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.research-card,
.publication-item,
.media-item,
.data-project-card {
    animation: fadeInUp 0.6s ease forwards;
}

/* ---- Accessibility ---- */
.btn:focus,
.nav-link:focus {
    outline: 2px solid #0f4c8a;
    outline-offset: 2px;
}

/* ---- Print ---- */
@media print {
    .hero-section { padding: 2rem 0; }
    .section { padding: 1.5rem 0; }
    .quarto-title-banner { display: none !important; }
}
