/* Import Retro Font */
@import url('https://fonts.googleapis.com/css?family=Press+Start+2P&display=swap');

/* Base Styles */
body {
    font-family: 'Press Start 2P', sans-serif;
    background-color: #2d2a32;
    color: #e0d674; /* Softer yellow for improved contrast */
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

/* Header and Navigation */
header {
    position: sticky;
    top: 0;
    z-index: 2000;
    background-color: #1a1a1a;
    border-bottom: 4px solid #e0d674;
}

.main-nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.2em;
}

.home-link,
.nav-link {
    color: #e0d674;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link,
.dropdown-trigger {
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
    display: inline-block;
    line-height: 1.5;
    vertical-align: middle;
}

.nav-link:hover {
    background-color: #e0d674;
    color: #1a1a1a;
}

/* Hamburger Menu */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.hamburger,
.hamburger::before,
.hamburger::after {
    display: block;
    position: relative;
    width: 30px;
    height: 3px;
    background: #e0d674;
    transition: all 0.3s ease;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
}

.hamburger::before {
    transform: translateY(-10px);
}

.hamburger::after {
    transform: translateY(10px);
}

/* Back to Home Link for Blog Posts */
.back-link,
.enter-button {
    display: inline-block;
    padding: 10px 20px;
    background-color: #1a1a1a;
    color: #e0d674;
    text-decoration: none;
    border: 2px solid #e0d674;
    border-radius: 5px;
    transition: all 0.3s ease;
    font-size: 1.1em;
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    width: fit-content;
}

.back-link:hover,
.enter-button:hover {
    background-color: #e0d674;
    color: #1a1a1a;
    transform: scale(1.05);
}

/* Common Styles for Post Containers */
.post-header,
.blog-post,
.post-navigation {
    width: 100%;
    padding: 20px;
    background-color: #333;
    border-radius: 10px;
    color: #e0d674;
    border: 4px solid #e0d674;
    box-shadow: 0 0 0 4px #2d2a32, 0 0 0 8px #e0d674;
    position: relative;
    box-sizing: border-box;
    z-index: 1;
}

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

.blog-post {
    margin-bottom: 4rem;
}

/* Headings */
.post-header h1,
.blog-post h1 {
    color: #f4e04d;
    margin-bottom: 20px;
    padding-bottom: 10px;
    text-shadow: 3px 3px #2d2a32, 6px 6px rgba(224, 214, 116, 0.3);
    letter-spacing: 2px;
}

.post-header h1 {
    margin-top: 0;
}

.blog-post h1 {
    margin-top: 40px;
}

.blog-post h2 {
    color: #f4e04d;
    margin: 40px 0 20px;
    padding-bottom: 10px;
    border-bottom: 3px double #e0d674;
    text-transform: uppercase;
}

/* Paragraphs */
.blog-post p {
    font-size: 1em;
    line-height: 1.8;
    margin: 10px 0;
}

/* Post Meta Information */
.blog-post .post-meta {
    font-size: 0.9em;
    color: #a0a0a0;
    margin-bottom: 20px;
}

/* Gallery Styling */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1rem;
    margin: 2rem 0;
    background: #1a1a1a;
    border: 2px solid #e0d674;
    border-radius: 10px;
}

.gallery-item {
    margin: 0;
    padding: 0;
    position: relative;
}

.gallery-item a {
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: 5px;
    border: 2px solid #555;
    transition: all 0.3s ease;
}

.gallery-item a:hover {
    border-color: #e0d674;
    transform: scale(1.05);
    z-index: 2;
}

.gallery-item img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.3s ease;
}

/* Regular Image Styling */
.blog-post img:not(.gallery-item img),
.blog-post table td img {
    display: block;
    max-width: 90%;
    height: auto;
    margin: 15px auto;
    border-radius: 5px;
    border: 2px solid #555;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: visible !important;
    overflow-clip-margin: unset !important;
}

.blog-post table td img {
    max-width: 150px;
    margin: 10px;
    vertical-align: middle;
    position: relative;
    z-index: 1;
}

.blog-post table td img:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(224, 214, 116, 0.5);
}

/* Ensure table cells don't clip images */
.blog-post table td {
    overflow: visible;
    position: relative;
    border: 2px solid #e0d674;
    padding: 20px;
    vertical-align: middle;
    line-height: 1.8;
    transition: background-color 0.3s ease;
}

.blog-post table td:hover {
    background-color: #444;
}

.blog-post table td:first-child {
    width: 170px;
    text-align: center;
}

/* Retro corner decorations */
.blog-post::before {
    content: '';
    position: absolute;
    top: -12px;
    left: -12px;
    width: 24px;
    height: 24px;
    background: #e0d674;
    transform: rotate(45deg);
}

/* Link Styling */
.blog-post a {
    position: relative;
    text-decoration: none;
    color: #e0d674;
}

.blog-post a::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: #e0d674;
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.blog-post a:hover::after {
    transform: scaleX(1);
}

/* Lists Styling */
.blog-post ul,
.blog-post ol {
    padding-left: 20px;
    color: #e0d674;
}

.blog-post li {
    margin-bottom: 10px;
}

.blog-post ol li {
    margin-bottom: 10px;
}

/* Table Styling */
.blog-post table {
    width: 100%;
    border-collapse: collapse;
    margin: 30px 0;
    color: #e0d674;
    border: 3px solid #e0d674;
    background: linear-gradient(45deg, #2d2a32 25%, #333 25%, #333 50%, #2d2a32 50%, #2d2a32 75%, #333 75%);
    background-size: 10px 10px;
}

/* Styling for Code Blocks */
.blog-post code {
    background-color: #444;
    color: #f4e04d;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.9em;
}

.blog-post pre {
    background-color: #444;
    color: #f4e04d;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    font-size: 0.9em;
    margin: 20px 0;
}

/* List of Blog Posts */
.blog-list,
.post-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.blog-list li,
.post-item {
    margin-bottom: 10px;
}

.blog-list a,
.post-link {
    color: #f4e04d;
    text-decoration: none;
    display: block;
    padding: 1.5rem;
    background-color: #1a1a1a;
    border: 2px solid #e0d674;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.blog-list a:hover,
.post-link:hover {
    background-color: #2d2a32;
    transform: translateX(10px);
    box-shadow: -4px 4px 0 #e0d674, -8px 8px 0 rgba(224, 214, 116, 0.3);
}

/* Home Page Styles */
.enter-page {
    padding: 4rem 2rem;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.enter-page h1 {
    font-size: 2.5em;
    margin-bottom: 1rem;
    color: #f4e04d;
    text-shadow: 3px 3px #2d2a32, 6px 6px rgba(224, 214, 116, 0.3);
}

.enter-page p {
    font-size: 1.2em;
    margin-bottom: 2rem;
}

.enter-button i {
    margin-right: 0.5rem;
}

/* Blog Index Page */
.blog-index {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 2rem;
    text-align: center;
}

.blog-index h1 {
    font-size: 3em;
    color: #e0d674;
    margin-bottom: 3rem;
    text-shadow: 4px 4px #2d2a32, 8px 8px rgba(224, 214, 116, 0.3);
    letter-spacing: 4px;
}

/* Post Titles and Dates */
.post-title {
    font-size: 1.2em;
    color: #e0d674;
    margin-bottom: 0.5rem;
    letter-spacing: 2px;
}

/* Ensure the date is displayed below the title */
.post-date {
    display: block;
    margin-top: 0.5rem; /* Adds a small gap between the title and date */
    font-size: 0.9em; /* Adjust size if needed */
    color: #808080; /* Gray color for the date */
}

/* Post Container */
.post-container {
    max-width: 800px;
    margin: 20px auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Post Navigation */
.post-navigation .nav-links {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    box-sizing: border-box;
}

.post-navigation .nav-previous,
.post-navigation .nav-next {
    flex: 0 1 45%;
    padding: 0.75rem;
    background-color: #2d2a32;
    border: 2px solid #e0d674;
    border-radius: 3px;
    text-align: center;
    margin: 0;
}

.post-navigation a {
    color: #e0d674;
    text-decoration: none;
    display: block;
    font-size: 0.8em;
    line-height: 1.5;
    transition: all 0.3s ease;
}

.post-navigation a:hover {
    color: #f4e04d;
    transform: scale(1.02);
}

/* Dropdown Menu Styles */
.nav-dropdown {
    position: relative;
    display: flex;
    align-items: center;
}

.dropdown-trigger {
    cursor: pointer;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: calc(100% - 5px); /* Move up slightly to remove gap */
    right: 0;
    background-color: #1a1a1a;
    min-width: 300px;
    max-width: 400px;
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    z-index: 1000;
    border: 2px solid #e0d674;
    border-radius: 5px;
    padding-top: 5px; /* Add padding at top */
    opacity: 1;
    visibility: visible;
    scrollbar-width: thin;
    scrollbar-color: #e0d674 #1a1a1a;
}

/* Add invisible padding to maintain hover */
.nav-dropdown::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 10px;
}

/* Custom scrollbar styling for WebKit browsers */
.dropdown-content::-webkit-scrollbar {
    width: 8px;
}

.dropdown-content::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.dropdown-content::-webkit-scrollbar-thumb {
    background-color: #e0d674;
    border-radius: 4px;
    border: 2px solid #1a1a1a;
}

.dropdown-content a {
    color: #e0d674;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.9em;
    white-space: nowrap;
}

.dropdown-content a:hover {
    background-color: #2d2a32;
}

.nav-dropdown:hover > .dropdown-content {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Mobile Menu Categories */
@media (max-width: 768px) {
    .dropdown-content {
        position: static;
        max-width: 100%;
        max-height: 60vh;
        overflow-y: auto;
        margin: 0;
        border: none;
        border-top: 1px solid #e0d674;
        border-bottom: 1px solid #e0d674;
        box-shadow: none;
        background-color: #2d2a32;
    }

    .nav-dropdown.active .dropdown-content {
        display: block;
    }

    .dropdown-content a {
        padding: 15px 2rem;
    }
}

/* Responsive Design for Smaller Screens */
@media (max-width: 768px) {
    .post-container,
    .blog-post,
    .post-navigation,
    .blog-index {
        padding: 0 15px;
        margin: 15px auto;
    }

    .blog-post {
        padding: 15px;
        margin-bottom: 1rem;
        font-size: 0.9em;
    }

    .blog-post img {
        max-width: 100%;
    }

    .post-navigation {
        padding: 0rem;
        margin: 2rem auto;
        position: relative;
        z-index: 1;
        max-width: 100%;
        box-sizing: border-box;
    }

    .post-navigation .nav-links {
        flex-direction: column;
        gap: 1rem;
        position: relative;
        z-index: 1;
        width: 100%;
        align-items: center;
    }

    .post-navigation .nav-previous,
    .post-navigation .nav-next {
        width: 100%;
        max-width: 300px;
        position: relative;
        z-index: 1;
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 60px;
    }

    .post-navigation a {
        width: 100%;
        padding: 0.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        word-break: break-word;
    }

    .enter-page {
        padding: 2rem 1rem;
    }

    .enter-page h1 {
        font-size: 2em;
    }

    .enter-page p {
        font-size: 1em;
    }

    .blog-index h1 {
        font-size: 2em;
        margin-bottom: 2rem;
    }

    .post-title {
        font-size: 1em;
    }

    /* Navigation Menu Responsive */
    .nav-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        flex-direction: column;
        background-color: #1a1a1a;
        padding: 1rem;
        text-align: center;
        z-index: 999;
        border-bottom: 4px solid #e0d674;
    }

    .nav-links.nav-active {
        display: flex;
    }

    .dropdown-content {
        position: static;
        display: none;
        border: none;
        box-shadow: none;
        background-color: #2d2a32;
    }

    .nav-dropdown.active .dropdown-content {
        display: block;
    }

    .nav-links a {
        padding: 1rem;
        display: block;
        width: 80%;
        margin: 0 auto;
        border-bottom: 1px solid rgba(224, 214, 116, 0.3);
    }

    .dropdown-content a {
        padding-left: 2rem;
    }

    .nav-links a:last-child {
        border-bottom: none;
    }

    .nav-links a:hover {
        background-color: rgba(224, 214, 116, 0.1);
    }

    .nav-toggle-active .hamburger {
        background: transparent;
    }

    .nav-toggle-active .hamburger::before {
        transform: rotate(45deg);
    }

    .nav-toggle-active .hamburger::after {
        transform: rotate(-45deg);
    }

    .back-link {
        margin: 2rem 0;
    }
}
