/* ===========================================
   graphers.net - Scholarly Editorial Stylesheet
   =========================================== */

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

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

body {
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-weight: 400;
    color: #2d2926;
    background-color: #faf7f2;
    line-height: 1.85;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
}

a {
    color: #2563eb;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #7c2d2d;
}

/* --- Header Cartouche --- */
#header-cartouche {
    max-width: 1100px;
    margin: 0 auto;
    padding: 48px 24px 32px;
    text-align: center;
}

.cartouche-border {
    position: relative;
    border: 1px solid #9ca3af;
    padding: 40px 32px 32px;
    display: inline-block;
    min-width: 420px;
}

.corner-motif {
    position: absolute;
    opacity: 0.7;
}

.corner-motif.top-left {
    top: -12px;
    left: -12px;
}

.corner-motif.top-right {
    top: -12px;
    right: -12px;
}

.corner-motif.bottom-left {
    bottom: -12px;
    left: -12px;
}

.corner-motif.bottom-right {
    bottom: -12px;
    right: -12px;
}

.wordmark {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 700;
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    color: #2d2926;
    letter-spacing: 0.02em;
    margin-bottom: 8px;
}

.subtitle {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 1.15rem;
    color: #9e5555;
    letter-spacing: 0.03em;
}

/* --- Main Layout --- */
#main-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 40px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px 48px;
}

/* --- Main Column --- */
#main-column {
    min-width: 0;
}

/* --- Feature Articles --- */
.feature-article {
    margin-bottom: 40px;
}

.article-title {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 700;
    font-size: clamp(1.75rem, 4vw, 3rem);
    color: #2d2926;
    line-height: 1.2;
    margin-bottom: 8px;
}

.article-meta {
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    font-weight: 400;
    font-size: 0.85rem;
    color: #9ca3af;
    margin-bottom: 24px;
    letter-spacing: 0.02em;
}

.article-meta .author {
    font-weight: 600;
    color: #374151;
}

.feature-article p {
    margin-bottom: 16px;
    font-size: 1rem;
    line-height: 1.85;
}

/* --- Drop Caps --- */
.has-dropcap::first-letter {
    float: left;
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 700;
    font-size: 3.5rem;
    line-height: 0.85;
    padding-right: 8px;
    padding-top: 4px;
    padding-bottom: 0;
    padding-left: 4px;
    color: #b8860b;
    border: 1px solid rgba(184, 134, 11, 0.2);
    margin-right: 2px;
}

/* --- Feature Spread --- */
.feature-spread {
    display: flex;
    gap: 32px;
    margin-bottom: 24px;
    align-items: flex-start;
}

.spread-illustration {
    flex: 0 0 280px;
}

.spread-text {
    flex: 1;
    min-width: 0;
}

.graph-diagram {
    display: block;
    background: transparent;
}

.graph-label {
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    font-size: 11px;
    fill: #374151;
    font-weight: 400;
}

.diagram-caption {
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    font-size: 0.8rem;
    color: #9ca3af;
    text-align: center;
    margin-top: 8px;
    font-style: italic;
}

.inline-diagram {
    text-align: center;
    margin: 24px 0;
}

.inline-diagram .graph-diagram {
    display: inline-block;
    max-width: 100%;
    height: auto;
}

/* --- Pull Quotes --- */
.pull-quote {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-style: italic;
    font-size: 1.25rem;
    line-height: 1.6;
    color: #9e5555;
    border-left: 3px solid #7c2d2d;
    padding-left: 24px;
    margin: 28px 0;
}

/* --- Section Dividers --- */
.section-divider {
    text-align: center;
    margin: 40px 0;
}

/* --- Community Mosaic --- */
#community-mosaic {
    margin-top: 32px;
}

.section-heading {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 600;
    font-size: 1.75rem;
    color: #2d2926;
    margin-bottom: 24px;
    text-align: center;
}

.mosaic-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.mosaic-card {
    background: #f0ece4;
    border-radius: 4px;
    padding: 16px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mosaic-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(45, 41, 38, 0.1);
}

.card-graph {
    display: block;
    margin: 0 auto 12px;
}

.card-title {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 600;
    font-size: 0.95rem;
    color: #2d2926;
    margin-bottom: 4px;
    line-height: 1.3;
}

.card-author {
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    font-size: 0.8rem;
    color: #9ca3af;
}

/* --- Sidebar --- */
#sidebar {
    position: sticky;
    top: 24px;
    align-self: start;
}

.sidebar-heading {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 700;
    font-size: 1.15rem;
    color: #2d2926;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #9ca3af;
}

/* --- Topics Nav --- */
#topics-nav {
    background: #f0ece4;
    padding: 20px;
    border-radius: 4px;
    margin-bottom: 24px;
}

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

.topics-list li {
    margin-bottom: 6px;
}

.topic-link {
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    font-size: 0.85rem;
    font-weight: 400;
    color: #374151;
    display: block;
    padding: 4px 8px;
    border-radius: 3px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.topic-link:hover {
    background-color: rgba(37, 99, 235, 0.08);
    color: #2563eb;
}

.topic-link.active {
    font-weight: 600;
    color: #7c2d2d;
    background-color: rgba(124, 45, 45, 0.06);
}

/* --- Graph of the Day --- */
#graph-of-the-day {
    margin-bottom: 24px;
    text-align: center;
}

#gotd-svg {
    display: block;
    margin: 0 auto 12px;
    max-width: 100%;
    height: auto;
}

.gotd-vertex,
.gotd-edge {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.gotd-vertex.visible,
.gotd-edge.visible {
    opacity: 1;
}

.gotd-caption {
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    font-size: 0.8rem;
    color: #374151;
    line-height: 1.5;
    text-align: left;
}

.gotd-caption strong {
    font-weight: 600;
    color: #7c2d2d;
}

/* --- Recent Posts --- */
#recent-posts {
    margin-bottom: 24px;
}

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

.recent-item {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(156, 163, 175, 0.3);
}

.recent-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.recent-link {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 600;
    font-size: 0.95rem;
    color: #2d2926;
    display: block;
    line-height: 1.3;
    margin-bottom: 2px;
}

.recent-link:hover {
    color: #2563eb;
}

.recent-author {
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    font-size: 0.75rem;
    color: #9ca3af;
}

/* --- Footer --- */
#site-footer {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 24px 48px;
    text-align: center;
}

.footer-divider {
    margin-bottom: 24px;
}

.footer-text {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 600;
    font-size: 1rem;
    color: #2d2926;
    margin-bottom: 4px;
}

.footer-sub {
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    font-size: 0.8rem;
    color: #9ca3af;
}

/* --- Mathematical / Code Text --- */
code, .math {
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.9rem;
    color: #374151;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    #main-layout {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    #sidebar {
        position: static;
    }

    .cartouche-border {
        min-width: auto;
        padding: 28px 20px 24px;
    }

    .feature-spread {
        flex-direction: column;
    }

    .spread-illustration {
        flex: none;
        text-align: center;
    }

    .mosaic-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .corner-motif {
        display: none;
    }
}

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