/* =================
   CSS Reset & Base
   ================= */

:root {
    /* Nature-Inspired Green Color Palette */
    --color-family-tree: #a8b491;     /* Light accent */
    --color-highland: #7d9164;        /* Medium-light accent */
    --color-jolly-green: #607548;     /* Medium accent */
    --color-zen-garden: #475833;      /* Medium-dark accent */
    --color-turtle-skin: #2e3b1f;     /* Dark accent */
    --color-darkness: #15190b;        /* Darkest color */
    --color-white: #FFFFFF;           /* White for contrast */
    
    /* Semantic Color Variables */
    --bg-primary: var(--color-white);
    --bg-secondary: #f8faf6;          /* Very light green tint */
    --bg-accent: var(--color-family-tree);
    --text-primary: var(--color-darkness);
    --text-secondary: var(--color-turtle-skin);
    --text-muted: var(--color-zen-garden);
    --border-color: var(--color-highland);
    --shadow-color: rgba(21, 25, 11, 0.1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-secondary);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    /* Mobile-first approach */
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Professional article container */
.article-container {
    max-width: 1200px;
    margin: 0 auto;
    background: transparent;
    width: 100%;
    box-sizing: border-box;
}

/* =================
   Typography
   ================= */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 1rem;
}

h1 {
    font-size: clamp(2rem, 6vw, 4rem);
    font-weight: 700;
    line-height: 1.2;
}

h2 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    margin-top: 2.5rem;
    margin-bottom: 1.5rem;
    line-height: 1.3;
}

h3 {
    font-size: clamp(1.125rem, 3vw, 1.75rem);
    margin-top: 1.75rem;
    margin-bottom: 1rem;
    line-height: 1.4;
}

h4 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

p {
    margin-bottom: 1.5rem;
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    line-height: 1.7;
}

ul, ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.5rem;
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    line-height: 1.6;
}

/* =================
   Layout Structure
   ================= */
.hero {
    background: linear-gradient(135deg, var(--color-turtle-skin) 0%, var(--color-darkness) 100%);
    color: var(--color-white);
    padding: 4rem 3rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    width: 100%;
}

.main-content {
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-primary);
    padding: 2rem;
    box-shadow: 0 20px 60px var(--shadow-color);
    border-radius: 0 0 20px 20px;
    width: 100%;
    box-sizing: border-box;
}

.blog-post {
    background: transparent;
    padding: 2rem 0;
    max-width: 100%;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}


/* =================
   Hero Section
   ================= */

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.05)"/><circle cx="10" cy="60" r="0.5" fill="rgba(255,255,255,0.05)"/><circle cx="90" cy="40" r="0.5" fill="rgba(255,255,255,0.05)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    margin-bottom: 1.5rem;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
}

.hero-subtitle {
    font-size: clamp(1.125rem, 2vw, 1.5rem);
    margin-bottom: 3rem;
    opacity: 0.9;
    font-weight: 300;
    line-height: 1.6;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.author-info {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 0.5rem;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.08);
    transition: background 0.3s ease;
    /* Ensure touch targets are accessible */
    min-height: 44px;
}

.author-info:hover {
    background: rgba(255, 255, 255, 0.12);
}

.author-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.5);
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    /* Professional profile photo optimizations */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    backface-visibility: hidden;
    will-change: transform;
}

.author-avatar:hover {
    transform: scale(1.08);
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.author-details {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.author-name {
    font-weight: 600;
    font-size: 1.125rem;
}

.author-title {
    opacity: 0.8;
    font-size: 0.875rem;
}

.publication-date {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.publication-date time {
    font-weight: 500;
    font-size: 1rem;
}

.read-time {
    opacity: 0.8;
    font-size: 0.875rem;
}

/* =================
   Main Content Area
   ================= */
.main-content {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-primary);
    overflow-y: auto;
    padding: 2rem 1rem;
    box-sizing: border-box;
}

.blog-post {
    padding: 4rem 3rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.content-section {
    margin-bottom: 3rem;
}

/* =================
   Highlight Boxes
   ================= */
.highlight-box {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border-left: 4px solid var(--color-jolly-green);
    padding: 2rem;
    border-radius: 12px;
    margin: 2rem 0;
    box-shadow: 0 4px 15px var(--shadow-color);
}

.highlight-box h3 {
    color: var(--color-jolly-green);
    margin-top: 0;
    margin-bottom: 1rem;
}

.key-takeaway {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border: 1px solid var(--color-highland);
    border-radius: 16px;
    padding: 2.5rem;
    margin: 3rem 0;
    text-align: center;
    box-shadow: 0 10px 30px var(--shadow-color);
}

.key-takeaway h3 {
    color: var(--color-zen-garden);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

/* =================
   Code Blocks
   ================= */
.code-block {
    background: var(--color-darkness);
    border-radius: 12px;
    overflow: hidden;
    margin: 2rem 0;
    box-shadow: 0 10px 30px var(--shadow-color);
    border: 1px solid var(--color-turtle-skin);
}

.code-header {
    background: var(--color-turtle-skin);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--color-zen-garden);
}

.code-title {
    color: var(--color-family-tree);
    font-weight: 500;
    font-size: 0.875rem;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

.copy-btn {
    background: var(--color-highland);
    color: var(--color-white);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.copy-btn:hover {
    background: var(--color-jolly-green);
}

.code-block pre {
    margin: 0;
    padding: 1.5rem;
    overflow-x: auto;
    background: transparent;
}

.code-block code {
    color: var(--color-family-tree);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.7;
    white-space: pre;
}

/* =================
   Feature Grid
   ================= */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 3rem 0;
}

.feature-card {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 15px var(--shadow-color);
}

.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px var(--shadow-color);
}

.feature-card h4 {
    color: var(--color-jolly-green);
    margin-bottom: 1rem;
}

.feature-card p {
    color: var(--text-muted);
    margin-bottom: 0;
    font-size: 1rem;
}

/* =================
   Lessons List
   ================= */
.lessons-list {
    margin: 2.5rem 0;
}

.lesson-item {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    align-items: flex-start;
}

.lesson-number {
    background: linear-gradient(135deg, var(--color-jolly-green) 0%, var(--color-zen-garden) 100%);
    color: var(--color-white);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    flex-shrink: 0;
    box-shadow: 0 4px 15px var(--shadow-color);
}

.lesson-content h4 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.lesson-content p {
    color: var(--text-muted);
    margin-bottom: 0;
    font-size: 1rem;
}

/* =================
   Call to Action
   ================= */
.cta-section {
    background: linear-gradient(135deg, var(--color-zen-garden) 0%, var(--color-turtle-skin) 100%);
    color: var(--color-white);
    padding: 4rem 2rem;
    text-align: center;
    width: 100%;
}

.cta-content {
    max-width: 600px;
    margin: 0 auto;
}

.cta-content h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: var(--color-white);
}

.cta-content p {
    margin-bottom: 2.5rem;
    opacity: 0.9;
    font-size: 1.125rem;
}

.cta-button {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, var(--color-highland) 0%, var(--color-jolly-green) 100%);
    color: var(--color-white);
    text-decoration: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 10px 30px var(--shadow-color);
    /* Ensure accessible touch target */
    min-height: 44px;
    text-align: center;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px var(--shadow-color);
}

.cta-button svg {
    transition: transform 0.3s ease;
}

.cta-button:hover svg {
    transform: translateX(2px);
}

/* =================
   Footer
   ================= */
.blog-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 3rem 2rem;
    text-align: center;
    width: 100%;
}

.footer-content {
    max-width: 600px;
    margin: 0 auto;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.social-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.social-links a:hover {
    color: var(--color-jolly-green);
}

.blog-footer p {
    color: var(--text-muted);
    margin: 0;
    font-size: 0.875rem;
}

/* =================
   Print Styles
   ================= */
@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body {
        background: white !important;
        color: black !important;
        font-size: 12pt;
        line-height: 1.4;
    }

    .blog-post {
        box-shadow: none !important;
        border-radius: 0 !important;
        margin: 0 !important;
        max-width: none !important;
    }


    .hero {
        background: var(--bg-secondary) !important;
        color: var(--text-primary) !important;
        page-break-inside: avoid;
    }

    .hero-title {
        text-shadow: none !important;
    }

    .code-block {
        background: var(--bg-secondary) !important;
        border: 1px solid var(--border-color) !important;
        page-break-inside: avoid;
    }

    .code-header {
        background: var(--bg-secondary) !important;
        border-bottom: 1px solid var(--border-color) !important;
    }

    .code-title {
        color: var(--text-secondary) !important;
    }

    .copy-btn {
        display: none !important;
    }

    .code-block code {
        color: var(--text-primary) !important;
    }

    .cta-section {
        background: var(--bg-secondary) !important;
        color: var(--text-primary) !important;
    }

    .cta-button {
        background: var(--color-zen-garden) !important;
        color: var(--color-white) !important;
        box-shadow: none !important;
    }

    .lesson-number {
        background: var(--color-zen-garden) !important;
        box-shadow: none !important;
    }

    .highlight-box,
    .key-takeaway {
        background: var(--bg-secondary) !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }

    .feature-card {
        background: var(--bg-secondary) !important;
        border: 1px solid var(--border-color) !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }

    .social-links {
        display: none !important;
    }

    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }

    p, li {
        orphans: 3;
        widows: 3;
    }

    .content-section {
        page-break-inside: avoid;
        margin-bottom: 2rem !important;
    }
}

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

/* Tablet styles */
@media (max-width: 1024px) and (min-width: 769px) {
    .main-content {
        margin: 0 2rem;
        padding: 2rem 1.5rem;
    }
    
    .hero {
        padding: 3rem 2rem;
    }
    
    .cta-section {
        padding: 3rem 2rem;
    }
    
    .blog-footer {
        padding: 2.5rem 2rem;
    }
}

/* Mobile tablet styles */
@media (max-width: 768px) {
    .hero {
        padding: 2rem 1rem;
    }

    .article-meta {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        text-align: center;
    }

    .publication-date {
        align-items: center;
    }

    .main-content {
        margin: 0;
        padding: 1rem;
        border-radius: 0;
        box-shadow: none;
        width: 100%;
        max-width: 100%;
    }

    .blog-post {
        padding: 1rem 0;
    }

    .feature-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin: 2rem 0;
    }

    .feature-card {
        padding: 1.5rem;
        margin: 0;
    }

    .lesson-item {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        align-items: center;
    }

    .lesson-number {
        align-self: center;
    }

    .cta-section {
        padding: 2rem 1rem;
    }

    .social-links {
        gap: 1rem;
    }

    .code-block {
        margin: 1.5rem 0;
    }

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

    .copy-btn {
        align-self: flex-end;
    }

    .content-section {
        margin-bottom: 2rem;
    }

    .highlight-box,
    .key-takeaway {
        margin: 1.5rem 0;
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 1.5rem 0.75rem;
    }

    .hero-title {
        font-size: clamp(1.75rem, 8vw, 2.5rem);
        line-height: 1.2;
        margin-bottom: 1rem;
    }

    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 2rem;
    }

    .main-content {
        margin: 0;
        padding: 0.75rem;
        border-radius: 0;
        box-shadow: none;
    }

    .blog-post {
        padding: 1rem 0;
    }

    .highlight-box,
    .key-takeaway {
        padding: 1.25rem;
        margin: 1rem 0;
    }

    .feature-card {
        padding: 1rem;
    }

    .cta-section {
        padding: 1.5rem 0.75rem;
    }

    .blog-footer {
        padding: 1.5rem 0.75rem;
    }

    p {
        font-size: 1rem;
        line-height: 1.6;
        margin-bottom: 1.25rem;
    }

    h2 {
        font-size: clamp(1.5rem, 6vw, 2rem);
        margin-top: 2rem;
        margin-bottom: 1rem;
    }

    h3 {
        font-size: clamp(1.25rem, 5vw, 1.5rem);
        margin-top: 1.5rem;
        margin-bottom: 0.75rem;
    }

    .author-avatar {
        width: 48px;
        height: 48px;
    }

    .author-info {
        gap: 1rem;
        padding: 0.75rem;
    }
}

/* =================
   Accessibility
   ================= */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* Focus styles for keyboard navigation */
a:focus,
button:focus {
    outline: 2px solid var(--color-jolly-green);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .hero {
        background: var(--color-darkness) !important;
        color: var(--color-white) !important;
    }

    .code-block {
        background: var(--color-darkness) !important;
        border: 2px solid var(--color-white) !important;
    }

    .code-block code {
        color: var(--color-white) !important;
    }
}