/* Material 3 Design System CSS */

/* Fallback fonts for better FOUT handling */
:root {
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Shader Background */
#shader-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    opacity: 0.8;
    transition: opacity var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-standard);
}

/* Shader disabled state */
body[data-shader="disabled"] #shader-background {
    opacity: 0 !important;
}

/* Adjust surface transparency for better layering */
body {
    background-color: transparent;
}

/* Color Tokens - Light Theme */
:root {
    /* Primary Colors */
    --md-sys-color-primary: #6750A4;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-primary-container: #EADDFF;
    --md-sys-color-on-primary-container: #21005D;
    
    /* Secondary Colors */
    --md-sys-color-secondary: #625B71;
    --md-sys-color-on-secondary: #FFFFFF;
    --md-sys-color-secondary-container: #E8DEF8;
    --md-sys-color-on-secondary-container: #1D192B;
    
    /* Tertiary Colors */
    --md-sys-color-tertiary: #7D5260;
    --md-sys-color-on-tertiary: #FFFFFF;
    --md-sys-color-tertiary-container: #FFD8E4;
    --md-sys-color-on-tertiary-container: #31111D;
      /* Surface Colors */
    --md-sys-color-surface: #FFFFFF;
    --md-sys-color-on-surface: #1C1B1F;
    --md-sys-color-surface-variant: #F4EFF4;
    --md-sys-color-on-surface-variant: #46464F;
    --md-sys-color-surface-container: #F7F2FA;
    --md-sys-color-surface-container-high: #F1ECF4;
    --md-sys-color-surface-container-highest: #ECE6F0;
    
    /* Surface Colors RGB values for backdrop filter */
    --md-sys-color-surface-container-rgb: 247, 242, 250;
    --md-sys-color-surface-container-high-rgb: 241, 236, 244;
      /* Outline Colors */
    --md-sys-color-outline: #79747E;
    --md-sys-color-outline-variant: #CAC4D0;    /* Typography Scale */
    --md-sys-typescale-display-large-font: var(--font-family);
    --md-sys-typescale-display-large-weight: 700;
    --md-sys-typescale-display-large-size: 57px;
    --md-sys-typescale-display-large-line-height: 64px;
    
    --md-sys-typescale-headline-large-font: var(--font-family);
    --md-sys-typescale-headline-large-weight: 600;
    --md-sys-typescale-headline-large-size: 32px;
    --md-sys-typescale-headline-large-line-height: 40px;
    
    --md-sys-typescale-body-large-font: var(--font-family);
    --md-sys-typescale-body-large-weight: 400;
    --md-sys-typescale-body-large-size: 16px;
    --md-sys-typescale-body-large-line-height: 24px;
    
    --md-sys-typescale-body-medium-font: var(--font-family);
    --md-sys-typescale-body-medium-weight: 400;
    --md-sys-typescale-body-medium-size: 14px;
    --md-sys-typescale-body-medium-line-height: 20px;
    
    /* Elevation */
    --md-sys-elevation-level1: 0px 1px 2px 0px rgba(0, 0, 0, 0.3), 0px 1px 3px 1px rgba(0, 0, 0, 0.15);
    --md-sys-elevation-level2: 0px 1px 2px 0px rgba(0, 0, 0, 0.3), 0px 2px 6px 2px rgba(0, 0, 0, 0.15);
    --md-sys-elevation-level3: 0px 1px 3px 0px rgba(0, 0, 0, 0.3), 0px 4px 8px 3px rgba(0, 0, 0, 0.15);
    
    /* Motion */
    --md-sys-motion-easing-standard: cubic-bezier(0.2, 0.0, 0, 1.0);
    --md-sys-motion-duration-short1: 50ms;
    --md-sys-motion-duration-short2: 100ms;
    --md-sys-motion-duration-medium1: 250ms;
    --md-sys-motion-duration-medium2: 300ms;
}

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

body {
    font-family: var(--md-sys-typescale-body-large-font), sans-serif;
    font-size: var(--md-sys-typescale-body-large-size);
    line-height: var(--md-sys-typescale-body-large-line-height);
    color: var(--md-sys-color-on-surface);
    background-color: var(--md-sys-color-surface);
    transition: all var(--md-sys-motion-duration-medium1) var(--md-sys-motion-easing-standard);
}

/* Enhanced surface containers for better contrast over shader background */
.surface-container {
    background-color: rgba(var(--md-sys-color-surface-container-rgb), 0.95);
    color: var(--md-sys-color-on-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.surface-variant {
    background-color: rgba(var(--md-sys-color-surface-container-high-rgb), 0.98);
    color: var(--md-sys-color-on-surface);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* Typography Classes */
.display-large {
    font-family: var(--md-sys-typescale-display-large-font);
    font-weight: var(--md-sys-typescale-display-large-weight);
    font-size: var(--md-sys-typescale-display-large-size);
    line-height: var(--md-sys-typescale-display-large-line-height);
    color: var(--md-sys-color-on-surface);
}

.headline-large {
    font-family: var(--md-sys-typescale-headline-large-font);
    font-weight: var(--md-sys-typescale-headline-large-weight);
    font-size: var(--md-sys-typescale-headline-large-size);
    line-height: var(--md-sys-typescale-headline-large-line-height);
    color: var(--md-sys-color-on-surface);
    margin-bottom: 16px;
}

.body-large {
    font-family: var(--md-sys-typescale-body-large-font);
    font-weight: var(--md-sys-typescale-body-large-weight);
    font-size: var(--md-sys-typescale-body-large-size);
    line-height: 1.7;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 20px;
}

/* Description text styling for wider horizontal layout */
header .body-large {
    max-width: 600px;
    margin: 0.25rem 0 0.5rem 0;
    opacity: 0.8;
}

.body-medium {
    font-family: var(--md-sys-typescale-body-medium-font);
    font-weight: var(--md-sys-typescale-body-medium-weight);
    font-size: var(--md-sys-typescale-body-medium-size);
    line-height: var(--md-sys-typescale-body-medium-line-height);
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 16px;
}

/* Surface Classes */
.surface-container {
    background-color: rgba(var(--md-sys-color-surface-container-rgb), 0.95);
    color: var(--md-sys-color-on-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.surface-variant {
    background-color: rgba(var(--md-sys-color-surface-container-high-rgb), 0.98);
    color: var(--md-sys-color-on-surface);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Header */
header {
    padding: 0px 0;
    margin-bottom: 48px;
    box-shadow: var(--md-sys-elevation-level2);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    gap: 24px;
}

/* Header text section (title and description) */
.header-text {
    flex: 1;
    min-width: 0; /* Allows flex item to shrink below content size */
}

header .display-large {
    text-align: left;
    margin-bottom: 0;
    color: var(--md-sys-color-on-surface);
}

/* Navigation */
.navigation-bar {
    display: flex;
    align-items: center;
    gap: 16px;
}

.navigation-bar ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 0;
    padding-right: 20px;
}

.navigation-bar .nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 100px;
    text-decoration: none;
    color: var(--md-sys-color-on-surface-variant);
    background-color: transparent;
    transition: all var(--md-sys-motion-duration-medium1) var(--md-sys-motion-easing-standard);
    font-weight: 500;
}

.navigation-bar .nav-link:hover {
    background-color: var(--md-sys-color-surface-container-highest);
    color: var(--md-sys-color-on-surface);
    transform: translateY(-2px);
}

.navigation-bar .material-symbols-outlined {
    font-size: 20px;
}

/* GitHub Icon Theme Switching */
.github-icon {
    width: 20px;
    height: 20px;
    transition: opacity var(--md-sys-motion-duration-medium1) var(--md-sys-motion-easing-standard);
}

/* Light theme - use dark icon */
body[data-theme="light"] .github-icon {
    content: url('github-mark.png');
}

/* Dark theme - use white icon */
body[data-theme="dark"] .github-icon {
    content: url('github-mark-white.png');
}

/* System theme support */
@media (prefers-color-scheme: light) {
    :root .github-icon {
        content: url('github-mark.png');
    }
}

@media (prefers-color-scheme: dark) {
    :root .github-icon {
        content: url('github-mark-white.png');
    }
}

/* Override system preference when manual theme is set */
body[data-theme="light"] .github-icon {
    content: url('github-mark.png') !important;
}

body[data-theme="dark"] .github-icon {
    content: url('github-mark-white.png') !important;
}

/* Shader Icon Theme Switching */
/* Light theme - use regular icon */
body[data-theme="light"] .shader-icon {
    content: url('turn_on_shader.svg');
}

/* Dark theme - use dark icon */
body[data-theme="dark"] .shader-icon {
    content: url('turn_on_shader_dark.svg');
}

/* System theme support */
@media (prefers-color-scheme: light) {
    :root .shader-icon {
        content: url('turn_on_shader.svg');
    }
}

@media (prefers-color-scheme: dark) {
    :root .shader-icon {
        content: url('turn_on_shader_dark.svg');
    }
}

/* Override system preference when manual theme is set */
body[data-theme="light"] .shader-icon {
    content: url('turn_on_shader.svg') !important;
}

body[data-theme="dark"] .shader-icon {
    content: url('turn_on_shader_dark.svg') !important;
}

/* Blog pages - adjust paths for subdirectory */
body[data-theme="light"] .blog-page .shader-icon {
    content: url('../turn_on_shader.svg') !important;
}

body[data-theme="dark"] .blog-page .shader-icon {
    content: url('../turn_on_shader_dark.svg') !important;
}

/* Blog Posts */
.blog-post {
    margin-bottom: 48px;
    padding: 48px;
    border-radius: 16px;
    box-shadow: var(--md-sys-elevation-level1);
    transition: all var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-standard);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.blog-post:hover {
    box-shadow: var(--md-sys-elevation-level3);
    transform: translateY(-4px);
}

.blog-post .headline-large {
    color: var(--md-sys-color-on-surface);
    margin-bottom: 24px;
    line-height: 1.2;
}

/* Post Preview Cards */
.post-preview .headline-large {
    margin-bottom: 20px;
}

.post-title-link {
    color: var(--md-sys-color-on-surface);
    text-decoration: none;
    transition: color var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
}

.post-title-link:hover {
    color: var(--md-sys-color-primary);
}

/* Post Content Spacing */
.post-content {
    margin-top: 32px;
}

.post-content h1 {
    margin-top: 48px;
    margin-bottom: 24px;
    line-height: 1.2;
}

.post-content h1:first-child {
    margin-top: 0;
}

.post-content h2 {
    margin-top: 40px;
    margin-bottom: 20px;
    line-height: 1.3;
}

.post-content h3 {
    margin-top: 32px;
    margin-bottom: 16px;
    line-height: 1.4;
}

.post-content p {
    margin-bottom: 20px;
    line-height: 1.6;
}

.post-content ul, 
.post-content ol {
    margin-bottom: 24px;
    padding-left: 24px;
}

.post-content li {
    margin-bottom: 8px;
    line-height: 1.6;
}

/* Image Styling */
.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: var(--md-sys-elevation-level2);
    transition: all var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-standard);
    margin: 24px 0;
    display: block;
}

.post-content img:hover {
    box-shadow: var(--md-sys-elevation-level3);
    transform: translateY(-2px);
}

.post-content pre {
    margin: 32px 0;
    padding: 24px;
    background-color: var(--md-sys-color-surface-container-highest);
    border-radius: 12px;
    overflow-x: auto;
}

.post-content code {
    padding: 4px 8px;
    background-color: var(--md-sys-color-surface-container-high);
    border-radius: 6px;
    font-size: 0.9em;
}

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

.post-content blockquote {
    margin: 32px 0;
    padding: 16px 24px;
    border-left: 4px solid var(--md-sys-color-primary);
    background-color: var(--md-sys-color-surface-container);
    border-radius: 0 8px 8px 0;
}

.post-actions {
    margin-top: 48px;
    display: flex;
    justify-content: flex-start;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-body-medium-size);
    margin-bottom: 32px;
    font-weight: 500;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.post-meta .material-symbols-outlined {
    font-size: 18px;
}

/* Primary Button */
.primary-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    text-decoration: none;
    border-radius: 100px;
    font-weight: 500;
    transition: all var(--md-sys-motion-duration-medium1) var(--md-sys-motion-easing-standard);
    box-shadow: var(--md-sys-elevation-level1);
    margin-top: 16px;
}

.primary-button:hover {
    background-color: color-mix(in srgb, var(--md-sys-color-primary) 85%, black);
    box-shadow: var(--md-sys-elevation-level2);
    transform: translateY(-2px);
}

.primary-button .material-symbols-outlined {
    font-size: 18px;
}

/* Controls Container */
.controls-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 40px;
}

/* Theme Toggle Switch */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--md-sys-color-on-surface-variant);
}

/* Shader Toggle Switch */
.shader-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--md-sys-color-on-surface-variant);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 32px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--md-sys-color-surface-variant);
    border: 2px solid var(--md-sys-color-outline);
    transition: all var(--md-sys-motion-duration-medium1) var(--md-sys-motion-easing-standard);
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: var(--md-sys-color-outline);
    transition: all var(--md-sys-motion-duration-medium1) var(--md-sys-motion-easing-standard);
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--md-sys-color-primary);
    border-color: var(--md-sys-color-primary);
}

input:checked + .toggle-slider:before {
    transform: translateX(20px);
    background-color: var(--md-sys-color-on-primary);
}

.toggle-switch:hover .toggle-slider {
    box-shadow: var(--md-sys-elevation-level1);
}

/* Shader icon on left of toggle */
.shader-icon {
    opacity: 0.6;
    transition: opacity var(--md-sys-motion-duration-medium1) var(--md-sys-motion-easing-standard);
    cursor: pointer;
}

.shader-icon:hover {
    opacity: 0.8;
}

input:checked ~ .shader-icon,
.shader-toggle:has(input:checked) .shader-icon {
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    .display-large {
        font-size: 36px;
        line-height: 44px;
    }
    
    .headline-large {
        font-size: 28px;
        line-height: 36px;
    }
      .blog-post {
        padding: 32px 24px;
        margin-bottom: 32px;
    }
    
    .post-content h1 {
        margin-top: 32px;
        margin-bottom: 20px;
    }
    
    .post-content h2 {
        margin-top: 28px;
        margin-bottom: 16px;
    }
    
    .post-content h3 {
        margin-top: 24px;
        margin-bottom: 12px;
    }
      .post-content p {
        margin-bottom: 16px;
    }
    
    .post-content img {
        margin: 16px 0;
        border-radius: 8px;
    }
    
    .post-content ul,
    .post-content ol {
        margin-bottom: 20px;
        padding-left: 20px;
    }
    
    .post-content pre {
        margin: 24px 0;
        padding: 16px;
    }
    
    .post-actions {
        margin-top: 32px;
    }
    
    .navigation-bar {
        flex-direction: column;
        gap: 16px;
        width: 100%;
        align-items: center;
    }
    
    .navigation-bar ul {
        flex-direction: row;
        align-items: center;
        width: 100%;
    }
      .navigation-bar .nav-link {
        width: 100%;
        max-width: 200px;
        justify-content: center;
    }
    
    .header-content {
        flex-direction: column;
        gap: 16px;
        align-items: center;
        margin-bottom: 0;
    }
    
    .header-text {
        text-align: center;
    }
    
    .header-content .display-large {
        text-align: center;
    }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    :root {
        --md-sys-color-primary: #D0BCFF;
        --md-sys-color-on-primary: #381E72;
        --md-sys-color-primary-container: #4F378B;
        --md-sys-color-on-primary-container: #EADDFF;
        
        --md-sys-color-secondary: #CCC2DC;
        --md-sys-color-on-secondary: #332D41;
        --md-sys-color-secondary-container: #4A4458;
        --md-sys-color-on-secondary-container: #E8DEF8;
        
        --md-sys-color-surface: #141218;
        --md-sys-color-on-surface: #E6E0E9;
        --md-sys-color-surface-variant: #49454F;
        --md-sys-color-on-surface-variant: #CAC4D0;
        --md-sys-color-surface-container: #211F26;
        --md-sys-color-surface-container-high: #2B2930;
        --md-sys-color-surface-container-highest: #36343B;
        
        /* Dark theme RGB values for backdrop filter */
        --md-sys-color-surface-container-rgb: 33, 31, 38;
        --md-sys-color-surface-container-high-rgb: 43, 41, 48;
        
        --md-sys-color-outline: #938F99;
        --md-sys-color-outline-variant: #49454F;
    }
}

/* Manual Theme Overrides - These take priority over system preferences */
body[data-theme="light"] {
    --md-sys-color-primary: #6750A4;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-primary-container: #EADDFF;
    --md-sys-color-on-primary-container: #21005D;
    
    --md-sys-color-secondary: #625B71;
    --md-sys-color-on-secondary: #FFFFFF;
    --md-sys-color-secondary-container: #E8DEF8;
    --md-sys-color-on-secondary-container: #1D192B;
    
    --md-sys-color-surface: #FFFFFF;
    --md-sys-color-on-surface: #1C1B1F;
    --md-sys-color-surface-variant: #F4EFF4;
    --md-sys-color-on-surface-variant: #46464F;
    --md-sys-color-surface-container: #F7F2FA;
    --md-sys-color-surface-container-high: #F1ECF4;
    --md-sys-color-surface-container-highest: #ECE6F0;
    
    --md-sys-color-surface-container-rgb: 247, 242, 250;
    --md-sys-color-surface-container-high-rgb: 241, 236, 244;
    
    --md-sys-color-outline: #79747E;
    --md-sys-color-outline-variant: #CAC4D0;
}

body[data-theme="dark"] {
    --md-sys-color-primary: #D0BCFF;
    --md-sys-color-on-primary: #381E72;
    --md-sys-color-primary-container: #4F378B;
    --md-sys-color-on-primary-container: #EADDFF;
    
    --md-sys-color-secondary: #CCC2DC;
    --md-sys-color-on-secondary: #332D41;
    --md-sys-color-secondary-container: #4A4458;
    --md-sys-color-on-secondary-container: #E8DEF8;
    
    --md-sys-color-surface: #141218;
    --md-sys-color-on-surface: #E6E0E9;
    --md-sys-color-surface-variant: #49454F;
    --md-sys-color-on-surface-variant: #CAC4D0;
    --md-sys-color-surface-container: #211F26;
    --md-sys-color-surface-container-high: #2B2930;
    --md-sys-color-surface-container-highest: #36343B;
    
    --md-sys-color-outline: #938F99;
    --md-sys-color-outline-variant: #49454F;
}

/* Responsive Design for Controls */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 16px;
        align-items: center;
        margin-bottom: 0;
    }
    
    .header-content .display-large {
        text-align: center;
    }
    
    .navigation-bar {
        flex-direction: column;
        gap: 16px;
        width: 100%;
        align-items: center;
    }
    
    .controls-container {
        flex-direction: row;
        gap: 16px;
    }
    
    .navigation-bar ul {
        flex-direction: row;
        align-items: center;
        width: 100%;
        padding-right: 20px
    }
    
    .navigation-bar .nav-link {
        width: 100%;
        max-width: 200px;
        justify-content: center;
    }
}

/* Footer Styles */
footer {
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

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

.footer-content p {
    margin: 0;
    color: var(--md-sys-color-on-surface-variant);
}

.footer-link {
    color: var(--md-sys-color-primary);
    text-decoration: none;
    transition: color var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
}

.footer-link:hover {
    color: var(--md-sys-color-secondary);
    text-decoration: underline;
}

/* Content Links */
.post-content a {
    color: var(--md-sys-color-primary);
    text-decoration: underline;
    text-decoration-color: var(--md-sys-color-primary);
    text-underline-offset: 2px;
    transition: all var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
}

.post-content a:hover {
    color: var(--md-sys-color-secondary);
    text-decoration-color: var(--md-sys-color-secondary);
}

/* Dark mode link colors with better contrast */
body[data-theme="dark"] .post-content a {
    color: #A0D0FF; /* Light blue with good contrast on dark background */
    text-decoration-color: #A0D0FF;
}

body[data-theme="dark"] .post-content a:hover {
    color: #70B0FF; /* Slightly different shade for hover */
    text-decoration-color: #70B0FF;
}
