/* =========================
   0. CORE STYLES & RESET
   ========================= */
.kg-width-wide {
    max-width: 100%;
}

.kg-width-full {
    max-width: 100%;
    width: 100%;
}

.kg-image {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 20px 0;
}

.kg-gallery-container {
    display: flex;
    flex-direction: column;
}

.kg-bookmark-card {
    width: 100%;
    display: block;
}

/* =========================
   CUSTOM FONT LOADING
   ========================= */

/* 1. Baramond (Kept for fallback or specific use) */
@font-face {
    font-family: 'Baramond';
    src: url('../fonts/baramond.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Baramond';
    src: url('../fonts/baramond-italic.woff2') format('woff2');
    font-weight: normal;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Baramond';
    src: url('../fonts/baramond-bold-italic.woff2') format('woff2');
    font-weight: bold;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Baramond';
    src: url('../fonts/baramond-bold.woff2') format('woff2');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

/* 
   2. AUTHENTIC SANS 90 (Main Font)
   We map the "90" file (Normal Width) to be the default "Normal" weight 
   so the browser uses it for everything.
*/
@font-face {
    font-family: 'Authentic Sans';
    /* FIX: Corrected typo from .woff2ff2 to .woff2 */
    src: url('../fonts/AUTHENTICSans-90.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Authentic Sans';
    src: url('../fonts/AUTHENTICSans-150.woff2') format('woff2');
    font-weight: bold;
    /* This keyword connects it to 'font-weight: bold' */
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Adobe Caslon Pro';
    src: url('../fonts/Adobe-Caslon-Pro-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Adobe Caslon Pro';
    src: url('../fonts/Adobe-Caslon-Pro-Bold.woff2') format('woff2');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Adobe Caslon Pro';
    src: url('../fonts/Adobe-Caslon-Pro-Italic.woff2') format('woff2');
    font-weight: normal;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Adobe Caslon Pro';
    src: url('../fonts/Adobe-Caslon-Pro-BoldItalic.woff2') format('woff2');
    font-weight: bold;
    font-style: italic;
    font-display: swap;
}

/* Optional: If you want a bold version, map a heavier file here. 
   If you don't have one, the browser will faux-bold the 90 file. */

/* =========================
   GLOBAL VARIABLES
   ========================= */
:root {
    --bg-color: #ffffff;
    --text-color: #000000;
    --border-color: #000000;
    --accent-color: #0000aa;
    --sidebar-width: 240px;

    /* FIX: Set the stack to use the name defined above */
    --font-stack: 'Helvetica';

    --base-size: 0.95rem;
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #e5e5e5;
    --border-color: #e5e5e5;
    --accent-color: #8ab4f8;
}

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

/* =========================
   LAYOUT FIX (THE IMPORTANT PART)
   ========================= */

/* FIX: restore flex to BODY so items sit side-by-side without needing a wrapper div */
body {
    background: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-stack);
    font-size: var(--base-size);
    line-height: 1.5;

    /* Layout Logic */
    display: flex;
    /* This forces the sidebars and content to sit in a row */
    flex-direction: row;
    /* Horizontal alignment */
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    /* Prevents double scrollbars */
    width: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1,
h2,
h3,
h4,
p,
li,
a,
blockquote {
    font-size: var(--base-size);
}

/* =========================
   2. SIDEBAR (LEFT)
   ========================= */
.sidebar {
    width: var(--sidebar-width);
    height: 100%;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 0;
    flex-shrink: 0;
    background: var(--bg-color);
    z-index: 100;
    transition: transform 0.3s ease;
    overflow: hidden;
}

.sidebar-header {
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 0px solid var(--border-color);
    padding: 20px;
    flex-shrink: 0;
}

.site-title {
    font-weight: bold;
    display: block;
    text-align: center;
}

.post-nav {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: 0;
}

.post-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    margin: 0;
    font-weight: bold;
}

.post-list li {
    margin-bottom: 12px;
}

.post-link {
    color: var(--text-color);
    opacity: 1;
}

.post-link.active-post {
    font-weight: bold;
    text-decoration: none;
    color: #fbcfe7;
}

.sidebar-footer {
    padding: 20px;
    padding-bottom: 40px;
    flex-shrink: 0;
    border-top: 1px solid var(--border-color);
}

.toggle-container {
    margin-bottom: 20px;
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.half-circle-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(90deg, #000000 50%, #ffffff 50%);
    border: 1px solid var(--text-color);
}

[data-theme="dark"] .half-circle-icon {
    background: linear-gradient(90deg, #ffffff 50%, #000000 50%);
}

.nav-arrows {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    min-height: 30px;
}

.disabled-link {
    opacity: 0.3;
    cursor: default;
}

/* =========================
   3. MAIN CONTENT
   ========================= */
.content-area {
    flex-grow: 1;
    height: 100%;
    overflow-y: auto;
    padding: 20px 40px 120px 40px;
}

/* FIX: Limit width to 600px and Center */
.post-content {
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
}

.post-title {
    font-weight: bold;
    margin-bottom: 40px;
    display: block;
    padding-bottom: 10px;
    justify-content: left;
    text-align: left;
}

.post-content p {
    margin-bottom: 20px;
    text-align: left;
}

.post-content a {
    color: var(--accent-color);
    text-decoration: underline;
}

.post-content blockquote {
    font-style: italic;
    margin: 30px 0;
    padding-left: 20px;
}

/* =========================
   SIDEBAR (RIGHT) - IMAGES
   ========================= */
.sidebar-right {
    width: var(--sidebar-width);
    height: 100%;
    /* Keep the border separating it from the content */
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    background: var(--bg-color);
    overflow-y: auto;

    /* ADDED: 10px padding on all sides (Top, Right, Bottom, Left) */
    padding: 20px;
}

.sidebar-image-link {
    display: block;
    width: 100%;

    /* ADDED: Gap between images */
    margin-bottom: 20px;

    /* REMOVED: The border-bottom, so it looks like a clean gap */
    border-bottom: none;

    transition: opacity 0.2s ease;
}

/* Optional: Remove margin from the very last image so it sits flush */
.sidebar-image-link:last-child {
    margin-bottom: 0;
}

.sidebar-image-link:hover {
    opacity: 0.7;
}

.sidebar-image-link img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;

    /* Optional: If you want sharp corners like your design, keep this default. 
       If you want slightly rounded corners, uncomment the line below: */
    border-radius: 4px;
}


/* =========================
   5. MOBILE RESPONSIVENESS
   ========================= */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #000000;
    color: #ffffff;
    border: none;
    padding: 12px 24px;
    font-family: 'Authentic Sans', sans-serif;
    font-weight: bold;
    z-index: 1000;
    cursor: pointer;
    border-radius: 30px;
}

/* Mobile: Change Layout */

@media (max-width: 1000px) {

    /* Hide the image sidebar on tablets and phones to save space */
    .sidebar-right {
        display: none;
    }
}

@media (max-width: 768px) {
    body {
        /* On mobile, we stack vertically. Content fills space. */
        flex-direction: column;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 60%;
        height: 100vh;
        height: 100dvh;
        transform: translateX(-100%);
        border-right: 1px solid var(--border-color);
        box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .content-area {
        width: 100%;
        height: 100vh;
        height: 100dvh;
        padding: 40px 5% 120px 5%;
    }
}

@media (max-width: 480px) {
    :root {
        --base-size: 0.95rem;
    }
}