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

img {
    max-width: 100%;
    height: auto;
}

html {
    font-size: 100%; /* Respect user's browser font size settings */
}

body {
    font-family: 'EB Garamond', serif;
    line-height: 1.7;
    color: #000;
    background: #fff;
    font-size: 1rem;
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Skip to main content link for keyboard users */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    background: #000;
    color: #fff;
    padding: 0.5rem 1rem;
    text-decoration: none;
    z-index: 10000;
    font-weight: 700;
    transform: translateY(-100%);
}

.skip-link:focus {
    top: 0;
    transform: translateY(0);
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Navigation */
nav {
    position: sticky;
    top: 0;
    background: #fff;
    border-bottom: 2px solid #000;
    padding: 1rem 2rem;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 100vw;
}

.nav-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: #000;
    text-decoration: none;
    display: inline-block;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
    align-items: center;
}

nav a:not(.nav-name) {
    color: #000;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

nav a:hover:not(.nav-name) {
    text-decoration: underline;
}

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

/* Use focus-visible for better UX */
nav a:focus:not(:focus-visible),
a:focus:not(:focus-visible),
button:focus:not(:focus-visible) {
    outline: none;
}

nav a:focus-visible,
a:focus-visible,
button:focus-visible {
    outline: 2px solid #000;
    outline-offset: 2px;
}

/* Sections */
section {
    display: none;
    min-height: calc(100vh - 150px);
    padding: 2rem 2rem;
    padding-bottom: 3rem;
    max-width: 800px;
    margin: 0 auto;
}

#about {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: calc(100vh - 150px);
    padding: 2rem;
}

section:target {
    display: block;
}

#blog:target ~ #about,
#projects:target ~ #about {
    display: none;
}

/* About Section */
.about-content {
    width: 100%;
    max-width: 1200px;
    display: flex;
    gap: 4rem;
    align-items: center;
}

.about-photo-container {
    flex-shrink: 0;
    max-width: 100%;
}

.about-photo {
    width: 100%;
    max-width: 450px;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid #ddd;
    display: block;
}

.photo-caption {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #595959;
    font-style: italic;
}

h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 900;
    margin-bottom: 1rem;
}

.subtitle {
    font-size: 1.5rem;
    color: #595959; /* Better contrast ratio for WCAG AA */
    margin-bottom: 2rem;
    font-weight: 600;
}

.bio {
    color: #595959; /* Better contrast ratio for WCAG AA */
    line-height: 1.8;
    text-align: left;
    flex: 1;
}

/* Section Headers */
.section-header {
    text-align: center;
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 2.25rem;
    font-weight: 900;
    margin-bottom: 1rem;
}

.section-header p {
    color: #595959; /* Better contrast ratio for WCAG AA */
}

/* Projects Section */
.projects-list {
    max-width: 100%;
}

.project-item {
    background: #fff;
    border: 2px solid #000;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    display: flex;
    gap: 2rem;
    align-items: center;
}

.project-icon {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    border: 1px solid #ddd;
    flex-shrink: 0;
}

.project-content {
    flex: 1;
}

.project-item h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
}

.project-tagline {
    font-size: 0.95rem;
    color: #595959;
    font-style: italic;
    margin-bottom: 1rem;
}

.project-description {
    color: #595959;
    line-height: 1.6;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.project-link {
    display: inline-block;
    background: #000;
    color: #fff;
    text-decoration: none;
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.9rem;
}

.project-link:hover {
    opacity: 0.8;
}

/* Blog Cards */
.featured-post {
    background: #fff;
    border: 2px solid #000;
    border-radius: 8px;
    padding: 3rem;
    margin-bottom: 4rem;
}

.featured-post .subtitle {
    font-size: 1.1rem;
    color: #595959;
    font-style: italic;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.excerpt {
    color: #595959; /* Better contrast ratio for WCAG AA */
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.read-more {
    display: inline-block;
    background: #000;
    color: #fff;
    text-decoration: none;
    padding: 0.75rem 2rem;
    border-radius: 4px;
    font-weight: 700;
}

.read-more:hover {
    opacity: 0.8;
}

/* Blog Loading & Error States */
#blog-loading,
#blog-error {
    text-align: center;
    padding: 2rem;
    margin: 2rem 0;
}

#blog-loading.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

#blog-error {
    color: #d32f2f;
    background: #ffebee;
    border: 1px solid #ef9a9a;
    border-radius: 4px;
}

#blog-error a {
    color: #d32f2f;
    text-decoration: underline;
}

/* No Posts State */
#blog-no-posts {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40vh;
    padding: 1rem;
    margin-top: 0;
}

.no-posts-image {
    max-width: 300px;
    width: 100%;
    height: auto;
    display: block;
}

/* Fade-in Animation */
.fade-in {
    animation: fadeIn 0.5s ease-in;
    display: block !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
    gap: 2rem;
}

.blog-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 2rem;
}

.blog-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.blog-card p {
    color: #595959; /* Better contrast ratio for WCAG AA */
    line-height: 1.6;
    margin-bottom: 1rem;
}

.blog-card-link {
    color: #000;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.blog-card-link:hover {
    text-decoration: underline;
}

.post-date {
    font-size: 0.9rem;
    color: #595959; /* Better contrast ratio for WCAG AA */
    margin-bottom: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Footer */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    color: #595959; /* Better contrast ratio for WCAG AA */
    background: #fff;
    border-top: 2px solid #000;
    width: 100%;
    z-index: 99;
}

.footer-social {
    display: flex;
    gap: 1.5rem;
}

.footer-social a {
    width: 32px;
    height: 32px;
    color: #000;
}

.footer-social a:hover {
    opacity: 0.7;
}

.footer-social svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.footer-social img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    nav {
        padding: 1rem;
    }

    nav ul {
        gap: 1rem;
    }

    nav a:not(.nav-name) {
        font-size: 0.85rem;
    }

    h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1.1rem;
    }

    #about {
        min-height: calc(100vh - 120px);
        justify-content: center;
        padding: 1.5rem 1rem;
    }

    .about-content {
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
        text-align: center;
    }

    .about-photo {
        max-width: 280px;
    }

    .photo-caption {
        text-align: center;
        margin-top: 0.25rem;
    }

    .bio {
        text-align: center;
    }

    .bio p {
        margin-bottom: 1rem;
    }

    .section-header h2 {
        font-size: 1.75rem;
    }

    .featured-post {
        padding: 2rem;
    }

    .blog-grid {
        grid-template-columns: 1fr;
    }

    footer {
        flex-direction: row;
        justify-content: center;
        align-items: center;
        padding: 0.75rem 1rem;
        gap: 2rem;
    }

    .footer-social {
        gap: 1.25rem;
    }

    .footer-social a {
        width: 24px;
        height: 24px;
    }

    footer p {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    nav {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.75rem;
    }

    nav ul {
        width: 100%;
        justify-content: center;
    }

    section {
        padding: 2rem 1rem;
    }

    #about {
        padding: 1rem;
        min-height: calc(100vh - 100px);
    }

    .about-content {
        gap: 1rem;
    }

    .about-photo {
        max-width: 240px;
    }

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

    .bio p {
        font-size: 0.95rem;
    }

    footer {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.5rem 1rem;
    }

    .footer-social {
        gap: 1rem;
    }

    .footer-social a {
        width: 20px;
        height: 20px;
    }

    footer p {
        font-size: 0.75rem;
    }

    .project-item {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
    }

    .project-icon {
        width: 64px;
        height: 64px;
    }

    .project-item h2 {
        font-size: 1.25rem;
    }

    .featured-post {
        padding: 1.5rem;
    }

    .blog-grid {
        gap: 1.5rem;
    }

    .blog-card {
        padding: 1.5rem;
    }
}

@media (max-width: 360px) {
    nav {
        padding: 0.5rem;
    }

    section {
        padding: 1.5rem 0.75rem;
    }

    #about {
        padding: 0.75rem;
    }

    .about-photo {
        max-width: 200px;
    }

    .project-item {
        padding: 1rem;
    }

    .featured-post {
        padding: 1rem;
    }

    .blog-card {
        padding: 1rem;
    }

    h1 {
        font-size: 1.75rem;
    }

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

    .blog-grid {
        gap: 1rem;
    }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .featured-post,
    .blog-card {
        border-width: 3px;
    }
}

/* Print styles */
@media print {
    header,
    footer,
    .skip-link {
        display: none;
    }

    body {
        font-size: 12pt;
        color: #000;
        background: #fff;
    }

    section {
        display: block !important;
        page-break-inside: avoid;
    }

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

    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 0.9em;
    }
}
