:root {
    --max-width: 1180px;
}

body[data-theme="sand"] {
    --background: #f4f0e8;
    --surface: #ffffff;
    --surface-soft: #ebe4d8;
    --text: #221b16;
    --muted: #766d63;
    --line: #d8cec0;
    --accent: #8f7d66;
    --accent-soft: rgba(143, 125, 102, 0.22);
    --thumb-background: #ddd2c2;
    --shadow: 0 18px 45px rgba(32, 24, 17, 0.14);
}

body[data-theme="graphite"] {
    --background: #151515;
    --surface: #222222;
    --surface-soft: #2d2d2d;
    --text: #f2f2f2;
    --muted: #b6b6b6;
    --line: #3d3d3d;
    --accent: #ff0086;
    --accent-soft: rgba(255, 0, 134, 0.28);
    --thumb-background: #2d2d2d;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.42);
}

body[data-theme="forest"] {
    --background: #172019;
    --surface: #243127;
    --surface-soft: #304032;
    --text: #f1f6ef;
    --muted: #b7c7b5;
    --line: #435746;
    --accent: #91b58a;
    --accent-soft: rgba(145, 181, 138, 0.24);
    --thumb-background: #304032;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
}

body[data-theme="ocean"] {
    --background: #10212a;
    --surface: #18313d;
    --surface-soft: #214555;
    --text: #eef8fb;
    --muted: #b5cbd3;
    --line: #315d6d;
    --accent: #7fc7dd;
    --accent-soft: rgba(127, 199, 221, 0.24);
    --thumb-background: #214555;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
}

body[data-theme="wine"] {
    --background: #241216;
    --surface: #351b22;
    --surface-soft: #4a2530;
    --text: #fff3f4;
    --muted: #d6b8bd;
    --line: #673440;
    --accent: #d08a96;
    --accent-soft: rgba(208, 138, 150, 0.25);
    --thumb-background: #4a2530;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.36);
}

body[data-theme="light"] {
    --background: #f7f7f7;
    --surface: #ffffff;
    --surface-soft: #ededed;
    --text: #1e1e1e;
    --muted: #666666;
    --line: #d7d7d7;
    --accent: #555555;
    --accent-soft: rgba(85, 85, 85, 0.20);
    --thumb-background: #ededed;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--background);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

code {
    padding: 0.1rem 0.3rem;
    background: rgba(0, 0, 0, 0.07);
    border-radius: 0;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--background);
    border-bottom: 1px solid var(--line);
}

.site-header-inner {
    width: min(var(--max-width), calc(100% - 32px));
    margin: 0 auto;
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-title {
    font-size: 1.35rem;
    line-height: 1.1;
    letter-spacing: 0.02em;
    font-weight: 750;
}

.brand-subtitle {
    color: var(--muted);
    font-size: 0.92rem;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.main-nav a {
    height: 38px;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 0;
}

.main-nav a:hover {
    background: var(--surface-soft);
    border-color: var(--accent);
}

.theme-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 650;
}

.theme-label {
    color: var(--muted);
}

.theme-menu select {
    width: auto;
    min-width: 130px;
    height: 38px;
    padding: 0 10px;
}

body[data-theme="graphite"] .theme-label,
body[data-theme="graphite"] .field span {
    color: #ff0086;
}

.hero {
    padding: 56px 0 34px;
}

.hero-inner {
    width: min(var(--max-width), calc(100% - 32px));
    margin: 0 auto;
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.78rem;
    font-weight: 700;
}

h1 {
    max-width: 800px;
    margin: 0;
    font-size: clamp(2.2rem, 7vw, 4.8rem);
    line-height: 0.95;
    letter-spacing: -0.06em;
}

.intro {
    max-width: 660px;
    margin: 22px 0 0;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.6;
}

.toolbar {
    position: sticky;
    top: var(--header-height, 77px);
    z-index: 15;
    padding: 0 0 18px;
    background: var(--background);
    border-bottom: 1px solid var(--line);
}

.toolbar-inner {
    width: min(var(--max-width), calc(100% - 32px));
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(150px, 220px) minmax(120px, 160px) minmax(220px, 1fr);
    align-items: end;
    gap: 14px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 650;
}

.search-field {
    min-width: 220px;
}

select,
input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 0;
    font: inherit;
    outline: none;
}

select:hover,
input:hover {
    border-color: var(--accent);
}

select:focus,
input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

body[data-theme="graphite"] select,
body[data-theme="graphite"] input {
    border-color: #ff0086;
    background: #ff0086;
    color: #FFFFFF;
    font-weight: 700;
}

body[data-theme="graphite"] #searchInput::placeholder {
    color: #ffffff;
    opacity: 1;
    font-weight: 700;
}

body[data-theme="graphite"] select:hover,
body[data-theme="graphite"] input:hover {
    box-shadow: 0 0 0 2px rgba(255, 0, 134, 0.20);
}

body[data-theme="graphite"] select:focus,
body[data-theme="graphite"] input:focus {
    border-color: #ff0086;
    box-shadow: 0 0 0 3px rgba(255, 0, 134, 0.34);
}

.status {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 0.94rem;
}

.gallery-section {
    width: min(var(--max-width), calc(100% - 32px));
    margin: 26px auto 76px;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 14px;
}

.thumb {
    position: relative;
    display: block;
    width: 100%;
    height: 230px;
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    background: var(--thumb-background);
    border: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
    color: var(--text);
    font: inherit;
}

.thumb:hover {
    border-color: var(--accent);
}

.thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
    transform: scale(1);
    transition: transform 180ms ease, filter 180ms ease;
}

.thumb:hover img {
    transform: scale(1.035);
    filter: contrast(1.02);
}

.video-tile {
    width: 100%;
    height: 100%;
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 10px;
    background: linear-gradient(135deg, var(--surface-soft), var(--surface));
    text-align: left;
}

.video-symbol {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    color: #ffffff;
    background: var(--accent);
    border-radius: 0;
    font-size: 1.8rem;
    line-height: 1;
}

.video-name {
    color: var(--text);
    font-weight: 700;
    word-break: break-word;
}

.video-hint {
    color: var(--muted);
    font-size: 0.86rem;
}

.thumb-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 28px 10px 9px;
    color: #ffffff;
    text-align: left;
    font-size: 0.82rem;
    font-weight: 650;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.68), rgba(0, 0, 0, 0));
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
    border-radius: 0;
}

.media-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 4px 7px;
    color: #ffffff;
    background: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 0;
}

.empty-state {
    width: min(680px, calc(100% - 32px));
    margin: 40px auto 90px;
    padding: 32px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 0;
}

.empty-state h2 {
    margin: 0 0 10px;
}

.empty-state p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.hidden,
.hidden-media {
    display: none !important;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 88px 76px 54px;
    background: rgba(16, 12, 9, 0.94);
}

.lightbox.open {
    display: flex;
}

body.lightbox-open {
    overflow: hidden;
}

.lightbox-top {
    position: absolute;
    left: 24px;
    right: 24px;
    top: 18px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    color: #ffffff;
}

.lightbox-title {
    font-size: 1rem;
    font-weight: 750;
    word-break: break-word;
}

.lightbox-meta {
    margin-top: 3px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.9rem;
}

.lightbox-button {
    min-height: 42px;
    padding: 0 16px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 0;
    cursor: pointer;
    font: inherit;
}

.lightbox-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 0;
    box-shadow: var(--shadow);
}

.video-fallback {
    max-width: 620px;
    padding: 28px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 0;
    text-align: center;
}

.video-fallback a {
    display: inline-block;
    margin-top: 14px;
    padding: 11px 16px;
    color: #ffffff;
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 0;
}

.lightbox-arrow {
    position: absolute;
    top: 50%;
    width: 48px;
    height: 76px;
    transform: translateY(-50%);
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 0;
    cursor: pointer;
    font-size: 3rem;
    line-height: 1;
}

.lightbox-arrow:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.lightbox-arrow:disabled {
    opacity: 0.3;
    cursor: default;
}

.lightbox-arrow-left {
    left: 18px;
}

.lightbox-arrow-right {
    right: 18px;
}

.site-footer {
    width: min(var(--max-width), calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 46px;
    color: var(--muted);
    border-top: 1px solid var(--line);
}

.site-footer p {
    margin: 0;
}

@media (max-width: 980px) {
    .toolbar-inner {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .status {
        grid-column: 1 / -1;
    }
}

@media (max-width: 760px) {
    .site-header-inner {
        min-height: 48px;
        flex-wrap: wrap;
        padding: 8px 0;
        align-items: center;
        flex-direction: row;
        gap: 10px;
    }

    .brand {
        gap: 0;
        min-width: 0;
    }

    .brand-title {
        font-size: 1rem;
        line-height: 1.05;
    }

    .brand-subtitle {
        display: none;
    }

    .main-nav {
        width: auto;
        margin-left: auto;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
    }

    .main-nav a {
        height: 32px;
        padding: 0 8px;
        font-size: 0.9rem;
    }

    .theme-menu {
        width: auto;
        display: flex;
        align-items: center;
        flex-direction: row;
        gap: 6px;
        font-size: 0.8rem;
    }

    .theme-label {
        display: none;
    }

    .theme-menu select {
        width: auto;
        min-width: 96px;
        max-width: 110px;
        height: 32px;
        padding: 0 6px;
        font-size: 0.82rem;
    }

    .hero {
        padding: 34px 0 24px;
    }


.toolbar {
    position: sticky;
    top: var(--header-height, 49px);
    z-index: 14;
    padding: 8px 0 10px;
    background: var(--background);
    border-bottom: 1px solid var(--line);
}

.toolbar-inner {
    width: min(var(--max-width), calc(100% - 20px));
    grid-template-columns: minmax(90px, 1fr) minmax(86px, 0.8fr) minmax(120px, 1.4fr);
    gap: 8px;
    align-items: end;
}

.field {
    gap: 4px;
    font-size: 0.74rem;
}

select,
input {
    height: 34px;
    padding: 0 7px;
    font-size: 0.78rem;
}

.search-field {
    min-width: 0;
}

.status {
    grid-column: 1 / -1;
    font-size: 0.76rem;
    line-height: 1.25;
}

    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }

    .thumb {
        height: 180px;
    }

    .lightbox {
        padding: 86px 48px 48px;
    }

    .lightbox-arrow {
        width: 38px;
        height: 62px;
        font-size: 2.2rem;
    }

    .lightbox-arrow-left {
        left: 6px;
    }

    .lightbox-arrow-right {
        right: 6px;
    }
}

@media (max-width: 480px) {
    .gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .thumb {
        height: 150px;
    }

    .video-tile {
        padding: 12px;
    }

    .video-symbol {
        width: 42px;
        height: 42px;
        font-size: 1.4rem;
    }

    .lightbox {
        padding-left: 8px;
        padding-right: 8px;
    }

    .lightbox-top {
        left: 10px;
        right: 10px;
    }
}
