/* --- CSS Variables --- */
:root {
    /* Palette: Refined, academic feel. Keeping the warm base, adding a deeper text, refined accent. */
    --font-primary: 'Lato', sans-serif; /* Sans-serif for headings, UI elements */
    --font-secondary: 'Merriweather', serif; /* Serif for body text */
    --color-text-body: #2d2d2d; /* Slightly softer, darker grey for body */
    --color-text-headings: #1a1a1a; /* Near black for strong headings */
    --color-background: #fdfdfa; /* Very subtle warm off-white, cleaner feel */
    --color-border: #e0e0e0; /* Softer grey border */
    --color-accent: #a07d3d; /* Refined, slightly desaturated gold/bronze */
    --color-accent-darker: #826430; /* For hover states */
    --color-meta: #6c757d; /* Standard muted grey for meta text */
    --color-caption: #757575;
    --color-quote-border: var(--color-accent);
    --color-separator: #ccc; /* Clearer separator */
    --color-subtle-bg: #f8f9fa; /* Subtle background for footer/elements */

    /* Layout */
    --container-width: 1280px; /* Slightly wider max width */
    --reading-width: 70ch; /* Optimal reading line length */
    --spacing-unit: 1rem; /* Base spacing unit (optional use) */

    /* Borders */
    --border-radius-subtle: 3px;
    --border-standard: 1px solid var(--color-border);
}

/* --- Basic Reset & Defaults --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; scroll-padding-top: 40px; /* Account for potential sticky header later */ }

body {
    font-family: var(--font-secondary);
    color: var(--color-text-body);
    background-color: var(--color-background);
    line-height: 1.75; /* Generous line height for serif body */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

img { max-width: 100%; height: auto; display: block; border-radius: var(--border-radius-subtle); }
figure { margin: 0 0 var(--spacing-unit) 0; } /* Consistent bottom margin */

a { color: var(--color-accent); text-decoration: none; transition: color 0.2s ease, background-color 0.2s ease; border-radius: 2px; }
a:hover, a:focus { color: var(--color-accent-darker); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; background-color: rgba(160, 125, 61, 0.05); }
a:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; } /* Modern focus outline */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-primary);
    font-weight: 700; /* Default bold for Lato */
    line-height: 1.25;
    margin-bottom: 0.75em; /* Consistent heading bottom margin */
    color: var(--color-text-headings);
    letter-spacing: -0.01em;
}
h1 { font-size: 2.8rem; font-weight: 900; letter-spacing: -0.025em;} /* Larger, heavier page title if used */
h2 { font-size: 2.2rem; } /* Article titles primarily */
h3 { font-size: 1.6rem; }
h4 { font-size: 1.3rem; }

p { margin-bottom: 1.75em; /* Match line-height for rhythm */ max-width: var(--reading-width); /* Apply reading width directly */ }
p:last-child { margin-bottom: 0; } /* Prevent extra space at end of containers */

ul, ol { margin-bottom: 1.75em; padding-left: 2em; /* Standard indentation */ }
li { margin-bottom: 0.6em; }

strong { font-weight: 700; /* Ensure Merriweather bold is used if available */ }
em, i { font-style: italic; } /* Ensure italic styles */

/* --- Container --- */
.container { max-width: var(--container-width); margin: 0 auto; padding: 0 30px; }
.container--narrow { max-width: calc(var(--reading-width) + 60px); /* Reading width + padding */}

/* --- Header --- */
.site-header {
    padding: 30px 0;
    border-bottom: var(--border-standard);
    border-top: 5px solid var(--color-accent); /* Stronger accent top border */
    margin-bottom: 70px; /* More space below header */
    background-color: #ffffff; /* Keep header distinct white */
}
.site-header .container { display: flex; flex-direction: column; align-items: center; text-align: center; }
.logo-link { display: inline-block; margin-bottom: 10px; }
.logo-link:hover, .logo-link:focus, .logo-link:focus-visible { background-color: transparent; outline: none; } /* No visual feedback on logo link */
.logo-img { max-height: 120px; /* Slightly smaller, more refined logo size */ width: auto; }
/* Optional Text Title Style */
/* .logo-text-title { font-family: var(--font-secondary); font-weight: 700; font-size: 2.5rem; color: var(--color-text-headings); display: block; margin-top: -8px; } */
/* Optional Tagline Style */
/* .tagline { font-family: var(--font-primary); font-size: 1rem; color: var(--color-meta); margin-top: 5px; letter-spacing: 0.03em; } */

/* --- Main Content --- */
.site-main { padding-bottom: 80px; }

/* --- Table of Contents (Refined) --- */
.toc {
    background-color: var(--color-subtle-bg);
    border: var(--border-standard);
    border-radius: 4px;
    padding: 30px 40px;
    margin: 0 auto 80px auto; /* More space below TOC */
    width: fit-content; /* Size to content */
    max-width: 100%;
}
.toc h2 { /* Style as a clear label */
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 25px;
    font-weight: 700;
    color: var(--color-meta);
    text-align: center;
}
.toc ul {
    list-style: none;
    padding-left: 0;
    display: grid; /* Use grid for better alignment control */
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* Responsive columns */
    gap: 15px 30px; /* Row and column gap */
    justify-content: center;
}
.toc li { margin-bottom: 0; text-align: center; } /* Center text within grid cells */
.toc a {
    font-family: var(--font-primary);
    font-size: 1.05rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--color-text-headings);
    padding: 5px 0; /* Add padding for better hover */
    display: block; /* Make link fill space */
    border-radius: 3px;
}
.toc a:hover, .toc a:focus {
    color: var(--color-accent-darker);
    background-color: rgba(160, 125, 61, 0.07);
    text-decoration: none; /* No underline needed here */
}

/* --- Articles Feed --- */
.articles-feed { } /* No specific container style needed */

/* --- Full Article Styling --- */
.full-article { margin-bottom: 6rem; /* Generous space between articles */ }

.article-header {
    text-align: left;
    margin-bottom: 2.5rem;
    border-bottom: var(--border-standard);
    padding-bottom: 1.5rem;
}
.article-title {
    font-size: 2.6rem; /* Larger title */
    font-weight: 900; /* Heavier weight (ensure Lato 900 is loaded) */
    line-height: 1.15;
    margin-bottom: 0.4em;
    color: var(--color-text-headings);
    letter-spacing: -0.02em; /* Tighter spacing for impact */
    max-width: none; /* Allow title to span wider than reading width */
}
.article-meta {
    font-family: var(--font-primary);
    font-size: 0.95rem;
    color: var(--color-meta);
    margin-top: 0.8rem; /* More space above meta */
    max-width: none; /* Allow meta to span wider */
}
.author-name { font-weight: 700; color: var(--color-text-body); } /* Use body text color for author */
.article-meta time { }

.article-figure {
    margin: 0 auto 2.5rem auto; /* Center figure horizontally if needed, add space below */
    max-width: calc(var(--reading-width) + 100px); /* Allow images to be slightly wider than text */
}
.article-image { margin-bottom: 0.8rem; /* Space between image and caption */ border: var(--border-standard); /* Optional subtle border */ }
.article-caption {
    font-family: var(--font-primary); /* Use sans-serif for clarity */
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--color-caption);
    text-align: left; /* Keep caption aligned left */
    padding: 0 5px; /* Small horizontal padding */
    max-width: var(--reading-width); /* Align caption width with text */
    margin: 0 auto; /* Center caption container if figure is centered */
}

.article-body {
    font-size: 1.1rem; /* Slightly larger body text ~17.6px */
    line-height: 1.8; /* Maintain good line height */
    color: var(--color-text-body);
}
/* Ensure elements within article body respect reading width */
.article-body > * {
    max-width: var(--reading-width);
    /* margin-left: auto;  Optional: center align text blocks if container is wider */
    /* margin-right: auto; Optional: center align text blocks if container is wider */
}
/* Target first paragraph for drop cap - requires paragraph right after div */
.article-body p:first-of-type .drop-cap {
    float: left;
    font-size: 4.8em; /* Larger drop cap */
    line-height: 0.7; /* Fine-tune vertical alignment */
    margin: 0.1em 0.12em 0 0; /* Adjust spacing around drop cap */
    font-weight: 400; /* Normal weight for serif drop cap can look elegant */
    font-family: var(--font-secondary); /* Serif */
    color: var(--color-accent); /* Use accent color */
    padding-top: 0.1em; /* Nudge down slightly */
}

/* List styling within articles */
.article-body ul,
.article-body ol {
    padding-left: 1.5em; /* Adjust indentation */
    margin-left: 1em; /* Indent whole list slightly */
    margin-bottom: 1.75em;
}
.article-body ul {
    list-style: disc; /* Standard disc */
}
.article-body ol {
    list-style: decimal; /* Standard numbers */
}
.article-body ul ul,
.article-body ol ol,
.article-body ul ol,
.article-body ol ul {
    margin-top: 0.5em;
    margin-bottom: 0.75em;
    padding-left: 2em; /* Deeper indent for nested */
}
.article-body li {
    margin-bottom: 0.7em;
    padding-left: 0.5em; /* Space between marker and text */
}
/* Target specific lists like the rating */
.article-body p + ul { /* Target lists directly after a paragraph */
   /* Potentially add more top margin if needed */
   margin-top: -0.75em; /* Pull list closer to intro para */
}


/* Blockquote Styling (using Merriweather Italic) */
blockquote {
    margin: 2.5em 0 2.5em 0; /* Remove default browser indent, control with padding */
    padding: 1.5em 1.5em 1.5em 2em; /* More padding */
    border-left: 4px solid var(--color-quote-border);
    font-size: 1.15rem; /* Slightly larger */
    font-style: italic;
    color: #4a4a4a; /* Slightly darker quote text */
    font-family: var(--font-secondary);
    background-color: var(--color-subtle-bg); /* Subtle background */
    border-radius: 0 var(--border-radius-subtle) var(--border-radius-subtle) 0;
    max-width: calc(var(--reading-width) - 2em); /* Ensure it fits reading flow */
}
blockquote p { margin-bottom: 0.75em; font-size: inherit; /* Inherit quote font size */ line-height: 1.7; }
blockquote cite {
    display: block;
    margin-top: 1em;
    font-size: 0.9rem;
    font-style: normal;
    font-family: var(--font-primary);
    color: var(--color-meta);
    text-align: right;
}

/* --- Article Separator --- */
.article-separator {
    border: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--color-separator), transparent); /* Subtle gradient */
    margin: 7rem auto; /* Increased spacing */
    width: 75%;
    max-width: 400px; /* Max width for the separator line */
}
/* Hide separator after the last article - targeting the HR directly after the last article */
.articles-feed > .full-article:last-of-type + hr.article-separator {
     display: none;
}
/* If there's no separator after the last article in the HTML already, this rule isn't strictly needed */
.full-article:last-child {
    margin-bottom: 0; /* Remove bottom margin from the very last article */
}


/* --- Footer --- */
.site-footer {
    padding: 40px 0;
    margin-top: 70px;
    background-color: var(--color-subtle-bg);
    border-top: var(--border-standard);
    text-align: center;
    font-size: 0.85rem; /* Slightly larger footer text */
    color: var(--color-meta);
    line-height: 1.6;
}
.site-footer .container { padding: 0 30px; } /* Ensure padding */
.site-footer p { margin-bottom: 10px; font-size: inherit; max-width: none; }
.footer-nyt-link { font-size: 0.8rem; opacity: 0.85; }
/* Footer Logo Style (if uncommented) */
/* .footer-logo { max-height: 35px; width: auto; margin-bottom: 20px; opacity: 0.75; filter: grayscale(50%); } */

/* --- Responsiveness --- */
@media (max-width: 1024px) {
    html { font-size: 15.5px; }
    .container--narrow { max-width: calc(var(--reading-width) + 40px); }
    .article-title { font-size: 2.4rem; }
    .toc { padding: 25px 30px; }
    .toc ul { gap: 12px 25px; }
}

@media (max-width: 768px) {
    html { font-size: 15px; }
    .container { padding: 0 20px; }
    .container--narrow { max-width: 100%; padding: 0 20px; }
    .site-header { padding: 25px 0; margin-bottom: 50px; }
    .logo-img { max-height: 70px; }
    .toc { padding: 20px 25px; margin-bottom: 60px; width: auto; /* Allow it to shrink */ }
    .toc ul { grid-template-columns: 1fr; /* Stack TOC items */ gap: 10px; }
    .toc li { text-align: left; } /* Align text left when stacked */
    .article-title { font-size: 2.1rem; line-height: 1.2; }
    .article-body { font-size: 1.05rem; line-height: 1.75; }
    .drop-cap { font-size: 4.2em; }
    blockquote { font-size: 1.1rem; padding: 1.2em 1.2em 1.2em 1.5em; }
    .article-separator { margin: 5rem auto; width: 85%; }
    .site-footer { padding: 30px 0; margin-top: 50px; }
    .site-footer .container { padding: 0 20px; }

    /* Adjust article body indentation on smaller screens */
    .article-body ul, .article-body ol { padding-left: 1.2em; margin-left: 0.5em;}
    .article-body li { padding-left: 0.3em; }
}

@media (max-width: 480px) {
    html { font-size: 14.5px; } /* Slightly smaller base */
    .container { padding: 0 15px; }
    .container--narrow { padding: 0 15px; }
    .site-header { padding: 20px 0; margin-bottom: 40px; }
    .logo-img { max-height: 60px; }
    .toc { padding: 15px 20px; margin-bottom: 50px; }
    .toc h2 { font-size: 0.85rem; margin-bottom: 20px; }
    .toc a { font-size: 1rem; }
    .article-title { font-size: 1.8rem; line-height: 1.25; }
    .article-header { padding-bottom: 1rem; margin-bottom: 2rem; }
    .article-body { font-size: 1rem; line-height: 1.7; }
    .drop-cap { font-size: 3.8em; line-height: 0.75; margin-right: 0.1em;}
    blockquote { font-size: 1rem; padding: 1em 1em 1em 1.2em; border-left-width: 3px; }
    .article-separator { margin: 4rem auto; width: 90%; }
    .site-footer { padding: 25px 0; font-size: 0.8rem; }
     .site-footer .container { padding: 0 15px; }

     /* Further reduce list indentation */
    .article-body ul, .article-body ol { padding-left: 1em; margin-left: 0em;}
}
