/* ==========================================================================
   The Collapse of Complexity — Site Stylesheet
   Typography: Playfair Display + Inter
   Palette: Ink on Paper with Burnt Orange accent
   ========================================================================== */

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

:root {
    --ink: #1a1a1a;
    --ink-light: #4a4a4a;
    --ink-muted: #8a8a8a;
    --paper: #fafaf8;
    --paper-dark: #f0f0ec;
    --accent: #c45d3e;
    --accent-hover: #a84d32;
    --rule: #d4d4d0;
    --max-width: 720px;
    --essay-width: 660px;
}

html {
    font-size: 18px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--paper);
    color: var(--ink);
    line-height: 1.75;
    min-height: 100vh;
}

/* ==========================================================================
   Navigation
   ========================================================================== */

.site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(250, 250, 248, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--rule);
}

.nav-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 2rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
    letter-spacing: -0.01em;
}

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

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.8rem;
    list-style: none;
}

.nav-links a {
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--ink-muted);
    text-decoration: none;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--ink);
}

.nav-cta {
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--paper) !important;
    background: var(--ink);
    padding: 0.4rem 1rem;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: background 0.2s;
}

.nav-cta:hover {
    background: var(--ink-light) !important;
    color: var(--paper) !important;
}

/* Mobile nav toggle */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--ink);
    margin: 4px 0;
    transition: 0.3s;
}

/* ==========================================================================
   Page Layout
   ========================================================================== */

.page-body {
    padding-top: 56px; /* nav height */
}

.container {
    max-width: var(--max-width);
    width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
}

.essay-container {
    max-width: var(--essay-width);
    width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ==========================================================================
   Hero (Landing Page)
   ========================================================================== */

.hero {
    text-align: center;
    padding: 6rem 2rem 4rem;
}

.hero .overline {
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: 2rem;
}

.hero h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 3.6rem;
    font-weight: 700;
    line-height: 1.08;
    color: var(--ink);
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

.hero .subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 1.15rem;
    font-weight: 300;
    color: var(--ink-light);
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.hero .authors {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--ink-muted);
    letter-spacing: 0.02em;
}

/* ==========================================================================
   Essay Header (Essay pages)
   ========================================================================== */

.essay-header {
    text-align: center;
    padding: 5rem 2rem 3rem;
    border-bottom: 1px solid var(--rule);
    margin-bottom: 3rem;
}

.essay-header .essay-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 1rem;
}

.essay-header h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2.8rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--ink);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.essay-header .essay-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 300;
    color: var(--ink-light);
    line-height: 1.6;
    max-width: 520px;
    margin: 0 auto;
}

/* Previously box */
.previously {
    background: var(--paper-dark);
    border-left: 3px solid var(--accent);
    padding: 1rem 1.5rem;
    margin-bottom: 2.5rem;
    font-size: 0.85rem;
    color: var(--ink-light);
    line-height: 1.6;
}

.previously strong {
    color: var(--ink);
    font-weight: 500;
}

.previously a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.previously a:hover {
    border-bottom-color: var(--accent);
}

/* ==========================================================================
   Typography — Essay Content
   ========================================================================== */

.essay-content h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--ink);
    margin: 3rem 0 1.2rem;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.essay-content h3 {
    font-family: 'Inter', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--ink);
    margin: 2.5rem 0 0.8rem;
    line-height: 1.3;
}

.essay-content h4 {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink);
    margin: 2rem 0 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.essay-content p {
    margin-bottom: 1.3rem;
    color: var(--ink);
}

.essay-content strong {
    font-weight: 600;
}

.essay-content em {
    font-style: italic;
}

.essay-content a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(196, 93, 62, 0.3);
    transition: border-color 0.2s;
}

.essay-content a:hover {
    border-bottom-color: var(--accent);
}

/* Blockquotes */
.essay-content blockquote {
    border-left: 3px solid var(--accent);
    padding: 0.5rem 0 0.5rem 1.5rem;
    margin: 2rem 0;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.05rem;
    font-style: italic;
    color: var(--ink-light);
    line-height: 1.7;
}

/* Lists */
.essay-content ul,
.essay-content ol {
    margin: 1rem 0 1.5rem 1.5rem;
}

.essay-content li {
    margin-bottom: 0.5rem;
}

/* Tables */
.essay-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.85rem;
}

.essay-content th {
    background: var(--paper-dark);
    font-weight: 600;
    text-align: left;
    padding: 0.7rem 1rem;
    border-bottom: 2px solid var(--rule);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.essay-content td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--rule);
    vertical-align: top;
}

/* Code blocks */
.essay-content pre {
    background: var(--ink);
    color: var(--paper);
    padding: 1.5rem;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.82rem;
    line-height: 1.6;
    margin: 2rem 0;
}

.essay-content code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.88em;
    background: var(--paper-dark);
    padding: 0.15em 0.4em;
    border-radius: 3px;
}

.essay-content pre code {
    background: none;
    padding: 0;
}

/* Key Insight boxes */
.key-insight {
    background: var(--paper-dark);
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 1.5rem 2rem;
    margin: 2.5rem 0;
}

.key-insight-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.7rem;
}

.key-insight p {
    font-size: 0.92rem;
    color: var(--ink);
    margin-bottom: 0.5rem;
}

.key-insight p:last-child {
    margin-bottom: 0;
}

/* Deep Dive, Evidence, In Practice boxes */
.callout-box {
    border-left: 3px solid var(--ink-muted);
    padding: 1rem 1.5rem;
    margin: 2rem 0;
    background: rgba(0,0,0,0.015);
}

.callout-box.deep-dive {
    border-left-color: #4a7c8c;
}

.callout-box.evidence {
    border-left-color: #6b8e5a;
}

.callout-box.practice {
    border-left-color: #9a7b4f;
}

.callout-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

/* First paragraph of essay — drop cap style */
.essay-content .opening-paragraph::first-letter {
    font-family: 'Playfair Display', Georgia, serif;
    float: left;
    font-size: 3.5rem;
    line-height: 0.85;
    padding-right: 0.1em;
    padding-top: 0.05em;
    color: var(--ink);
    font-weight: 700;
}

/* ==========================================================================
   Horizontal Rule / Section Breaks
   ========================================================================== */

.section-break {
    width: 60px;
    height: 1px;
    background: var(--rule);
    margin: 3rem auto;
    border: none;
}

.rule {
    width: 60px;
    height: 1px;
    background: var(--rule);
    margin: 0 auto;
}

/* ==========================================================================
   Essay Navigation (Prev / Next)
   ========================================================================== */

.essay-nav {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    margin: 4rem 0 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--rule);
    gap: 1rem;
}

.essay-nav a {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    padding: 1rem;
    border-radius: 4px;
    transition: background 0.2s;
    max-width: 48%;
}

.essay-nav a:hover {
    background: var(--paper-dark);
}

.essay-nav .nav-direction {
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: 0.3rem;
}

.essay-nav .nav-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.3;
}

.essay-nav .next {
    text-align: right;
    margin-left: auto;
}

/* ==========================================================================
   Essay List (Landing Page)
   ========================================================================== */

.essay-list {
    margin: 3rem auto;
    max-width: 600px;
}

.essay-list a {
    display: flex;
    align-items: baseline;
    padding: 1rem 0.5rem;
    border-bottom: 1px solid var(--rule);
    text-decoration: none;
    transition: background 0.15s;
}

.essay-list a:first-child {
    border-top: 1px solid var(--rule);
}

.essay-list a:hover {
    background: var(--paper-dark);
}

.essay-list .essay-number {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 0.85rem;
    color: var(--ink-muted);
    width: 2.5rem;
    flex-shrink: 0;
}

.essay-list .essay-title {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--ink);
}

.essay-list .essay-desc {
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 300;
    color: var(--ink-muted);
    margin-left: 0.5rem;
}

/* ==========================================================================
   CTA / Email Signup
   ========================================================================== */

.cta-section {
    text-align: center;
    padding: 3rem 0;
}

.cta-text {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: var(--ink-light);
    margin-bottom: 1.2rem;
}

.email-form {
    display: flex;
    gap: 0.5rem;
    max-width: 440px;
    margin: 0 auto;
}

.email-input {
    flex: 1;
    padding: 0.7rem 1rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    border: 1px solid var(--rule);
    border-radius: 4px;
    background: white;
    color: var(--ink);
    outline: none;
    transition: border-color 0.2s;
}

.email-input:focus {
    border-color: var(--ink-muted);
}

.email-input::placeholder {
    color: var(--ink-muted);
}

.submit-btn {
    padding: 0.7rem 1.5rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    background: var(--ink);
    color: var(--paper);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.submit-btn:hover {
    background: var(--ink-light);
}

.success-message {
    display: none;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: var(--accent);
    margin-top: 0.8rem;
}

/* Start Reading button */
.btn-primary {
    display: inline-block;
    padding: 0.8rem 2rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
    letter-spacing: 0.02em;
}

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

.btn-secondary {
    display: inline-block;
    padding: 0.8rem 2rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--rule);
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    letter-spacing: 0.02em;
}

.btn-secondary:hover {
    border-color: var(--ink);
}

/* ==========================================================================
   Thesis Block
   ========================================================================== */

.thesis-block {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.1rem;
    font-weight: 400;
    font-style: italic;
    color: var(--ink-light);
    line-height: 1.7;
    max-width: 560px;
    margin: 0 auto;
    text-align: center;
    padding: 2rem 0;
}

/* Flow line */
.flow-line {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    color: var(--ink-muted);
    text-align: center;
    margin: 1.5rem 0;
}

.flow-line span {
    color: var(--rule);
    margin: 0 0.3rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
    text-align: center;
    padding: 3rem 2rem;
    border-top: 1px solid var(--rule);
    margin-top: 2rem;
}

.site-footer p {
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    color: var(--ink-muted);
    margin-bottom: 0.3rem;
}

.site-footer a {
    color: var(--ink-muted);
    text-decoration: none;
    border-bottom: 1px solid var(--rule);
    transition: color 0.2s;
}

.site-footer a:hover {
    color: var(--ink-light);
}

/* ==========================================================================
   About Page
   ========================================================================== */

.about-content {
    padding: 4rem 0;
}

.author-bio {
    margin-bottom: 3rem;
}

.author-bio h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.author-bio p {
    margin-bottom: 1rem;
    color: var(--ink-light);
}

/* ==========================================================================
   Table of Contents (within essays)
   ========================================================================== */

.essay-toc {
    background: var(--paper-dark);
    border-radius: 4px;
    padding: 1.5rem 2rem;
    margin: 2rem 0 3rem;
}

.essay-toc-title {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: 0.8rem;
}

.essay-toc ol {
    list-style: none;
    counter-reset: toc;
}

.essay-toc li {
    counter-increment: toc;
    padding: 0.3rem 0;
}

.essay-toc li::before {
    content: counter(toc) ".";
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 0.85rem;
    color: var(--ink-muted);
    margin-right: 0.6rem;
}

.essay-toc a {
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.essay-toc a:hover {
    border-bottom-color: var(--accent);
    color: var(--accent);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    html { font-size: 17px; }

    .hero h1 { font-size: 2.6rem; }
    .essay-header h1 { font-size: 2.2rem; }

    .nav-links {
        display: none;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: var(--paper);
        border-bottom: 1px solid var(--rule);
        flex-direction: column;
        padding: 1rem 2rem;
        gap: 0.8rem;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-toggle {
        display: block;
    }

    .essay-nav {
        flex-direction: column;
    }

    .essay-nav a {
        max-width: 100%;
    }

    .essay-nav .next {
        text-align: left;
    }

    .essay-list .essay-desc {
        display: none;
    }

    .email-form {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    html { font-size: 16px; }
    .hero h1 { font-size: 2.2rem; }
    .essay-header h1 { font-size: 1.9rem; }
    .container, .essay-container { padding: 0 1.25rem; }
    .hero { padding: 4rem 1.25rem 3rem; }
    .essay-header { padding: 4rem 1.25rem 2rem; }
}
