/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --max-width: 800px;
    --color-primary: #2563eb;
    --color-text: #1f2937;
    --color-text-light: #6b7280;
    --color-background: #ffffff;
    --color-border: #e5e7eb;
    --font-serif: 'Georgia', 'Times New Roman', serif;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

body {
    font-family: var(--font-sans);
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-background);
}

/* Header */
header {
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 0;
    margin-bottom: 2rem;
}

header h1 {
    max-width: var(--max-width);
    margin: 0 auto;
    font-size: 1.5rem;
    font-weight: 600;
}

header p {
    font-size: .8rem;
    font-weight: 600;
    padding: .4rem;
}

header h1 a {
    color: var(--color-text);
    text-decoration: none;
    padding: 0 1rem;
}

/* Main Navigation */
.main-nav {
    max-width: var(--max-width);
    margin: 1rem auto 0;
    padding: 0 1rem;
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-item {
    position: relative;
}

.nav-link {
    color: var(--color-text-light);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    display: block;
}

.nav-link:hover,
.nav-link:focus {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* Active states for navigation */
.nav-link.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* Dropdown styles */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 0.5rem 0;
    min-width: 150px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-link {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--color-text);
    text-decoration: none;
    font-weight: 400;
    border-bottom: none;
    transition: background-color 0.2s ease;
}

.dropdown-link:hover {
    background: var(--color-border);
    color: var(--color-primary);
    border-bottom: none;
}

/* Keep dropdown open briefly when moving to menu */
.dropdown-menu:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Header container adjustments */
header {
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 0;
    margin-bottom: 2rem;
}

header h1 {
    max-width: var(--max-width);
    margin: 0 auto;
    font-size: 1.5rem;
    font-weight: 600;
}

header h1 a:hover {
    color: var(--color-primary);
}

/* Main content */
main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
    min-height: calc(100vh - 200px);
}

/* Articles list */
.articles {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.article-preview {
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 1.5rem;
}

.article-preview:last-child {
    border-bottom: none;
}

.article-preview h2 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.article-preview h2 a {
    color: var(--color-text);
    text-decoration: none;
}

.article-preview h2 a:hover {
    color: var(--color-primary);
}

.article-preview time {
    color: var(--color-text-light);
    font-size: 0.875rem;
    display: block;
    margin-bottom: 0.5rem;
}

.article-preview p {
    color: var(--color-text-light);
    margin-bottom: 0.75rem;
}

/* Breadcrumbs */
.breadcrumbs {
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.breadcrumbs ol {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0;
    margin: 0;
}

.breadcrumbs li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumbs li:not(:last-child)::after {
    content: ">";
    color: var(--color-text-light);
    font-weight: 400;
}

.breadcrumbs a {
    color: var(--color-text-light);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumbs a:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.breadcrumbs li[aria-current="page"] {
    color: var(--color-text);
    font-weight: 500;
}

/* Article page */
.article-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.article-header h1 {
    font-family: var(--font-serif);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.article-content {
    font-family: var(--font-serif);
    font-size: 1.125rem;
    line-height: 1.7;
    margin-bottom: 2rem;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    font-family: var(--font-sans);
    font-weight: 600;
    margin: 1.5rem 0 0.75rem;
    line-height: 1.3;
}

.article-content h1 {
    font-size: 1.75rem;
}

.article-content h2 {
    font-size: 1.5rem;
}

.article-content h3 {
    font-size: 1.25rem;
}

.article-content p {
    margin-bottom: 1rem;
}

.article-content ul,
.article-content ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.article-content li {
    margin-bottom: 0.25rem;
}

.article-content blockquote {
    border-left: 4px solid var(--color-primary);
    padding: 0.5rem 1rem;
    margin: 1.5rem 0;
    background-color: #f8fafc;
    font-style: italic;
}

.article-content code {
    background-color: #f1f5f9;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
}

.article-content pre {
    background-color: #1e293b;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.article-content pre code {
    background-color: transparent;
    padding: 0;
    color: inherit;
}

.article-content a {
    color: var(--color-primary);
    text-decoration: underline;
}

.article-content a:hover {
    text-decoration: none;
}

.article-content img {
    max-width: 768px;
    width: 100%;
    height: auto;
    display: block;
    margin: 1.5rem auto;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.article-content img:hover {
    opacity: 0.9;
}

/* Details/Summary styling */
.article-content details {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    margin: 1.5rem 0;
    overflow: hidden;
    transition: all 0.2s ease;
}

.article-content details:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.article-content details[open] {
    border-color: var(--color-primary);
}

.article-content summary {
    background-color: #f1f5f9;
    padding: 1rem;
    cursor: pointer;
    font-weight: 600;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
    transition: all 0.2s ease;
}

.article-content summary:hover {
    background-color: #e2e8f0;
}

.article-content details[open] summary {
    background-color: #dbeafe;
    border-bottom-color: var(--color-primary);
}

.article-content summary::marker {
    display: none;
}

.article-content summary::before {
    content: "▶";
    position: absolute;
    right: 1rem;
    transition: transform 0.2s ease;
    color: var(--color-primary);
}

.article-content details[open] summary::before {
    transform: rotate(90deg);
}

.article-content details > *:not(summary) {
    padding: 1rem;
}

/* Tags */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tag {
    background-color: #f1f5f9;
    color: var(--color-text);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    text-decoration: none;
}

/* Related Articles */
.related-articles {
    background-color: #f8fafc;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin: 2rem 0;
}

.related-articles h2 {
    font-family: var(--font-sans);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    color: var(--color-text);
}

.related-articles ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.related-articles li {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.related-articles li:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.related-articles li a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.05rem;
    display: block;
    margin-bottom: 0.25rem;
}

.related-articles li a:hover {
    text-decoration: underline;
}

.related-articles li p {
    margin: 0;
    color: var(--color-text-light);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Article footer */
.article-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.back-link {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

.back-link:hover {
    text-decoration: underline;
}

/* Footer */
footer {
    margin-top: 3rem;
    padding: 2rem 0;
    border-top: 1px solid var(--color-border);
    text-align: center;
}

footer p {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
    color: var(--color-text-light);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.footer-nav {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
    text-align: center;
}

.footer-nav a {
    color: var(--color-text-light);
    text-decoration: none;
    font-size: 0.875rem;
}

.footer-nav a:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .article-header h1 {
        font-size: 1.5rem;
    }
    
    .article-content {
        font-size: 1rem;
    }
    
    .article-content h1 {
        font-size: 1.5rem;
    }
    
    .article-content h2 {
        font-size: 1.25rem;
    }
    
    .article-content h3 {
        font-size: 1.125rem;
    }
}

/* Contact page styles */
.contact-form-placeholder,
.newsletter-signup {
    background-color: #f8fafc;
    border: 2px dashed var(--color-border);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin: 1.5rem 0;
    text-align: center;
}

.buttondown-placeholder {
    margin-top: 1rem;
    text-align: left;
}

.buttondown-placeholder ul {
    margin: 0.5rem 0;
}

.newsletter-signup h3 {
    margin-top: 0;
    color: var(--color-primary);
}

/* Heading anchor links */
.heading-anchor {
    color: inherit !important;
    text-decoration: none !important;
    position: relative;
}

.heading-anchor:hover {
    color: inherit !important;
    text-decoration: none !important;
}

.heading-anchor:visited {
    color: inherit !important;
    text-decoration: none !important;
}

.heading-anchor:active {
    color: inherit !important;
    text-decoration: none !important;
}

.heading-anchor:before {
    content: "#";
    position: absolute;
    left: -1.5rem;
    color: var(--color-text-light);
    opacity: 0;
    transition: opacity 0.2s ease;
    font-weight: normal;
}

.article-content h1:hover .heading-anchor:before,
.article-content h2:hover .heading-anchor:before,
.article-content h3:hover .heading-anchor:before,
.article-content h4:hover .heading-anchor:before,
.article-content h5:hover .heading-anchor:before,
.article-content h6:hover .heading-anchor:before {
    opacity: 1;
}

/* Lightbox trigger link */
.lightbox-trigger {
    display: block;
    text-decoration: none;
}

/* CSS-only lightbox */
.lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.lightbox:target {
    display: flex;
}

.lightbox img {
    max-width: 95vw;
    max-height: 95vh;
    width: auto;
    height: auto;
    object-fit: contain;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

/* Close lightbox by clicking anywhere */
.lightbox:target::before {
    content: '\00d7';
    position: absolute;
    top: 20px;
    right: 40px;
    font-size: 48px;
    color: white;
    font-weight: 100;
    line-height: 1;
    cursor: pointer;
}