/* Match content width exactly to header width */
/* Header max-width: 1200px, Content max-width: 1200px */
/* Both centered with margin: auto, 24px padding left and right */

/* Prevent horizontal scrolling on mobile */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}

/* Image Protection */
img {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    pointer-events: none;
}

/* Allow pointer events on carousel navigation */
.carousel-arrow,
.carousel-dot {
    pointer-events: auto;
}

/* Invisible overlay for image protection */
.image-protection-overlay {
    background: transparent;
    pointer-events: auto;
}

body {
    position: relative;
}

/* Force header to be transparent in both light and dark mode */
header.header,
.header {
    background: transparent !important;
}

/* Prevent body scroll when mobile menu is open */
body.menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Make text colors brighter in Dark Mode for better contrast */
:root[data-theme="dark"] {
    --primary: rgb(245, 245, 245);   /* Brighter white instead of rgb(218, 218, 219) */
    --content: rgb(235, 235, 235);   /* Brighter content text instead of rgb(196, 196, 197) */
    --secondary: rgb(180, 180, 180); /* Brighter secondary text instead of rgb(155, 156, 157) */
}

/* Single gradient background that moves vertically */
body::before {
    content: '';
    position: fixed;
    left: 0;
    right: 0;
    z-index: -2;
    /* Extended gradient - Light mode shows 0%-42%, Dark mode shows 60%-100% */
    background: linear-gradient(180deg,
    #ffffff 0%,
    #f2f0f2 10%,
    #d3ced3 28%,
    #a39ea3 42%,
    #4a4b49 60%,
    #212524 80%,
    #1e1f20 95%,
    #1d1e20 100%);
    /* Gradient height needs to be: 100vh / 0.4 = 250vh */
    height: 250vh;
    width: 100%;
    /* Light mode: Show 0%-42% range, top at 0 */
    top: 0;
    transition: top 0.5s ease-in-out;
}

/* Dark mode: Show 60%-100% range
   Move up by 60% of 250vh = -150vh */
[data-theme="dark"] body::before,
html[data-theme="dark"] body::before {
    top: -150vh;
}

/* ========================================
   THEME COLOR TRANSITIONS - 0.5 SECONDS
   Synchronized with background transitions
   ======================================== */

/* Minimal transitions to prevent flicker - only background fades */
body {
    transition: background-color 0.5s ease-in-out;
}

/* Very fast color transitions to minimize flicker (0.2s instead of 0.5s) */
h1, h2, h3, h4, h5, h6,
p, a, span, li,
button, input, textarea,
.logo, .menu {
    transition: color 0.2s ease-out;
}

/* Container backgrounds use full 0.5s */
header, footer, main, article, section,
.post-entry, code, pre {
    transition: background-color 0.5s ease-in-out,
                border-color 0.5s ease-in-out;
}

/* SVG icons also get fast transitions to minimize flicker */
svg {
    transition: fill 0.2s ease-out,
                stroke 0.2s ease-out;
}

/* Completely disable all transitions on theme toggle button */
#theme-toggle,
#theme-toggle *,
#moon, #sun {
    transition: none !important;
}

/* Preserve fast transform transitions for interactive elements */
.post-entry,
article.post-entry,
.terms-tags a,
.profile .button {
    transition: transform 0.1s ease-in-out,
                color 0.5s ease-in-out,
                background-color 0.5s ease-in-out,
                border-color 0.5s ease-in-out;
}

/* Preserve hamburger menu animations */
.menu-toggle span {
    transition-property: all, color, background;
    transition-duration: 0.3s, 0.5s, 0.5s;
    transition-timing-function: linear, ease-in-out, ease-in-out;
}

/* Mobile menu transitions - will be overridden in responsive breakpoints */

/* Preserve top-link button behavior */
.top-link {
    transition-property: visibility, opacity, color, background-color;
    transition-duration: 0.5s, 0.8s, 0.5s, 0.5s;
    transition-timing-function: linear, linear, ease-in-out, ease-in-out;
}

/* Grid effect background color transitions */
.grid-effect-tile::before {
    transition: background 0.5s ease-in-out;
}

/* Table of Contents transitions */
.toc,
.toc-container,
#TableOfContents,
#TableOfContents ul,
#TableOfContents li,
#TableOfContents a,
details.toc,
details.toc summary {
    transition: color 0.2s ease-out,
                background-color 0.5s ease-in-out,
                border-color 0.5s ease-in-out;
}

/* Tags transitions */
.post-tags,
.post-tags a,
.tag,
.tags a,
.terms-tags,
.terms-tags a {
    transition: color 0.2s ease-out,
                background-color 0.5s ease-in-out,
                border-color 0.5s ease-in-out;
}

/* Post navigation (next/previous) transitions */
.paginav,
.paginav a,
.paginav .prev,
.paginav .next,
.post-nav,
.post-nav-item {
    transition: color 0.2s ease-out,
                background-color 0.5s ease-in-out,
                border-color 0.5s ease-in-out;
}

/* Background position transition is defined above on body::before */

/* Grid effect background - Visible on all devices */
body {
    position: relative;
}

.grid-effect-background {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 250vh;
    z-index: 0;
    pointer-events: none;
    /* GPU acceleration for smooth animation */
    will-change: transform;
    transform: translateZ(0);
    /* Move grid with gradient during theme transition using transform for better performance */
    transition: transform 0.5s ease-in-out;
}

/* Dark mode: Move grid down with gradient using transform for GPU acceleration
   Move by 60% of 250vh = 150vh */
[data-theme="dark"] .grid-effect-background,
html[data-theme="dark"] .grid-effect-background {
    transform: translate3d(0, -150vh, 0);
}

/* SVG grid dot styling - Light mode (dark gray) */
.grid-dot {
    fill: rgb(60, 60, 60);
    opacity: 0.3;
    transition: fill 0.5s ease-in-out, opacity 0.5s ease-in-out;
}

/* Dark mode grid dot color (light gray) */
[data-theme="dark"] .grid-dot,
html[data-theme="dark"] .grid-dot {
    fill: rgb(180, 180, 180);
    opacity: 0.3;
}

@media screen and (min-width: 1201px) {

    /* Hover animation disabled */
    /*
    .grid-effect-tile.hover::before,
    .grid-effect-tile:hover::before {
        height: 2rem;
        width: 2rem;
        opacity: 0.6;
        transition: opacity 100ms ease-in, height 100ms ease-in, width 100ms ease-in;
    }

    [data-theme="dark"] .grid-effect-tile.hover::before,
    [data-theme="dark"] .grid-effect-tile:hover::before {
        background: #0F4336;
        box-shadow:
            0 0 0 #0F4336,
            3rem 0 0 -0.3rem #0F4336,
            -3rem 0 0 -0.3rem #0F4336,
            0 -3rem 0 -0.3rem #0F4336,
            0 3rem 0 -0.3rem #0F4336,
            3rem 3rem 0 -0.45rem #0F4336,
            3rem -3rem 0 -0.45rem #0F4336,
            -3rem 3rem 0 -0.45rem #0F4336,
            -3rem -3rem 0 -0.45rem #0F4336,
            6rem 0 0 -0.6rem #0F4336,
            -6rem 0 0 -0.6rem #0F4336,
            0 -6rem 0 -0.6rem #0F4336,
            0 6rem 0 -0.6rem #0F4336,
            6rem 6rem 0 -0.9rem #0F4336,
            6rem -6rem 0 -0.9rem #0F4336,
            -6rem 6rem 0 -0.9rem #0F4336,
            -6rem -6rem 0 -0.9rem #0F4336,
            9rem 0 0 -0.9rem #0F4336,
            -9rem 0 0 -0.9rem #0F4336,
            0 -9rem 0 -0.9rem #0F4336,
            0 9rem 0 -0.9rem #0F4336;
    }
    */

    /* All content above grid effect */
    header, main, footer {
        position: relative;
        z-index: 1;
    }

    /* Header and footer transparent to show background layers */
    header {
        background: transparent;
    }

    footer {
        background: transparent;
    }

    /* Grid background matches site background */
    .grid-effect-background {
        background: transparent;
    }

    /* Main has transparent background by default */
    main {
        background: transparent;
    }

    /* Dark mode - backgrounds already transparent above */
}

/* Blog Post Hero Image - Desktop */
.post-hero-image-container {
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    margin-top: 0;
    margin-bottom: 0;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
    position: relative;
}

.post-hero-image {
    width: 100%;
    max-width: 1200px;
    max-height: 300px;
    object-fit: cover;
    display: block;
    border-radius: 8px 8px 0 0;
}

/* Hero image GIF lazy loading */
.post-hero-image-container .cover-static {
    position: relative;
    z-index: 1;
}

.post-hero-image-container .cover-gif {
    position: absolute !important;
    top: 0;
    left: 0;
    opacity: 0;
    z-index: 2;
    transition: opacity 0.5s ease-in-out;
}

.post-hero-image-container .cover-gif.loaded {
    opacity: 1;
}

/* Hero Image Overlay */
.post-hero-overlay {
    position: absolute;
    z-index: 10;  /* Ensure overlay is above both static image and GIF */
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    padding: 24px 48px;
    text-align: left;
    color: #ffffff;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.7);
    max-width: 60%;
}

/* Hero Image Overlay - Dark background card when GIF is present */
.post-hero-image-container[data-gif] .post-hero-overlay {
    background: rgba(0, 0, 0, 0.6);
    border-radius: 12px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Dark text variant for light backgrounds */
.post-hero-overlay.hero-overlay-dark {
    color: #1a1a1a;
    text-shadow: 1px 1px 4px rgba(255, 255, 255, 0.5);
}

.post-hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    line-height: 1.2;
    color: inherit;
}

.post-hero-subtitle {
    font-size: 1.1rem;
    margin: 0 0 0.75rem 0;
    opacity: 0.95;
}

.post-hero-meta {
    display: flex;
    gap: 16px;
    align-items: center;
    font-size: 0.95rem;
    opacity: 0.9;
}

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

.post-hero-date {
    opacity: 0.85;
}

/* Single pages (About, etc.) - solid background for better text readability */
.post-single {
    background: var(--entry) !important;
    padding: 2rem 24px;
    border-radius: 0 0 8px 8px;
    margin-top: 0;
}

/* Dark mode single page background */
[data-theme="dark"] .post-single {
    background: var(--entry) !important;
}

/* Header: Set to 1200px max-width with 24px padding */
header.header nav {
    max-width: 1200px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 24px !important;
    padding-right: 24px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    position: relative !important;
}

header.header {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Remove ALL padding and margin from logo/title (left side) - padding comes from nav */
.logo,
.logo a,
header.header .logo {
    padding-left: 0 !important;
    margin-left: 0 !important;
    padding-right: 0 !important;
}

/* Remove ALL padding and margin from menu (right side) - padding comes from nav */
.menu,
#menu,
header.header .menu {
    padding-right: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
}

/* Menu list items */
.menu li {
    margin-right: 0 !important;
}

.menu li:last-child {
    margin-right: 0 !important;
    padding-right: 0 !important;
}

/* Desktop menu hover effect */
.menu a:hover,
.menu a:hover span,
header .menu a:hover,
header .menu a:hover span,
#menu a:hover,
#menu a:hover span {
    color: #EE6123 !important;
}

/* Ensure transition on desktop menu */
.menu a,
.menu a span {
    transition: color 0.2s ease-out;
}

/* Content: Set to 1200px max-width with 24px padding */
.main {
    max-width: 1200px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 24px !important;
    padding-right: 24px !important;
    padding-top: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Portfolio page: Remove all margins from post content */
body.list.section-portfolio main.main .post-content,
body.list.section-portfolio main.main div.post-content,
body#top.list main .post-content {
    margin: 0 !important;
    padding: 0 !important;
}

.post-content,
.page-header,
.post-header,
.post-footer {
    max-width: 1200px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 24px !important;
    padding-right: 24px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Remove top margin from post header and set bottom margin */
.post-header {
    margin-top: 0 !important;
    margin-bottom: 32px !important;  /* Desktop: 32px */
}

article {
    max-width: 1200px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    width: 100% !important;
}

/* Portfolio grid alignment - 1152px (1200px - 24px left - 24px right) */
.portfolio-grid {
    max-width: 1152px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Post navigation (previous/next) - Desktop */
.paginav {
    margin-top: 2rem !important;
}

/* Blog post cards - fixed dimensions with image on LEFT */
.post-entry {
    max-width: 1200px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding: 1rem !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: row !important;
    gap: 1rem;
    align-items: flex-start;
    position: relative;
    height: 200px;
    width: 100%;
}

/* Post entry image (LEFT side - square, max 336px width, max 168px height) */
.post-entry-image,
.post-entry .entry-cover {
    flex-shrink: 0 !important;
    width: 336px !important;
    max-height: 168px !important;
    aspect-ratio: 1 / 1 !important;
    overflow: hidden !important;
    border-radius: 12px !important;
    order: -1 !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
}

.post-entry-image img,
.post-entry .entry-cover img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center center !important;
    border-radius: 0 !important;
}

/* GIF Lazy Loading - Static image always visible */
.post-entry-image .cover-static {
    position: relative;
    z-index: 1;
}

/* GIF overlay - positioned absolutely over static image */
.post-entry-image .cover-gif {
    position: absolute !important;
    top: 0;
    left: 0;
    opacity: 0;
    z-index: 2;
    transition: opacity 0.5s ease-in-out;
}

/* When GIF is loaded, fade it in */
.post-entry-image .cover-gif.loaded {
    opacity: 1;
}

/* Post entry content wrapper (RIGHT side) - Grid structure */
.post-entry-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-content: start;
}

/* Meta line container - use flexbox with wrapping to separate title */
.entry-meta-line {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: baseline;
}

/* Title on its own line - force line break after title */
.entry-title {
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.3;
    width: 100%;
    order: -1;
}

.entry-title a {
    color: var(--primary);
    text-decoration: none;
}

.entry-title a:hover {
    color: var(--secondary);
}

/* Other meta items on second line */
.entry-meta-line > span:not(.entry-title) {
    color: var(--secondary);
    font-size: 0.85rem;
    order: 1;
}

/* Add separator before all meta items except the first one after title */
.entry-meta-line > span:not(.entry-title) ~ span:not(.entry-title)::before {
    content: " | ";
    margin: 0 0.5rem;
    color: var(--secondary);
    opacity: 0.5;
}

/* Summary: Max 3 Zeilen */
.entry-summary {
    overflow: hidden;
    align-self: start;
}

.entry-summary p {
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.6;
    color: var(--secondary);
    font-size: 14px;
}

/* Force proper background for post entries - Light Mode */
:root:not([data-theme="dark"]) {
    --post-entry-bg: #ffffff;
}

/* Force proper background for post entries - Dark Mode */
:root[data-theme="dark"] {
    --post-entry-bg: #2e2e33;
}

/* Dark mode specific - force card backgrounds */
[data-theme="dark"] .post-entry,
[data-theme="dark"] article.post-entry {
    background: #2e2e33 !important;
    background-color: #2e2e33 !important;
}

/* Blog Activity Heatmap */
#blog-heatmap-container {
    max-width: 1200px;
    margin: 0 auto 1.5rem auto;
    padding: 0;
    background: transparent;
    position: relative;
    overflow: hidden;
}

#cal-heatmap {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Scale heatmap SVG to fill available width */
#cal-heatmap svg {
    max-width: 100%;
    height: auto;
}

/* Heatmap reveal animation - left to right mask */
@keyframes revealHeatmap {
    from {
        clip-path: inset(0 100% 0 0);
        -webkit-clip-path: inset(0 100% 0 0);
    }
    to {
        clip-path: inset(0 0 0 0);
        -webkit-clip-path: inset(0 0 0 0);
    }
}

#cal-heatmap {
    animation: revealHeatmap 1.5s cubic-bezier(.5,0,.5,1) forwards;
}

/* Heatmap styling adjustments */
#cal-heatmap .ch-domain-text {
    fill: var(--primary);
    font-size: 10px;
    font-weight: 400;
}

#cal-heatmap rect {
    rx: 2;
}

/* Hide day numbers inside cells */
#cal-heatmap .ch-subdomain-text {
    display: none !important;
}

/* Hide default stroke */
#cal-heatmap .ch-subdomain-bg {
    stroke: none;
}

/* Month labels styling */
#cal-heatmap .ch-domain-text {
    font-size: 12px;
}

/* Dark mode adjustments for heatmap */
[data-theme="dark"] #blog-heatmap-container {
    background: transparent;
}

[data-theme="dark"] #cal-heatmap .ch-domain-text {
    fill: var(--content);
}

/* Ensure cells have no text */
#cal-heatmap text:not(.ch-domain-text):not(.ch-subdomain-text) {
    display: none !important;
}

/* Show weekday labels on the left */
#cal-heatmap .ch-subdomain-text {
    display: block !important;
    fill: var(--secondary);
    font-size: 9px;
}

/* Tooltip styling - ensure it appears above heatmap cells */
.ch-tooltip {
    z-index: 9999 !important;
    pointer-events: none;
}

/* Popper tooltip container */
[data-popper-placement] {
    z-index: 9999 !important;
}

/* Maximum specificity for post entries */
body main article.post-entry {
    background-color: var(--post-entry-bg) !important;
}

body .post-entry {
    background-color: var(--post-entry-bg) !important;
}

article.post-entry {
    background-color: var(--post-entry-bg) !important;
}

.post-entry {
    background-color: var(--post-entry-bg) !important;
}

/* Post entry header (title area) */
.post-entry .entry-header {
    padding: 0 !important;
    margin: 0 0 0.5rem 0 !important;
    background: transparent !important;
}

/* Post entry header h2 */
.post-entry .entry-header h2 {
    background: transparent !important;
}

/* Post entry content (description) */
.post-entry .entry-content {
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
}

/* Post entry footer (meta info) */
.post-entry .entry-footer {
    padding: 0 !important;
    margin: 0.5rem 0 0 0 !important;
    background: transparent !important;
}

/* Hero Carousel Container */
.hero-carousel-container {
    position: relative;
    margin-bottom: 24px;
}

.hero-carousel {
    position: relative;
    width: 100%;
    max-width: 1176px;
    margin: 0 auto;
    aspect-ratio: 1176 / 600;
    overflow: hidden;
}

.hero-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: transform 0.5s ease-in-out, opacity 0.5s ease-in-out;
    pointer-events: none;
}

.hero-slide.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
    z-index: 2;
}

/* Slide positioned to the left (for entering from left or exiting to left) */
.hero-slide.prev {
    transform: translateX(-100%);
    opacity: 0;
    z-index: 1;
}

/* Slide positioned to the right (for entering from right or exiting to right) */
.hero-slide.next {
    transform: translateX(100%);
    opacity: 0;
    z-index: 1;
}

/* Carousel Navigation Arrows */
.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: background 0.3s ease;
}

.carousel-arrow:hover {
    background: rgba(0, 0, 0, 0.7);
}

.carousel-arrow-prev {
    left: 20px;
}

.carousel-arrow-next {
    right: 20px;
}

/* Carousel Dots */
.carousel-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    gap: 12px;
}

.carousel-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
    padding: 0;
}

.carousel-dot:hover {
    background: rgba(255, 255, 255, 0.7);
    transform: scale(1.2);
}

.carousel-dot.active {
    background: rgba(255, 255, 255, 1);
}

/* Homepage hero banner with text overlay */
.home-hero-section {
    position: relative;
    width: 100%;
    height: 100%;
    margin-bottom: 0;
}

/* Full width hero slide (for second carousel slide) */
.hero-slide-fullwidth {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    overflow: hidden;
}

.hero-fullwidth-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
}

/* Slide 3 custom layout: Full width background with profile overlay */
.slide-3-custom {
    position: relative;
    width: 100%;
    height: 100%;
}

.slide-3-images-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    overflow: hidden;
}

.slide-3-bg-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center 0%; /* Light mode: Show top edge (maximum sky/clouds) */
    border-radius: 8px;
    transition: object-position 0.5s ease-in-out;
}

/* Dark mode: Show bottom edge of image */
[data-theme="dark"] .slide-3-bg-image,
html[data-theme="dark"] .slide-3-bg-image {
    object-position: center 100%;
}

.slide-3-profile-image {
    position: absolute;
    bottom: 0;
    right: 0;
    max-width: 100%;
    max-height: 100%;
    height: auto;
    width: auto;
    object-fit: contain;
    object-position: bottom right;
    z-index: 20;
}

.home-hero-images-wrapper {
    position: relative;
    display: grid;
    grid-template-columns: 700fr 452fr;
    gap: 24px;
    width: 100%;
    height: 100%;
}

.home-hero-image {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 8px;
    object-fit: cover;
    object-position: center;
    margin: 0;
    grid-column: 1;
}

.home-hero-image-right {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 8px;
    object-fit: cover;
    object-position: center;
    margin: 0;
    grid-column: 2;
}

/* Hide mobile image on desktop/tablet */
.home-hero-image-right-mobile {
    display: none;
}

/* Text overlay on hero images - max 750px width */
.home-hero-overlay {
    position: absolute;
    top: 50%;
    left: 24px;
    transform: translateY(-50%);
    z-index: 10;
    text-align: left;
    max-width: 750px;
    background: rgba(0, 0, 0, 0.6);
    padding: 1.5rem 2rem;
    border-radius: 8px;
    backdrop-filter: blur(8px);
}

.hero-title {
    font-size: 2.5rem;
    font-weight: bold;
    margin: 0 0 1rem 0;
    color: #ffffff;
    line-height: 1.2;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.hero-subtitle {
    font-size: 1.1rem;
    color: #ffffff;
    line-height: 1.6;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
}

.hero-subtitle p {
    margin: 0;
    white-space: pre-line;
}

/* Hero CTA Button */
.hero-cta-button {
    margin-top: 1.5rem;
    padding: 0.8rem 2rem;
    background-color: #EE6123;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

/* Header Social Icons */
.header-social-icons {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: auto;
    margin-right: 20px;
}

.header-social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    transition: color 0.2s ease-out, transform 0.2s ease-out;
    line-height: 0;
}

.header-social-icon:hover {
    color: #EE6123 !important;
    transform: translateY(-2px);
}

.header-social-icon svg {
    width: 20px;
    height: 20px;
    vertical-align: middle;
}

.header-social-icon svg path,
.header-social-icon svg circle,
.header-social-icon svg rect,
.header-social-icon svg line,
.header-social-icon svg polyline,
.header-social-icon svg polygon {
    transition: stroke 0.2s ease-out;
}

.header-social-icon:hover svg path,
.header-social-icon:hover svg circle,
.header-social-icon:hover svg rect,
.header-social-icon:hover svg line,
.header-social-icon:hover svg polyline,
.header-social-icon:hover svg polygon {
    stroke: #EE6123 !important;
}

/* Hamburger Menu Styles */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1000;
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
}

.menu-toggle span {
    width: 30px;
    height: 3px;
    background: var(--primary);
    border-radius: 3px;
    transition: all 0.3s linear;
    position: relative;
    transform-origin: 1px;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(20px);
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg);
}

/* Responsive: Tablet view */
@media screen and (max-width: 1200px) {
    /* Post header bottom margin - Tablet: 24px */
    .post-header {
        margin-bottom: 24px !important;
    }

    /* Carousel full-width on tablet (but max 1200px) */
    .hero-carousel-container {
        width: 100vw;
        max-width: 1200px;
        margin-left: -24px;
        margin-right: -24px;
    }

    /* Remove rounded corners on carousel images for tablet */
    .hero-carousel,
    .home-hero-section,
    .home-hero-image,
    .home-hero-image-right,
    .hero-slide-fullwidth,
    .hero-fullwidth-image,
    .slide-3-images-wrapper,
    .slide-3-bg-image,
    .slide-3-profile-image {
        border-radius: 0 !important;
    }

    .home-hero-overlay {
        left: 24px;
        max-width: 70%;
        top: 50%;
        transform: translateY(-50%);
    }

    .hero-title {
        font-size: 1.8rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    /* Make header sticky on tablet */
    header.header {
        position: sticky !important;
        top: 0 !important;
        z-index: 100 !important;
        background: transparent !important;
    }

    /* Show hamburger menu and social icons on tablet */
    .menu-toggle {
        display: flex !important;
    }

    .header-social-icons {
        position: absolute;
        right: 70px;
        top: 50%;
        transform: translateY(-50%);
        gap: 16px;
        margin-right: 0;
    }

    #menu {
        position: fixed;
        top: var(--header-height, 60px);
        right: -100%;
        bottom: 0;
        flex-direction: column;
        background-color: var(--entry);
        width: 70%;
        max-width: 400px;
        margin: 0;
        text-align: right;
        transition: right 0.3s ease-in-out,
                    opacity 0.3s ease-in-out,
                    visibility 0.3s ease-in-out,
                    color 0.5s ease-in-out,
                    background-color 0.5s ease-in-out,
                    border-color 0.5s ease-in-out;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
        padding: 2rem 0;
        z-index: 99;
        opacity: 0;
        visibility: hidden;
        overflow-y: auto;
    }

    #menu.active {
        right: 0;
        opacity: 1;
        visibility: visible;
    }

    #menu li {
        margin: 0.5rem 0 !important;
        padding: 0 !important;
        list-style: none;
        text-align: right;
    }

    #menu li a {
        display: block;
        padding: 0.5rem 2rem;
        text-align: right;
        font-size: 1.5rem;
        font-weight: 600;
        line-height: 1.3;
        transition: color 0.2s ease-out;
    }

    #menu li a:hover,
    #menu li a:hover span {
        color: #EE6123 !important;
    }

    #menu li a span {
        display: inline-block;
        text-align: right;
        font-size: 1.5rem;
        font-weight: 600;
    }

    #menu li:first-child {
        margin-left: 0 !important;
        padding-left: 0 !important;
    }

    #menu li a span {
        padding-bottom: 0px;
        line-height: 1.3;
    }

    #menu li a span.active {
        border-bottom-width: 2px;
    }

    /* Blog post hero image on tablet */
    .post-hero-image-container {
        width: 100vw;
        max-width: 1200px;
        margin-left: -24px;
        margin-right: -24px;
        margin-bottom: 0;
        border-radius: 8px 8px 0 0 !important;
        overflow: hidden;
    }

    .post-hero-image {
        width: 100%;
        max-height: 30vh;
        border-radius: 8px 8px 0 0 !important;
    }

    /* Blog post content area 100% width on tablet */
    .post-single {
        width: 100vw !important;
        max-width: 100vw !important;
        margin-left: -24px !important;
        margin-right: -24px !important;
        margin-top: 0 !important;
        padding: 1.5rem 24px !important;
        border-radius: 0 !important;
    }

    /* Hero overlay on tablet */
    .post-hero-overlay {
        padding: 16px 24px;
        max-width: 70%;
    }

    /* Hero overlay - Dark background card when GIF is present (tablet) */
    .post-hero-image-container[data-gif] .post-hero-overlay {
        background: rgba(0, 0, 0, 0.6);
        border-radius: 12px;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }

    .post-hero-title {
        font-size: 1.8rem;
    }

    .post-hero-subtitle {
        font-size: 1rem;
    }

    .post-hero-meta {
        font-size: 0.85rem;
        gap: 12px;
    }

    /* Blog Activity Heatmap - prevent month labels from being cut off on tablet */
    #blog-heatmap-container {
        min-height: 40px;
        margin-bottom: 0.875rem;
    }

    #cal-heatmap {
        min-height: 40px;
        overflow-y: visible !important;
    }

    #cal-heatmap svg {
        min-height: 40px;
    }

    /* Post navigation (previous/next) - Tablet: no side margins */
    .paginav {
        margin-left: -24px !important;
        margin-right: -24px !important;
        margin-top: 2rem !important;
        border-radius: 0 !important;
    }
}

@media screen and (max-width: 768px) {
    /* Post header bottom margin - Mobile: 24px */
    .post-header {
        margin-bottom: 24px !important;
    }

    /* Prevent horizontal scrolling on mobile */
    html, body {
        overflow-x: hidden !important;
        width: 100%;
        max-width: 100vw;
    }

    * {
        max-width: 100vw;
    }

    /* Carousel adjustments for mobile */
    .hero-carousel-container {
        margin-bottom: 16px;
        margin-left: -1rem;
        margin-right: -1rem;
        width: calc(100% + 2rem);
    }

    /* Remove rounded corners on carousel images for mobile */
    .hero-carousel,
    .home-hero-section,
    .home-hero-image,
    .home-hero-image-right,
    .hero-slide-fullwidth,
    .hero-fullwidth-image,
    .slide-3-images-wrapper,
    .slide-3-bg-image,
    .slide-3-profile-image {
        border-radius: 0 !important;
    }

    .hero-carousel {
        height: 50vh;
        max-width: 100%;
    }

    .hero-slide {
        height: 50vh;
    }

    .hero-slide-fullwidth {
        height: 50vh;
    }

    .hero-fullwidth-image {
        height: 50vh;
        object-fit: cover;
    }

    /* Mobile: Stack layout with profile image */
    .home-hero-section {
        display: block;
        width: 100%;
        max-width: 100%;
        height: 50vh;
        aspect-ratio: auto;
    }

    .home-hero-images-wrapper {
        position: relative;
        display: block;
        width: 100%;
        max-width: 100%;
        height: 50vh;
        aspect-ratio: auto;
        gap: 0;
    }

    .home-hero-image {
        width: 100%;
        height: 50vh;
        border-radius: 8px;
        grid-column: auto;
    }

    /* Hide desktop image on mobile */
    .home-hero-image-right-desktop {
        display: none !important;
    }

    /* Show mobile image on mobile */
    .home-hero-image-right-mobile {
        display: block !important;
    }

    .home-hero-image-right {
        position: absolute;
        bottom: 0;
        right: 24px;
        width: 65%;
        max-width: 65%;
        height: auto;
        max-height: 50vh;
        border-radius: 8px;
        border: none;
        box-shadow: none;
        grid-column: auto;
    }

    .home-hero-overlay {
        position: absolute;
        top: 50%;
        left: 0;
        right: auto;
        transform: translateY(-50%);
        max-width: 50%;
        margin-top: 0;
        margin-left: 1rem;
        padding: 1rem;
        z-index: 10;
    }

    /* Second carousel slide adjustments for mobile */
    .slide-3-custom .home-hero-overlay {
        max-width: 60%;
    }

    .slide-3-custom .slide-3-profile-image {
        max-width: 50%;
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
    }

    /* Make header sticky on mobile/tablet */
    header.header {
        position: sticky !important;
        top: 0 !important;
        z-index: 100 !important;
        background: transparent !important;
        margin-bottom: 0 !important;
    }

    header.header nav,
    .main {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .post-content,
    .page-header,
    .post-header,
    .post-footer {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    article {
        max-width: 100% !important;
    }

    /* Blog post content area 100% width on mobile */
    .post-single {
        width: 100vw !important;
        max-width: 100vw !important;
        margin-left: -1rem !important;
        margin-right: -1rem !important;
        margin-top: 0 !important;
        padding: 1.5rem 1rem !important;
        border-radius: 0 !important;
    }

    /* Stack blog preview cards vertically on mobile */
    .post-entry {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 0 !important;
        height: auto !important;
        min-height: auto !important;
    }

    /* Add padding back to content area only */
    .post-entry-content {
        padding: 1rem !important;
    }

    .post-entry-image,
    .post-entry .entry-cover {
        width: 100% !important;
        height: auto !important;
        max-height: 200px !important;
        aspect-ratio: 16 / 9 !important;
        order: -1 !important;
        border-radius: 8px 8px 0 0 !important;
        margin-bottom: 0 !important;
        position: relative !important;
    }

    .post-entry-image img,
    .post-entry .entry-cover img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        border-radius: 8px 8px 0 0 !important;
    }

    /* Mobile: GIF lazy loading positioning */
    .post-entry-image .cover-static {
        position: relative;
        z-index: 1;
    }

    .post-entry-image .cover-gif {
        position: absolute !important;
        top: 0;
        left: 0;
        opacity: 0;
        z-index: 2;
        transition: opacity 0.5s ease-in-out;
    }

    .post-entry-image .cover-gif.loaded {
        opacity: 1;
    }

    /* Blog post hero image full-width on mobile */
    .post-hero-image-container {
        width: 100vw;
        margin-left: -1rem;
        margin-right: -1rem;
        margin-bottom: 0;
        border-radius: 8px 8px 0 0 !important;
        overflow: hidden;
    }

    .post-hero-image {
        width: 100%;
        max-height: 30vh;
        border-radius: 8px 8px 0 0 !important;
    }

    /* Hero overlay on mobile */
    .post-hero-overlay {
        padding: 12px 16px;
        max-width: 85%;
    }

    /* Hero overlay - Dark background card when GIF is present (mobile) */
    .post-hero-image-container[data-gif] .post-hero-overlay {
        background: rgba(0, 0, 0, 0.6);
        border-radius: 12px;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }

    .post-hero-title {
        font-size: 1.5rem;
    }

    .post-hero-subtitle {
        font-size: 0.9rem;
    }

    .post-hero-meta {
        font-size: 0.8rem;
        gap: 10px;
        flex-wrap: wrap;
    }

    .logo,
    .menu {
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Blog Activity Heatmap - prevent month labels from being cut off on mobile */
    #blog-heatmap-container {
        min-height: 40px;
        margin-bottom: 0.875rem;
    }

    #cal-heatmap {
        min-height: 40px;
        overflow-y: visible !important;
    }

    #cal-heatmap svg {
        min-height: 40px;
    }

    /* Post navigation (previous/next) - Mobile: no side margins */
    .paginav {
        margin-left: -1rem !important;
        margin-right: -1rem !important;
        margin-top: 2rem !important;
        border-radius: 0 !important;
    }
}

/* Notion Callout Blocks Styling */
.notion-callout {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 8px;
    background: var(--entry);
    border-left: 4px solid;
}

.notion-callout-emoji {
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.notion-callout-text {
    flex: 1;
    line-height: 1.6;
    color: var(--content);
}

/* Callout type styling - Light Mode */
.notion-callout-info {
    border-left-color: #0ea5e9;
    background: rgba(14, 165, 233, 0.1);
}

.notion-callout-warning {
    border-left-color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.notion-callout-danger {
    border-left-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.notion-callout-success {
    border-left-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.notion-callout-note {
    border-left-color: #8b5cf6;
    background: rgba(139, 92, 246, 0.1);
}

.notion-callout-tip {
    border-left-color: #06b6d4;
    background: rgba(6, 182, 212, 0.1);
}

.notion-callout-abstract {
    border-left-color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
}

.notion-callout-error {
    border-left-color: #dc2626;
    background: rgba(220, 38, 38, 0.1);
}

/* Dark Mode adjustments for callouts */
[data-theme="dark"] .notion-callout {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .notion-callout-info {
    background: rgba(14, 165, 233, 0.15);
}

[data-theme="dark"] .notion-callout-warning {
    background: rgba(245, 158, 11, 0.15);
}

[data-theme="dark"] .notion-callout-danger {
    background: rgba(239, 68, 68, 0.15);
}

[data-theme="dark"] .notion-callout-success {
    background: rgba(16, 185, 129, 0.15);
}

[data-theme="dark"] .notion-callout-note {
    background: rgba(139, 92, 246, 0.15);
}

[data-theme="dark"] .notion-callout-tip {
    background: rgba(6, 182, 212, 0.15);
}

[data-theme="dark"] .notion-callout-abstract {
    background: rgba(99, 102, 241, 0.15);
}

[data-theme="dark"] .notion-callout-error {
    background: rgba(220, 38, 38, 0.15);
}

/* Toggle Menu (Details/Summary) Styling */
details {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    background: var(--entry);
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: color 0.2s ease-out,
                background-color 0.5s ease-in-out,
                border-color 0.5s ease-in-out;
}

details summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--primary);
    padding: 0.5rem;
    margin: -0.75rem -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
    border-radius: 8px 8px 0 0;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s ease-out,
                background-color 0.5s ease-in-out,
                border-color 0.5s ease-in-out;
}

details summary::-webkit-details-marker {
    display: none;
}

details summary::before {
    content: '▶';
    display: inline-block;
    transition: transform 0.2s ease;
    font-size: 0.75rem;
    color: var(--secondary);
}

details[open] summary::before {
    transform: rotate(90deg);
}

details[open] summary {
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    border-radius: 8px 8px 0 0;
    transition: color 0.2s ease-out,
                background-color 0.5s ease-in-out,
                border-color 0.5s ease-in-out;
}

details > *:not(summary) {
    margin-top: 0.75rem;
    padding-left: 0.5rem;
}

/* Nested details styling */
details details {
    margin-left: 0;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.02);
}

details details summary {
    margin: -0.5rem -0.75rem;
    padding: 0.4rem 0.75rem;
    font-weight: 500;
    font-size: 0.95rem;
}

details details[open] summary {
    margin-bottom: 0.5rem;
}

[data-theme="dark"] details details {
    background: rgba(255, 255, 255, 0.02);
}

/* Dark mode adjustments for details */
[data-theme="dark"] details {
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] details[open] summary {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

/* Code blocks - darker background in dark mode */
[data-theme="dark"] code {
    background: rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] pre {
    background: rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] pre code {
    background: transparent !important;
}
