/* Reset & Base Variables */
:root {
    --text-primary: #1a1a1a;
    --text-secondary: #4a4a4a;
    --text-muted: #888888;
    --bg-primary: #faf9f7;
    --bg-secondary: #ffffff;
    --accent-color: #8a3a2d;
    /* Elegant Terracotta */
    --accent-light: rgba(138, 58, 45, 0.05);

    --font-heading: 'Playfair Display', serif;
    --font-body: 'Cormorant Garamond', serif;
    --font-sans: 'Inter', sans-serif;
}

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

html {
    scroll-behavior: smooth;
    background-color: var(--bg-primary);
}

body {
    font-family: var(--font-body);
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 20px;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Animations (Screen only) */
.fade-up {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.fade-in {
    animation: fadeIn 1.5s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Navigation */
.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    z-index: 100;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-sans);
    font-size: 0.9rem;
}

.nav-title {
    font-weight: 500;
    color: var(--text-secondary);
}

.logo {
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-primary);
}

.print-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--text-primary);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    transition: background 0.2s;
}

.print-btn:hover {
    background: var(--accent-color);
}

.nav-extra {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-extra a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
}

.nav-extra a:hover {
    color: var(--accent-color);
    background: none;
}

/* Cover Page */
.cover-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    position: relative;
}

.cover-page::after {
    content: '';
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 80px;
    background: var(--text-muted);
}

.cover-content {
    max-width: 800px;
}

.cover-subtitle {
    font-family: var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.cover-title {
    font-family: var(--font-heading);
    font-size: 5rem;
    line-height: 1;
    font-weight: 900;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    letter-spacing: -2px;
}

.cover-theme {
    font-family: var(--font-sans);
    font-weight: 300;
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
}

.cover-divider {
    width: 60px;
    height: 3px;
    background: var(--accent-color);
    margin: 0 auto 2rem;
}

.cover-authors {
    font-family: var(--font-sans);
    font-size: 1rem;
    color: var(--text-secondary);
}

.cover-authors p {
    margin-bottom: 0.5rem;
}

/* Dashboard Section */
.project-dashboard {
    padding: 6rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.dashboard-card {
    background: var(--bg-secondary);
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 2.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
    border-color: var(--accent-color);
}

.dashboard-card h3 {
    font-family: var(--font-sans);
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
    font-weight: 600;
    margin-top: 0;
}

.dashboard-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    text-align: left;
    flex-grow: 1;
}

.btn-dashboard {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-color);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.btn-dashboard:hover {
    color: var(--text-primary);
    background: none;
}

.btn-dashboard::after {
    content: '→';
    margin-left: 0.5rem;
}

/* Article Layout */
.content-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 6rem 2rem;
}

/* Typography elements */
h1,
h2,
h3,
h4,
h5 {
    color: var(--text-primary);
}

/* The first H1 in the markdown (which we duplicate in the cover, but just in case we hide it here or style it) */
article>h1:first-of-type {
    display: none;
}

article>h2:first-of-type {
    display: none;
    /* The "A Dissertation Proposal" text */
}

h2 {
    font-family: var(--font-sans);
    font-size: 1.8rem;
    font-weight: 600;
    margin-top: 4rem;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding-bottom: 0.5rem;
}

h3 {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-style: italic;
    margin-top: 3rem;
    margin-bottom: 1rem;
    color: var(--accent-color);
}

h4 {
    font-family: var(--font-sans);
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.5rem;
}

p {
    margin-bottom: 1.5rem;
    text-align: justify;
    hyphens: auto;
}

/* The abstract block - Markdown outputs H2 "Abstract" then paragraphs. */
h2#abstract {
    display: none;
}

:has(> #abstract)+p {
    font-size: 1.25rem;
    font-style: italic;
    line-height: 1.8;
    color: var(--text-secondary);
    padding: 2rem;
    background: var(--bg-secondary);
    border-left: 4px solid var(--accent-color);
    margin-bottom: 4rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
}

/* Lists */
ul,
ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

li {
    margin-bottom: 0.5rem;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 2.5rem 0;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    background: var(--bg-secondary);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    overflow: hidden;
}

th,
td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

th {
    background: var(--text-primary);
    color: white;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.85rem;
}

tr:nth-child(even) {
    background: var(--accent-light);
}

/* Mermaid */
.mermaid-container {
    width: 100%;
    margin: 3rem 0;
    padding: 2rem;
    background: var(--bg-secondary);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    display: flex;
    justify-content: center;
}

/* Blockquotes */
blockquote {
    font-size: 1.5rem;
    font-family: var(--font-heading);
    font-style: italic;
    color: var(--accent-color);
    margin: 3rem 0;
    padding-left: 2rem;
    border-left: 2px solid var(--accent-color);
    line-height: 1.5;
}

/* Strong bold specific styles */
strong {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.95em;
}

/* Links */
a {
    color: var(--accent-color);
    text-decoration: underline;
    text-decoration-color: rgba(138, 58, 45, 0.4);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: all 0.2s ease;
}

a:hover {
    color: #ac4736;
    text-decoration-color: rgba(172, 71, 54, 0.8);
    background-color: var(--accent-light);
}

.cover-authors a {
    text-decoration: none;
}

.cover-authors a:hover {
    text-decoration: underline;
    text-decoration-color: rgba(138, 58, 45, 0.4);
    background-color: transparent;
}

/* References block specifically */
h2:last-of-type+p,
/* End of proposal status */
h2:last-of-type+p+p {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--text-secondary);
}


/* ======= ACCESSIBILITY ====== */
:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 3px;
}

.logo {
    text-decoration: none;
    color: var(--text-primary);
}

.logo:hover {
    color: var(--accent-color);
    background-color: transparent;
}

/* ======= RESPONSIVE — TABLET ====== */
@media (max-width: 1024px) {
    .cover-title {
        font-size: 3.5rem;
    }

    .cover-theme {
        font-size: 1.25rem;
    }

    .content-wrapper {
        padding: 4rem 1.5rem;
    }

    h2 {
        font-size: 1.5rem;
        margin-top: 3rem;
    }

    h3 {
        font-size: 1.6rem;
        margin-top: 2rem;
    }

    blockquote {
        font-size: 1.25rem;
    }
}

/* ======= RESPONSIVE — MOBILE ====== */
@media (max-width: 768px) {
    body {
        font-size: 17px;
    }

    .nav-content {
        padding: 0.75rem 1rem;
    }

    .nav-title {
        display: none;
    }

    .cover-page {
        min-height: 80vh;
        padding: 1.5rem;
    }

    .cover-title {
        font-size: 2.5rem;
        letter-spacing: -1px;
    }

    .cover-subtitle {
        font-size: 0.7rem;
        letter-spacing: 1px;
    }

    .cover-theme {
        font-size: 1.1rem;
        margin-bottom: 2rem;
    }

    .cover-authors {
        font-size: 0.9rem;
    }

    .cover-page::after {
        height: 40px;
    }

    .content-wrapper {
        padding: 3rem 1.25rem;
    }

    h2 {
        font-size: 1.3rem;
        margin-top: 2.5rem;
    }

    h3 {
        font-size: 1.4rem;
    }

    h4 {
        font-size: 1.1rem;
    }

    blockquote {
        font-size: 1.15rem;
        margin: 2rem 0;
        padding-left: 1.25rem;
    }

    p {
        text-align: left;
        hyphens: none;
    }

    /* Scrollable tables on mobile */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    th,
    td {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }

    /* Mermaid diagrams */
    .mermaid-container {
        padding: 1rem;
        overflow-x: auto;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .nav-extra {
        display: none;
    }
}

/* ======= RESPONSIVE — SMALL MOBILE ====== */
@media (max-width: 480px) {
    .cover-title {
        font-size: 2rem;
    }

    .cover-theme {
        font-size: 1rem;
    }

    .print-btn span,
    .print-btn {
        font-size: 0;
        padding: 0.5rem;
    }

    .print-btn svg {
        width: 18px;
        height: 18px;
    }
}

/* ======= PRINT STYLES ====== */
@media print {
    @page {
        size: letter;
        margin: 20mm;

        @bottom-center {
            content: counter(page);
            font-family: 'Inter', sans-serif;
            font-size: 10pt;
            color: #888;
        }
    }

    html,
    body {
        background: transparent !important;
        font-size: 12pt;
        color: #000;
    }

    .print-hide {
        display: none !important;
    }

    .cover-page {
        min-height: auto;
        height: 100vh;
        background: none;
        page-break-after: always;
        display: flex;
        align-items: center;
        margin: 0;
    }

    .cover-page::after {
        display: none;
    }

    .content-wrapper {
        padding: 0;
        max-width: none;
    }

    p {
        text-align: justify;
        line-height: 1.5;
        orphans: 3;
        widows: 3;
    }

    h2,
    h3,
    h4 {
        page-break-after: avoid;
    }

    h2 {
        font-size: 16pt;
        margin-top: 2rem;
        page-break-before: always;
    }

    table {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }

    th {
        background: #f0f0f0;
        color: #000;
    }

    tr:nth-child(even) {
        background: transparent;
    }

    .mermaid-container {
        page-break-inside: avoid;
        background: transparent;
        border: none;
    }

    a {
        text-decoration: none;
        color: #000;
    }
}

/* Presentations & Posters */
.presentation-section {
    padding-bottom: 8rem;
}

.presentation-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3rem;
    margin-top: 3rem;
}

.presentation-card {
    background: var(--bg-secondary);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.presentation-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
    border-color: var(--accent-color);
}

.presentation-image {
    width: 100%;
    height: 480px;
    background: #eee;
    overflow: hidden;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.presentation-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #f8f8f8;
}

.presentation-content {
    padding: 2rem;
}

.presentation-tag {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
    display: block;
}

.presentation-card h3 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-style: italic;
    margin-bottom: 1rem;
    margin-top: 0;
}

.presentation-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0;
}

.presentation-footer {
    padding: 1rem 2rem;
    background: var(--bg-primary);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

@media (max-width: 900px) {
    .presentation-grid {
        grid-template-columns: 1fr;
    }

    .presentation-image {
        height: 300px;
    }
}