/* --- 1. Root Variables (Theme) --- */
:root {
    --bg-color: #ffeeee;
    --text-color: #100029;
    --sidebar-bg: #f2dede;
    --border-color: #d4b8b8;
    --link-color: #C15F49;
    --muted-color: #906F6F;
    --sidebar-width: 280px;
    --sidebar-width-closed: 65px; /* Hidden on mobile by default */
}

/* Dark mode variables */
:root.dark {
    --bg-color: #100029;
    --text-color: #ffeeee;
    --sidebar-bg: #1c0038;
    --border-color: #2e1855;
    --link-color: #37C871;
    --muted-color: #c4a4a4;
}

/* --- 2. Basic Setup --- */

:focus-visible {
    outline: 2px solid var(--link-color);
    outline-offset: 3px;
    border-radius: 4px;
}


.skip-to-content {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: 9999;
    padding: 0.5rem 1rem;
    background: var(--bg-color);
    color: var(--link-color);
    border: 2px solid var(--link-color);
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: top 0.15s ease;
}
.skip-to-content:focus {
    top: 1rem;
    background: var(--link-color);
    color: var(--bg-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    outline: none;
}


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

html {
    /* Smooth theme transition */
    transition: background-color 0.2s, color 0.2s;
    background-color: var(--bg-color);
    color: var(--text-color);
}

body {
    font-family: "Rubik", sans-serif;
    font-optical-sizing: auto;
    font-weight: 300;
    font-style: normal;
    line-height: 1.6;
}

p {
    margin: 0 0 15px 0;
}

a {
    color: var(--link-color);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

hr {
    border: none;
    border-top: 1px solid color-mix(in srgb, var(--border-color) 50%, transparent);
    margin: 2rem 0;
}

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


/* --- 3. Layout Grid --- */
.body-grid {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow: hidden;
    transition: width 0.3s ease;
    z-index: 100;
    border-radius: 0 16px 16px 0;
}

.main-content {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* --- 4. Sidebar Inner Layout --- */
.sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0;
}

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

.sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1rem;
}

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

/* --- 5. Sidebar Image --- */
.sidebar-logo-link {
    display: block;
    text-decoration: none;
}
.sidebar-image-container {
    padding: 0.5rem 0 1.25rem;
}
.sidebar-image-container img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    display: block;
    margin: 0 auto;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    transition: opacity 0.2s ease;
}
.sidebar-logo-link:hover .sidebar-image-container img {
    opacity: 0.85;
}

/* --- 6. Nav Links --- */
.sidebar-nav ul {
    list-style: none;
}
.sidebar-nav li {
    margin-bottom: 0.25rem;
}
.sidebar-nav a {
    display: block;
    padding: 0.55rem 0.85rem;
    border-radius: 8px;
    color: var(--text-color);
    font-size: 0.95rem;
    font-weight: 400;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}
.sidebar-nav a:hover {
    background: color-mix(in srgb, var(--link-color) 12%, transparent);
    color: var(--link-color);
    text-decoration: none;
}

/* --- 7. Toggle Button --- */
.sidebar-toggle-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    flex-shrink: 0;
}
.sidebar-toggle-button:hover {
    background: color-mix(in srgb, var(--text-color) 8%, transparent);
}

/* Swap open/close icons based on state */
.toggle-open  { display: block; }
.toggle-close { display: none; }
body:not(.sidebar-closed) .toggle-open  { display: none; }
body:not(.sidebar-closed) .toggle-close { display: block; }

/* --- 8. Dark Mode Toggle --- */
.dark-mode-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.55rem 0.85rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: none;
    color: var(--text-color);
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease;
}
.dark-mode-toggle:hover {
    background: color-mix(in srgb, var(--text-color) 8%, transparent);
}

.dark-mode-toggle .moon-icon { display: none; }
.dark-mode-toggle .sun-icon  { display: block; }
:root.dark .dark-mode-toggle .moon-icon { display: block; }
:root.dark .dark-mode-toggle .sun-icon  { display: none; }

/* --- 9. Collapsed Sidebar State --- */
body.sidebar-closed .sidebar {
    width: var(--sidebar-width-closed);
}
body.sidebar-closed .main-content {
    margin-left: var(--sidebar-width-closed);
}
body.sidebar-closed .sidebar-body,
body.sidebar-closed .sidebar-footer {
    display: none;
}
body.sidebar-closed .sidebar-header {
    border-bottom: none;
}

/* --- 10. Responsive (Mobile) --- */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 99;
}

@media (max-width: 768px) {
    .body-grid {
        display: block;
    }
    .sidebar {
        width: var(--sidebar-width-closed);
    }
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1rem;
        padding-top: 4.5rem;
        /* Clear the fixed 65px collapsed sidebar */
        padding-left: calc(var(--sidebar-width-closed) + 0.75rem);
    }
    body:not(.sidebar-closed) .sidebar {
        width: var(--sidebar-width);
    }
    /* Overlay pattern: sidebar slides over content instead of pushing it */
    body:not(.sidebar-closed) .main-content {
        margin-left: 0;
    }
    body:not(.sidebar-closed) .sidebar-backdrop {
        display: block;
    }
    /* Prevent background scroll while drawer is open */
    body:not(.sidebar-closed) {
        overflow: hidden;
    }
}
/* --- 8. Post Previews (List Layout) --- */
.post-list-container {
    display: flex;
    flex-direction: column;
    /* This adds space between the post previews */
    gap: 2.5rem;
}

.post-preview {
    padding-bottom: 2rem;
    border-bottom: 1px solid color-mix(in srgb, var(--border-color) 50%, transparent);
}

.post-list-container article.post-preview:last-of-type {
    /* Removes the border from the very last post in the list */
    border-bottom: none;
    padding-bottom: 0;
}

.post-title-preview {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.post-title-preview a {
    color: var(--text-color); /* Make title same color as text */
    text-decoration: none;
}

.post-title-preview a:hover {
    color: var(--link-color); /* Add hover color */
    text-decoration: underline;
}

/* Style for the optional subtitle */
.post-subtitle-preview {
    font-size: 1rem;
    font-weight: 300;
    color: var(--muted-color);
    margin-bottom: 0.5rem;
    margin-top: 0;
}


.post-summary {
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

.read-more {
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-color);
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.read-more:hover {
    background: color-mix(in srgb, var(--link-color) 12%, transparent);
    border-color: var(--link-color);
    color: var(--link-color);
    text-decoration: none;
}

/* --- 9. Image Styles --- */

/* Page/Post Banner */
.page-banner-container {
    width: 100%;
    height: 300px; /* Adjust height as you like */
    margin-bottom: 2rem;
    overflow: hidden;
    border-radius: 12px;
    background-color: var(--sidebar-bg); /* Placeholder color */
}
.page-banner-container img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Crops image to fit, preserving aspect ratio */
}

/* Post Preview Thumbnail */
.post-preview-thumbnail {
    display: block;
    margin-bottom: 1rem;
    border-radius: 12px;
    overflow: hidden;
    background-color: var(--sidebar-bg); /* Placeholder color */
}
.post-preview-thumbnail img {
    width: 100%;
    height: auto;
    display: block; /* Removes bottom space */
    transition: transform 0.2s ease-in-out;
}
.post-preview-thumbnail:hover img {
    transform: scale(1.05); /* Simple zoom on hover */
}

/* =================================================================
   APPEND THIS ENTIRE BLOCK to the bottom of static/css/style.css
   ================================================================= */


/* --- 10. Game Page Layout --- */

.game-title {
    margin-bottom: 0.25rem;
}

.game-tagline {
    font-size: 1.15rem;
    font-weight: 300;
    color: var(--muted-color);
    margin-bottom: 1.25rem;
    font-style: italic;
}


/* Status / platform / tag badges */
.game-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.game-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--sidebar-bg);
    color: var(--text-color);
}

.badge-status {
    background: var(--link-color);
    color: #fff;
    border-color: transparent;
}

/* Store / download buttons */
.game-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.game-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.4rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.game-link-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    opacity: 0.92;
    text-decoration: none;
}
.game-link-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.btn-itch     { background: #fa5c5c; color: #fff; }
.btn-steam    { background: #1b2838; color: #c7d5e0; }
.btn-download { background: var(--link-color); color: #fff; }

/* Trailer embed — responsive 16:9 */
.game-trailer {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 2rem;
    background: #000;
}
.game-trailer iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
}

/* Screenshot grid */
.game-screenshots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
    margin-bottom: 2rem;
}
.game-screenshots img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 12px;
    display: block;
    transition: transform 0.2s ease;
}
.game-screenshots .screenshot-link:hover img {
    transform: scale(1.03);
}

/* Game description body */
.game-description {
    margin-bottom: 2rem;
}
.game-description h2 {
    margin: 1.5rem 0 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--link-color);
}

/* Credits */
.game-credits {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 2rem;
}
.game-credits h3 {
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted-color);
}

.game-credits ul {
    list-style: none;
    font-size: 0.9rem;
}
.game-credits li {
    margin-bottom: 0.25rem;
}

/* Related devlog posts */
.game-related {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    margin-top: 2rem;
}
.game-related h3 {
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted-color);
}

.game-related ul { list-style: none; }
.game-related li { margin-bottom: 0.4rem; font-size: 0.9rem; }

/* "View all" link on homepage */
.view-all-link {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-color);
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.view-all-link:hover {
    background: color-mix(in srgb, var(--link-color) 12%, transparent);
    border-color: var(--link-color);
    color: var(--link-color);
    text-decoration: none;
}


/* --- 11. Bug fix: post-preview thumbnail ---
   The original partial had `{{ .RelPermalink }}` on the $image string.
   Replace the thumbnail block in layouts/partials/post-preview.html with:

    {{ with $image }}
    <a href="{{ $.RelPermalink }}" class="post-preview-thumbnail">
        <img src="{{ . }}" alt="{{ $.Title }}">
    </a>
    {{ end }}

   Note the $ prefix — $.RelPermalink and $.Title refer to the PAGE,
   not to the string variable.
*/


/* --- 12. Title Showcase / Carousel --- */
.title-showcase {
    position: relative;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 2.5rem;
    background: var(--sidebar-bg);
}

.showcase-track {
    position: relative;
    width: 100%;
    aspect-ratio: 21 / 9;
    min-height: 200px;
}

.showcase-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
}

.showcase-slide.active {
    opacity: 1;
    pointer-events: auto;
}

.showcase-banner {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
}

.showcase-banner-placeholder {
    background: linear-gradient(135deg, var(--sidebar-bg) 0%, var(--border-color) 50%, var(--sidebar-bg) 100%);
    background-size: 200% 200%;
    animation: showcase-shimmer 4s ease-in-out infinite;
}

@keyframes showcase-shimmer {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.showcase-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.25) 55%, transparent 100%);
    display: flex;
    align-items: flex-end;
    padding: 1.75rem 2rem;
}

.showcase-info {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.showcase-title {
    color: #fff;
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 1px 6px rgba(0,0,0,0.6);
}

.showcase-tagline {
    color: rgba(255,255,255,0.82);
    font-size: 1rem;
    font-style: italic;
    margin: 0;
}

.showcase-cta {
    align-self: flex-start;
    margin-top: 0.25rem;
}

.showcase-controls {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 10;
}

.showcase-btn {
    background: rgba(0,0,0,0.5);
    border: none;
    color: #fff;
    font-size: 1.4rem;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    padding: 0;
    line-height: 1;
}
.showcase-btn:hover { background: rgba(0,0,0,0.78); }

.showcase-dots {
    display: flex;
    gap: 0.35rem;
}

.showcase-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    padding: 0;
}
.showcase-dot.active {
    background: #fff;
    transform: scale(1.25);
}

@media (max-width: 768px) {
    .showcase-title { font-size: 1.25rem; }
    .showcase-overlay { padding: 1rem 1.25rem; }
}

/* --- 13. 404 page --- */
.page-404 {
    text-align: center;
    padding: 4rem 2rem;
}
.page-404 h1 {
    font-size: 6rem;
    font-weight: 700;
    line-height: 1;
    color: var(--link-color);
    margin-bottom: 0.5rem;
}
.page-404 p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

/* --- 14. Newsletter Signup --- */
.newsletter-signup {
    margin-top: 4rem;
    padding: 1.75rem 2rem;
    border-radius: 12px;
    background: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    text-align: center;
}

.newsletter-heading {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.newsletter-sub {
    font-size: 0.9rem;
    color: var(--muted-color);
    margin-bottom: 1rem;
}

.newsletter-form {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.newsletter-input {
    padding: 0.55rem 1rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.9rem;
    width: 260px;
    max-width: 100%;
}

.newsletter-input:focus {
    outline: none;
    border-color: var(--link-color);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--link-color) 20%, transparent);
}

.newsletter-btn {
    padding: 0.55rem 1.4rem;
    border-radius: 20px;
    border: none;
    background: var(--link-color);
    color: var(--bg-color);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.newsletter-btn:hover {
    opacity: 0.85;
}

.newsletter-success,
.newsletter-error {
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.newsletter-success { color: #10bf7a; }
.newsletter-error   { color: #ea4110; }

.site-footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid color-mix(in srgb, var(--border-color) 50%, transparent);
}

.page-content {
    margin-bottom: auto;
}

/* --- 15. Footer --- */
.site-footer {
    padding-top: 3rem;
    padding-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--muted-color);
}

.site-footer-copy {
    margin: 0;
}

.site-footer-socials {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.social-link:hover {
    background: color-mix(in srgb, var(--link-color) 12%, transparent);
    border-color: var(--link-color);
    color: var(--link-color);
    text-decoration: none;
}

@media (max-width: 768px) {
    .site-footer-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}
