/* Basic Reset and Clean Styles - Mobile-First Responsive System - Updated: 2024-12-19 - Cache Buster: 20241219123456 */

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    color: #333;
    transition: filter 0.3s ease;
}

/* Button Container - Fixed Position */
#buttonContainer {
    position: fixed !important;
    bottom: 20px !important;
    left: 20px !important;
    z-index: 999999 !important;
    width: 180px !important;
    height: 48px !important;
    pointer-events: none !important;
    filter: none !important;
    transform: none !important;
}

/* Color Toggle Button - Inside Container */
.color-toggle {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 25px !important;
    font-size: 14px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
    transition: none !important;
    font-family: Arial, sans-serif !important;
    transform: none !important;
    filter: none !important;
    text-align: center !important;
    white-space: nowrap !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    outline: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    box-sizing: border-box !important;
    pointer-events: auto !important;
}

.color-toggle:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
}

.color-toggle.grayscale-active {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

/* Grayscale Mode - Apply to specific elements instead of body */
body.grayscale-mode h1,
body.grayscale-mode h4,
body.grayscale-mode p,
body.grayscale-mode a {
    filter: grayscale(100%);
}

/* Ensure button container is never affected by grayscale */
body.grayscale-mode #buttonContainer {
    filter: none !important;
}

body.grayscale-mode .color-toggle {
    filter: grayscale(100%) !important; /* Make button grayscale too */
}

/* Apply grayscale to specific text elements */
body.grayscale-mode h1,
body.grayscale-mode h2,
body.grayscale-mode h3,
body.grayscale-mode h4,
body.grayscale-mode p,
body.grayscale-mode p1,
body.grayscale-mode a,
body.grayscale-mode li {
    filter: grayscale(100%);
}

/* Apply grayscale AND drop-shadow to images */
body.grayscale-mode img {
    filter: grayscale(100%) drop-shadow(0 8px 16px rgba(0, 0, 0, 0.8));
}

body.grayscale-mode .corner-image img {
    filter: grayscale(100%) drop-shadow(0 8px 16px rgba(0, 0, 0, 0.8));
}

body.grayscale-mode .cycle-image {
    filter: grayscale(100%) drop-shadow(0 8px 16px rgba(0, 0, 0, 0.8)) !important;
}

/* Grayscale mode for home page - apply filter to background image */
body.grayscale-mode.home-page .background-image {
    filter: grayscale(100%) !important;
}

/* Ensure color mode shows full color */
body.home-page:not(.grayscale-mode) .background-image {
    filter: none !important;
}

/* Ensure button container is not affected by grayscale filter */
body.grayscale-mode.home-page #buttonContainer {
    filter: none !important;
}

/* No background image for about page in grayscale mode */

/* No mobile grayscale background needed */


/* No grayscale background for about-page */
body.grayscale-mode.about-page {
    background-image: none !important;
}

/* Apply grayscale filter to background image in grayscale mode */
body.grayscale-mode.about-page .background-image {
    filter: grayscale(100%);
}

/* Ensure background image is in color mode */
body.about-page:not(.grayscale-mode) .background-image {
    filter: none;
}

/* Apply grayscale filter to self-portrait in grayscale mode */
body.grayscale-mode.home-page .self-portrait-image {
    filter: grayscale(100%);
}

/* Ensure self-portrait is in color mode */
body.home-page:not(.grayscale-mode) .self-portrait-image {
    filter: none;
}

/* Ensure button container is not affected by grayscale filter */
body.grayscale-mode.about-page #buttonContainer {
    filter: none !important;
}

/* Corner image at top-right */
.corner-image {
    position: absolute;
    top: 0px;
    right: 20px;
    width: 300px;
    height: 300px;
    z-index: 10;
}

.corner-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.8));
}



/* Background image for index page */
body.home-page {
    background-color: black;
    color: white;
    background-image: none !important;
    background: black !important;
}

/* Background image as regular img element for about page */
.background-image {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    object-position: center center;
    z-index: -1;
    pointer-events: none;
}

/* Self-portrait image for index page */
.self-portrait-image {
    position: fixed;
    top: 0;
    right: 0;
    width: 50%;
    height: 100vh;
    object-fit: cover;
    object-position: right center;
    z-index: 1;
    pointer-events: none;
}

/* Background for about page - no background image */
body.about-page {
    background-color: black;
    color: white;
}

/* Make paragraph text black on about page for better readability */
body.about-page p,
body.about-page p1,
body.about-page p3,
body.about-page li {
    color: black !important;
}

/* No mobile background adjustments needed */


/* Background colors for project pages */
body.art74-page {
    background-color: #C1E7FF; /* Pastel blue */
}

body.art75-page {
    background-color: #D2FFC1; /* Pastel green*/
}

/* Grayscale mode for project page backgrounds */
body.grayscale-mode.art74-page {
    background-color: #E0E0E0; /* Light gray */
}

body.grayscale-mode.art75-page {
    background-color: #E0E0E0; /* Light gray */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.85);
    border-radius: 8px;
    text-align: center;
    position: relative;
}

/* Center content on project pages */
body.art74-page .container,
body.art75-page .container {
    text-align: center;
    margin-top: 50px;
}

body.art74-page h1,
body.art75-page h1 {
    text-align: center;
    margin-bottom: 40px;
    margin-top: 200px;
}

/* Special spacing for page 4 */
body.page4 h1 {
    margin-top: 310px;
}

/* Special spacing for page 10 */
body.page10 h1 {
    margin-top: 310px;
}

/* Horizontal alignment for small images on page 4 */
body.page4 .container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

body.page4 .small-images {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
}

body.page4 .small-images img {
    width: 250px;
    height: auto;
    margin: 0;
}

/* Mobile layout for small images on page 4 */
@media (max-width: 1024px) {
    body.page4 .small-images {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    body.page4 .small-images img {
        width: 100%;
        max-width: 300px;
        height: auto;
    }
}

body.art74-page h2,
body.art75-page h2,
body.art74-page h3,
body.art75-page h3 {
    text-align: center;
    margin-bottom: 40px;
    margin-top: 0;
}

body.art74-page img,
body.art75-page img {
    display: block;
    margin: 0 auto 40px auto;
}

/* Add margin between About Me and Art 74 sections */
#art74 {
    margin-top: 80px;
}

/* Add margin between Art 74 and Art 75 sections */
#art75 {
    margin-top: 80px;
}

/* House image link styling */
.house-link {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
}

.house-link img {
    width: 700px;
    height: 700px;
    transition: transform 0.3s ease;
    animation: shaky 3s ease-in-out infinite;
}

.house-link:hover img {
    transform: scale(1.1);
    animation: none;
}

h1 {
    margin-top: 0;
    margin-bottom: 15px;
    font-family: 'Arial Black', Gadget, sans-serif;
    font-size: 50px;
    color: #24133A;
}
h2, h3{
    margin-top: 0;
    margin-bottom: 15px;
    font-family:  'Arial Black', Gadget, sans-serif;
    font-size: 50px;
    color: #280c4c;
    text-align: center;
}

h4 {
    margin-top: 0;
    margin-bottom: 15px;
    font-family: 'Arial Black', Gadget, sans-serif;
    font-size: 50px;
    color: #EE4BC2
}

h5 {
    margin-top: 0;
    margin-bottom: 15px;
    font-family: 'Lucida Console', 'Monaco', 'monospace';
    font-size: 20px;
    color: #ffffff;
}

/* Mobile h5 adjustments */
@media (max-width: 768px) {
    h5 {
        font-size: 16px;
        margin-top: 10px;
        margin-bottom: 20px;
        padding: 0 10px;
    }
}
p {
    font-family: 'Lucida Console', 'Monaco', 'monospace';
    font-size: 30px;
    margin-bottom: 15px;
}

p1{
    font-family: 'Lucida Console', 'Monaco', 'monospace';
    font-size: 20px;
    margin-bottom: 15px;
}

p3{
    font-family: 'Lucida Console', 'Monaco', 'monospace';
    font-size: 20px;
    margin-bottom: 15px;
    color:#0066cc
}
a {
    color: #0066cc;
    text-decoration: underline;
}

a:hover {
    color: #004499;
}

ul {
    margin-bottom: 20px;
    padding-left: 20px;
}

li {
    font-family: 'Lucida Console', 'Monaco', 'monospace';
    font-size: 20px;
    margin-bottom: 8px;
}

img {
    max-width: 100%;
    height: auto;
    margin: 10px 0;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.8));
}

/* Center title block vertically while keeping left alignment on home page */
.title-block {
    position: absolute;
    top: 50%;
    left: 20px; /* matches body padding for left alignment */
    transform: translateY(-50%);
    text-align: left;
    z-index: 1;
}

/* Back link styled as a modern floating pill button */
.back-link {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    text-decoration: none;
    padding: 10px 16px;
    border-radius: 9999px;
    font-family: Arial, sans-serif;
    font-weight: bold;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.back-link:hover {
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    opacity: 0.95;
}

/* Keep legibility in grayscale mode */
body.grayscale-mode .back-link {
    filter: grayscale(100%);
}

/* Project grid layout */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
    margin: 20px 0;
}

.project-item {
    text-align: center;
    margin-bottom: 20px;
}

.project-item a img {
    transition: transform 0.3s ease, filter 0.3s ease !important;
    animation: shaky 3s ease-in-out infinite;
}

/* Ensure shaky animation is not overridden by later rules */
.project-item a img {
    animation: shaky 3s ease-in-out infinite !important;
}

.project-item a:hover img {
    transform: scale(1.05) rotate(2deg) !important;
    filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.9)) !important;
    animation: none !important;
}

/* Enhanced hover effect for project images in grayscale mode */
body.grayscale-mode .project-item a:hover img {
    filter: grayscale(100%) drop-shadow(0 12px 24px rgba(0, 0, 0, 0.9)) !important;
}

.project-title {
    text-align: center;
    font-weight: bold;
    margin-top: 10px;
    margin-bottom: 0;
    color: #333;
}

/* About content layout */
.about-content {
    display: flex;
    gap: 50px;
    align-items: flex-start;
    margin: 20px 0;
    justify-content: flex-start;
}

/* Align h1 with image cycle */
body.about-page h1 {
    margin-top: 100px;
    margin-bottom: 20px;
    text-align: center;
}

.about-text {
    flex: 0 0 60%;
    text-align: left;
    max-width: 60%;
    margin-top: 50px;
    background-color: rgba(255, 255, 255, 0.9);
   border-radius: 12px;
  padding: 20px;
}

.home-text {
    text-align: center;
    margin-top: 50px;
    background-color: rgba(255, 255, 255, 0.9);
   border-radius: 12px;
  padding: 20px;
}
/* Image cycling animation */
.image-cycle {
    position: relative;
    width: 500px;
    height: 500px;
    flex-shrink: 0;
}

.cycle-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.2s;
    object-fit: contain;
}

.cycle-image.active {
    opacity: 1;
}

.credits-text {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 20px;
}

.contact-text {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.contact-text h3 {
    margin-top: 40px;
}

/* Animation keyframes for cycling */
@keyframes cycleImages {
    0% { opacity: 1; }
    11.11% { opacity: 1; }
    11.12% { opacity: 0; }
    100% { opacity: 0; }
}

/* Shaky animation for project images */
@keyframes shaky {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    10% { transform: translate(-1px, -1px) rotate(-0.5deg); }
    20% { transform: translate(1px, -1px) rotate(0.5deg); }
    30% { transform: translate(-1px, 1px) rotate(-0.3deg); }
    40% { transform: translate(1px, 1px) rotate(0.3deg); }
    50% { transform: translate(-1px, -1px) rotate(-0.2deg); }
    60% { transform: translate(1px, -1px) rotate(0.2deg); }
    70% { transform: translate(-1px, 1px) rotate(-0.1deg); }
    80% { transform: translate(1px, 1px) rotate(0.1deg); }
    90% { transform: translate(-1px, -1px) rotate(-0.05deg); }
}

.cycle-image:nth-child(1) { animation: cycleImages 27s infinite 0s; }
.cycle-image:nth-child(2) { animation: cycleImages 27s infinite 3s; }
.cycle-image:nth-child(3) { animation: cycleImages 27s infinite 6s; }
.cycle-image:nth-child(4) { animation: cycleImages 27s infinite 9s; }
.cycle-image:nth-child(5) { animation: cycleImages 27s infinite 12s; }
.cycle-image:nth-child(6) { animation: cycleImages 27s infinite 15s; }
.cycle-image:nth-child(7) { animation: cycleImages 27s infinite 18s; }
.cycle-image:nth-child(8) { animation: cycleImages 27s infinite 21s; }
.cycle-image:nth-child(9) { animation: cycleImages 27s infinite 24s; }

/* Accessibility: visible focus outlines */
a:focus-visible,
button:focus-visible,
.back-link:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 3px;
}

/* Make the large title image on the home page responsive even with inline width */
.title-block img {
    width: min(90vw, 900px) !important;
    height: auto !important;
}

/* Mobile title image adjustments */
@media (max-width: 768px) {
    .title-block img {
        width: min(85vw, 400px) !important;
        height: auto !important;
        max-width: 400px;
    }
}

/* Ensure non-grayscale filters in color mode for key visuals */
.home-page:not(.grayscale-mode) .cycle-image,
.home-page:not(.grayscale-mode) .project-item a img,
.home-page:not(.grayscale-mode) img {
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.8)) !important;
}

/* Ensure grayscale mode applies to all pages, not just home page */
body.grayscale-mode .cycle-image {
    filter: grayscale(100%) drop-shadow(0 8px 16px rgba(0, 0, 0, 0.8)) !important;
}

/* Mobile-specific grayscale fixes */
@media (max-width: 768px) {
    /* Force color mode on mobile - ensure images are NOT grayscale in color mode */
    body:not(.grayscale-mode) img {
        filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.8)) !important;
    }
    
    body:not(.grayscale-mode) .cycle-image {
        filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.8)) !important;
    }
    
    body:not(.grayscale-mode) .project-item a img {
        filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.8)) !important;
    }
    
    body:not(.grayscale-mode) .corner-image img {
        filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.8)) !important;
    }
    
}

/* Animations enabled for all users */

/* Ensure shaky animation works on project thumbnails */
.project-item a img {
    animation: shaky 3s ease-in-out infinite !important;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .about-content {
        gap: 24px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 0;
    }
    
    /* Mobile home page - no background image */
    body.home-page {
        padding: 0;
        margin: 0;
        background-color: rgb(0, 0, 0);
        background-image: none !important;
        background: black !important;
        color: rgb(255, 255, 255);
    }
    
    /* Mobile about page - background image handled in mobile accessibility system */
    

    h1 { font-size: 36px; font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif; }
    h2, h3 { font-size: 32px; font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif; }
    h4 { font-size: 32px; font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif; }
    p { font-size: 20px; }
    p1, p3, li { font-size: 18px; }


    /* Mobile index page - structured layout */
    .title-block {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        text-align: center !important;
        z-index: 1 !important;
        margin: 20px auto !important;
        padding: 20px !important;
        max-width: 90vw !important;
    }
    
    /* Mobile index page background image positioning - portrait mode */
/* No background image element needed */
    
    /* Ensure text doesn't overlap background */
    .title-block {
        margin-bottom: 20px !important;
        padding-bottom: 20px !important;
    }

    /* Corner and house images scale down on mobile */
    .corner-image {
        top: 8px;
        right: 8px;
        width: 200px;
        height: 200px;
    }
    .house-link img {
        width: 300px;
        height: 300px;
    }

    /* Container breathing space */
    .container {
        padding: 16px;
    }

    /* Stack about section */
    .about-content {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
    }
    .about-text {
        flex: 0 1 auto;
        max-width: 100%;
        margin-top: 0;
        text-align: left; /* keep body text left-aligned for readability */
        padding: 12px;
        margin: 8px;
    }
    
    /* Remove all white backgrounds on mobile for page 1 */
    .home-text {
        background-color: transparent !important;
        padding: 0;
        margin: 0;
        border-radius: 0;
    }
    
    .about-text {
        background-color: transparent !important;
        padding: 0;
        margin: 0;
        border-radius: 0;
    }
    
    .credits-text {
        background-color: transparent !important;
        padding: 0;
        margin: 0;
        border-radius: 0;
    }
    
    /* Remove container background on mobile */
    .container {
        background-color: transparent !important;
        padding: 0;
        margin: 0;
        border-radius: 0;
    }

    /* Image cycle panel scales with viewport */
    .image-cycle {
        width: min(90vw, 420px);
        height: min(90vw, 420px);
    }

    /* Projects grid: 1 column on narrow screens */
    .project-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* Back link remains tappable but compact */
    .back-link {
        padding: 10px 14px;
        font-size: 14px;
    }

    /* Toggle button container stays usable but smaller */
    #buttonContainer {
        width: 160px !important;
        height: 44px !important;
    }
}

/* Landscape-specific adjustments */
@media (orientation: landscape) {

    /* Prevent house icon from covering titles */
    .house-link img {
        width: 250px;
        height: 250px;
    }
    .container h1 {
        margin-top: 100px;
    }
    
    /* No landscape mobile background adjustments needed */
    
    /* Ensure images work properly in landscape mode */
    .image-cycle {
        width: min(40vw, 500px);
        height: min(40vw, 500px);
    }
    
    .project-item a img {
        max-width: 100%;
        height: auto;
        filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.8)) !important;
    }
    
    /* Ensure image cycle works in landscape */
    .cycle-image {
        filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.8)) !important;
    }
}

@media (max-width: 480px) {
    h1 { font-size: 30px; }
    h2, h3 { font-size: 26px; }
    h4 { font-size: 26px; }
    p { font-size: 18px; }
    p1, p3, li { font-size: 16px; }

    .corner-image {
        width: 120px;
        height: 120px;
    }
    .house-link img {
        width: 150px;
        height: 150px;
    }

    .image-cycle {
        width: min(92vw, 360px);
        height: min(92vw, 360px);
    }

    .project-item a img {
        /* Ensure tappable size without overflow */
        max-width: 90vw;
        height: auto;
    }

    #buttonContainer {
        width: 150px !important;
        height: 44px !important;
        left: 16px !important;
        bottom: 16px !important;
    }
}

/* ========================================
   MOBILE ACCESSIBILITY SYSTEM
   ======================================== */

/* Mobile and Tablet Base Styles */
@media (max-width: 1024px) {
    
    /* Page 1 - No background image on mobile/tablet */
    body.home-page {
        background-color: black !important;
        background-image: none !important;
        background: black !important;
        color: white !important;
    }
    
    body.grayscale-mode.home-page {
        background-color: black !important;
        background-image: none !important;
        background: black !important;
        color: white !important;
    }
    
    /* Mobile grayscale mode for background image */
    body.grayscale-mode.home-page .background-image {
        filter: grayscale(100%) !important;
    }
    
    /* Mobile color mode for background image */
    body.home-page:not(.grayscale-mode) .background-image {
        filter: none !important;
    }
    
    /* Cover Page - no background image */
    body.about-page {
        background-color: black !important;
        background-image: none !important;
        background: black !important;
        color: white !important;
    }
    
    /* Make paragraph text black on about page for mobile */
    body.about-page p,
    body.about-page p1,
    body.about-page p3,
    body.about-page li {
        color: black !important;
    }
    
    body.grayscale-mode.about-page {
        background-color: black !important;
        background-image: none !important;
        color: white !important;
    }
    
    /* Mobile background image positioning */
    .background-image {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        object-fit: cover !important;
        object-position: center center !important;
        z-index: -1 !important;
        pointer-events: none !important;
    }
    
    /* Mobile grayscale mode for background image */
    body.grayscale-mode.about-page .background-image {
        filter: grayscale(100%) !important;
    }
    
    /* Mobile color mode for background image */
    body.about-page:not(.grayscale-mode) .background-image {
        filter: none !important;
    }
    
    /* Mobile self-portrait image positioning - portrait mode */
    .self-portrait-image {
        position: relative !important;
        top: auto !important;
        right: auto !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 75% !important;
        height: auto !important;
        object-fit: contain !important;
        object-position: center center !important;
        z-index: 1 !important;
        pointer-events: none !important;
        margin-top: 30px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
    
    /* Mobile grayscale mode for self-portrait */
    body.grayscale-mode.home-page .self-portrait-image {
        filter: grayscale(100%) !important;
    }
    
    /* Mobile color mode for self-portrait */
    body.home-page:not(.grayscale-mode) .self-portrait-image {
        filter: none !important;
    }
    
    /* Landscape mobile layout for index page */
    @media (max-width: 1024px) and (orientation: landscape) {
        /* Make self-portrait smaller and center it below h5 */
        .self-portrait-image {
            position: relative !important;
            top: auto !important;
            right: auto !important;
            left: 50% !important;
            transform: translateX(-50%) !important;
            width: 40% !important;
            height: auto !important;
            object-fit: contain !important;
            object-position: center center !important;
            z-index: 1 !important;
            pointer-events: none !important;
            margin-top: 20px !important;
        }
        
        /* Make title image smaller in landscape */
        .title-block img {
            width: min(60vw, 400px) !important;
            height: auto !important;
        }
        
        /* Make h5 text smaller in landscape */
        h5 {
            font-size: 14px !important;
            margin-top: 10px !important;
            margin-bottom: 10px !important;
        }
    }
    
    /* Simplified Layout */
    body {
        padding: 10px;
        margin: 0;
    }
    
    .container {
        background-color: transparent !important;
        padding: 10px;
        margin: 0;
        border-radius: 0;
        max-width: 100%;
    }
    
    /* Typography - Double Spaced Headers */
    h1 { 
        font-size: 32px; 
        font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif;
        margin-top: 120px;
        margin-bottom: 20px;
        line-height: 2.0;
        text-align: center;
    }
    
    h2, h3 { 
        font-size: 28px; 
        font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif;
        margin-top: 120px;
        margin-bottom: 20px;
        line-height: 2.0;
        text-align: center;
    }
    
    h4 { 
        font-size: 24px; 
        font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif;
        margin-top: 120px;
        margin-bottom: 20px;
        line-height: 2.0;
        text-align: center;
    }
    
    p { 
        font-size: 18px; 
        font-family: 'Lucida Console', 'Monaco', 'monospace';
        margin-bottom: 15px;
        text-align: left;
    }
    
    p1, p3, li { 
        font-size: 16px; 
        font-family: 'Lucida Console', 'Monaco', 'monospace';
        margin-bottom: 10px;
        text-align: left;
    }
    
    /* Image System - Color/Grayscale Modes */
    img {
        max-width: 100%;
        height: auto;
        display: block;
        margin: 15px auto;
        filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    }
    
    /* Color Mode Images */
    body:not(.grayscale-mode) img {
        filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3)) !important;
    }
    
    /* Grayscale Mode Images */
    body.grayscale-mode img {
        filter: grayscale(100%) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3)) !important;
    }
    
    /* House Link - Smaller and Non-Overlapping */
    .house-link {
        position: absolute;
        top: 10px;
        left: 10px;
        z-index: 1000;
    }
    
    .house-link img {
        width: 180px;
        height: 180px;
        transition: transform 0.3s ease;
        animation: shaky 3s ease-in-out infinite;
        filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    }
    
    .house-link:hover img {
        transform: scale(1.1);
    }
    
    /* Corner Image - Smaller */
    .corner-image {
        position: absolute;
        top: 10px;
        right: 10px;
        width: 100px;
        height: 100px;
        z-index: 10;
    }
    
    .corner-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    }
    
    /* Title Block - Mobile structured layout */
    .title-block {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        text-align: center !important;
        z-index: 1 !important;
        margin: 20px auto !important;
        padding: 20px !important;
        max-width: 90vw !important;
    }
    
    /* Mobile index page background image positioning - portrait mode */
/* No background image element needed */
    
    /* Ensure text doesn't overlap background */
    .title-block {
        margin-bottom: 20px !important;
        padding-bottom: 20px !important;
    }
    
    /* About Content - Stacked Layout */
    .about-content {
        flex-direction: column;
        align-items: center;
        gap: 20px;
        text-align: center;
    }
    
    .about-text {
        flex: 0 1 auto;
        max-width: 100%;
        margin-top: 0;
        text-align: left;
        padding: 15px;
        background-color: rgba(255, 255, 255, 0.9);
        border-radius: 8px;
    }
    
    /* Image Cycle - Responsive */
    .image-cycle {
        width: min(80vw, 400px);
        height: min(80vw, 400px);
        position: relative;
        margin: 20px auto;
    }
    
    .cycle-image {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        opacity: 0;
        transition: opacity 0.2s;
        object-fit: contain;
        filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    }
    
    /* Project Grid - Single Column */
    .project-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        margin: 20px 0;
    }
    
    .project-item {
        text-align: center;
        margin-bottom: 20px;
    }
    
    .project-item a img {
        width: 200px;
        height: 200px;
        object-fit: cover;
        border-radius: 8px;
        transition: transform 0.3s ease;
        filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    }
    
    .project-item a:hover img {
        transform: scale(1.05);
    }
    
    /* Button Container - Mobile Friendly */
    #buttonContainer {
        width: 140px !important;
        height: 40px !important;
        left: 10px !important;
        bottom: 10px !important;
    }
    
    .color-toggle {
        font-size: 12px !important;
    }
    
    /* Back Link - Mobile Friendly */
    .back-link {
        padding: 8px 12px;
        font-size: 14px;
        position: absolute;
        top: 10px;
        left: 100px;
        z-index: 1000;
    }
    
    /* Text Containers - White Background */
    .home-text, .about-text, .credits-text, .contact-text {
        background-color: rgba(255, 255, 255, 0.9) !important;
        padding: 15px;
        margin: 10px;
        border-radius: 8px;
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    h1 { font-size: 28px; margin-top: 100px; }
    h2, h3 { font-size: 24px; margin-top: 100px; }
    h4 { font-size: 20px; margin-top: 100px; }
    p { font-size: 16px; }
    p1, p3, li { font-size: 14px; }
    
    .house-link img {
        width: 160px;
        height: 160px;
        animation: shaky 3s ease-in-out infinite;
    }
    
    .corner-image {
        width: 80px;
        height: 80px;
    }
    
    .image-cycle {
        width: min(85vw, 300px);
        height: min(85vw, 300px);
    }
    
    .project-item a img {
        width: 150px;
        height: 150px;
    }
    
    #buttonContainer {
        width: 120px !important;
        height: 36px !important;
    }
    
    .color-toggle {
        font-size: 10px !important;
    }
    
    .back-link {
        padding: 6px 10px;
        font-size: 12px;
        left: 80px;
    }
}

/* Landscape Mobile */
@media (max-width: 1024px) and (orientation: landscape) {
    .house-link img {
        width: 170px;
        height: 170px;
        animation: shaky 3s ease-in-out infinite;
    }
    
    .corner-image {
        width: 90px;
        height: 90px;
    }
    
    .image-cycle {
        width: min(50vw, 300px);
        height: min(50vw, 300px);
    }
    
    h1, h2, h3, h4 {
        margin-top: 80px;
    }
    
    /* Landscape mobile index page layout */
    .title-block {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        text-align: center !important;
        z-index: 1 !important;
        margin: 20px auto !important;
        padding: 20px !important;
        max-width: 90vw !important;
    }
    
    /* No background image element needed */
    
    /* Landscape mobile - position text on left side */
    .title-block {
        position: absolute !important;
        top: 50% !important;
        left: 20px !important;
        transform: translateY(-50%) !important;
        text-align: left !important;
        width: 55% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
}
