/* Gallery Styles - Editorial Minimalism */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Crimson+Text:ital,wght@0,400;0,600;0,700;1,400;1,600&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* CSS Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -moz-text-size-adjust: none;
    -webkit-text-size-adjust: none;
    text-size-adjust: none;
}

body,
h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
    margin-block-end: 0;
}

ul[role='list'],
ol[role='list'] {
    list-style: none;
}

body {
    min-height: 100vh;
    line-height: 1.5;
}

h1,
h2,
h3,
h4,
button,
input,
label {
    line-height: 1.1;
}

h1,
h2,
h3,
h4 {
    text-wrap: balance;
}

a:not([class]) {
    text-decoration-skip-ink: auto;
    color: currentColor;
}

img,
picture {
    max-width: 100%;
    display: block;
}

input,
button,
textarea,
select {
    font-family: inherit;
    font-size: inherit;
}

textarea:not([rows]) {
    min-height: 10em;
}

:target {
    scroll-margin-block: 5ex;
}

/* Design System - Editorial Minimalism */
:root {
    /* Color Palette - Warm, Editorial */
    --color-paper: #FFFEF9;
    --color-ink: #1C1917;
    --color-ink-light: #78716C;
    --color-ink-lighter: #A8A29E;
    --color-accent: #0F766E;
    --color-accent-light: #CCFBF1;
    --color-accent-dark: #134E4A;
    --color-border: rgba(28, 25, 23, 0.06);
    --color-shadow-sm: rgba(28, 25, 23, 0.04);
    --color-shadow-md: rgba(28, 25, 23, 0.08);
    --color-shadow-lg: rgba(28, 25, 23, 0.12);

    /* Typography */
    --font-serif: 'Crimson Text', 'Georgia', 'Times New Roman', serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;

    /* Spacing - 8px base grid */
    --space-2xs: 0.25rem;  /* 4px */
    --space-xs: 0.5rem;    /* 8px */
    --space-sm: 0.75rem;   /* 12px */
    --space-md: 1rem;      /* 16px */
    --space-lg: 1.5rem;    /* 24px */
    --space-xl: 2.5rem;    /* 40px */
    --space-2xl: 4rem;     /* 64px */
    --space-3xl: 6rem;     /* 96px */

    /* Sizes */
    --size-prose: 65ch;
    --size-content: 42rem;
    --size-gallery: 90rem;
    --size-full: 100%;

    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;

    /* Transitions */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-paper: #000000;
        --color-ink: #FAFAF9;
        --color-ink-light: #A8A29E;
        --color-ink-lighter: #78716C;
        --color-accent: #5EEAD4;
        --color-accent-light: rgba(94, 234, 212, 0.1);
        --color-accent-dark: #99F6E4;
        --color-border: rgba(250, 250, 249, 0.06);
        --color-shadow-sm: rgba(0, 0, 0, 0.2);
        --color-shadow-md: rgba(0, 0, 0, 0.3);
        --color-shadow-lg: rgba(0, 0, 0, 0.4);
    }

    .gallery {
        background: #000000;
    }

    .gallery-item {
        background: var(--color-paper);
        box-shadow:
            0 2px 8px var(--color-shadow-md),
            0 8px 24px var(--color-shadow-sm);
    }

    .gallery-item:hover {
        box-shadow:
            0 4px 16px var(--color-shadow-lg),
            0 16px 32px var(--color-shadow-md);
    }
}

/* Base Styles */
html {
    font-size: 18px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-paper);
    color: var(--color-ink);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    transition: var(--transition);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--color-accent);
    color: white;
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
    text-decoration: none;
    z-index: 1000;
    font-weight: 500;
    transition: var(--transition);
}

.skip-link:focus {
    top: 6px;
}

/* Navigation */
.nav-bar {
    position: sticky;
    top: 0;
    background-color: var(--color-paper);
    border-bottom: 1px solid var(--color-border);
    z-index: 100;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.nav-container {
    max-width: var(--size-gallery);
    margin: 0 auto;
    padding: var(--space-md) var(--space-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-title {
    display: flex;
    align-items: center;
}

.site-title h1 {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--color-ink);
    letter-spacing: 0.01em;
}

.nav-profile-image {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: var(--space-sm);
    border: 1px solid var(--color-border);
}

.nav-links {
    display: flex;
    gap: var(--space-lg);
    align-items: center;
}

.nav-links a {
    color: var(--color-ink-light);
    text-decoration: none;
    transition: var(--transition);
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
}

.nav-links a:hover {
    color: var(--color-accent);
    background-color: var(--color-accent-light);
}

.nav-links svg,
.nav-links i {
    width: 18px;
    height: 18px;
    display: block;
}

/* Gallery Header */
.gallery-header {
    max-width: var(--size-gallery);
    margin: 0 auto;
    padding: var(--space-3xl) var(--space-lg) var(--space-xl);
    text-align: center;
}

.gallery-header h1 {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    font-weight: 600;
    margin: 0 0 var(--space-md) 0;
    color: var(--color-ink);
    letter-spacing: 0.01em;
}

.gallery-header p {
    font-size: 1.1rem;
    color: var(--color-ink-light);
    margin: 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Tag Header (for tag index pages) */
.tag-header {
    max-width: var(--size-gallery);
    margin: 0 auto;
    padding: var(--space-2xl) var(--space-lg) var(--space-lg);
    text-align: center;
}

.tag-title {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    font-weight: 600;
    margin: 0 0 var(--space-xs) 0;
    color: var(--color-ink);
    letter-spacing: 0.01em;
}

.tag-title::before {
    content: '#';
    opacity: 0.4;
    margin-right: 0.25rem;
}

.tag-meta {
    font-size: 1rem;
    color: var(--color-ink-light);
    margin: 0;
    font-weight: 500;
}

/* Gallery Grid */
.gallery {
    width: 100vw;
    min-height: 100vh;
    padding: var(--space-md);
    background: var(--color-paper);
    overflow-x: hidden;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-sm);
    align-items: start;
    width: 100%;
    max-width: 1800px;
    margin: 0 auto;
    padding: var(--space-lg) 0;
}

/* Dynamic grid sizing based on viewport */
@media (min-width: 1400px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: var(--space-md);
    }
}

@media (min-width: 1800px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
        gap: var(--space-lg);
    }
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-md);
    background: var(--color-paper);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.1),
        0 8px 24px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    animation: fadeInUp 0.8s ease forwards;
    animation-fill-mode: both;
    aspect-ratio: var(--aspect-ratio, 1);

    /* Performance optimizations */
    will-change: transform, box-shadow;
    contain: layout style paint;

    /* Accessibility improvements */
    outline: none;
}

/* Focus styles for keyboard navigation */
.gallery-item:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 4px;
}

.gallery-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.15),
        0 16px 32px rgba(0, 0, 0, 0.12);
}

.gallery-item picture {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);

    /* Performance optimizations */
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
}

.gallery-item:hover img {
    transform: scale(1.05);
}

/* Create sophisticated staggered animation delay for masonry flow */
.gallery-item:nth-child(3n + 1) {
    animation-delay: 0.1s;
}

.gallery-item:nth-child(3n + 2) {
    animation-delay: 0.2s;
}

.gallery-item:nth-child(3n + 3) {
    animation-delay: 0.3s;
}

.gallery-item:nth-child(7n + 1) {
    animation-delay: 0.15s;
}

.gallery-item:nth-child(7n + 2) {
    animation-delay: 0.25s;
}

.gallery-item:nth-child(7n + 3) {
    animation-delay: 0.35s;
}

.gallery-item:nth-child(7n + 4) {
    animation-delay: 0.45s;
}

.gallery-item:nth-child(7n + 5) {
    animation-delay: 0.55s;
}

.gallery-item:nth-child(7n + 6) {
    animation-delay: 0.65s;
}

.gallery-item:nth-child(7n + 7) {
    animation-delay: 0.75s;
}

/* Additional natural flow delays */
.gallery-item:nth-child(11n + 1),
.gallery-item:nth-child(13n + 1),
.gallery-item:nth-child(17n + 1) {
    animation-delay: 0.05s;
}

.gallery-item:nth-child(11n + 5),
.gallery-item:nth-child(13n + 7),
.gallery-item:nth-child(17n + 11) {
    animation-delay: 0.85s;
}

/* Fade-in animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Dynamic aspect ratio classes for masonry effect */
.gallery-item[data-aspect-ratio*='0.75'] {
    aspect-ratio: 3/4;
}

/* Portrait */
.gallery-item[data-aspect-ratio*='1.33'] {
    aspect-ratio: 4/3;
}

/* Landscape */
.gallery-item[data-aspect-ratio*='1.77'] {
    aspect-ratio: 16/9;
}

/* Widescreen */
.gallery-item[data-aspect-ratio*='1.00'] {
    aspect-ratio: 1/1;
}

/* Square */
.gallery-item[data-aspect-ratio*='0.66'] {
    aspect-ratio: 2/3;
}

/* Tall portrait */
.gallery-item[data-aspect-ratio*='1.50'] {
    aspect-ratio: 3/2;
}

/* Classic photo */

/* Panoramic images get special treatment */
.gallery-item[data-aspect-ratio*='2.'] {
    aspect-ratio: 2/1;
    grid-column: span 2;
}

/* Extra large portrait images */
.gallery-item[data-aspect-ratio*='0.5'],
.gallery-item[data-aspect-ratio*='0.6'] {
    aspect-ratio: 3/5;
}

/* Wide landscape images */
.gallery-item[data-aspect-ratio*='1.8'],
.gallery-item[data-aspect-ratio*='1.9'] {
    aspect-ratio: 16/9;
}

@media (max-width: 768px) {
    .gallery-item[data-aspect-ratio*='2.'] {
        grid-column: span 1;
        aspect-ratio: 16/9;
    }
}

/* Image Overlay */
.gallery-item figcaption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-md);
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    opacity: 0;
    transition: var(--transition);
    transform: translateY(10px);
}

.gallery-item:hover figcaption {
    opacity: 1;
    transform: translateY(0);
}

.gallery-item figcaption h2 {
    margin: 0 0 var(--space-xs) 0;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: var(--font-serif);
}

.gallery-item figcaption p {
    margin: 0;
    font-size: 0.85rem;
    opacity: 0.9;
    line-height: 1.4;
}

/* Legacy Header Styles (for backwards compatibility) */
header {
    padding: var(--space-md);
}

header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: var(--size-gallery);
    margin: 0 auto;
}

.back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    background-color: var(--color-paper);
    border: 1px solid var(--color-border);
    border-radius: 50%;
    text-decoration: none;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.back-link:hover {
    background-color: var(--color-accent-light);
    transform: scale(1.05);
    border-color: var(--color-accent);
}

.back-link i {
    font-size: 1.2rem;
    color: var(--color-ink);
}

.rss-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    background-color: var(--color-paper);
    border: 1px solid var(--color-border);
    border-radius: 50%;
    text-decoration: none;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.rss-link:hover {
    background-color: var(--color-accent-light);
    transform: scale(1.05);
    border-color: var(--color-accent);
}

.rss-link i {
    font-size: 1.2rem;
    color: var(--color-ink);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(8px);
    overflow: hidden;
    transition: var(--transition);
}

.modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 80%;
    object-fit: contain;
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: none;
    border-radius: var(--radius-md);
    box-shadow: 0 0 40px rgba(255, 255, 255, 0.1);
    transition: var(--transition);
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -48%);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.close-modal {
    position: absolute;
    top: var(--space-md);
    right: var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    text-decoration: none;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    cursor: pointer;
    color: var(--color-ink);
    font-size: 1.4rem;
    border: none;
}

.close-modal:hover,
.close-modal:focus {
    background-color: #ffffff;
    transform: scale(1.05);
    color: var(--color-ink);
}

#modalCaption {
    position: absolute;
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 800px;
    text-align: center;
    color: white;
    background-color: rgba(0, 0, 0, 0.8);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0.95;
    transition: var(--transition);
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.9);
    color: var(--color-ink);
    border: none;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.prev-btn {
    left: var(--space-lg);
}

.next-btn {
    right: var(--space-lg);
}

.nav-btn:hover {
    background-color: #ffffff;
    transform: translateY(-50%) scale(1.05);
}

/* Dark Room mode styles */
.dark-room-mode .close-modal,
.dark-room-mode .nav-btn,
.dark-room-mode #modalCaption,
.dark-room-mode .dark-room-toggle,
.dark-room-mode .permalink-btn {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.dark-room-mode {
    transition: cursor 0.5s ease;
}

.dark-room-mode:hover .close-modal,
.dark-room-mode:hover .nav-btn,
.dark-room-mode:hover #modalCaption,
.dark-room-mode:hover .dark-room-toggle,
.dark-room-mode:hover .permalink-btn {
    opacity: 0.8;
    pointer-events: auto;
}

/* Dark room toggle button */
.dark-room-toggle {
    position: absolute;
    top: var(--space-md);
    left: var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    text-decoration: none;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    cursor: pointer;
    color: var(--color-ink);
    font-size: 1rem;
    border: none;
}

.dark-room-toggle:hover,
.dark-room-toggle:focus {
    background-color: #ffffff;
    transform: scale(1.05);
    color: var(--color-ink);
}

.dark-room-toggle i {
    transition: var(--transition);
}

.dark-room-mode .dark-room-toggle {
    background-color: rgba(50, 50, 50, 0.8);
    color: #fff;
}

.dark-room-mode .dark-room-toggle:hover {
    background-color: rgba(80, 80, 80, 0.9);
}

.dark-room-mode .dark-room-toggle i {
    transform: rotate(180deg);
}

/* Permalink button */
.permalink-btn {
    position: absolute;
    top: var(--space-md);
    left: calc(var(--space-lg) + 50px);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    text-decoration: none;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    cursor: pointer;
    color: var(--color-ink);
    font-size: 1rem;
    border: none;
}

.permalink-btn:hover,
.permalink-btn:focus {
    background-color: #ffffff;
    transform: scale(1.05);
    color: var(--color-ink);
}

/* EXIF metadata styles */
.image-metadata {
    display: block;
    margin-top: var(--space-sm);
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    font-style: normal;
}

.image-metadata .camera,
.image-metadata .date {
    display: inline-block;
    margin: 0 var(--space-xs);
}

.image-metadata i {
    margin-right: var(--space-xs);
    opacity: 0.7;
}

/* PWA Styles */
#online-status {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    background-color: #ef4444;
    color: white;
    display: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#online-status.offline {
    display: block;
}

#cache-refresh-notification {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    background-color: var(--color-accent);
    color: white;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    display: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .gallery {
        padding: var(--space-sm);
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: var(--space-sm);
        max-width: 1200px;
    }

    .gallery-header h1 {
        font-size: 2.2rem;
    }

    .gallery-item[data-aspect-ratio*='2.'] {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    html {
        font-size: 16px;
    }

    .nav-container {
        padding: var(--space-md) var(--space-md);
    }

    .nav-links {
        gap: var(--space-md);
    }

    .gallery-header {
        padding: var(--space-2xl) var(--space-md) var(--space-lg);
    }

    .gallery-header h1 {
        font-size: 2rem;
    }

    .tag-header {
        padding: var(--space-xl) var(--space-md) var(--space-md);
    }

    .tag-title {
        font-size: 2rem;
    }

    .gallery {
        padding: 0 var(--space-md) var(--space-2xl);
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: var(--space-xs);
        padding: var(--space-md) 0;
    }

    .nav-btn {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .close-modal {
        font-size: 1.3rem;
    }

    #modalCaption {
        font-size: 0.9rem;
        padding: var(--space-sm);
    }

    header {
        padding: var(--space-sm);
    }

    .back-link,
    .rss-link {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
    }
}

@media (max-width: 640px) {
    .nav-container {
        flex-direction: column;
        gap: var(--space-md);
        text-align: center;
    }

    .nav-links {
        justify-content: center;
    }

    .gallery-header h1 {
        font-size: 1.8rem;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: var(--space-xs);
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
        padding: var(--space-sm) 0;
    }

    .gallery-item {
        aspect-ratio: 4/3;
    }

    .gallery-header h1 {
        font-size: 1.6rem;
    }
}

/* Touch device optimizations */
@media (hover: none) {
    .gallery-item figcaption {
        opacity: 1;
        background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
        transform: translateY(0);
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .gallery-item {
        opacity: 1;
        transform: none;
        animation: none;
    }

    .gallery-item:hover {
        transform: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .gallery-item {
        border: 2px solid;
        box-shadow: none;
    }

    .gallery-item:hover {
        box-shadow: 0 0 0 4px var(--color-accent);
    }
}

/* Print styles */
@media print {
    .gallery {
        background: white;
    }

    .gallery-item {
        break-inside: avoid;
        animation: none;
        opacity: 1;
        transform: none;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    }
}

/* Focus States */
.nav-links a:focus-visible,
.gallery-item:focus-visible,
.back-link:focus-visible,
.rss-link:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Print Styles */
@media print {

    .nav-bar,
    .back-link,
    .rss-link,
    .modal,
    #online-status,
    #cache-refresh-notification {
        display: none;
    }

    .gallery {
        padding: 0;
    }

    .gallery-item {
        break-inside: avoid;
    }
}
