:root {
    --black: #111111;
    --black-soft: #1b1b1b;
    --white: #ffffff;
    --paper: #f7f7f5;
    --line: #e7e7e5;
    --muted: #747474;
    --red: #d71920;
    --red-dark: #b71117;
    --shadow: 0 12px 35px rgba(0, 0, 0, 0.08);
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--black);
    background: var(--paper);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

img {
    max-width: 100%;
}

button,
input,
select {
    font: inherit;
}

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

.container {
    width: min(1240px, calc(100% - 40px));
    margin-inline: auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    color: var(--white);
    background: rgba(17, 17, 17, 0.96);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(14px);
}

.header-inner {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.brand-flag {
    font-size: 26px;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 16px;
    letter-spacing: 0.02em;
}

.brand small {
    margin-top: 1px;
    color: #bcbcbc;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.header-badge {
    color: #d0d0d0;
    font-size: 12px;
}

.hero {
    color: var(--white);
    background:
        radial-gradient(circle at 85% 20%, rgba(215, 25, 32, 0.22), transparent 30%),
        linear-gradient(135deg, #111111, #252525);
}

.hero-content {
    padding: 72px 0 64px;
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--red);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.hero .eyebrow {
    color: #ff5a60;
}

.hero h1 {
    max-width: 800px;
    margin: 0;
    font-size: clamp(38px, 6vw, 72px);
    line-height: 0.98;
    letter-spacing: -0.045em;
}

.hero p:not(.eyebrow) {
    max-width: 620px;
    margin: 22px 0 30px;
    color: #c9c9c9;
    font-size: 18px;
}

.search-form {
    max-width: 780px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 62px;
    padding: 7px 8px 7px 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
}

.search-box > span {
    color: #cfcfcf;
    font-size: 25px;
}

.search-box input {
    min-width: 0;
    flex: 1;
    border: 0;
    outline: 0;
    color: white;
    background: transparent;
    font-size: 16px;
}

.search-box input::placeholder {
    color: #a7a7a7;
}

.search-box button,
.button,
.download-button {
    border: 0;
    cursor: pointer;
    font-weight: 800;
    transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.search-box button {
    min-height: 46px;
    padding: 0 22px;
    border-radius: 10px;
    color: white;
    background: var(--red);
}

.search-box button:hover,
.download-button:hover,
.button:hover {
    transform: translateY(-1px);
}

.search-box button:hover,
.download-button:hover {
    background: var(--red-dark);
}

.gallery-section {
    padding: 38px 0 72px;
}

.filters {
    display: flex;
    align-items: end;
    gap: 14px;
    margin-bottom: 36px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: white;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.03);
}

.filter-group {
    min-width: 220px;
}

.filter-group label {
    display: block;
    margin-bottom: 7px;
    color: #666;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.filter-group select {
    width: 100%;
    height: 45px;
    padding: 0 38px 0 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    outline: 0;
    color: var(--black);
    background: white;
}

.filter-group select:focus {
    border-color: #aaa;
}

.reset-filter {
    margin-left: auto;
    padding: 12px 4px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.reset-filter:hover {
    color: var(--red);
}

.gallery-toolbar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.gallery-toolbar h2 {
    margin: 0;
    font-size: 25px;
    letter-spacing: -0.02em;
}

.gallery-toolbar p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.page-indicator {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.masonry-grid {
    columns: 4 260px;
    column-gap: 18px;
}

.photo-card {
    display: inline-block;
    width: 100%;
    margin: 0 0 18px;
    overflow: hidden;
    break-inside: avoid;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: white;
    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.035);
}

.photo-frame {
    position: relative;
    overflow: hidden;
    background: #ececec;
}

.photo-frame img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 300ms ease;
}

.photo-link:hover .photo-frame img {
    transform: scale(1.025);
}

.photo-overlay {
    position: absolute;
    right: 10px;
    bottom: 10px;
    padding: 7px 10px;
    border-radius: 999px;
    color: white;
    background: rgba(0, 0, 0, 0.7);
    font-size: 11px;
    font-weight: 800;
    opacity: 0;
    transform: translateY(5px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.photo-link:hover .photo-overlay,
.photo-link:focus-visible .photo-overlay {
    opacity: 1;
    transform: translateY(0);
}

.photo-info {
    padding: 14px;
}

.photo-info h3 {
    overflow: hidden;
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.photo-info p {
    overflow: hidden;
    margin: 0 0 13px;
    color: var(--muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.photo-info p span {
    margin: 0 3px;
    color: #bbb;
}

.download-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 43px;
    padding: 0 12px;
    border-radius: 10px;
    color: white;
    background: var(--red);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.download-button span:first-child {
    font-size: 18px;
    line-height: 1;
}

.download-button.is-armed {
    color: white;
    background: var(--black);
}

.empty-state {
    padding: 70px 20px;
    text-align: center;
    border: 1px dashed #d5d5d5;
    border-radius: var(--radius);
    background: white;
}

.empty-icon {
    margin-bottom: 12px;
    font-size: 38px;
}

.empty-state h2,
.empty-state h1 {
    margin: 0 0 8px;
    font-size: 24px;
}

.empty-state p {
    margin: 0 0 22px;
    color: var(--muted);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
}

.button-dark {
    color: white;
    background: var(--black);
}

.button-light {
    color: var(--black);
    background: #f0f0ee;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-top: 30px;
}

.pagination a,
.pagination span {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 15px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 800;
}

.pagination a {
    color: white;
    background: var(--black);
}

.pagination span {
    color: var(--muted);
    background: white;
    border: 1px solid var(--line);
}

.site-footer {
    padding: 28px 0;
    border-top: 1px solid var(--line);
    color: var(--muted);
    background: white;
    font-size: 12px;
}

.detail-main {
    min-height: calc(100vh - 72px);
    padding: 35px 0 70px;
}

.back-link {
    display: inline-block;
    margin-bottom: 22px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.back-link:hover {
    color: var(--red);
}

.detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 28px;
    align-items: start;
}

.detail-image-wrap {
    overflow: hidden;
    border-radius: 18px;
    background: #111;
    box-shadow: var(--shadow);
}

.detail-image {
    display: block;
    width: 100%;
    height: auto;
    max-height: 78vh;
    object-fit: contain;
}

.detail-panel {
    position: sticky;
    top: 100px;
    padding: 25px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: white;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.05);
}

.detail-panel h1 {
    margin: 0 0 25px;
    font-size: 24px;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.detail-meta {
    margin-bottom: 22px;
    border-top: 1px solid var(--line);
}

.detail-meta div {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
}

.detail-meta span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-meta strong {
    font-size: 15px;
}

.download-button-large {
    min-height: 50px;
    margin-bottom: 10px;
}

.detail-panel .button-light {
    width: 100%;
}

.download-note {
    margin: 17px 0 0;
    color: #8a8a8a;
    font-size: 11px;
    line-height: 1.6;
}

.detail-error {
    margin-top: 35px;
}

@media (max-width: 1050px) {
    .masonry-grid {
        columns: 3 240px;
    }

    .detail-layout {
        grid-template-columns: minmax(0, 1fr) 300px;
    }
}

@media (max-width: 780px) {
    .container {
        width: min(100% - 28px, 700px);
    }

    .header-badge {
        display: none;
    }

    .hero-content {
        padding: 55px 0 48px;
    }

    .hero h1 {
        font-size: clamp(38px, 12vw, 58px);
    }

    .hero p:not(.eyebrow) {
        font-size: 16px;
    }

    .filters {
        align-items: stretch;
        flex-direction: column;
    }

    .filter-group {
        min-width: 0;
    }

    .reset-filter {
        margin-left: 0;
        padding-bottom: 0;
    }

    .masonry-grid {
        columns: 2 160px;
        column-gap: 10px;
    }

    .photo-card {
        margin-bottom: 10px;
        border-radius: 12px;
    }

    .photo-info {
        padding: 10px;
    }

    .photo-info p {
        margin-bottom: 10px;
    }

    .download-button {
        min-height: 40px;
        font-size: 10px;
    }

    .detail-layout {
        grid-template-columns: 1fr;
    }

    .detail-panel {
        position: static;
    }
}

@media (max-width: 480px) {
    .container {
        width: min(100% - 20px, 700px);
    }

    .brand small {
        font-size: 9px;
    }

    .search-box {
        padding-left: 14px;
    }

    .search-box button {
        padding-inline: 15px;
    }

    .gallery-section {
        padding-top: 25px;
    }

    .gallery-toolbar {
        align-items: start;
        flex-direction: column;
        gap: 4px;
    }

    .masonry-grid {
        columns: 2;
        column-gap: 8px;
    }

    .photo-card {
        margin-bottom: 8px;
    }

    .photo-info h3 {
        font-size: 12px;
    }

    .photo-info p {
        font-size: 10px;
    }

    .download-button span:first-child {
        font-size: 15px;
    }

    .download-button {
        min-height: 37px;
        padding-inline: 6px;
    }

    .detail-main {
        padding-top: 20px;
    }

    .detail-panel {
        padding: 18px;
    }
}
