/* ============================================
   LaTeX.css Integration for TooEarly
   Hybrid approach: Ghost navigation + LaTeX content
   ============================================ */

/* Override LaTeX.css max-width for better Ghost integration */
body {
    max-width: 120ch !important;
    margin: 0 auto;
    padding: 1rem;
    font-size: 16px; /* Override LaTeX default to web-standard size */
}

/* Adjust content font size for better readability */
.gh-content {
    font-size: 1rem; /* 16px base */
    line-height: 1.6;
}

/* Keep Ghost navigation styling (don't let LaTeX.css override) */
.gh-head,
.gh-viewport,
nav,
.gh-footer {
    font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif) !important;
}

/* Apply LaTeX styling to post/page content only */
article.post,
article.page,
.gh-content {
    font-family: 'Latin Modern', Georgia, serif;
}

/* Ensure code blocks have proper LaTeX styling */
pre,
code {
    font-family: 'Latin Modern Mono', 'Courier New', monospace;
}

/* LaTeX-style headers within content */
.gh-content h1,
.gh-content h2,
.gh-content h3,
.gh-content h4,
.gh-content h5,
.gh-content h6 {
    font-weight: bold;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

/* LaTeX-style paragraph indentation (except first paragraph) */
.gh-content p + p {
    text-indent: 1.5em;
    margin-top: 0;
}

/* Sidenotes/footnotes in LaTeX style */
.footnotes {
    font-size: 0.9em;
    margin-top: 3rem;
    border-top: 1px solid #ccc;
    padding-top: 1rem;
}

/* Tables get LaTeX styling - responsive without horizontal scroll */
.gh-content table {
    border-collapse: collapse;
    margin: 2rem auto;
    width: 100%;
    max-width: 100%;
    table-layout: auto;
    font-size: 0.9rem;
}

.gh-content table th,
.gh-content table td {
    border-bottom: 1px solid #000;
    padding: 0.4em 0.6em;
    word-wrap: break-word;
}

/* Wrap tables in scrollable container only when necessary */
.gh-content .table-wrapper {
    overflow-x: auto;
    max-width: 100%;
    margin: 2rem 0;
}

/* On mobile, allow smaller font for tables */
@media (max-width: 768px) {
    .gh-content table {
        font-size: 0.8rem;
    }

    .gh-content table th,
    .gh-content table td {
        padding: 0.3em 0.4em;
    }
}

/* Blockquotes in LaTeX style */
.gh-content blockquote {
    margin-left: 2em;
    font-style: italic;
    border-left: none;
    padding-left: 0;
}

/* Lists with better spacing */
.gh-content ul,
.gh-content ol {
    margin-left: 2em;
    margin-bottom: 1rem;
}

/* Math support (if using MathJax/KaTeX) */
.gh-content .math {
    overflow-x: auto;
    overflow-y: hidden;
}

/* Keep Ghost card layouts working */
.kg-card,
.kg-image-card,
.kg-gallery-card {
    margin: 2rem 0;
}

/* Ensure images don't break layout - scale to fit viewport */
.gh-content img {
    max-width: 100%;
    width: auto;
    height: auto;
    display: block;
    margin: 2rem auto;
}

/* Figures with wide content scale down */
.gh-content figure {
    max-width: 100%;
    margin: 2rem auto;
}

.gh-content figure img {
    max-width: 100%;
    height: auto;
}

/* For data visualizations that may be wide, ensure they fit */
.gh-content .kg-image-card,
.gh-content .kg-gallery-card {
    max-width: 100%;
    overflow: hidden;
}

.gh-content .kg-image-card img,
.gh-content .kg-gallery-image img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

/* Figure captions in LaTeX style */
.gh-content figcaption {
    text-align: center;
    font-size: 0.9em;
    margin-top: 0.5rem;
    font-style: italic;
}

/* Hide author name and reading time EVERYWHERE - comprehensive */
.byline,
.author-name,
.author-info,
.post-author,
.article-author,
.reading-time,
.post-meta .reading-time,
.gh-article-meta,
.gh-article-author-name,
.gh-article-author-image,
.gh-article-meta-wrapper,
.gh-article-meta-date,
.gh-article-meta-length,
.article-byline,
.byline-content,
.article-meta-author,
header .author,
.post-full-meta,
.gh-author,
.post-card-byline,
.post-card-byline-content,
.post-card-byline-date,
.author-list,
.article-author-list,
.author-profile-image,
.gh-card-author,
.gh-card-meta .gh-card-author,
span.gh-card-author,
[class*="author"],
[class*="byline"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
}

/* Hide subscribe forms but KEEP floating portal button */
.gh-form[data-members-form],
.gh-footer-signup,
.gh-cta,
section.gh-header.is-classic,
section.gh-header.is-magazine,
section.gh-header.is-highlight,
.gh-button[data-portal] {
    display: none !important;
}

/* Hide "Powered by Ghost" in footer */
.gh-footer-copyright {
    display: none !important;
}

/* Override red accent color with teal theme color */
.is-title,
.gh-header-title,
.gh-content h1,
.gh-content h2 {
    color: #264653 !important; /* Deep teal from theme */
}

/* Change subtitle to black instead of red */
.post-card-excerpt,
.article-excerpt,
.gh-content .excerpt,
p.excerpt,
.post-excerpt,
.custom-excerpt,
.gh-article-excerpt,
.post-card-excerpt-wrapper,
.gh-card-excerpt {
    color: #000000 !important;
}

/* Footer styling - 2 column, tighter spacing */
.gh-footer-sections {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    padding: 2rem 0 1rem;
    border-top: 1px solid #e5e5e5;
}

.gh-footer-section {
    display: flex;
    flex-direction: column;
}

.gh-footer-heading {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #264653;
}

.gh-footer-description {
    font-size: 0.85rem;
    line-height: 1.5;
    color: #666;
    margin: 0;
}

.gh-footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.gh-footer-links a {
    font-size: 0.85rem;
    color: #666;
    text-decoration: none;
    line-height: 1.4;
}

.gh-footer-links a:hover {
    color: #264653;
}

.gh-footer-bottom {
    display: flex;
    justify-content: space-between;
    padding: 1rem 0;
    border-top: 1px solid #e5e5e5;
    font-size: 0.8rem;
    color: #999;
}

.gh-footer-copyright,
.gh-footer-powered {
    margin: 0;
}

.gh-footer-powered a {
    color: #999;
    text-decoration: none;
}

.gh-footer-powered a:hover {
    color: #264653;
}

@media (max-width: 768px) {
    .gh-footer-sections {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .gh-footer-bottom {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}

/* Override Ghost accent color globally */
:root {
    --ghost-accent-color: #264653 !important;
}

/* Right-aligned navigation without logo */
.gh-navigation.is-right-aligned .gh-navigation-inner {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.gh-navigation.is-right-aligned .gh-navigation-brand {
    margin-right: auto;
}

.gh-navigation.is-right-aligned .gh-navigation-menu {
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    gap: 3rem;
    min-width: 400px;
}

.gh-navigation-menu a,
.gh-navigation-menu button {
    font-size: 1rem !important;
    font-weight: normal !important;
    text-transform: none !important;
    flex: 0 0 auto;
}

/* Site title section */
.gh-site-title {
    text-align: center;
    padding: 3rem 0 2rem;
    border-bottom: 2px solid #264653;
}

.gh-site-title-text {
    font-size: 3.5rem;
    margin: 0;
    font-weight: bold;
    color: #264653;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.gh-site-title-text a {
    color: inherit;
    text-decoration: none;
}

.gh-site-title-text a:hover {
    color: #1a3540;
}

@media (max-width: 768px) {
    .gh-site-title-text {
        font-size: 2.5rem;
    }

    .gh-site-title {
        padding: 2rem 0 1.5rem;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    body {
        padding: 0.5rem;
    }

    .gh-content p + p {
        text-indent: 1em;
    }
}
