/*
 * Dephilade Blog Stylesheet - Version 1.2.0
 *
 * Design philosophy based on principles from:
 * - Edward Tufte: Data-ink ratio, minimal chartjunk, content-first
 * - Robert Bringhurst: Typography exists to honor content
 * - Dieter Rams: Less, but better
 * - Jan Tschichold: Asymmetric, functional typography
 * - Josef Müller-Brockmann: Grid-based systems
 * - Matthew Butterick: Practical web typography
 * - Winterthur Museum: Georgian/Federal classical architecture
 *   (crown moulding, dentil details, panel wainscoting, classical proportions)
 */

/* ============================================
   RESET & BASE
   ============================================ */

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

html {
    font-size: 100%; /* 16px baseline */
}

/* ============================================
   TYPOGRAPHY
   Bringhurst: "Typography exists to honor content"
   Butterick: 18-21px, 1.4-1.6 line-height, 55-75 chars
   ============================================ */

body {
    /* Serif font stack for readability */
    font-family: Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;
    font-size: 1.1875rem; /* 19px */
    line-height: 1.5; /* Tufte-recommended line height */
    color: #5a5a5a; /* Lighter charcoal for better readability */
    background-color: #fdfbf8; /* Even lighter warm off-white */

    /* Winterthur-inspired pilaster pattern background */
    background-image:
        /* Pilaster shadow effect */
        linear-gradient(90deg,
            transparent 0%,
            rgba(138, 133, 122, 0.03) 15%,
            rgba(138, 133, 122, 0.08) 20%,
            rgba(138, 133, 122, 0.08) 80%,
            rgba(138, 133, 122, 0.03) 85%,
            transparent 100%
        ),
        /* Vertical pilaster lines */
        repeating-linear-gradient(
            90deg,
            transparent 0px,
            transparent 95px,
            rgba(138, 133, 122, 0.15) 95px,
            rgba(138, 133, 122, 0.15) 105px,
            transparent 105px,
            transparent 200px
        ),
        /* Subtle base texture */
        radial-gradient(circle at 50% 50%, rgba(240, 238, 231, 0.1) 0%, transparent 50%);
    background-size: 200px 100%, 200px 100%, 100px 100px;
    background-repeat: repeat, repeat, repeat;
    background-attachment: fixed;

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   LAYOUT
   Müller-Brockmann: Grid systems
   Tufte: Optimal line length 55-75 characters
   ============================================ */

.container {
    max-width: 700px; /* ~65 characters at 19px */
    margin: 0 auto;
    padding: 0 40px; /* Generous margins per Tufte */
}

/* ============================================
   HEADER - Enhanced with Classical Entablature
   Winterthur: Tripartite division (architrave, frieze, cornice)
   Rams: Unobtrusive, functional
   Tschichold: Asymmetric but balanced
   ============================================ */

header {
    position: relative;
    padding: 2.5rem 0 2rem 0;
    margin-bottom: 3rem;
    background: linear-gradient(to bottom, #fefefe 0%, #fdfbf8 100%);

    /* Entablature: Bottom border with dentil effect */
    border-bottom: 3px solid #6a6459;
}

/* Crown Moulding Effect - Top of header */
header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(to bottom,
        #e0dad0 0%,
        #f0ede7 50%,
        #fefefe 100%
    );
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Dentil Moulding - Small repeating blocks at bottom */
header::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    right: 0;
    height: 12px;
    background-image: repeating-linear-gradient(
        to right,
        #6a6459 0px,
        #6a6459 16px,
        transparent 16px,
        transparent 24px
    );
    background-size: 24px 12px;
    background-position: 0 0;
    opacity: 0.7;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: baseline; /* Baseline alignment for typography */
    position: relative;
    z-index: 1;
}

.site-title {
    font-size: 1.75rem; /* 28px - more prominent */
    font-weight: 600;
    color: #3a3a3a;
    letter-spacing: 0.05em; /* Classical spacing */
    text-transform: uppercase; /* Federal style formality */
    font-variant: small-caps;
}

/* ============================================
   NAVIGATION
   Rams: Good design is unobtrusive
   ============================================ */

nav ul {
    list-style: none;
    display: flex;
    gap: 2.5rem;
}

nav a {
    text-decoration: none;
    color: #6a6459;
    font-size: 0.9375rem; /* 15px */
    font-weight: 500;
    letter-spacing: 0.03em;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

nav a:hover,
nav a:focus {
    color: #3a3a3a;
    border-bottom-color: #d4b573; /* Lighter gold accent */
}

/* ============================================
   MAIN CONTENT
   ============================================ */

main {
    min-height: calc(100vh - 300px);
    padding-bottom: 4rem;
}

/* ============================================
   BLOG POST LISTINGS
   Winterthur: Panel wainscoting effect
   Tufte: Remove chartjunk, maximize content
   Rams: Less but better
   ============================================ */

.blog-posts {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.post-preview {
    position: relative;
    padding: 2.5rem;
    margin-bottom: 2rem;

    /* Subtle panel wainscoting effect */
    background: linear-gradient(to bottom, #ffffff 0%, #fefefe 100%);
    border: 1px solid #f0ede7;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.6),
        0 1px 2px rgba(0, 0, 0, 0.02),
        0 2px 4px rgba(0, 0, 0, 0.01);
}

/* Refined panel frame effect */
.post-preview::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    bottom: 12px;
    border: 1px solid #f0ede7;
    pointer-events: none;
}

.post-preview h2 {
    font-size: 1.75rem; /* 28px */
    font-weight: 600;
    margin-bottom: 0.75rem;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.post-preview h2 a {
    text-decoration: none;
    color: #3a3a3a;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s ease;
}

.post-preview h2 a:hover,
.post-preview h2 a:focus {
    border-bottom-color: #d4b573;
}

/* ============================================
   METADATA
   Butterick: Secondary information, smaller, lighter
   ============================================ */

.post-meta {
    color: #9a9589;
    font-size: 0.875rem; /* 14px */
    font-style: italic;
    margin-bottom: 1.25rem;
    letter-spacing: 0.02em;
}

/* ============================================
   POST EXCERPTS
   ============================================ */

.post-excerpt {
    color: #5a5a5a;
    margin-bottom: 1.25rem;
    line-height: 1.6;
}

.read-more {
    display: inline-block;
    color: #6a6459;
    text-decoration: none;
    font-size: 0.9375rem; /* 15px */
    font-weight: 500;
    letter-spacing: 0.03em;
    border-bottom: 1px solid #d4b573;
    transition: all 0.2s ease;
}

.read-more:hover,
.read-more:focus {
    color: #3a3a3a;
    border-bottom-color: #3a3a3a;
}

/* ============================================
   INDIVIDUAL POST PAGES
   Tufte: Integrated, clean presentation
   Winterthur: Classical proportions
   ============================================ */

.post-header {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid #f0ede7;

    /* Subtle architectural detail */
    position: relative;
}

/* Small decorative element - like a classical ornament */
.post-header::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 60px;
    height: 4px;
    background: linear-gradient(to right, #d4b573, transparent);
}

.post-title {
    font-size: 2.5rem; /* 40px - more prominent for classical hierarchy */
    font-weight: 600;
    color: #3a3a3a;
    margin-bottom: 0.75rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

/* ============================================
   POST CONTENT
   Bringhurst: Rhythm, proportion, harmony
   ============================================ */

.post-content {
    /* Subtle content panel */
    padding: 2.5rem;
    background: linear-gradient(to bottom, #ffffff 0%, #fefefe 100%);
    border: 1px solid #f0ede7;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.6),
        0 1px 2px rgba(0, 0, 0, 0.02);
}

.post-content h3 {
    font-size: 1.5rem; /* 24px */
    font-weight: 600;
    color: #3a3a3a;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

/* First h3 doesn't need top margin */
.post-content h3:first-child {
    margin-top: 0;
}

.post-content p {
    margin-bottom: 1.5rem;
    line-height: 1.6;
    color: #5a5a5a;
}

/* Tufte: Tight integration of lists with text */
.post-content ul,
.post-content ol {
    margin-bottom: 1.5rem;
    margin-left: 1.5rem;
    line-height: 1.6;
}

.post-content li {
    margin-bottom: 0.5rem;
    padding-left: 0.5rem;
}

.post-content ul li {
    list-style-type: disc;
}

/* Emphasis */
.post-content strong {
    font-weight: 600;
    color: #3a3a3a;
}

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

/* Code - monospace for technical accuracy */
.post-content code {
    background-color: #f8f6f2;
    padding: 0.125rem 0.375rem;
    font-family: "Consolas", "Monaco", "Courier New", monospace;
    font-size: 0.875em;
    color: #4a4a4a;
    border: 1px solid #f0ede7;
}

/* ============================================
   LINKS WITHIN CONTENT
   Tufte: Subtle, integrated with text
   ============================================ */

.post-content a {
    color: #5a5a5a;
    text-decoration: none;
    border-bottom: 1px solid #d4b573;
    transition: border-color 0.2s ease;
}

.post-content a:hover,
.post-content a:focus {
    border-bottom-color: #3a3a3a;
}

/* Back link */
.back-link {
    display: inline-block;
    margin-top: 3rem;
    color: #6a6459;
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    border-bottom: 1px solid #d4b573;
    transition: all 0.2s ease;
}

.back-link:hover,
.back-link:focus {
    color: #3a3a3a;
    border-bottom-color: #3a3a3a;
}

/* ============================================
   ABOUT PAGE
   ============================================ */

.about-content {
    padding: 2.5rem;
    background: linear-gradient(to bottom, #ffffff 0%, #fefefe 100%);
    border: 1px solid #f0ede7;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.6),
        0 1px 2px rgba(0, 0, 0, 0.02);
}

.about-content h2 {
    font-size: 1.75rem; /* 28px */
    font-weight: 600;
    color: #3a3a3a;
    margin-bottom: 1.5rem;
    margin-top: 2.5rem;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.about-content h2:first-child {
    margin-top: 0;
}

.about-content p {
    margin-bottom: 1.5rem;
    line-height: 1.6;
    color: #5a5a5a;
}

.about-content ul {
    margin-bottom: 1.5rem;
    margin-left: 1.5rem;
    line-height: 1.6;
}

.about-content li {
    margin-bottom: 0.5rem;
    padding-left: 0.5rem;
    list-style-type: disc;
}

/* ============================================
   FOOTER - Classical Cornice Treatment
   Rams: Minimal, unobtrusive
   Winterthur: Crown moulding detail
   ============================================ */

footer {
    position: relative;
    padding: 2.5rem 0;
    margin-top: 5rem;
    background: linear-gradient(to bottom, #fdfbf8 0%, #faf7f2 100%);
    text-align: center;

    /* Top border as cornice base */
    border-top: 3px solid #6a6459;
}

/* Crown moulding at top of footer */
footer::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(to bottom,
        #6a6459 0%,
        #9a9589 30%,
        #d0cabf 60%,
        #f0ede7 100%
    );
}

/* Dentil detail at top */
footer::after {
    content: '';
    position: absolute;
    top: -15px;
    left: 0;
    right: 0;
    height: 12px;
    background-image: repeating-linear-gradient(
        to right,
        #6a6459 0px,
        #6a6459 16px,
        transparent 16px,
        transparent 24px
    );
    background-size: 24px 12px;
    opacity: 0.6;
}

footer p {
    color: #9a9589;
    font-size: 0.875rem;
    position: relative;
    z-index: 1;
}

.version {
    color: #c5bfb3;
    font-size: 0.75rem;
    font-style: italic;
    margin-left: 0.5rem;
}

/* Cloud decoration - CSS-drawn vector shape */
footer::before {
    content: '';
    position: absolute;
    top: 1rem;
    right: 2rem;
    width: 80px;
    height: 40px;
    opacity: 0.25;
    z-index: 0;
    pointer-events: none;
}

/* Cloud shape using multiple circles */
footer::before {
    background:
        radial-gradient(circle at 25% 75%, rgba(240, 238, 231, 0.6) 0%, transparent 50%),
        radial-gradient(circle at 50% 85%, rgba(240, 238, 231, 0.6) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(240, 238, 231, 0.6) 0%, transparent 50%),
        radial-gradient(circle at 15% 60%, rgba(240, 238, 231, 0.6) 0%, transparent 50%),
        radial-gradient(circle at 35% 55%, rgba(240, 238, 231, 0.6) 0%, transparent 50%),
        radial-gradient(circle at 60% 55%, rgba(240, 238, 231, 0.6) 0%, transparent 50%),
        radial-gradient(circle at 85% 60%, rgba(240, 238, 231, 0.6) 0%, transparent 50%);
    border-radius: 50%;
    filter: blur(1px);
}

/* ============================================
   RESPONSIVE DESIGN
   Mobile-first thinking, essential content only
   ============================================ */

@media (max-width: 768px) {
    html {
        font-size: 100%; /* Maintain 16px baseline on mobile */
    }

    body {
        font-size: 1.125rem; /* 18px on mobile */
        line-height: 1.55;
    }

    .container {
        padding: 0 20px; /* Reduced but still generous */
    }

    header {
        padding: 2rem 0 1.5rem 0;
        margin-bottom: 2rem;
    }

    header .container {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    nav ul {
        gap: 1.5rem;
    }

    .site-title {
        font-size: 1.5rem; /* 24px */
    }

    .post-preview,
    .post-content,
    .about-content {
        padding: 1.5rem;
    }

    .post-preview::before {
        top: 8px;
        left: 8px;
        right: 8px;
        bottom: 8px;
    }

    .post-preview h2 {
        font-size: 1.5rem; /* 24px */
    }

    .post-title {
        font-size: 2rem; /* 32px */
    }

    .post-content h3,
    .about-content h2 {
        font-size: 1.375rem; /* 22px */
        margin-top: 2rem;
    }

    .blog-posts {
        gap: 2rem;
    }

    /* Simplify architectural details on mobile */
    header::before,
    header::after,
    footer::before,
    footer::after {
        height: 4px;
    }
}

/* ============================================
   PRINT STYLES
   Tufte: Consider all presentation contexts
   ============================================ */

@media print {
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    header,
    footer,
    nav,
    .read-more,
    .back-link {
        display: none;
    }

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

    .post-content a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        font-style: italic;
    }

    /* Remove decorative elements in print */
    .post-preview::before,
    .post-header::after {
        display: none;
    }

    .post-preview,
    .post-content,
    .about-content {
        border: none;
        box-shadow: none;
        padding: 0;
        background: none;
    }
}

/* ============================================
   ACCESSIBILITY
   Norman: Design for all users
   ============================================ */

/* Focus states for keyboard navigation */
a:focus,
button:focus {
    outline: 2px solid #c9a961;
    outline-offset: 2px;
}

/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
