/* CSS Variables for theming */
:root {
    --color-bg: #F8F9FA;
    --color-fg: #FFFFFF;
    --color-text: #212529;
    --color-text-muted: #6C757D;
    --color-primary: #6F42C1;
    --color-accent: #FFC107;
    --color-border: #E9ECEF;
    --color-shadow: rgba(0, 0, 0, 0.08);
    --color-primary-hover: #5a34a3;
}

[data-theme="dark"] {
    --color-bg: #1A1A1A;
    --color-fg: #2C2C2C;
    --color-text: #E9ECEF;
    --color-text-muted: #ADB5BD;
    --color-primary: #8A63D2;
    --color-accent: #FFC107;
    --color-border: #3a3a3a;
    --color-shadow: rgba(0, 0, 0, 0.3);
    --color-primary-hover: #9d7dd9;
}

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

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    transition: background-color 0.3s, color 0.3s;
    padding: 0;
    font-size: 16px;
    position: relative;
}

body.font-size-large {
    font-size: 18px;
}

body.font-size-xl {
    font-size: 20px;
}

/* Neural network background canvas */
#neural-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Card system */
.card {
    background-color: var(--color-fg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px var(--color-shadow);
    margin-bottom: 2rem;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.card:hover {
    box-shadow: 0 8px 24px var(--color-shadow);
    transform: translateY(-2px);
    border-color: var(--color-primary);
}

.card.no-hover:hover {
    box-shadow: 0 2px 8px var(--color-shadow);
    transform: none;
    border-color: transparent;
}

/* Card Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

/* Header */
header {
    background-color: var(--color-fg);
    border-bottom: 1px solid var(--color-border);
    padding: 0rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.50rem;
    font-size: 1.75rem;
    font-weight: 700;
    font-family: 'Oswald', sans-serif;
}

.logo-img {
    height: 50px;
    width: auto;
    border-radius: 2px;
}

.logo a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.logo a:hover {
    color: var(--color-primary-hover);
}

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

nav a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.25rem;
    transition: color 0.3s ease;
    white-space: nowrap;
}

nav a:hover {
    color: var(--color-primary-hover);
}

.header-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.admin-link {
    background: none;
    border: none;
    color: var(--color-text);
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1.25rem;
    transition: all 0.2s;
    line-height: 1;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.sensei-link:hover {
    color: var(--color-primary);
    transform: scale(1.1);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-text);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--color-text);
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1.25rem;
    transition: all 0.2s;
    line-height: 1;
}

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

/* Main Content */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: calc(100vh - 300px);
}

/* Two-column grid layout */
.main-content-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    margin-bottom: 2rem;
}

.main-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    order: 1;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    order: 2;
}

.sidebar-post {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--color-border);
}

.sidebar-post:last-child {
    border-bottom: none;
}

.sidebar-post h4 {
    margin: 0 0 0.25rem 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.sidebar-post h4 a {
    color: var(--color-primary);
    text-decoration: none;
}

.sidebar-post h4 a:hover {
    color: var(--color-accent);
}

.sidebar-post .post-meta {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Oswald', sans-serif;
    margin: 1.5rem 0 1rem;
    line-height: 1.3;
    color: var(--color-primary);
    font-weight: 700;
}

h1 {
    font-size: 2.5rem;
    margin-top: 0;
    margin-bottom: 1rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: all 0.2s ease;
}

a:hover {
    color: var(--color-accent);
}

/* Posts */
/* Title section with background */
.title-section {
    background-image: url('/static/assets/neuralpattern.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    padding: 3rem 2rem;
    margin: -2rem -2rem 2rem -2rem;
    border-radius: 12px 12px 0 0;
    position: relative;
    overflow: hidden;
}

.title-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(111, 66, 193, 0.85) 0%, 
        rgba(138, 99, 210, 0.75) 50%, 
        rgba(111, 66, 193, 0.85) 100%);
    backdrop-filter: blur(1px);
}

.title-section h1 {
    position: relative;
    z-index: 2;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin: 0;
    font-size: 2.5rem;
    font-weight: 700;
}

.title-section .post-meta {
    position: relative;
    z-index: 2;
    color: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    margin-bottom: 0;
}

.byline {
    position: relative;
    z-index: 2;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
    margin: 0.5rem 0 0 0;
    font-style: italic;
}

.post-card {
    background-color: var(--color-fg);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px var(--color-shadow);
    margin-bottom: 1.5rem;
    transition: box-shadow 0.3s ease;
}

.post-card:hover {
    box-shadow: 0 4px 12px var(--color-shadow);
}

.post-title {
    font-family: 'Oswald', sans-serif;
    font-size: 1.35rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.post-title a {
    margin-bottom: 0.75rem;
    font-style: italic;
}

.post-meta {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.post-meta .author {
    font-weight: 500;
}

.post-excerpt {
    color: var(--color-text);
    margin-bottom: 0.75rem;
    line-height: 1.6;
    font-size: 0.95rem;
}

.read-more {
    color: var(--color-accent);
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.95rem;
}

.read-more:hover {
    text-decoration: underline;
}

/* Tags */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
}

.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--color-text);
    text-decoration: none;
    transition: all 0.2s;
}

.tag:hover,
.tag-active {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background-color: rgba(111, 66, 193, 0.05);
}

/* Content */
.content {
    line-height: 1.8;
}

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

.content code {
    background-color: var(--color-border);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.content pre {
    background-color: var(--color-border);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.content pre code {
    background-color: transparent;
    padding: 0;
}

/* Video Embeds */
.video-embed {
    margin: 2rem 0;
    width: 100%;
    clear: both;
}

.video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    background-color: var(--color-border);
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Video Sizes */
.video-small {
    max-width: 400px;
}

.video-medium {
    max-width: 600px;
}

.video-large {
    max-width: 800px;
}

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

/* Video Alignment (for block mode) */
.video-left {
    margin-left: 0;
    margin-right: auto;
}

.video-center {
    margin-left: auto;
    margin-right: auto;
}

.video-right {
    margin-left: auto;
    margin-right: 0;
}

/* Video Float (text wrapping) */
.video-float {
    clear: none;
}

.video-float.video-left {
    float: left;
    margin-right: 1.5rem;
    margin-bottom: 1rem;
}

.video-float.video-right {
    float: right;
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.video-float.video-center {
    /* Center floating doesn't make sense, treat as block */
    float: none;
    clear: both;
}

/* Clear floats after content */
.content::after {
    content: "";
    display: table;
    clear: both;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .video-embed {
        max-width: 100% !important;
    }
    
    .video-float {
        float: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        clear: both;
    }
}

/* ============================================
   IMAGE EMBED STYLES
   ============================================ */

/* Base image embed container */
.image-embed {
    margin: 2rem 0;
    width: 100%;
    clear: both;
}

.image-embed img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Size variations */
.image-small {
    max-width: 400px;
}

.image-medium {
    max-width: 600px;
}

.image-large {
    max-width: 800px;
}

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

/* Alignment */
.image-left {
    margin-right: auto;
}

.image-center {
    margin-left: auto;
    margin-right: auto;
}

.image-right {
    margin-left: auto;
}

/* Float mode - allows text wrapping */
.image-float.image-left {
    float: left;
    margin-right: 2rem;
    margin-left: 0;
}

.image-float.image-right {
    float: right;
    margin-left: 2rem;
    margin-right: 0;
}

.image-float.image-center {
    /* Center floating doesn't make sense, treat as block */
    float: none;
    clear: both;
}

/* Responsive adjustments for images */
@media (max-width: 768px) {
    .image-embed {
        max-width: 100% !important;
    }
    
    .image-float {
        float: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        clear: both;
    }
}

/* Ensure the card grows to fit content and prevents overflow */
article {
  display: block;  /* Or block if flex breaks your layout */
  width: 100%;   /* Full width of container */      
  height: auto;   /* Let it expand naturally */
  overflow: hidden;  /* Clip any bleed */
}

/* Footer */
footer {
    background-color: var(--color-fg);
    border-top: 1px solid var(--color-border);
    margin-top: 4rem;
    padding: 3rem 0;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s;
    font-weight: 600;
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.footer-links a:hover {
    color: var(--color-accent);
}

.additional-links {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

.additional-links h3 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--color-text);
    font-family: 'Roboto', sans-serif;
}

.additional-links ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    background-color: var(--color-accent);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s;
    font-size: 1rem;
}

.btn:hover {
    background-color: var(--color-primary-hover);
    color: white;
}

.btn-secondary {
    background-color: transparent;
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background-color: transparent;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--color-text);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="number"],
textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background-color: var(--color-bg);
    color: var(--color-text);
    font-size: 1rem;
    font-family: inherit;
}

textarea {
    min-height: 200px;
    font-family: 'Courier New', monospace;
}

input[type="checkbox"] {
    margin-right: 0.5rem;
}

/* Recent posts section */
.recent-posts-section h3 {
    font-family: 'Oswald', sans-serif;
    color: var(--color-primary);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Welcome section */
.welcome-section {
    margin-bottom: 2rem;
}

.welcome-section h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
}

/* Back link */
.back-link {
    display: inline-block;
    margin-bottom: 2rem;
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
    }

    .logo {
        flex-grow: 1;
    }

    .header-controls {
        order: 2;
    }

    .menu-toggle {
        display: block;
    }

    nav {
        display: none;
        width: 100%;
        order: 3;
        flex-direction: column;
        padding-top: 1rem;
        gap: 1rem;
        text-align: center;
        border-top: 1px solid var(--color-border);
        margin-top: 1rem;
    }

    nav.active {
        display: flex !important;
    }

    .main-content-grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 1.5rem;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    main {
        padding: 1.5rem 1rem;
    }
}
