/* screen.css */

:root {
    /* Light Mode Variables */
    --bg-color: #f2f2f7; /* iOS system background */
    --card-bg: #ffffff;
    --text-primary: #1c1c1e;
    --text-secondary: #8e8e93;
    --text-muted: #aeaeb2;
    --accent-color: #007aff;
    --border-color: #e5e5ea;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.02);
    --nav-bg: rgba(255, 255, 255, 0.85);
    --squircle-radius: 28px; /* Deep rounding */
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        /* Dark Mode Variables */
        --bg-color: #000000;
        --card-bg: #1c1c1e;
        --text-primary: #f2f2f7;
        --text-secondary: #98989d;
        --text-muted: #636366;
        --accent-color: #0a84ff;
        --border-color: #38383a;
        --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.2);
        --nav-bg: rgba(28, 28, 30, 0.85);
    }
}

[data-theme="dark"] {
    /* Dark Mode Variables Override */
    --bg-color: #000000;
    --card-bg: #1c1c1e;
    --text-primary: #f2f2f7;
    --text-secondary: #98989d;
    --text-muted: #636366;
    --accent-color: #0a84ff;
    --border-color: #38383a;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.2);
    --nav-bg: rgba(28, 28, 30, 0.85);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    color: var(--accent-color);
    text-decoration: none;
}

.site-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: 280px;
    height: calc(100vh - 40px);
    position: fixed;
    top: 20px;
    left: 20px;
    padding: 40px 30px;
    display: flex;
    flex-direction: column;
    background-color: var(--card-bg);
    border-radius: var(--squircle-radius);
    box-shadow: var(--card-shadow);
    z-index: 10;
}

.sidebar-header {
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.site-logo {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.site-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #007aff, #34c759);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.site-avatar.is-icon {
    background: none;
    color: var(--accent-color);
    font-size: 50px; /* Fill the whole area */
}

.site-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.site-title a {
    color: var(--text-primary);
}

.site-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.sidebar-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sidebar-nav a {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 1.05rem;
    opacity: 0.8;
    transition: opacity 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-nav a i {
    font-size: 1.3rem;
    color: var(--text-secondary);
}

.sidebar-nav a:hover,
.sidebar-nav li.nav-current a {
    opacity: 1;
    color: var(--accent-color);
}

.sidebar-nav li.nav-current a i {
    color: var(--accent-color);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    transition: background-color 0.2s, color 0.2s;
}

.theme-toggle:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}

/* Sidebar Search */
.sidebar-search-container {
    margin-bottom: 30px;
}

.sidebar-search {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    font-family: inherit;
}

.sidebar-search:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}

.sidebar-search i {
    font-size: 1.1rem;
}

/* Main Content */
.main-content {
    margin-left: 320px;
    padding: 40px 20px;
    width: calc(100% - 320px);
    max-width: 800px; /* Limit width for reading experience */
    margin-right: auto;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Mobile Overlay Menu (Hidden on desktop) */
.mobile-overlay, .mobile-menu-backdrop {
    display: none;
}

/* Journal Cards */
.post-feed {
    display: flex;
    flex-direction: column;
    gap: 60px; /* More breathing room */
    flex-grow: 1;
}

.post-card {
    background-color: var(--card-bg);
    border-radius: var(--squircle-radius);
    padding: 30px;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
}

.post-card-date {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.post-card-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--text-primary);
    line-height: 1.2;
    font-family: var(--font-headings);
}

.post-card-excerpt {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-headings);
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 0.5em;
}

/* Feature Image in Card */
.post-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: calc(var(--squircle-radius) - 10px);
    margin-bottom: 20px;
}

/* Post Content Container (Single View) */
.post-content {
    background-color: var(--card-bg);
    border-radius: var(--squircle-radius);
    padding: 40px;
    box-shadow: var(--card-shadow);
}

.post-plain {
    padding: 20px 0;
}

.post-header {
    margin-bottom: 30px;
}

.post-header-date {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 10px;
    display: block;
    font-weight: 500;
}

.post-title {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.2;
}

.post-feature-image {
    width: 100%;
    border-radius: calc(var(--squircle-radius) - 15px);
    margin-bottom: 30px;
}

/* Typography inside post body */
.gh-content {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-primary);
}

.gh-content p {
    margin-bottom: 1.5em;
}

.gh-content h2, .gh-content h3 {
    margin-top: 2em;
    margin-bottom: 1em;
    font-weight: 600;
}

.gh-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 1.5em 0;
}

/* Ghost Koenig Editor Styles */
.kg-card {
    margin: 2em 0;
}

.kg-image-card img {
    width: 100%;
    height: auto;
    display: block;
}

.kg-width-wide {
    position: relative;
    width: 120%;
    margin-left: -10%;
}

@media (max-width: 1000px) {
    .kg-width-wide {
        width: 100%;
        margin-left: 0;
    }
}

.kg-width-full {
    position: relative;
    width: calc(100vw - 360px); /* accounting for sidebar and gaps */
    left: 50%;
    transform: translateX(-50%);
    max-width: none;
}

.kg-width-full img {
    border-radius: 0;
}

@media (max-width: 768px) {
    .kg-width-full {
        width: 100vw;
        margin-left: -15px; /* offset main-content padding */
        left: auto;
        transform: none;
    }
}

/* Mobile Header */
.mobile-header {
    display: none;
}

/* Mobile Breakpoints */
@media (max-width: 768px) {
    .site-wrapper {
        display: block;
    }

    .sidebar {
        display: none;
    }

    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 15px 20px;
        background-color: var(--nav-bg);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        position: sticky;
        top: 0;
        z-index: 2000;
        border-bottom: 1px solid var(--border-color);
    }

    .mobile-header-brand {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .mobile-menu-toggle {
        background: none;
        border: none;
        width: 24px;
        height: 14px;
        cursor: pointer;
        padding: 0;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        position: relative;
        z-index: 2000;
    }

    .hamburger-line {
        display: block;
        width: 100%;
        height: 2px;
        background-color: var(--text-primary);
        border-radius: 2px;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), top 0.3s, bottom 0.3s;
        position: absolute;
    }

    .line-1 { top: 0; }
    .line-2 { bottom: 0; }

    .mobile-menu-toggle.is-active .line-1 {
        top: 6px;
        transform: rotate(45deg);
    }

    .mobile-menu-toggle.is-active .line-2 {
        bottom: 6px;
        transform: rotate(-45deg);
    }

    .mobile-overlay {
        display: block;
        position: fixed;
        top: 80px;
        left: 15px;
        right: 15px;
        bottom: 15px;
        width: auto;
        height: auto;
        background-color: var(--nav-bg);
        backdrop-filter: blur(30px);
        -webkit-backdrop-filter: blur(30px);
        border-radius: var(--squircle-radius);
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transform: scale(0.95) translateY(10px);
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s, visibility 0.3s;
        box-shadow: 0 10px 40px rgba(0,0,0,0.1);
        border: 1px solid var(--border-color);
        overflow: hidden;
    }

    .mobile-overlay.is-open {
        opacity: 1;
        visibility: visible;
        transform: scale(1) translateY(0);
    }

    .mobile-overlay-nav {
        padding: 40px 30px;
        height: 100%;
        overflow-y: auto;
    }

    .mobile-overlay-nav ul {
        list-style: none;
        display: flex;
        flex-direction: column;
        gap: 25px;
    }

    .mobile-overlay-nav a {
        font-size: 1.5rem;
        font-weight: 600;
        color: var(--text-primary);
        display: flex;
        align-items: center;
        gap: 15px;
        opacity: 0.8;
        transition: opacity 0.2s, color 0.2s;
    }

    .mobile-overlay-nav a i {
        font-size: 1.8rem;
        color: var(--accent-color);
    }

    .mobile-overlay-nav a:hover,
    .mobile-overlay-nav li.nav-current a {
        opacity: 1;
        color: var(--text-primary);
    }

    .mobile-overlay-search {
        margin-top: 40px;
        margin-bottom: 20px;
    }

    .mobile-search-button {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 14px 18px;
        background-color: rgba(0, 0, 0, 0.05);
        border: none;
        border-radius: 14px;
        color: var(--text-secondary);
        font-size: 1.1rem;
        font-family: inherit;
        text-align: left;
    }

    @media (prefers-color-scheme: dark) {
        .mobile-search-button {
            background-color: rgba(255, 255, 255, 0.05);
        }
    }

    .mobile-search-button i {
        font-size: 1.3rem;
    }

    .mobile-avatar {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: linear-gradient(135deg, #007aff, #34c759);
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: bold;
        font-size: 0.8rem;
    }

    .mobile-avatar.is-icon {
        background: none;
        color: var(--accent-color);
        font-size: 32px;
    }

    .mobile-logo {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        object-fit: cover;
    }

    .mobile-menu-backdrop {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.1);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        z-index: 900;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.4s ease, visibility 0.4s ease;
    }

    .mobile-menu-backdrop.is-open {
        opacity: 1;
        visibility: visible;
    }

    .mobile-site-title {
        font-size: 1.1rem;
        font-weight: 600;
        color: var(--text-primary);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 20px 15px;
        min-height: auto;
    }

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

    .post-content {
        padding: 20px;
        border-radius: 24px;
    }
}

/* Pagination Styles */
.pagination-header {
    margin-bottom: 40px;
}

.pagination-footer {
    margin-top: 40px;
    padding-bottom: 40px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.pagination-header .pagination,
.pagination-footer .pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.pagination-header a,
.pagination-footer a {
    color: var(--accent-color);
    padding: 8px 16px;
    border-radius: 20px;
    background-color: rgba(0, 122, 255, 0.1);
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pagination-header a:hover,
.pagination-footer a:hover {
    background-color: rgba(0, 122, 255, 0.2);
}

/* Post Navigation */
.post-navigation {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid var(--border-color);
}

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

.post-nav-prev, .post-nav-next {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-decoration: none;
    transition: opacity 0.2s;
}

.post-nav-next {
    text-align: right;
}

.post-nav-prev:hover, .post-nav-next:hover {
    opacity: 0.7;
}

.post-nav-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.post-nav-next .post-nav-label {
    justify-content: flex-end;
}

.post-nav-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

@media (max-width: 768px) {
    .post-nav-container {
        grid-template-columns: 1fr;
        gap: 40px;
    }
}

