/* ===========================================
   Reset and Base Styles
   =========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Visually hidden but accessible to screen readers */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip link for keyboard accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--secondary-color);
    color: var(--text-color);
    padding: 8px 16px;
    z-index: 100;
    text-decoration: none;
    font-family: var(--font-primary);
    font-weight: 700;
    transition: top var(--transition-fast);
    outline: none;
}

.skip-link:focus {
    top: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

:root {
    /* Colors */
    --primary-color: #3C9F6A;
    --secondary-color: #173625;
    --bg-color: #3C9F6A;
    --text-color: #ffffff;
    --nav-bg: #EAF6EF;
    --nav-text: #3C9F6A;
    
    /* Typography */
    --font-primary: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-body: 'Merriweather', Georgia, serif;
    --font-heading: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    /* Spacing */
    --section-padding: 100px 40px;
    --section-padding-mobile: 40px 20px;
    --section-padding-small: 40px 16px;
    --container-max-width: 1400px;
    --grid-gap: 40px;
    --grid-gap-mobile: 20px;
    
    /* Layout */
    --sidebar-width: 400px;
    --post-sidebar-width: 500px;
    --header-offset: 80px;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Prevent horizontal scroll from layout issues */
    overflow-x: hidden;
}

/* Base link styling */
a {
    color: inherit;
    text-decoration: none;
}

/* Content links with thin underline */
.hero-subtitle a,
.section-content a,
.contact-phone a,
.contact-email a {
    color: var(--text-color);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.post-body a {
    color: var(--secondary-color);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

/* ===========================================
   Header Navigation
   =========================================== */
.header {
    position: sticky;
    top: 0;
    background-color: var(--nav-bg);
    z-index: 50;
    border-bottom: 1px solid var(--primary-color);
}

.nav-container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 30px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo a {
    font-family: var(--font-primary);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--nav-text);
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    font-family: var(--font-primary);
    color: var(--nav-text);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    font-size: 1rem;
    font-weight: 700;
    transition: opacity 0.2s;
}

.nav-links a:hover {
    opacity: 0.7;
}

/* Loading and error message styling */
.loading-message,
.error-message {
    padding: 40px;
    text-align: center;
    grid-column: 1 / -1;
    font-size: 1.125rem;
    color: var(--text-color);
}

.error-message p {
    margin: 0;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--nav-text);
    padding: 5px;
}

.menu-toggle-close {
    display: none;
}

.menu-toggle.active .menu-toggle-icon {
    display: none;
}

.menu-toggle.active .menu-toggle-close {
    display: inline;
}

.mobile-menu {
    display: none;
    flex-direction: column;
    gap: 15px;
    padding: 20px 40px;
    background-color: var(--nav-bg);
    border-top: 1px solid var(--primary-color);
}

.mobile-menu.active {
    display: flex;
}

.mobile-menu a {
    font-family: var(--font-primary);
    color: var(--nav-text);
    font-size: 1.1rem;
    font-weight: 700;
}

/* ===========================================
   Hero Section
   =========================================== */
.hero {
    padding: var(--section-padding);
    padding-left: var(--sidebar-width);
    min-height: 70vh;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
}

.hero-content {
    max-width: 100%;
    width: 100%;
}

.hero-title {
    font-family: var(--font-heading);
    font-size: clamp(3rem, 6vw, 5.5rem);
    font-weight: 500;
    margin-bottom: 40px;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: var(--text-color);
}

.hero-subtitle {
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 500;
    margin-bottom: 30px;
    letter-spacing: -0.02em;
    line-height: 1.3;
    color: var(--text-color);
    white-space: pre-wrap;
}

/* ===========================================
   Section Styles
   =========================================== */
.section {
    padding: var(--section-padding);
}

.container {
    max-width: 100%;
    width: 100%;
    display: grid;
    grid-template-columns: var(--sidebar-width) auto 1fr;
    gap: var(--grid-gap) 60px;
    align-items: start;
}

.section-header {
    display: flex;
    align-items: flex-start;
    position: relative;
    grid-column: 2;
}

.posts-section .section-header {
    grid-column: 1;
}

.section-title {
    font-family: var(--font-body);
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    font-weight: 300;
    letter-spacing: -0.02em;
    color: var(--text-color);
    margin: 0;
    position: relative;
    padding-left: 50px;
}

.section-title::before {
    content: '';
    position: absolute;
    right: 100%;
    top: 50%;
    width: var(--sidebar-width);
    margin-right: 10px;
    height: 1px;
    background-color: var(--text-color);
    transform: translateY(-50%);
}

.posts-section .section-title::before {
    left: 0;
    right: auto;
    width: 40px;
    margin-right: 0;
}

.section-content {
    font-size: 1.125rem;
    line-height: 1.7;
    color: var(--text-color);
    grid-column: 3;
}

.section-content p {
    margin-bottom: 20px;
}

.section-content p:last-child {
    margin-bottom: 0;
}

/* ===========================================
   Posts Section
   =========================================== */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
    grid-column: 1 / -1;
    align-items: stretch;
    max-width: 100%;
    box-sizing: border-box;
}

.post-card-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
    max-width: 100%;
    box-sizing: border-box;
}

.post-card {
    background-color: var(--secondary-color);
    padding: 30px;
    border-bottom: 1px solid var(--text-color);
    transition: opacity 0.2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.post-card:hover {
    opacity: 0.7;
}

.post-tag {
    font-family: var(--font-primary);
    display: inline-block;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 20px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.post-title {
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    font-weight: 500;
    margin-bottom: 20px;
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: var(--text-color);
}

.post-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.post-category {
    font-family: var(--font-primary);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ===========================================
   Contact Section
   =========================================== */
.contact-section {
    text-align: left;
}

.contact-title {
    font-family: var(--font-heading);
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 500;
    margin-bottom: 50px;
    letter-spacing: -0.03em;
    color: var(--text-color);
    grid-column: 2;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
    grid-column: 3;
}

.contact-name,
.contact-phone,
.contact-email {
    font-size: 1.125rem;
    line-height: 1.7;
    color: var(--text-color);
}

/* ===========================================
   Post Page Styles
   =========================================== */
.back-section {
    padding: 40px 40px 0;
}

.back-link {
    font-family: var(--font-primary);
    display: inline-block;
    color: var(--text-color);
    font-size: 1rem;
    font-weight: 700;
    transition: opacity 0.2s;
}

.back-link:hover {
    opacity: 0.7;
}

.post-header-section {
    padding: 60px 40px 80px;
}

.post-header-section .container {
    display: grid;
    grid-template-columns: var(--post-sidebar-width) 1fr;
    gap: 60px;
    align-items: start;
    max-width: var(--container-max-width);
    margin: 0 auto;
}

.post-header-section .post-tag {
    margin-bottom: 20px;
}

.post-page-title {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 500;
    letter-spacing: -0.03em;
    line-height: 1.2;
    color: var(--text-color);
    margin: 0;
    grid-column: 1;
}

.post-header-meta {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-top: 8px;
}

.post-date {
    font-family: var(--font-primary);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-color);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.9;
}

.post-header-section .post-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.post-content-section {
    padding: 80px 40px 100px;
    background-color: var(--nav-bg);
}

.post-content-section .container {
    display: grid;
    grid-template-columns: var(--post-sidebar-width) 1fr;
    gap: 60px;
    max-width: var(--container-max-width);
    margin: 0 auto;
}

.post-body {
    grid-column: 2;
    max-width: 1000px;
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--secondary-color);
}

.post-body h2 {
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 500;
    letter-spacing: -0.02em;
    margin-top: 50px;
    margin-bottom: 20px;
    color: var(--secondary-color);
}

.post-body h2:first-child {
    margin-top: 0;
}

.post-body p {
    margin-bottom: 20px;
}

.post-body ul,
.post-body ol {
    margin-bottom: 20px;
    padding-left: 30px;
}

.post-body li {
    margin-bottom: 10px;
}

.post-body blockquote {
    margin: 40px 0;
    padding: 30px 40px;
    border-left: 3px solid var(--secondary-color);
    background-color: rgba(23, 54, 37, 0.1);
    font-size: 1.25rem;
    font-style: italic;
    line-height: 1.6;
    color: var(--secondary-color);
}

.post-body blockquote p {
    margin-bottom: 0;
}

.post-image-placeholder {
    margin: 40px 0;
    padding: 60px 40px;
    background-color: #f5f5f5;
    border: 2px dashed #ccc;
    text-align: center;
    color: #666;
    font-size: 1rem;
}

/* ===========================================
   Responsive Design
   =========================================== */
@media (max-width: 968px) {
    .posts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    :root {
        --section-padding: var(--section-padding-mobile);
        --sidebar-width: 0;
    }

    .nav-container {
        padding: 20px;
    }

    .nav-links {
        display: none;
    }

    .menu-toggle {
        display: block;
    }

    .hero {
        min-height: auto;
        padding: 30px 20px 10px;
        padding-left: 20px;
    }

    .hero-title {
        margin-bottom: 30px;
    }

    .hero-subtitle {
        margin-bottom: 16px;
        font-size: 2.75rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .container {
        grid-template-columns: 1fr;
        gap: var(--grid-gap-mobile);
    }

    .section-header {
        grid-column: 1;
    }

    .section-title {
        padding-left: 0;
    }

    .section-title::before {
        display: none;
    }

    .section-content {
        grid-column: 1;
        font-size: 1rem;
    }

    /* Intro section specific spacing */
    .section.intro-section {
        padding: 10px 16px 40px;
    }

    .posts-grid {
        grid-column: 1;
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .post-card {
        padding: 24px 16px 20px;
    }

    .contact-title {
        grid-column: 1;
    }

    .contact-info {
        grid-column: 1;
        gap: 15px;
    }

    .back-section {
        padding: 30px 20px 0;
    }

    .post-header-section {
        padding: 40px 20px 50px;
    }

    .post-header-section .container {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .post-page-title {
        grid-column: 1;
    }

    .post-header-meta {
        grid-column: 1;
        gap: 20px;
    }

    .post-content-section {
        padding: 0 20px 60px;
    }

    .post-content-section .container {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .post-body {
        grid-column: 1;
        font-size: 1rem;
    }

    .post-body blockquote {
        padding: 20px 25px;
        font-size: 1.125rem;
    }

    .post-image-placeholder {
        padding: 40px 20px;
    }
}

@media (max-width: 480px) {
    :root {
        --section-padding: var(--section-padding-small);
    }

    .nav-container {
        padding: 15px 16px;
    }

    .nav-logo a {
        font-size: 1.2rem;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 2.25rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .section-title {
        font-size: 2rem;
    }

    .mobile-menu {
        padding: 20px 16px;
    }

    .back-section {
        padding: 20px 16px 0;
    }

    .post-header-section {
        padding: 30px 16px 40px;
    }

    .post-header-section .container {
        gap: 24px;
    }

    .post-content-section {
        padding: 0 16px 40px;
    }

    .post-body h2 {
        margin-top: 40px;
        margin-bottom: 15px;
    }

    .post-body blockquote {
        padding: 15px 20px;
        margin: 30px 0;
    }
}
