/* Organic Earth Blog Theme - Calm & Natural */

:root {
    --background: #f4f1ea;
    --surface: #ffffff;
    --text-primary: #3a3a3a;
    --text-secondary: #6b6b6b;
    --accent-primary: #3d5e53;
    --accent-secondary: #b08c4f;
    --accent-green: #3d5e53;
    --accent-terracotta: #c47c5e;
    --accent-gold: #b08c4f;
    --border-radius: 4px;
    --font-serif: 'Playfair Display', serif;
    --font-sans: 'Work Sans', sans-serif;
    --transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-sans);
    line-height: 1.9;
    color: var(--text-primary);
    background: var(--background);
    background-image: url('data:image/svg+xml,%3Csvg width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"%3E%3Cg fill="none" fill-rule="evenodd"%3E%3Cg fill="%239C92AC" fill-opacity="0.05"%3E%3Cpath d="M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z"/%3E%3C/g%3E%3C/g%3E%3C/svg%3E');
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* --- Hide decorative elements --- */
.corner,
.window,
.window-titlebar,
.window-buttons,
.statusbar,
.separator,
.header-decoration-top,
.header-decoration-bottom,
.footer-decoration-top,
.footer-decoration-bottom,
.card-decoration-top,
.card-decoration-bottom {
    display: none;
}

/* --- Container --- */
.wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 5rem 2rem;
    min-height: 100vh;
}

/* --- Page Structure --- */
.page {
    position: relative;
}

.page-main {
    background: transparent;
}

/* --- Header --- */
.header {
    text-align: center;
    padding: 3rem 0;
    margin-bottom: 4rem;
}

.title {
    font-family: var(--font-serif);
    font-weight: 700;
    color: var(--accent-green);
    line-height: 1.3;
}

.title-main {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: var(--accent-green);
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-style: italic;
    margin: 0;
}

/* --- Category Sections --- */
.content {
    margin: 4rem 0;
}

.category {
    margin: 4rem 0;
}

.title-category {
    font-size: 2.5rem;
    margin: 4rem 0 3rem 0;
    text-align: center;
    position: relative;
    display: block;
}

.title-category::after {
    content: '';
    display: block;
    width: 80px;
    height: 2px;
    background: var(--accent-gold);
    margin: 1rem auto 0;
}

.title-icon {
    margin-right: 0.5rem;
}

.title-text {
    font-weight: 700;
}

.title-count {
    font-size: 1.5rem;
    color: var(--accent-gold);
    font-weight: normal;
    margin-left: 0.5rem;
}

/* --- Links --- */
.link {
    color: inherit;
    text-decoration: none;
    background: none;
}

.link:hover .title-category {
    color: var(--accent-terracotta);
}

a {
    color: var(--accent-terracotta);
    text-decoration: none;
    position: relative;
    font-weight: 500;
    background-image: linear-gradient(var(--accent-gold), var(--accent-gold));
    background-position: 0% 100%;
    background-repeat: no-repeat;
    background-size: 0% 2px;
    transition: background-size 0.3s;
}

a:hover {
    background-size: 100% 2px;
}

/* --- Grid --- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

/* --- Cards --- */
.card {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--accent-green), var(--accent-gold), var(--accent-terracotta));
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.card:hover::before {
    transform: scaleY(1);
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
}

.card-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent-green);
    margin: 0 0 1rem 0;
    font-family: var(--font-serif);
    line-height: 1.4;
}

.card-path {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--accent-gold);
    background: rgba(176, 140, 79, 0.1);
    padding: 0.3rem 0.6rem;
    border-radius: 3px;
    display: inline-block;
    margin-bottom: 1rem;
}

.card-meta {
    margin: 1rem 0;
}

.card-date {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.card-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* --- Buttons --- */
.button {
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--accent-green);
    background: transparent;
    color: var(--accent-green);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.button:hover {
    background: var(--accent-green);
    color: var(--surface);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(61, 94, 83, 0.2);
}

.button-home {
    background: var(--surface);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

.button-home:hover {
    background: var(--accent-gold);
    color: var(--surface);
}

.button-read {
    border-color: var(--accent-terracotta);
    color: var(--accent-terracotta);
}

.button-read:hover {
    background: var(--accent-terracotta);
    color: var(--surface);
}

.button-icon {
    font-size: 1rem;
}

.button-label {
    font-weight: 600;
}

/* --- Controls --- */
.controls {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

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

.dropdown-trigger {
    padding: 0.75rem 1.5rem;
    background: var(--surface);
    border: 2px solid var(--accent-green);
    color: var(--accent-green);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.dropdown-trigger:hover {
    background: var(--accent-green);
    color: var(--surface);
    box-shadow: 0 5px 15px rgba(61, 94, 83, 0.2);
}

.dropdown-icon {
    font-size: 1rem;
}

.dropdown-label {
    font-weight: 600;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.1rem;
    min-width: 200px;
    background: var(--surface);
    border: 2px solid var(--accent-green);
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: auto;
    max-height: 400px;
}

.dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-item {
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(176, 140, 79, 0.1);
}

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

.dropdown-item:hover {
    background: rgba(61, 94, 83, 0.05);
    color: var(--accent-green);
}

.dropdown-item-icon {
    font-size: 1rem;
}

.dropdown-item-label {
    font-weight: 500;
}

/* --- Progress Bar --- */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-gold), var(--accent-terracotta));
    z-index: 1000;
    transition: width 0.1s ease;
}

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 3rem 0 2rem;
    margin-top: 5rem;
    border-top: 1px solid rgba(176, 140, 79, 0.2);
}

.text-footer {
    font-size: 1rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* --- Messages (Loading/Error) --- */
.message {
    text-align: center;
    padding: 3rem;
    margin: 3rem 0;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
}

.message-loading {
    background: rgba(61, 94, 83, 0.05);
    color: var(--accent-green);
    font-style: italic;
}

.message-error {
    background: rgba(196, 124, 94, 0.1);
    color: var(--accent-terracotta);
    border: 2px solid var(--accent-terracotta);
}

/* --- Modal --- */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-open {
    display: flex;
    opacity: 1;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(61, 94, 83, 0.95);
    backdrop-filter: blur(5px);
}

.modal-container {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    z-index: 1;
}

.modal-content {
    background: var(--surface);
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-close {
    position: absolute;
    top: -3rem;
    right: 0;
    background: var(--surface);
    border: 2px solid var(--accent-gold);
    color: var(--accent-gold);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--accent-gold);
    color: var(--surface);
    transform: rotate(90deg);
}

.modal-close-icon {
    font-weight: bold;
}

.image {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    display: block;
}

.image-caption {
    color: var(--text-primary);
    text-align: center;
    margin-top: 1rem;
    font-style: italic;
    font-size: 0.95rem;
}

.spinner {
    border: 4px solid rgba(176, 140, 79, 0.2);
    border-top: 4px solid var(--accent-gold);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- Typography for Markdown Content --- */
main h1:first-child {
    text-align: center;
    color: var(--accent-green);
}

main h1 {
    font-size: 3rem;
    margin-bottom: 2rem;
}

main h2 {
    font-size: 2.5rem;
    margin: 4rem 0 1.5rem 0;
    position: relative;
    text-align: center;
    color: var(--accent-green);
}

main h2::after {
    content: '';
    display: block;
    width: 80px;
    height: 2px;
    background: var(--accent-gold);
    margin: 1rem auto 0;
}

main h3 {
    font-size: 1.8rem;
    margin: 3rem 0 1rem 0;
    color: var(--accent-terracotta);
}

main p {
    margin: 1.5rem 0;
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.9;
}

main ul,
main ol {
    margin: 1.5rem 0;
    padding-left: 2rem;
}

main li {
    margin: 0.75rem 0;
    color: var(--text-secondary);
}

main blockquote {
    margin: 3rem auto;
    padding: 2rem;
    background: var(--surface);
    border-left: 5px solid var(--accent-gold);
    font-style: italic;
    font-family: var(--font-serif);
    color: var(--text-secondary);
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.05);
    border-radius: var(--border-radius);
    max-width: 90%;
}

main code {
    background: rgba(61, 94, 83, 0.1);
    color: var(--accent-green);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
}

main pre {
    background: #2b3a35;
    color: #e0d7ff;
    font-family: 'Courier New', monospace;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    overflow-x: auto;
    margin: 2.5rem 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

main pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

main img {
    max-width: 100%;
    height: auto;
    margin: 3rem auto;
    display: block;
    border-radius: var(--border-radius);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
    filter: sepia(0.2) contrast(0.9);
    cursor: pointer;
}

main img:hover {
    transform: translateY(-10px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    filter: sepia(0) contrast(1);
}

main hr {
    border: none;
    height: 1px;
    background-color: rgba(176, 140, 79, 0.3);
    margin: 4rem auto;
    width: 50%;
}

main table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    background: var(--surface);
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.05);
    border-radius: var(--border-radius);
    overflow: hidden;
}

main th,
main td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(176, 140, 79, 0.1);
}

main th {
    background: rgba(61, 94, 83, 0.05);
    color: var(--accent-green);
    font-weight: 600;
}

main tr:hover {
    background: rgba(176, 140, 79, 0.05);
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
    .wrapper {
        padding: 3rem 1.5rem;
    }

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

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

    .grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .controls {
        top: 1rem;
        right: 1rem;
    }

    .button,
    .dropdown-trigger {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    main h1 {
        font-size: 2rem;
    }

    main h2 {
        font-size: 1.75rem;
    }

    main h3 {
        font-size: 1.4rem;
    }

    main p {
        font-size: 1rem;
    }
}

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

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

    .card {
        padding: 1.5rem;
    }
}