/* DarkMallard Theme - Hacker-style blog with duck accents */

/* Base Styles */
@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Inter:wght@300;400;600&display=swap');

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

/* Custom Cursor - Dark Mode (Mallard Duck) */
body {
    cursor: url('/assets/cursors/02Help.ani'), url('/assets/cursors/02Help.cur'), auto;
}

/* Custom cursor for interactive elements */
a, button, input, textarea, select, .pdf-btn, .ctf-group-header, .category-header {
    cursor: url('/assets/cursors/02Help.ani'), url('/assets/cursors/02Help.cur'), pointer;
}

/* Custom cursor for text selection */
::selection {
    cursor: url('/assets/cursors/02Help.ani'), url('/assets/cursors/02Help.cur'), text;
}

/* Light Mode Cursor (Normal Duck) - You can add different cursor files here */
body.light-theme {
    cursor: url('/assets/cursors/02Help.ani'), url('/assets/cursors/02Help.cur'), auto;
}

body.light-theme a,
body.light-theme button,
body.light-theme input,
body.light-theme textarea,
body.light-theme select,
body.light-theme .pdf-btn,
body.light-theme .ctf-group-header,
body.light-theme .category-header {
    cursor: url('/assets/cursors/02Help.ani'), url('/assets/cursors/02Help.cur'), pointer;
}

body.light-theme ::selection {
    cursor: url('/assets/cursors/02Help.ani'), url('/assets/cursors/02Help.cur'), text;
}

body {
    background-color: #0d0f10; /* Near black background */
    color: #72dec2; /* Duck pond mint for text */
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    display: grid;
    grid-template-columns: 220px 1fr; /* widen main area */
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "header header"
        "sidebar main";
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: #4cd137; /* Terminal green for headers */
    font-family: 'Space Mono', monospace;
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.8rem;
    text-shadow: 0 0 8px rgba(76, 209, 55, 0.7);
    margin-bottom: 0.5rem;
    font-weight: 700;
    letter-spacing: 1px;
}

h2 {
    font-size: 1.3rem;
    color: #72dec2;
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    margin-bottom: 0;
    margin-top: 0.2rem;
    letter-spacing: 0.5px;
}

h3 {
    font-size: 1.5rem;
}

a {
    color: #72dec2;
    text-decoration: none;
    border-bottom: 1px solid #4cd137;
    transition: color 0.3s, border-color 0.3s;
}

a:hover {
    color: #4cd137;
    border-color: #72dec2;
}

p {
    margin-bottom: 1rem;
}

/* Layout Components */

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

/* Main content layout */
/* (Old flex-based rule removed; grid-based rule below applies) */

/* Logo section */
.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.profile-img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid #4cd137;
    object-fit: cover;
}

.tagline {
    color: #72dec2;
    font-size: 0.9rem;
    margin: 0;
    font-family: 'Inter', sans-serif;
}

/* Header controls */
.header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

header {
    grid-area: header;
    background: linear-gradient(135deg, #1a1d23 0%, #2d3748 100%);
    border-bottom: 2px solid #4cd137;
    padding: 2rem 3rem 1.5rem 3rem;
    z-index: 100;
    box-shadow: 0 2px 8px 0 rgba(12, 18, 16, 0.12);
}

.header-main {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.header-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-left: 0;
}

.duck-logo {
    width: 90px;
    height: 90px;
    border-radius: 10px;
    object-fit: cover;
    filter: drop-shadow(0 0 6px rgba(114, 222, 194, 0.5));
    border: 2px solid #4cd137;
    background: #121416;
}

.sidebar {
    grid-area: sidebar;
    background-color: #0a0c0d;
    padding: 1.5rem;
    border-right: 1px solid #005f3c;
    overflow-y: auto;
    height: 100%;
    position: relative;
}

/* Custom scrollbar for sidebar - Dark theme */
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: #0a0c0d;
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #4cd137;
    border-radius: 4px;
    border: 1px solid #0a0c0d;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #72dec2;
}

/* Firefox scrollbar */
.sidebar {
    scrollbar-width: thin;
    scrollbar-color: #4cd137 #0a0c0d;
}

.main-content {
    grid-area: main;
    padding: 2rem;
    overflow-y: auto;
    max-width: 100%;
}

/* Custom vertical scrollbar for main content - Dark theme */
.main-content::-webkit-scrollbar {
    width: 8px;
}

.main-content::-webkit-scrollbar-track {
    background: #0d0f10;
    border-radius: 4px;
}

.main-content::-webkit-scrollbar-thumb {
    background: #4cd137; /* Green thumb */
    border-radius: 4px;
    border: 1px solid #0d0f10;
}

.main-content::-webkit-scrollbar-thumb:hover {
    background: #72dec2; /* Mint on hover */
}

/* Firefox scrollbar for main content */
.main-content {
    scrollbar-width: thin;
    scrollbar-color: #4cd137 #0d0f10;
}

/* Markdown Content Styling - Theme Matched */
.main-content > *:first-child {
    margin-top: 0;
}

.main-content > *:last-child {
    margin-bottom: 0;
}

/* Headers in markdown content - Green theme */
.main-content h1,
.main-content h2,
.main-content h3,
.main-content h4,
.main-content h5,
.main-content h6 {
    color: #4cd137; /* Terminal green */
    font-family: 'Space Mono', monospace;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.main-content h1 {
    font-size: 2rem;
    border-bottom: 2px solid #2d3748;
    padding-bottom: 0.5rem;
    margin-top: 0;
    text-shadow: 0 0 8px rgba(76, 209, 55, 0.5);
}

.main-content h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid #2d3748;
    padding-bottom: 0.3rem;
    color: #72dec2; /* Duck pond mint */
}

.main-content h3 {
    font-size: 1.25rem;
    color: #4cd137;
}

/* Paragraphs in markdown - Mint color */
.main-content p {
    color: #a8b2d1; /* Light gray-blue */
    line-height: 1.7;
    margin-bottom: 1rem;
}

/* Images in markdown content - Responsive and styled */
.main-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.5rem auto;
    border-radius: 8px;
    border: 1px solid #2d3748;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.main-content img:hover {
    border-color: #4cd137;
    box-shadow: 0 6px 20px rgba(76, 209, 55, 0.2);
    transform: translateY(-2px);
}

/* Centered images with caption support */
.main-content p img,
.main-content figure {
    margin: 1.5rem auto;
}

.main-content figure {
    text-align: center;
    margin: 2rem auto;
}

.main-content figure img {
    margin-bottom: 0.5rem;
}

.main-content figcaption {
    color: #8892b0;
    font-size: 0.9rem;
    font-style: italic;
    margin-top: 0.5rem;
    text-align: center;
}

/* Code blocks - Terminal style with green border */
.main-content pre {
    background-color: #0a0c0d; /* Dark terminal background */
    border: 1px solid #4cd137; /* Green border */
    border-radius: 4px;
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    box-shadow: 0 0 10px rgba(76, 209, 55, 0.2);
}

/* Custom horizontal scrollbar for code blocks - Dark theme */
.main-content pre::-webkit-scrollbar {
    height: 8px;
}

.main-content pre::-webkit-scrollbar-track {
    background: #0a0c0d;
    border-radius: 4px;
    border: 1px solid #2d3748;
}

.main-content pre::-webkit-scrollbar-thumb {
    background: #4cd137; /* Green thumb */
    border-radius: 4px;
    border: 1px solid #0a0c0d;
}

.main-content pre::-webkit-scrollbar-thumb:hover {
    background: #72dec2; /* Mint on hover */
}

/* Firefox scrollbar for code blocks */
.main-content pre {
    scrollbar-width: thin;
    scrollbar-color: #4cd137 #0a0c0d;
}

.main-content pre code {
    background: none;
    color: #4cd137; /* Green color for code - matches theme */
    padding: 0;
    border: none; /* No border for code inside pre */
    border-radius: 0;
    font-size: inherit;
}

/* Inline code - Green theme */
.main-content code {
    background-color: rgba(76, 209, 55, 0.1); /* Light green background */
    color: #4cd137; /* Green text */
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Space Mono', monospace;
    font-size: 0.9em;
    border: 1px solid rgba(76, 209, 55, 0.3);
}

/* Lists - Mint color */
.main-content ul,
.main-content ol {
    color: #a8b2d1;
    margin: 1rem 0;
    padding-left: 2rem;
    line-height: 1.7;
}

.main-content li {
    margin-bottom: 0.5rem;
    color: #a8b2d1;
}

.main-content li::marker {
    color: #4cd137; /* Green bullets/numbers */
}

.main-content li p {
    margin-bottom: 0.5rem;
}

/* Blockquotes - Green accent */
.main-content blockquote {
    border-left: 4px solid #4cd137;
    padding-left: 1rem;
    margin: 1rem 0;
    color: #8892b0;
    font-style: italic;
    background: rgba(76, 209, 55, 0.05);
    padding: 1rem;
    border-radius: 4px;
}

/* Strong/Bold text - Mint color */
.main-content strong {
    color: #72dec2;
    font-weight: 600;
}

/* Links in markdown - Theme colors */
.main-content a {
    color: #72dec2;
    text-decoration: underline;
    border-bottom: 1px solid #4cd137;
    transition: color 0.3s, border-color 0.3s;
}

.main-content a:hover {
    color: #4cd137;
    border-bottom-color: #72dec2;
}

/* Horizontal rules - Green accent */
.main-content hr {
    border: none;
    border-top: 1px solid #2d3748;
    margin: 2rem 0;
    background: linear-gradient(90deg, rgba(76, 209, 55, 0), #4cd137, rgba(76, 209, 55, 0));
    height: 1px;
}

/* Tables - Theme styled */
.main-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    color: #a8b2d1;
    border: 1px solid #2d3748;
}

.main-content th,
.main-content td {
    border: 1px solid #2d3748;
    padding: 0.5rem;
    text-align: left;
}

.main-content th {
    background-color: #121416;
    font-weight: 600;
    color: #4cd137; /* Green headers */
}

.main-content tr:nth-child(even) {
    background-color: rgba(18, 20, 22, 0.5);
}

/* Light theme markdown styles - Yellow theme */
body.light-theme .main-content h1,
body.light-theme .main-content h3 {
    color: #f59e0b; /* Yellow */
    text-shadow: none;
}

body.light-theme .main-content h1 {
    border-bottom-color: #e5e7eb;
    text-shadow: none;
}

body.light-theme .main-content h2 {
    color: #d97706; /* Darker yellow */
    border-bottom-color: #e5e7eb;
}

body.light-theme .main-content p {
    color: #2d3748; /* Dark text */
}

body.light-theme .main-content img {
    border-color: #e5e7eb;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body.light-theme .main-content img:hover {
    border-color: #f59e0b;
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.2);
}

body.light-theme .main-content figcaption {
    color: #718096;
}

body.light-theme .main-content pre {
    background-color: #f7fafc;
    border-color: #f59e0b; /* Yellow border */
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

/* Custom horizontal scrollbar for code blocks - Light theme */
body.light-theme .main-content pre::-webkit-scrollbar-track {
    background: #f7fafc;
    border-color: #e5e7eb;
}

body.light-theme .main-content pre::-webkit-scrollbar-thumb {
    background: #f59e0b; /* Yellow thumb */
    border-color: #ffffff;
}

body.light-theme .main-content pre::-webkit-scrollbar-thumb:hover {
    background: #fbbf24; /* Lighter yellow on hover */
}

body.light-theme .main-content pre {
    scrollbar-color: #f59e0b #f7fafc;
}

body.light-theme .main-content pre code {
    color: #d97706; /* Darker yellow for code */
    border: none; /* No border for code inside pre */
    background: none;
}

body.light-theme .main-content code {
    background-color: rgba(245, 158, 11, 0.1); /* Light yellow background */
    color: #f59e0b; /* Yellow text */
    border-color: rgba(245, 158, 11, 0.3);
}

body.light-theme .main-content ul,
body.light-theme .main-content ol,
body.light-theme .main-content li {
    color: #2d3748;
}

body.light-theme .main-content li::marker {
    color: #f59e0b; /* Yellow bullets/numbers */
}

body.light-theme .main-content blockquote {
    border-left-color: #f59e0b;
    color: #4a5568;
    background: rgba(245, 158, 11, 0.05);
}

body.light-theme .main-content strong {
    color: #d97706; /* Darker yellow */
}

body.light-theme .main-content a {
    color: #d97706;
    border-bottom-color: #f59e0b;
}

body.light-theme .main-content a:hover {
    color: #f59e0b;
    border-bottom-color: #fbbf24;
}

body.light-theme .main-content hr {
    border-top-color: #e5e7eb;
    background: linear-gradient(90deg, rgba(245, 158, 11, 0), #f59e0b, rgba(245, 158, 11, 0));
}

body.light-theme .main-content th {
    background-color: #f3f4f6;
    color: #f59e0b; /* Yellow headers */
}

body.light-theme .main-content th,
body.light-theme .main-content td {
    border-color: #e5e7eb;
    color: #2d3748;
}

body.light-theme .main-content tr:nth-child(even) {
    background-color: #f9fafb;
}

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar .sidebar-section h3 {
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #4cd137;
}

.sidebar-list {
    list-style-type: none;
}

.sidebar-list li {
    margin-bottom: 0.5rem;
    padding: 0.3rem 0;
}

.sidebar-list a {
    color: #72dec2;
    text-decoration: none;
    transition: color 0.3s ease;
}

.sidebar-list a:hover {
    color: #4cd137;
    background: rgba(76, 209, 55, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}

main {
    grid-area: main;
    padding: 2rem;
}

.post {
    margin-bottom: 2.5rem;
    padding: 1.5rem;
    background-color: #121416;
    border-left: 3px solid #4cd137;
}

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

.post-date {
    color: #72dec2;
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
}

.post-tag {
    display: inline-block;
    background-color: #005f3c;
    color: #fff;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.8rem;
    margin-right: 0.5rem;
}

footer {
    grid-area: footer;
    text-align: center;
    padding: 1.5rem;
    background-color: #0a0c0d;
    border-top: 1px solid #005f3c;
    font-size: 0.9rem;
}

/* Terminal-like elements */
pre.terminal {
    background-color: #0a0c0d;
    padding: 1rem;
    border: 1px solid #4cd137;
    font-family: 'Space Mono', monospace;
    color: #72dec2;
    overflow-x: auto;
    position: relative;
    margin: 1.5rem 0;
}

pre.terminal::before {
    content: "$ darkduck_terminal";
    display: block;
    color: #4cd137;
    margin-bottom: 0.5rem;
    border-bottom: 1px dashed #005f3c;
    padding-bottom: 0.5rem;
}

.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background-color: #4cd137;
    color: #0a0c0d;
    border: none;
    border-radius: 3px;
    padding: 0.2rem 0.5rem;
    font-family: 'Space Mono', monospace;
    cursor: pointer;
    font-size: 0.8rem;
}

.copy-btn:hover {
    background-color: #72dec2;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    body {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "header"
            "main"
            "sidebar"
            "footer";
    }
    
    header {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        padding: 1.5rem 1rem 1rem 1rem;
        text-align: center;
        justify-content: flex-start;
    }
    
    .header-main {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
        width: 100%;
    }
    .header-content {
        margin-left: 0;
        margin-top: 0.5rem;
    }
    .duck-logo {
        width: 70px;
        height: 70px;
    }
    .search-form {
        margin: 1rem 0 0 0;
        width: 100%;
        justify-content: center;
    }
    .search-form input[type="text"] {
        width: 100px;
    }
}

/* Duck ASCII art Easter egg - visible in CSS source */
/*
   __
 <(o )___
  ( ._> /
   `---'   
*/

.search-form button {
    background: #0d0f10;
    color: #4cd137;
    border: 2px solid #4cd137;
    border-radius: 4px;
    font-size: 1.1rem;
    padding: 0.4rem 0.9rem 0.4rem 0.7rem;
    margin-left: 0.3rem;
    cursor: pointer;
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    box-shadow: 0 0 8px #4cd13744, 0 0 2px #4cd137;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s, border-color 0.2s;
    outline: none;
    letter-spacing: 1px;
    text-shadow: 0 0 4px #4cd13799;
}

.search-form button:hover, .search-form button:focus {
    background: #4cd137;
    color: #0d0f10;
    border-color: #72dec2;
    box-shadow: 0 0 16px #72dec2cc, 0 0 4px #4cd137;
    text-shadow: none;
}

.search-form input[type="text"] {
    background: #0d0f10;
    border: none;
    color: #72dec2;
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    padding: 0.4rem 0.6rem;
    outline: none;
    width: 140px;
    transition: width 0.3s, box-shadow 0.2s;
    border-radius: 4px;
    box-shadow: 0 0 4px #005f3c44;
}

.search-form input[type="text"]:focus {
    box-shadow: 0 0 8px #4cd13799, 0 0 2px #72dec2;
    border: 1px solid #4cd137;
}

/* Content Boxes */
.content-box {
    background: linear-gradient(135deg, #1a1f23 0%, #0f1419 100%);
    border: 1px solid #2d3748;
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    width: 100%;
    max-width: none;
}

.content-box:hover {
    border-color: #4cd137;
    box-shadow: 0 8px 25px rgba(76, 209, 55, 0.1);
}

.content-box h2 {
    color: #4cd137;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #2d3748;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.featured-box {
    background: linear-gradient(135deg, #1a1f23 0%, #0f1419 100%);
    border: 1px solid #4cd137;
    position: relative;
    overflow: hidden;
}

.featured-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #4cd137, #72dec2, #4cd137);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Featured Posts Section */
.featured-posts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.featured-post {
    background: linear-gradient(135deg, #1a1f23 0%, #0f1419 100%);
    border: 1px solid #2d3748;
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.featured-post::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #4cd137, #72dec2);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.featured-post:hover {
    border-color: #4cd137;
    box-shadow: 0 4px 20px rgba(76, 209, 55, 0.1);
    transform: translateY(-2px);
}

.featured-post:hover::before {
    opacity: 1;
}

.featured-post h3 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.featured-post h3 a {
    color: #4cd137;
    text-decoration: none;
    transition: color 0.3s ease;
}

.featured-post h3 a:hover {
    color: #72dec2;
    text-shadow: 0 0 4px rgba(114, 222, 194, 0.5);
}

.featured-post .post-meta {
    color: #8892b0;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    font-family: 'Space Mono', monospace;
}

.featured-post p {
    color: #a8b2d1;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.featured-post .read-more {
    color: #72dec2;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.featured-post .read-more:hover {
    color: #4cd137;
    text-shadow: 0 0 4px rgba(76, 209, 55, 0.5);
}

/* Featured Post Boxes */
.featured-post-box {
    border: 1px solid #4cd137;
    position: relative;
}

.featured-post-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #4cd137, #72dec2);
    border-radius: 12px 12px 0 0;
}

.featured-post-box h3 {
    color: #4cd137;
    margin-bottom: 0.5rem;
}

.featured-post-box h3 a {
    color: #4cd137;
    text-decoration: none;
}

.featured-post-box h3 a:hover {
    color: #72dec2;
    text-shadow: 0 0 4px rgba(114, 222, 194, 0.5);
}

.featured-post-box .post-meta {
    color: #8892b0;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.featured-post-box .read-more {
    color: #72dec2;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.featured-post-box .read-more:hover {
    color: #4cd137;
}

/* Header Controls */
.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle {
    background: transparent;
    border: 1px solid #2d3748;
    border-radius: 8px;
    padding: 0.5rem;
    color: #72dec2;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.theme-toggle:hover {
    border-color: #4cd137;
    box-shadow: 0 0 8px rgba(76, 209, 55, 0.3);
}

/* About and Contact Sections */
.about-box, .contact-box {
    margin: 2rem 0;
}

.about-content {
    line-height: 1.7;
}

.about-text p {
    margin-bottom: 1rem;
    color: #a8b2d1;
}

.about-text strong {
    color: #72dec2;
}

.contact-content {
    text-align: center;
}

.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1rem 0;
    justify-content: center;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(76, 209, 55, 0.1);
    border: 1px solid #4cd137;
    border-radius: 8px;
    color: #72dec2;
    text-decoration: none;
    transition: all 0.3s ease;
}

.contact-link:hover {
    background: rgba(76, 209, 55, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 209, 55, 0.2);
}

.contact-note {
    font-size: 0.9rem;
    color: #8892b0;
    margin-top: 1rem;
}

/* Light Theme - White & Yellow (Normal Duck) */
body.light-theme {
    background: #ffffff;
    color: #2d3748;
}

/* Fix header for light theme */
body.light-theme header {
    background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%);
    border-bottom: 2px solid #f59e0b;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

body.light-theme .logo h1 {
    color: #f59e0b;
    text-shadow: none;
}

body.light-theme .tagline {
    color: #4a5568;
}

body.light-theme .content-box {
    background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%);
    border: 1px solid #fef3c7;
    color: #2d3748;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

body.light-theme .content-box:hover {
    border-color: #f59e0b;
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.15);
}

body.light-theme .content-box p {
    color: #2d3748;
}

body.light-theme h1 {
    color: #f59e0b;
    text-shadow: none;
}

body.light-theme h2,
body.light-theme h3 {
    color: #f59e0b;
}

body.light-theme .content-box h2 {
    color: #f59e0b;
    border-bottom-color: #fef3c7;
}

body.light-theme .theme-toggle {
    border-color: #fef3c7;
    color: #f59e0b;
    background: rgba(255, 255, 255, 0.8);
}

body.light-theme .theme-toggle:hover {
    border-color: #f59e0b;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
}

body.light-theme .about-text p {
    color: #4a5568;
}

body.light-theme .about-text strong {
    color: #f59e0b;
}

body.light-theme .contact-content p {
    color: #4a5568;
}

body.light-theme .contact-note {
    color: #718096;
}

body.light-theme .sidebar {
    background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%);
    border-color: #fef3c7;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
}

body.light-theme .sidebar h3 {
    color: #f59e0b;
    border-bottom-color: #fef3c7;
}

body.light-theme .sidebar-list a {
    color: #4a5568;
}

body.light-theme .sidebar-list a:hover {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

body.light-theme .contact-link {
    background: rgba(245, 158, 11, 0.1);
    border-color: #f59e0b;
    color: #f59e0b;
}

body.light-theme .contact-link:hover {
    background: rgba(245, 158, 11, 0.2);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

body.light-theme .search-form input[type="text"] {
    background: #ffffff;
    border-color: #fef3c7;
    color: #2d3748;
}

body.light-theme .search-form input[type="text"]:focus {
    border-color: #f59e0b;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
}

body.light-theme .search-form button {
    background: #f59e0b;
    border-color: #f59e0b;
    color: #ffffff;
}

body.light-theme .search-form button:hover {
    background: #d97706;
    color: #ffffff;
}

/* Light theme refinements for featured posts */
body.light-theme .featured-posts {
    gap: 1.25rem;
}

body.light-theme .featured-post {
    background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%);
    border: 1px solid #fef3c7;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

body.light-theme .featured-post h3 a {
    color: #f59e0b;
}

body.light-theme .featured-post h3 a:hover {
    color: #d97706;
    text-shadow: none;
}

body.light-theme .featured-post .post-meta {
    color: #718096;
}

body.light-theme .featured-post p {
    color: #2d3748;
}

body.light-theme .featured-post .read-more {
    color: #f59e0b;
}

body.light-theme .featured-post .read-more:hover {
    color: #d97706;
}

body.light-theme .section-divider {
    background: linear-gradient(90deg, rgba(0,0,0,0), #f59e0b, #fbbf24, #f59e0b, rgba(0,0,0,0));
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.25);
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Fade-in animation for content boxes */
.content-box {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger animation delays */
.content-box:nth-child(1) { animation-delay: 0.1s; }
.content-box:nth-child(2) { animation-delay: 0.2s; }
.content-box:nth-child(3) { animation-delay: 0.3s; }
.content-box:nth-child(4) { animation-delay: 0.4s; }

/* Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "main"
            "sidebar"
            "footer";
    }

    .sidebar {
        order: 3;
        padding: 1rem;
    }

    .header-controls {
        flex-direction: column;
        gap: 0.5rem;
    }

    .search-form {
        width: 100%;
    }

    .contact-links {
        justify-content: center;
    }

    .content-box {
        margin: 1rem 0;
        padding: 1.5rem;
    }

    h1 {
        font-size: 2rem;
    }

    .featured-posts {
        grid-template-columns: 1fr;
    }
}

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

    .contact-links {
        flex-direction: column;
        align-items: center;
    }

    .contact-link {
        width: 100%;
        max-width: 200px;
        justify-content: center;
    }
}

header .container {
    max-width: 100%;
    margin: 0;
    padding: 0 20px;
    justify-content: space-between; /* logo on left, controls on right */
}

.profile-img {
    width: 80px;
    height: 80px;
    border-radius: 12px; /* Rounded corners */
    border: 2px solid #4cd137;
    object-fit: cover;
    margin-right: 15px; /* Space between image and text */
}

/* Mobile header layout improvements */
@media (max-width: 768px) {
  header .container {
    flex-direction: column;
    align-items: flex-start; /* Keep left alignment */
    gap: 0.75rem;
  }
  .header-controls {
    width: 100%;
    display: flex;
    justify-content: flex-end; /* Keep controls on right */
  }
  .logo .profile-img {
    width: 64px;
    height: 64px;
  }
}

/* CTF Writeup Content Display */
.ctf-writeup-content {
    background: linear-gradient(135deg, #1a1f23 0%, #0f1419 100%);
    border: 1px solid #2d3748;
    border-radius: 12px;
    padding: 2rem;
    margin-top: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.ctf-writeup-content h1,
.ctf-writeup-content h2,
.ctf-writeup-content h3,
.ctf-writeup-content h4,
.ctf-writeup-content h5,
.ctf-writeup-content h6 {
    color: #4cd137;
    font-family: 'Space Mono', monospace;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.ctf-writeup-content h1 {
    font-size: 2rem;
    border-bottom: 2px solid #2d3748;
    padding-bottom: 0.5rem;
}

.ctf-writeup-content h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid #2d3748;
    padding-bottom: 0.3rem;
}

.ctf-writeup-content p {
    color: #a8b2d1;
    line-height: 1.7;
    margin-bottom: 1rem;
}

.ctf-writeup-content strong {
    color: #72dec2;
}

.ctf-writeup-content code {
    background: rgba(76, 209, 55, 0.1);
    color: #4cd137;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
}

.ctf-writeup-content pre {
    background: #0a0c0d;
    border: 1px solid #2d3748;
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.ctf-writeup-content pre code {
    background: none;
    color: #72dec2;
    padding: 0;
}

.ctf-writeup-content ul,
.ctf-writeup-content ol {
    color: #a8b2d1;
    margin: 1rem 0;
    padding-left: 2rem;
}

.ctf-writeup-content li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.ctf-writeup-content blockquote {
    border-left: 4px solid #4cd137;
    padding-left: 1rem;
    margin: 1rem 0;
    color: #8892b0;
    font-style: italic;
}

/* Light theme variants */
body.light-theme .ctf-writeup-content {
    background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%);
    border-color: #fef3c7;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

body.light-theme .ctf-writeup-content h1,
body.light-theme .ctf-writeup-content h2,
body.light-theme .ctf-writeup-content h3,
body.light-theme .ctf-writeup-content h4,
body.light-theme .ctf-writeup-content h5,
body.light-theme .ctf-writeup-content h6 {
    color: #f59e0b;
}

body.light-theme .ctf-writeup-content h1,
body.light-theme .ctf-writeup-content h2 {
    border-bottom-color: #fef3c7;
}

body.light-theme .ctf-writeup-content p {
    color: #2d3748;
}

body.light-theme .ctf-writeup-content strong {
    color: #d97706;
}

body.light-theme .ctf-writeup-content code {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

body.light-theme .ctf-writeup-content pre {
    background: #f7fafc;
    border-color: #fef3c7;
}

body.light-theme .ctf-writeup-content pre code {
    color: #d97706;
}

body.light-theme .ctf-writeup-content ul,
body.light-theme .ctf-writeup-content ol {
    color: #4a5568;
}

body.light-theme .ctf-writeup-content blockquote {
    border-left-color: #f59e0b;
    color: #718096;
}

/* CTF Sidebar Navigation - GitBook Style */
.ctf-navigation {
    margin-top: 0.5rem;
}

.ctf-group {
    margin-bottom: 0.5rem;
}

.ctf-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
    margin-bottom: 0.2rem;
}

.ctf-group-header:hover {
    background: rgba(76, 209, 55, 0.1);
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.ctf-name {
    color: #4cd137;
    font-weight: 600;
    font-size: 0.9rem;
    font-family: 'Space Mono', monospace;
}

.ctf-toggle {
    color: #72dec2;
    font-size: 0.7rem;
    transition: transform 0.2s ease;
    opacity: 0.8;
}

.ctf-group-header:hover .ctf-toggle {
    opacity: 1;
}

.ctf-categories {
    margin-left: 0.8rem;
    border-left: 1px solid #2d3748;
    padding-left: 0.8rem;
    margin-top: 0.2rem;
}

.ctf-category {
    margin-bottom: 0.3rem;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3rem 0;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 3px;
    margin-bottom: 0.1rem;
}

.category-header:hover {
    background: rgba(114, 222, 194, 0.1);
    padding-left: 0.4rem;
    padding-right: 0.4rem;
}

.category-name {
    color: #a8b2d1;
    font-size: 0.8rem;
    font-weight: 500;
}

.category-toggle {
    color: #72dec2;
    font-size: 0.6rem;
    transition: transform 0.2s ease;
    opacity: 0.7;
}

.category-header:hover .category-toggle {
    opacity: 1;
}

.challenge-list {
    margin-left: 0.6rem;
    border-left: 1px solid #2d3748;
    padding-left: 0.6rem;
    margin-top: 0.1rem;
}

.challenge-item {
    margin-bottom: 0.1rem;
}

.challenge-link {
    color: #8892b0;
    text-decoration: none;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    display: block;
    padding: 0.2rem 0.3rem;
    border-radius: 3px;
    margin: 0.1rem 0;
}

.challenge-link:hover {
    color: #72dec2;
    background: rgba(114, 222, 194, 0.1);
    padding-left: 0.5rem;
}

/* Challenge Meta */
.challenge-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.challenge-difficulty,
.challenge-points,
.challenge-category {
    background: rgba(76, 209, 55, 0.1);
    border: 1px solid #4cd137;
    border-radius: 6px;
    padding: 0.3rem 0.8rem;
    font-size: 0.85rem;
    color: #72dec2;
    font-family: 'Space Mono', monospace;
}

/* Light theme variants for CTF navigation */
body.light-theme .ctf-group-header:hover {
    background: rgba(245, 158, 11, 0.1);
}

body.light-theme .ctf-name {
    color: #f59e0b;
}

body.light-theme .category-header:hover {
    background: rgba(245, 158, 11, 0.1);
}

body.light-theme .category-name {
    color: #4a5568;
}

body.light-theme .challenge-link {
    color: #718096;
}

body.light-theme .challenge-link:hover {
    color: #d97706;
    background: rgba(245, 158, 11, 0.1);
}

body.light-theme .challenge-difficulty,
body.light-theme .challenge-points,
body.light-theme .challenge-category {
    background: rgba(245, 158, 11, 0.1);
    border-color: #f59e0b;
    color: #d97706;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 2rem;
    color: #72dec2;
    font-family: 'Space Mono', monospace;
    font-size: 1.1rem;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #4cd137;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
    margin-left: 10px;
}

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

/* Light theme loading */
body.light-theme .loading {
    color: #d97706;
}

body.light-theme .loading::after {
    border-color: #f59e0b;
    border-top-color: transparent;
}

/* Additional light theme overrides for all green elements */
body.light-theme .profile-img {
    border-color: #f59e0b;
}

body.light-theme a {
    color: #d97706;
    border-bottom-color: #f59e0b;
}

body.light-theme a:hover {
    color: #f59e0b;
    border-bottom-color: #fbbf24;
}

body.light-theme header {
    border-bottom-color: #f59e0b;
}

body.light-theme .duck-logo {
    border-color: #f59e0b;
}

body.light-theme .post {
    border-left-color: #f59e0b;
}

body.light-theme .post-date {
    color: #d97706;
}

body.light-theme .post-tag {
    background-color: #d97706;
}

body.light-theme pre.terminal {
    border-color: #f59e0b;
}

body.light-theme pre.terminal::before {
    color: #f59e0b;
    border-bottom-color: #fbbf24;
}

body.light-theme .copy-btn {
    background-color: #f59e0b;
    color: #ffffff;
}

body.light-theme .copy-btn:hover {
    background-color: #fbbf24;
}

body.light-theme .sidebar::-webkit-scrollbar-thumb {
    background: #f59e0b;
}

body.light-theme .sidebar::-webkit-scrollbar-thumb:hover {
    background: #fbbf24;
}

body.light-theme .sidebar {
    scrollbar-color: #f59e0b #ffffff;
}

body.light-theme .burger-toggle {
    border-color: #fef3c7;
    color: #f59e0b;
}

body.light-theme .burger-toggle:hover {
    border-color: #f59e0b;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
}

.sidebar .sidebar-section h3 {
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #4cd137;
}

body.light-theme .sidebar .sidebar-section h3 {
    border-bottom-color: #f59e0b;
}

/* Additional text color overrides for light theme */
body.light-theme {
    color: #2d3748;
}

body.light-theme h1,
body.light-theme h2,
body.light-theme h3,
body.light-theme h4,
body.light-theme h5,
body.light-theme h6 {
    color: #f59e0b;
}

body.light-theme .tagline {
    color: #4a5568;
}

body.light-theme .ctf-toggle,
body.light-theme .category-toggle {
    color: #d97706;
}

body.light-theme .challenge-link:hover {
    color: #d97706;
}

body.light-theme .ctf-writeup-content code {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

body.light-theme .ctf-writeup-content strong {
    color: #d97706;
}

/* Section dividers */
.section-divider {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, rgba(76, 209, 55, 0), #4cd137, #72dec2, #4cd137, rgba(76, 209, 55, 0));
    box-shadow: 0 0 10px rgba(76, 209, 55, 0.6), 0 0 20px rgba(76, 209, 55, 0.3);
    margin: 2rem 0;
}

body.light-theme .section-divider {
    background: linear-gradient(90deg, rgba(0,0,0,0), #38a169, #4ade80, #38a169, rgba(0,0,0,0));
    box-shadow: 0 0 6px rgba(56, 161, 105, 0.25);
}

@media (max-width: 768px) {
  /* Layout stacks: header, main, sidebar, footer */
  body {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "main"
      "sidebar"
      "footer";
  }

  main {
    padding: 1rem;
  }

  .sidebar {
    order: 3;
    padding: 1rem;
    max-height: none;
  }

  .sidebar-section {
    margin-bottom: 1.25rem;
  }

  .sidebar .sidebar-section h3 {
    font-size: 1.1rem;
    padding-bottom: 0.4rem;
  }

  .sidebar-list li {
    margin-bottom: 0.4rem;
  }

  /* CTF nav: make targets easier to tap */
  .ctf-group-header,
  .category-header {
    padding: 0.5rem 0.6rem;
  }

  .ctf-name,
  .category-name {
    font-size: 0.95rem;
  }

  .challenge-link {
    display: block;
    padding: 0.35rem 0.5rem;
    font-size: 0.95rem;
  }

  h1 { font-size: 1.9rem; }
  h2 { font-size: 1.1rem; }
  h3 { font-size: 1.2rem; }

  /* Buttons and form controls */
  .pdf-btn {
    width: 100%;
    text-align: center;
  }

  /* Featured posts grid collapse handled earlier; ensure images scale */
  img { max-width: 100%; height: auto; }
}

@media (max-width: 768px) {
	/* Mobile header: single horizontal row */
	header .container { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 0.5rem; }
	.logo { display: flex; flex-direction: row; align-items: center; gap: 0.5rem; }
	.logo .tagline { display: none; }
	.search-form { display: none; }
	.header-controls { display: flex; flex-direction: row; align-items: center; gap: 0.5rem; margin-left: auto; }
	.theme-toggle { order: 1; }
	.burger-toggle { order: 2; }
	.profile-img { width: 48px; height: 48px; }
}

.burger-toggle { background: transparent; border: 1px solid #2d3748; border-radius: 8px; color: #72dec2; padding: 0.4rem; display: inline-flex; align-items: center; justify-content: center; }
.burger-toggle:hover { border-color: #4cd137; box-shadow: 0 0 8px rgba(76, 209, 55, 0.3); }
@media (max-width: 768px) { .burger-toggle { padding: 0.4rem; } }

/* Global overlay for off-canvas sidebar */
.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(1px); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.2s ease; z-index: 1000; }
.sidebar-overlay.overlay-visible { opacity: 1; visibility: visible; pointer-events: auto; }

/*** Mobile sidebar off-canvas (final override) ***/
@media (max-width: 768px) {
	.sidebar {
		position: fixed;
		top: 0;
		left: 0;
		height: 100vh;
		width: 80%;
		max-width: 300px;
		transform: translateX(-100%);
		transition: transform 0.25s ease;
		z-index: 1001;
	}
	.sidebar.sidebar-open { transform: translateX(0); }
}

/* Burger hidden on desktop */
.burger-toggle { display: none; }
@media (max-width: 768px) { .burger-toggle { display: inline-flex; } }

/* Mobile sidebar from right */
@media (max-width: 768px) {
	.sidebar { left: auto; right: 0; transform: translateX(100%); }
	.sidebar.sidebar-open { transform: translateX(0); }
}
