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

:root {
    --color-bg: #ffffff;
    --color-text: #1a1a1a;
    --color-text-muted: #6b6b6b;
    --color-accent: #0a0a0a;
    --color-border: #e5e5e5;
    --color-hover: #f5f5f5;

    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-heading: 'Lora', Georgia, serif;

    --max-width-content: 1200px;
    --max-width-layout: 1400px;
}

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

body {
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.7;
    color: var(--color-text);
    background-color: var(--color-bg);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 1rem;
}

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

a:hover {
    color: var(--color-text-muted);
}

/* Animated underline for content links */
.post-content p a,
.post-content li a,
.post-single p a,
.post-single li a,
article p a,
article li a {
    position: relative !important;
    display: inline-block !important;
    color: #4299e1 !important;
    border-bottom: 2px solid rgba(66, 153, 225, 0.5) !important;
    padding-bottom: 2px !important;
    transition: all 0.3s ease !important;
}

.post-content p a::before,
.post-content li a::before,
.post-single p a::before,
.post-single li a::before,
article p a::before,
article li a::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -2px;
    width: 0%;
    height: 2px;
    background: linear-gradient(90deg, #667eea, #4299e1, #764ba2);
    transform: translateX(-50%);
    transition: width 0.45s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1;
}

.post-content p a:hover,
.post-content li a:hover,
.post-single p a:hover,
.post-single li a:hover,
article p a:hover,
article li a:hover {
    color: #2b6cb0 !important;
    border-bottom-color: transparent !important;
}

.post-content p a:hover::before,
.post-content li a:hover::before,
.post-single p a:hover::before,
.post-single li a:hover::before,
article p a:hover::before,
article li a:hover::before {
    width: 100%;
}

/* Container */
.container {
    max-width: var(--max-width-content);
    margin: 0 auto;
    padding: 0 3rem;
}

@media (max-width: 1024px) {
    .container {
        padding: 0 2rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 1.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }
}

/* Header */
.site-header {
    padding: 1.5rem 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: var(--max-width-layout);
    margin: 0 auto;
    padding: 0 3rem;
}

@media (max-width: 1024px) {
    .header-content {
        padding: 0 2rem;
    }
}

@media (max-width: 768px) {
    .header-content {
        padding: 0 1.5rem;
    }
}

@media (max-width: 480px) {
    .header-content {
        padding: 0 1rem;
    }
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-accent);
    transition: opacity 0.2s ease;
}

.logo:hover {
    opacity: 0.7;
}

/* Navigation */
.main-nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.main-nav li {
    position: relative;
}

.main-nav a {
    font-size: 1rem;
    transition: color 0.2s ease;
}

.main-nav a:hover {
    color: var(--color-text-muted);
}

/* Dropdown Menu */
.has-dropdown {
    position: relative;
}

.dropdown-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.dropdown-arrow {
    font-size: 0.7em;
    transition: transform 0.2s ease;
}

.has-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

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

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

.dropdown-menu {
    display: flex;
    flex-direction: column;
}

.dropdown-menu li {
    list-style: none;
}

.dropdown-menu a {
    display: block;
    padding: 0.75rem 1.25rem;
    color: var(--color-text);
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.dropdown-menu a:hover {
    background-color: var(--color-hover);
    color: var(--color-accent);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-menu-toggle span {
    width: 24px;
    height: 2px;
    background-color: var(--color-text);
    transition: all 0.3s ease;
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .main-nav {
        position: fixed;
        top: 0;
        right: -70%;
        width: 70%;
        height: 100vh;
        background-color: var(--color-bg);
        padding: 2rem;
        transition: right 0.3s ease;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
        z-index: 1000;
        overflow-y: auto;
    }

    .main-nav.active {
        right: 0;
    }

    .main-nav ul {
        flex-direction: column;
        gap: 1.5rem;
    }

    /* Mobile Dropdown */
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        border: none;
        box-shadow: none;
        padding: 0.5rem 0 0 1rem;
        margin-top: 0.5rem;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .has-dropdown.active .dropdown-menu {
        max-height: 500px;
    }

    .dropdown-arrow {
        transition: transform 0.3s ease;
    }

    .has-dropdown.active .dropdown-arrow {
        transform: rotate(180deg);
    }
}

/* Main Content */
.site-main {
    min-height: calc(100vh - 200px);
}

/* Blog Index */
.blog-index {
    padding: 4rem 0;
}

@media (max-width: 768px) {
    .blog-index {
        padding: 3rem 0;
    }
}

.page-header {
    margin-bottom: 3rem;
}

.page-title {
    font-size: 2.5rem;
    font-weight: 600;
}

@media (max-width: 768px) {
    .page-title {
        font-size: 2rem;
    }
}

/* Posts List */
.posts-list {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.post-item {
    padding-bottom: 3rem;
    border-bottom: 1px solid var(--color-border);
}

.post-item:last-child {
    border-bottom: none;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.post-category {
    padding: 0.25rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 3px;
    text-transform: lowercase;
    font-size: 0.875rem;
    transition: background-color 0.2s ease;
}

.post-category:hover {
    background-color: var(--color-hover);
}

.post-title {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

@media (max-width: 768px) {
    .post-title {
        font-size: 1.5rem;
    }
}

.post-title a {
    transition: color 0.2s ease;
}

.post-title a:hover {
    color: var(--color-text-muted);
}

.post-excerpt {
    color: var(--color-text-muted);
    line-height: 1.7;
}

/* Single Post */
.post-single {
    padding: 4rem 0;
}

@media (max-width: 768px) {
    .post-single {
        padding: 3rem 0;
    }
}

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

.post-single .post-title {
    font-size: 2.5rem;
    margin-top: 0.5rem;
}

@media (max-width: 768px) {
    .post-single .post-title {
        font-size: 2rem;
    }
}

.post-content {
    font-size: 18px;
    line-height: 1.7;
}

.post-content h2 {
    font-size: 2rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.post-content h3 {
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.post-content p {
    margin-bottom: 1.5rem;
}

.post-content ul,
.post-content ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

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

.post-content blockquote {
    border-left: 3px solid var(--color-border);
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: var(--color-text-muted);
}

.post-content code {
    background-color: var(--color-hover);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9em;
    font-family: 'Monaco', 'Courier New', monospace;
}

.post-content pre {
    background-color: var(--color-hover);
    padding: 1.5rem;
    border-radius: 5px;
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.post-content pre code {
    background: none;
    padding: 0;
}

.post-content img {
    max-width: 100%;
    width: 100%;
    height: auto;
    margin: 2rem auto;
    display: block;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .post-content img {
        margin: 1.5rem auto;
        border-radius: 6px;
    }
}

@media (max-width: 480px) {
    .post-content img {
        margin: 1rem auto;
        border-radius: 4px;
    }
}

.post-content p img {
    margin: 2rem auto;
}

@media (max-width: 768px) {
    .post-content p img {
        margin: 1.5rem auto;
    }
}

@media (max-width: 480px) {
    .post-content p img {
        margin: 1rem auto;
    }
}

/* Image captions */
.post-content em {
    display: block;
    text-align: center;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-top: -1.5rem;
    margin-bottom: 2rem;
    font-style: italic;
}

/* Image gallery styles */
.post-content h2 + p img,
.post-content h3 + p img {
    margin-top: 1rem;
}

/* Image Figure */
.image-figure {
    margin: 2rem auto;
    text-align: center;
    max-width: 100%;
}

.image-figure a {
    display: inline-block;
    cursor: pointer;
    transition: opacity 0.2s ease;
    max-width: 100%;
}

.image-figure a:hover {
    opacity: 0.9;
}

.image-figure img {
    max-width: 100%;
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
    object-fit: cover;
}

@media (max-width: 768px) {
    .image-figure img {
        border-radius: 6px;
    }
}

@media (max-width: 480px) {
    .image-figure {
        margin: 1.5rem auto;
    }

    .image-figure img {
        border-radius: 4px;
    }
}

.image-figure a:hover img {
    transform: scale(1.02);
}

.image-figure figcaption {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    font-style: italic;
}

@media (max-width: 480px) {
    .image-figure figcaption {
        font-size: 0.8rem;
    }
}

/* Categories List */
.categories-list {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.category-item {
    padding: 1.5rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-item:hover {
    background-color: var(--color-hover);
    border-color: var(--color-text-muted);
}

.category-name {
    margin: 0;
    font-size: 1.5rem;
}

.category-name a {
    transition: color 0.2s ease;
}

.category-name a:hover {
    color: var(--color-text-muted);
}

.category-count {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    background-color: var(--color-hover);
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

.category-description {
    color: var(--color-text-muted);
    font-size: 1rem;
    margin-top: 0.5rem;
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--color-border);
    padding: 2rem 0;
    margin-top: 4rem;
}

.site-footer .container {
    text-align: center;
}

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

@media (max-width: 768px) {
    .site-footer {
        margin-top: 3rem;
    }
}

/* Image Hint */
.image-hint {
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 0.5rem;
    font-style: italic;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    display: flex;
    opacity: 1;
    align-items: center;
    justify-content: center;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: rgba(255, 255, 255, 0.9);
    color: var(--color-text);
    border: none;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

.lightbox-close:hover {
    background: white;
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .lightbox-close {
        top: 1rem;
        right: 1rem;
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.5rem;
    }
}

/* Responsive Typography */
@media (max-width: 768px) {
    body {
        font-size: 16px;
    }
}

/* Modern Grid Layout for Homepage */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    padding: 2.5rem 0;
}

@media (max-width: 1024px) {
    .posts-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.75rem;
    }
}

@media (max-width: 768px) {
    .posts-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .posts-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

.post-card {
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.post-card:hover {
    transform: translateY(-4px);
}

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

.post-card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 10px;
    margin-bottom: 1rem;
    background-color: var(--color-hover);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.3s ease;
}

.post-card:hover .post-card-image {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.post-card:hover .post-card-image img {
    transform: scale(1.05);
}

.post-card-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.375rem 0.875rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.post-card-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
}

.post-card-meta {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
}

.post-card-title {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
    color: var(--color-text);
    transition: color 0.2s ease;
}

@media (max-width: 480px) {
    .post-card-title {
        font-size: 1.2rem;
    }
}

.post-card:hover .post-card-title {
    color: var(--color-text-muted);
}

.post-card-excerpt {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--color-text-muted);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 480px) {
    .post-card-excerpt {
        font-size: 0.9rem;
        -webkit-line-clamp: 2;
    }
}
