/* ==========================================================================
   COLOR DEFINITIONS
   ========================================================================== */
:root {
    /* Primary Colors */
    --color-black: rgb(0, 0, 0);
    --color-dark-gray: rgb(10, 10, 10);
    --color-light-gray: rgb(220, 220, 220);
    
    /* Accent Color */
    --color-accent: rgb(0, 200, 200);
    
    /* Border color using accent color */
    --color-border: var(--color-accent);
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Remove any debugging borders and outlines */
.main-content, .content-container, body, html {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

body {
    font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--color-light-gray);
    color: var(--color-dark-gray);
    font-weight: 400;
    line-height: 1.6;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

/* Loading states */
body.loading {
    cursor: wait;
}

.segment.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Progressive enhancement */
.no-js .segment {
    display: block;
    min-height: auto;
    max-height: none;
}

.no-js .segment__content {
    opacity: 1;
    transform: none;
    position: static;
}

/* ==========================================================================
   LAYOUT COMPONENTS
   ========================================================================== */

/* Site Header */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: var(--color-light-gray);
    border-bottom: 1px solid var(--color-border);
    z-index: 100;
    padding: 15px 0;
    transition: opacity 0.3s ease;
    opacity: 1;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: opacity;
}

.site-header__content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
}

.site-header__title-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.site-header__title {
    font-size: 2.5rem;
    font-weight: 300;
    margin: 0;
    letter-spacing: 1px;
}

.site-header__subtitle {
    font-size: 0.875rem;
    font-weight: 400;
    color: rgb(100, 100, 100);
    margin: 0;
    line-height: 1.4;
    letter-spacing: 0.5px;
}

.site-header__info {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.site-header__info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
}

.site-header__label {
    font-weight: 500;
    color: #666666;
}

.site-header__link {
    color: #000000;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.site-header__link:hover {
    opacity: 0.7;
}

/* Main Content Area */
.main-content {
    margin-top: 160px;
    margin-left: 40px;
    margin-right: 40px;
    margin-bottom: 40px;
    width: calc(100% - 80px);
    border: none !important;
    outline: none !important;
}

.content-container {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 160px);
    max-width: 1200px;
    margin: 0 auto;
    overflow: visible;
    border: none !important;
    outline: none !important;
}

/* ==========================================================================
   SEGMENT COMPONENTS
   ========================================================================== */

/* Collapsible Segment */
.segment {
    position: relative;
    min-height: 80px;
    overflow: visible;
    transition: all 0.2s ease;
    cursor: default;
    border-bottom: 1px solid var(--color-border);
    -webkit-tap-highlight-color: transparent;
    touch-action: auto;
}

.segment:hover {
    background: rgb(235, 235, 235);
}

.segment--expanded:hover {
    background: rgb(240, 240, 240);
}

.segment:last-child {
    border-bottom: none;
}

.segment--collapsed {
    min-height: 80px;
    max-height: 80px;
}

.segment--expanded {
    min-height: 400px;
    max-height: none;
    background: rgb(240, 240, 240);
}

.segment__header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    font-size: 18px;
    font-weight: 400;
    color: var(--color-dark-gray);
    z-index: 2;
    transition: all 0.2s ease;
    letter-spacing: 0.5px;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(0, 200, 200, 0.2);
    touch-action: manipulation;
}

.segment__header:hover {
    color: var(--color-black);
}

.segment__header::before {
    content: 'Click to expand';
    position: absolute;
    right: 80px;
    font-size: 10px;
    color: rgb(150, 150, 150);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    font-weight: 300;
    letter-spacing: 0.5px;
}

.segment--collapsed .segment__header:hover::before {
    opacity: 0.6;
}

.segment--expanded .segment__header::before {
    content: 'Click to collapse';
}

.segment--expanded .segment__header {
    background: rgb(240, 240, 240);
    border-bottom: 1px solid var(--color-border);
}

.segment__title {
    text-transform: uppercase;
    font-size: 14px;
    letter-spacing: 1px;
}

.segment__content {
    position: relative;
    width: 100%;
    padding: 40px;
    padding-top: 140px;
    color: var(--color-dark-gray);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.2s ease;
    overflow: visible;
    max-height: none;
}

.segment--expanded .segment__content {
    opacity: 1;
    transform: translateY(0);
}

/* Removed custom scrollbar - content now expands naturally */

.segment__expand-icon {
    font-size: 24px;
    font-weight: 300;
    transition: all 0.2s ease;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgb(120, 120, 120);
}

.segment__expand-icon:hover {
    transform: scale(1.05);
    color: rgb(80, 80, 80);
}

.segment:hover .segment__expand-icon {
    color: rgb(100, 100, 100);
}

.segment--collapsed .segment__expand-icon::before {
    content: '+';
}

.segment--expanded .segment__expand-icon::before {
    content: '−';
}

.segment__text {
    font-size: 16px;
    line-height: 1.8;
    color: var(--color-dark-gray);
    max-width: 100%;
    font-weight: 400;
}

.segment__meta {
    font-size: 0.875rem;
    color: #666666;
    margin-bottom: 1rem;
    font-style: italic;
}

.segment__divider {
    height: 1px;
    background: linear-gradient(to right, transparent, #e0e0e0, transparent);
    margin: 0 40px;
}

.segment:hover .segment__header {
    background: #fafafa;
}

.segment--expanded:hover .segment__header {
    background: #f8f8f8;
}

/* ==========================================================================
   CONTENT ITEMS
   ========================================================================== */

/* Experience and Education Items */
.content-item {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
    transition: opacity 0.2s ease;
}

.content-item:hover {
    opacity: 0.8;
}

.content-item:last-child {
    margin-bottom: 0;
    border-bottom: none;
}

.content-item__title {
    font-size: 1.125rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--color-dark-gray);
    line-height: 1.3;
}

.content-item__meta {
    font-size: 0.875rem;
    color: rgb(100, 100, 100);
    margin-bottom: 1rem;
    font-style: italic;
}

.content-item__description {
    font-size: 0.9rem;
    line-height: 1.6;
    color: rgb(30, 30, 30);
    margin: 0;
}

/* Contact Items */
.contact-item {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.contact-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.contact-item__title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333333;
}

.contact-item__meta {
    font-size: 1rem;
    color: #000000;
    margin-bottom: 0.75rem;
    font-weight: 400;
}

.contact-item__meta a {
    color: #000000;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.contact-item__meta a:hover {
    opacity: 0.7;
}

/* ==========================================================================
   PROJECT LINK STYLING
   ========================================================================== */

.project-link {
    color: var(--color-dark-gray);
    text-decoration: underline;
    text-decoration-color: rgb(100, 100, 100);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: all 0.3s ease;
    font-size: 0.875rem;
    font-weight: 400;
}

.project-link:hover {
    color: var(--color-black);
    text-decoration-color: var(--color-dark-gray);
    text-decoration-thickness: 2px;
}

.project-link i {
    font-size: 0.75rem;
    color: #666666;
    margin-right: 0.25rem;
}

.contact-item__description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #555555;
    margin: 0;
}

/* Trivia Items */
.trivia-item {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
    transition: opacity 0.2s ease;
}

.trivia-item:hover {
    opacity: 0.8;
}

.trivia-item:last-child {
    margin-bottom: 0;
    border-bottom: none;
}

.trivia-item__title {
    font-size: 1.125rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--color-dark-gray);
    line-height: 1.3;
}

.trivia-item__description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #555555;
    margin: 0;
}

/* ==========================================================================
   SPECIAL COMPONENTS
   ========================================================================== */

/* EnneadTab Section */
.enneadtab-list {
    list-style: none;
    margin: 1rem 0;
    padding: 0;
}

.enneadtab-list li {
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
    line-height: 1.6;
    position: relative;
    transition: opacity 0.2s ease;
}

.enneadtab-list li:hover {
    opacity: 0.8;
}

.enneadtab-list li:last-child {
    margin-bottom: 0;
}

.enneadtab-list li::before {
    content: "+";
    position: absolute;
    left: 0;
    top: 0;
    color: rgb(100, 100, 100);
    font-weight: 500;
    font-size: 0.875rem;
}

.enneadtab-duck {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 1.5rem 0;
    padding: 1rem;
    background: #f0f0f0;
    border-radius: 8px;
    max-width: 200px;
}

.enneadtab-duck__art {
    font-size: 1.5rem;
}

.enneadtab-duck__label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #333333;
}

.enneadtab-wiki {
    margin-top: 1rem;
    text-align: center;
}

.enneadtab-wiki a {
    color: inherit;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.enneadtab-wiki a:hover {
    opacity: 1;
}

/* Awards List */
.awards-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.award-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
}

.award-item__text {
    flex: 1;
    font-size: 0.875rem;
    line-height: 1.5;
}

.award-item__year {
    font-size: 0.75rem;
    color: #666666;
    font-style: italic;
    margin-left: 1rem;
    white-space: nowrap;
}

/* Publicity Items */
.publicity-item {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.publicity-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.publicity-item__content {
    margin-bottom: 0.75rem;
}

.publicity-item__title {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #333333;
}

.publicity-item__description {
    font-size: 0.875rem;
    line-height: 1.6;
    color: #555555;
}

.publicity-item__details {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.publicity-item__location {
    font-size: 0.75rem;
    color: #666666;
    font-style: italic;
}

/* ==========================================================================
   SITE FOOTER
   ========================================================================== */

.site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--color-light-gray);
    border-top: 1px solid var(--color-border);
    padding: 20px 0;
    z-index: 100;
}

.site-footer__content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-footer__links {
    display: flex;
    gap: 20px;
}

.site-footer__link {
    color: var(--color-dark-gray);
    text-decoration: none;
    font-size: 0.875rem;
    transition: opacity 0.3s ease;
}

.site-footer__link:hover {
    opacity: 0.7;
}

.site-footer__copyright {
    font-size: 0.75rem;
    color: #666666;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 768px) {
    .site-header {
        transition: opacity 0.2s ease;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        will-change: opacity;
    }
    
    .site-header__content {
        padding: 0 20px;
    }
    
    .site-header__title {
        font-size: 2rem;
    }
    
    .site-header__subtitle {
        font-size: 0.8rem;
    }
    
    .site-header__info {
        gap: 20px;
    }
    
    .main-content {
        margin-top: 140px;
        margin-left: 20px;
        margin-right: 20px;
        width: calc(100% - 40px);
        overflow: visible;
    }
    
    .segment {
        min-height: 60px;
    }
    
    .segment--collapsed {
        min-height: 60px;
        max-height: 60px;
    }
    
    .segment__header {
        padding: 0 20px;
        height: 60px;
        min-height: 48px; /* Minimum touch target size */
    }
    
    .segment__header::before {
        right: 60px;
        font-size: 9px;
        opacity: 0;
    }
    
    .segment--collapsed .segment__header:hover::before {
        opacity: 0.4;
    }
    
    .segment__content {
        padding: 30px 20px;
        padding-top: 120px;
        min-height: auto;
        max-height: none;
        overflow: visible;
    }
    
    .segment__title {
        font-size: 12px;
    }
    
    .segment__divider {
        margin: 0 20px;
    }
    
    .site-footer__content {
        padding: 0 20px;
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .enneadtab-wiki {
        margin-top: 0.75rem;
    }
    
    .enneadtab-wiki a {
        font-size: 0.8rem;
    }
    
    .award-item {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .award-item__year {
        margin-left: 0;
    }
    
    .content-item, .contact-item, .trivia-item {
        margin-bottom: 1.5rem;
        padding-bottom: 1rem;
    }
    
    .content-item__title, .contact-item__title, .trivia-item__title {
        font-size: 1.1rem;
    }
    
    .content-item__description, .contact-item__description, .trivia-item__description {
        font-size: 0.9rem;
    }
    
    .contact-item__meta {
        font-size: 0.9rem;
    }
    
    .content-item__meta {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .content-item__meta .company {
        font-weight: 500;
    }
    
    .content-item__meta .location-dates {
        font-size: 0.85rem;
        color: rgb(120, 120, 120);
    }
    
    .segment__expand-icon {
        font-size: 20px;
        width: 44px; /* Larger touch target */
        height: 44px;
        margin: -12px; /* Negative margin to maintain visual size */
        color: rgb(130, 130, 130);
    }
    
    .segment:hover .segment__expand-icon {
        color: rgb(110, 110, 110);
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .main-content {
        margin-top: 130px;
    }
    
    .site-header__title {
        font-size: 1.75rem;
    }
    
    .site-header__subtitle {
        font-size: 0.75rem;
    }
    
    .segment__header {
        padding: 0 15px;
    }
    
    .segment__content {
        padding: 20px 15px;
        padding-top: 110px;
        min-height: auto;
        max-height: none;
        overflow: visible;
    }
    
    .segment__text {
        font-size: 14px;
    }
    
    .content-item__title, .contact-item__title, .trivia-item__title {
        font-size: 1rem;
    }
    
    .content-item__description, .contact-item__description, .trivia-item__description {
        font-size: 0.85rem;
    }
    
    .contact-item__meta {
        font-size: 0.85rem;
    }
    
    .content-item__meta {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .content-item__meta .company {
        font-weight: 500;
    }
    
    .content-item__meta .location-dates {
        font-size: 0.8rem;
        color: rgb(120, 120, 120);
    }
}

/* ==========================================================================
   SPECIAL INTERACTIVE ELEMENTS
   ========================================================================== */

/* Color showcase functionality */
.color-showcase {
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: underline;
    text-decoration-style: dotted;
}



/* Desktop hover effect - changes entire page background */
@media (hover: hover) and (pointer: fine) {
    /* Desktop cursor styles - improved for better UX */
    .segment__header {
        cursor: pointer;
    }
    
    .segment {
        cursor: default;
    }
    
    /* Color showcase hover effects for desktop */
    .color-showcase {
        cursor: pointer;
    }
    
    .color-showcase:hover {
        font-weight: 500;
        transition: all 0.3s ease;
    }
    
    /* Color showcase hover effect - background will be handled by JavaScript */
    .color-showcase:hover {
        font-weight: 500;
        transition: all 0.3s ease;
    }
    
    /* CSS class for when color showcase is hovered */
    .website-background-green {
        background-color: #4b5e35 !important;
        transition: background-color 0.3s ease;
    }
    
    .website-background-green .site-header,
    .website-background-green .site-footer {
        background-color: #4b5e35 !important;
        transition: background-color 0.3s ease;
    }
    
    /* Interactive elements cursor improvements */
    .project-link {
        cursor: pointer;
    }
    
    .internal-link {
        cursor: pointer;
    }
    
    .work-link {
        cursor: pointer;
    }
    
    .site-header__link {
        cursor: pointer;
    }
    
    .site-footer__link {
        cursor: pointer;
    }
}

/* Mobile display - show hex and RGB values */
.color-values {
    display: none;
    font-size: 0.8em;
    font-weight: 400;
    opacity: 0.8;
    color: #666666;
}

/* Show color values on mobile/touch devices */
@media (hover: none) and (pointer: coarse) {
    .color-values {
        display: inline;
    }
    
    /* Disable hover effects on mobile */
    .color-showcase:hover {
        font-weight: normal;
        transform: none;
        box-shadow: none;
    }
}

/* ==========================================================================
   DARK MODE SUPPORT
   ========================================================================== */

/* Dark mode disabled - using light theme only for consistency */

/* ==========================================================================
   SELECTED WORKS GRID
   ========================================================================== */

.selected-works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 1.5rem;
    /* Ensure proper rendering across all browsers */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
}

.selected-work-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: var(--color-light-gray);
    border: 1px solid var(--color-border);
}

.selected-work-item:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Touch-friendly improvements for mobile */
@media (hover: none) and (pointer: coarse) {
    .selected-work-item:hover {
        transform: none;
        box-shadow: none;
    }
    
    .selected-work-item:active {
        transform: scale(1.01);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }
    
    .selected-work-item:hover .work-image {
        transform: none;
    }
    
    .selected-work-item:active .work-image {
        transform: scale(1.01);
    }
    
    /* Improve touch targets */
    .work-link {
        min-height: 44px;
        touch-action: manipulation;
    }
    
    /* Optimize image loading for mobile */
    .work-image {
        will-change: transform;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

.work-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.work-image-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 80%; /* 5:4 aspect ratio */
    overflow: hidden;
    border-radius: 8px 8px 0 0;
    /* Cross-platform compatibility */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* Prevent layout shifts */
    contain: layout style paint;
}

.work-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
    position: absolute;
    top: 0;
    left: 0;
    /* Cross-platform image rendering */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* Prevent image distortion */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
    /* Fallback for older browsers */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    /* Loading optimization */
    will-change: transform;
    /* Prevent layout shifts */
    contain: layout style paint;
}

.work-image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #666;
    font-size: 1rem;
    font-weight: 500;
    display: none;
    border: 2px dashed #ccc;
}

.work-image-placeholder small {
    display: block;
    font-size: 0.8rem;
    color: #999;
    margin-top: 0.5rem;
}

.selected-work-item:hover .work-image {
    transform: scale(1.03);
}

.work-caption {
    padding: 1rem;
    background: var(--color-light-gray);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-dark-gray);
    text-align: center;
    border-top: 1px solid var(--color-border);
}

/* ==========================================================================
   CROSS-PLATFORM RESPONSIVE DESIGN
   ========================================================================== */

/* High-DPI Displays (Retina, 4K, etc.) */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .work-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Safari-specific fixes */
@supports (-webkit-appearance: none) {
    .work-image-container {
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
    }
    
    .work-image {
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
    }
}

/* Firefox-specific fixes */
@-moz-document url-prefix() {
    .work-image {
        image-rendering: -moz-crisp-edges;
    }
}

/* Edge/IE specific fixes */
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
    .work-image-container {
        transform: none;
    }
    
    .work-image {
        transform: none;
    }
}

/* Large Desktop (4K and above) */
@media (min-width: 2560px) {
    .selected-works-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 3rem;
        max-width: 2000px;
        margin: 2rem auto 0;
    }
    
    .work-image-container {
        padding-bottom: 75%;
    }
}

/* Standard Desktop */
@media (min-width: 1200px) and (max-width: 2559px) {
    .selected-works-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2.5rem;
    }
}

/* Small Desktop / Large Tablet */
@media (min-width: 769px) and (max-width: 1199px) {
    .selected-works-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    .work-image-container {
        padding-bottom: 78%;
    }
}

/* Tablet Portrait */
@media (min-width: 481px) and (max-width: 768px) {
    .selected-works-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-top: 1rem;
    }
    
    .work-image-container {
        padding-bottom: 75%;
    }
    
    .work-image {
        height: 100%;
    }
    
    .work-caption {
        padding: 0.75rem;
        font-size: 0.85rem;
    }
    
    .work-image-placeholder {
        font-size: 0.9rem;
    }
    
    .work-image-placeholder small {
        font-size: 0.75rem;
    }
}

/* Mobile Landscape */
@media (max-width: 480px) and (orientation: landscape) {
    .selected-works-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        margin-top: 0.75rem;
    }
    
    .work-image-container {
        padding-bottom: 65%;
    }
    
    .work-caption {
        padding: 0.5rem;
        font-size: 0.75rem;
    }
}

/* Mobile Portrait */
@media (max-width: 480px) and (orientation: portrait) {
    .selected-works-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-top: 0.75rem;
    }
    
    .work-image-container {
        padding-bottom: 70%;
    }
    
    .work-image {
        height: 100%;
    }
    
    .work-caption {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .work-image-placeholder {
        font-size: 0.85rem;
    }
    
    .work-image-placeholder small {
        font-size: 0.7rem;
    }
}

/* Ultra-wide screens */
@media (min-width: 2000px) {
    .selected-works-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2.5rem;
    }
}

/* Print styles */
@media print {
    .selected-works-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .work-image-container {
        padding-bottom: 70%;
        break-inside: avoid;
    }
    
    .selected-work-item {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .selected-work-item,
    .work-image {
        transition: none;
    }
    
    .selected-work-item:hover .work-image {
        transform: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .work-image-placeholder {
        background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
        color: #ccc;
        border-color: #555;
    }
    
    .work-image-placeholder small {
        color: #999;
    }
}

/* ==========================================================================
   IMAGE LOADING STATES AND ANIMATIONS
   ========================================================================== */

/* Loading state */
.work-image.image-loading {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Loaded state */
.work-image.image-loaded {
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Error state */
.work-image.image-error {
    opacity: 0;
}

/* Loading skeleton animation */
.work-image-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.work-image.image-loading + .work-image-container::before,
.work-image-container:has(.image-loading)::before {
    opacity: 1;
}

@keyframes loading-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Cross-browser loading animation support */
@supports not (animation: loading-shimmer 1.5s infinite) {
    .work-image-container::before {
        background: #f0f0f0;
        animation: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .work-image-placeholder {
        border-width: 3px;
        border-color: #000;
        background: #fff;
        color: #000;
    }
    
    .work-image-placeholder small {
        color: #333;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .work-image-container::before {
        animation: none;
    }
    
    .work-image {
        transition: none;
    }
}

/* ==========================================================================
   INTERNAL LINK STYLES
   ========================================================================== */

.internal-link {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease, text-decoration 0.3s ease;
    cursor: pointer;
}

.internal-link:hover {
    color: var(--color-dark-gray);
    text-decoration: underline;
}

.internal-link:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Touch-friendly improvements for mobile */
@media (hover: none) and (pointer: coarse) {
    .internal-link:hover {
        color: var(--color-accent);
        text-decoration: none;
    }
    
    .internal-link:active {
        color: var(--color-dark-gray);
        text-decoration: underline;
    }
} 