:root {
    --bg: #0a0a0c;
    --bg-soft: #0f0f12;
    --surface: #141418;
    --surface-2: #1a1a20;
    --text: #f3efe7;
    --muted: #96918a;
    --accent: #c9a86a;
    --accent-soft: rgba(201, 168, 106, 0.16);
    --line: rgba(243, 239, 231, 0.12);
    --line-strong: rgba(243, 239, 231, 0.24);
    --danger: #e4897d;
    --success: #9fc6a4;
    --radius: 8px;
    --gap: clamp(14px, 2vw, 24px);
    --page: 1320px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(1200px 600px at 50% -20%, rgba(201, 168, 106, 0.09), transparent 65%),
        var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

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

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

button,
input,
textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

ul {
    list-style: none;
}

[hidden] {
    display: none !important;
}

::selection {
    background: var(--accent);
    color: #14110a;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.grain {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

.eyebrow {
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

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

.site-header {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    max-width: var(--page);
    margin: 0 auto;
    padding: 26px clamp(20px, 4vw, 56px);
}

.brand {
    display: inline-flex;
    align-items: baseline;
    gap: 9px;
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.3em;
    text-transform: uppercase;
}

.brand span {
    color: var(--accent);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.05rem;
    font-style: italic;
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: none;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: clamp(18px, 3vw, 34px);
    font-size: 0.78rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.site-nav a {
    color: var(--muted);
    transition: color 0.25s ease;
}

.site-nav a:hover {
    color: var(--text);
}

.hero {
    position: relative;
    z-index: 2;
    max-width: 900px;
    margin: 0 auto;
    padding: clamp(60px, 10vw, 120px) 24px clamp(48px, 7vw, 80px);
    text-align: center;
}

.hero h1 {
    margin: 18px 0 20px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.6rem, 6.5vw, 5rem);
    font-weight: 400;
    letter-spacing: -0.03em;
    line-height: 1.02;
}

.hero h1 em {
    color: var(--accent);
    font-style: italic;
}

.hero-copy {
    max-width: 460px;
    margin: 0 auto;
    color: var(--muted);
    font-size: 1rem;
}

.hero-rule {
    width: 1px;
    height: 54px;
    margin: 38px auto 0;
    background: linear-gradient(to bottom, var(--accent), transparent);
}

.home-view {
    position: relative;
    z-index: 2;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--gap);
    max-width: var(--page);
    margin: 0 auto;
    padding: 0 clamp(20px, 4vw, 56px);
}

.gallery-card {
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: 4 / 5;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    isolation: isolate;
}

.gallery-card::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(to top, rgba(6, 6, 8, 0.9) 0%, rgba(6, 6, 8, 0.18) 48%, transparent 75%);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.gallery-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 1s var(--ease), filter 0.5s ease;
}

.gallery-card:hover img,
.gallery-card:focus-visible img {
    transform: scale(1.045);
}

.gallery-card:hover::after,
.gallery-card:focus-visible::after {
    opacity: 1;
}

.card-empty {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: var(--line-strong);
    font-family: Georgia, serif;
    font-size: 3rem;
    background:
        radial-gradient(circle at 30% 20%, rgba(201, 168, 106, 0.16), transparent 60%),
        var(--surface-2);
}

.card-count {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 3;
    padding: 5px 11px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    background: rgba(8, 8, 10, 0.5);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    font-size: 0.64rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.card-overlay {
    position: absolute;
    inset: auto 0 0 0;
    z-index: 2;
    padding: clamp(18px, 2.4vw, 28px);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.45s ease, transform 0.45s var(--ease);
}

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

.card-overlay h2 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.3rem, 2vw, 1.7rem);
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.card-overlay p {
    margin-top: 5px;
    color: rgba(243, 239, 231, 0.72);
    font-size: 0.86rem;
}

.grid-status {
    max-width: var(--page);
    margin: 0 auto;
    padding: 38px 24px 10px;
    color: var(--muted);
    font-size: 0.78rem;
    letter-spacing: 0.14em;
    text-align: center;
    text-transform: uppercase;
}

.grid-status:empty {
    display: none;
}

.grid-status.is-error {
    color: var(--danger);
    letter-spacing: 0.04em;
    text-transform: none;
}

.grid-status.is-empty {
    padding: 70px 24px;
    font-family: Georgia, serif;
    font-size: 1.4rem;
    font-style: italic;
    letter-spacing: 0;
    text-transform: none;
}

.grid-sentinel {
    height: 1px;
}

.gallery-view {
    position: relative;
    z-index: 2;
    max-width: var(--page);
    margin: 0 auto;
    padding: 10px clamp(20px, 4vw, 56px) 40px;
}

.back-link {
    display: inline-block;
    margin-bottom: clamp(28px, 4vw, 46px);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    transition: color 0.25s ease;
}

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

.gallery-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: clamp(26px, 4vw, 48px);
    padding-bottom: clamp(22px, 3vw, 34px);
    border-bottom: 1px solid var(--line);
}

.gallery-head h2 {
    margin: 8px 0 6px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.1rem, 5vw, 3.8rem);
    font-weight: 400;
    letter-spacing: -0.03em;
    line-height: 1.05;
}

.gallery-subtitle {
    color: var(--muted);
    font-size: 0.98rem;
}

.gallery-count {
    flex-shrink: 0;
    padding-bottom: 6px;
    color: var(--muted);
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.photo-grid {
    columns: 3;
    column-gap: var(--gap);
}

.photo-tile {
    display: block;
    width: 100%;
    margin: 0 0 var(--gap);
    padding: 0;
    overflow: hidden;
    break-inside: avoid;
    background: var(--surface);
    border: 0;
    border-radius: var(--radius);
    cursor: zoom-in;
}

.photo-tile img {
    width: 100%;
    height: auto;
    transition: transform 0.9s var(--ease), opacity 0.4s ease;
}

.photo-tile:hover img,
.photo-tile:focus-visible img {
    transform: scale(1.025);
    opacity: 0.94;
}

.gallery-end {
    padding: 44px 0 10px;
    color: var(--line-strong);
    font-family: Georgia, serif;
    font-size: 1.1rem;
    font-style: italic;
    letter-spacing: 0.3em;
    text-align: center;
}

.site-footer {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: var(--page);
    margin: clamp(50px, 8vw, 100px) auto 0;
    padding: 26px clamp(20px, 4vw, 56px) 34px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.76rem;
}

.footer-admin {
    color: var(--muted);
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    transition: color 0.25s ease;
}

.footer-admin:hover {
    color: var(--accent);
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 64px clamp(76px, 9vw, 124px) 72px clamp(48px, 8vw, 110px);
    background: rgba(5, 5, 7, 0.97);
    opacity: 0;
    touch-action: none;
    transition: opacity 0.25s ease;
}

.lightbox.open {
    opacity: 1;
}

.lightbox:focus {
    outline: none;
}

body.lb-open {
    overflow: hidden;
}

.lb-figure {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    max-width: 100%;
    max-height: 100%;
}

.lb-figure img {
    max-width: 100%;
    max-height: 82vh;
    border-radius: 3px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
    object-fit: contain;
    touch-action: manipulation;
    user-select: none;
}

.lb-close {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text);
    font-size: 2rem;
    font-weight: 200;
    line-height: 1;
    transition: color 0.2s ease, background 0.2s ease;
}

.lb-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--accent);
}

.lb-nav {
    position: absolute;
    top: 50%;
    width: 48px;
    height: 64px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(20, 20, 24, 0.5);
    color: var(--text);
    font-size: 1.7rem;
    line-height: 1;
    transform: translateY(-50%);
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.lb-nav:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(201, 168, 106, 0.08);
}

.lb-prev {
    left: 16px;
}

.lb-next {
    right: 16px;
}

.lb-counter {
    position: absolute;
    bottom: 18px;
    left: 50%;
    z-index: 4;
    color: var(--muted);
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    transform: translateX(-50%);
}

.lb-hint {
    position: absolute;
    bottom: 42px;
    left: 50%;
    z-index: 4;
    color: rgba(150, 145, 138, 0.7);
    font-size: 0.58rem;
    letter-spacing: 0.12em;
    text-align: center;
    text-transform: uppercase;
    transform: translateX(-50%);
    white-space: nowrap;
}

.lb-actions {
    position: absolute;
    right: clamp(10px, 2vw, 24px);
    bottom: clamp(78px, 12vh, 124px);
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.lb-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 54px;
    padding: 8px 4px 6px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(18, 18, 22, 0.68);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: var(--text);
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.lb-action:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
}

.lb-action svg {
    width: 23px;
    height: 23px;
    fill: currentColor;
}

#lb-share svg {
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.6;
}

.lb-action.is-liked {
    border-color: rgba(255, 77, 109, 0.5);
    background: rgba(255, 77, 109, 0.1);
    color: #ff5c7a;
}

.lb-action-count,
.lb-action-label {
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    line-height: 1.2;
}

.lb-burst {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.lb-burst svg {
    width: 130px;
    height: 130px;
    fill: #ff5c7a;
    filter: drop-shadow(0 10px 30px rgba(255, 77, 109, 0.35));
    opacity: 0;
    transform: scale(0.4);
}

.lb-burst.is-on svg {
    animation: lb-burst 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes lb-burst {
    0% {
        opacity: 0;
        transform: scale(0.4);
    }
    25% {
        opacity: 1;
        transform: scale(1.15);
    }
    60% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(1.3);
    }
}

.lb-toast {
    position: absolute;
    bottom: 78px;
    left: 50%;
    z-index: 7;
    padding: 8px 15px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(18, 18, 22, 0.94);
    color: var(--text);
    font-size: 0.7rem;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    white-space: nowrap;
}

.lb-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    line-height: 1.2;
    text-transform: uppercase;
    transition: background 0.22s ease, border-color 0.22s ease, color 0.22s ease, opacity 0.2s ease;
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #17130b;
}

.btn-primary:hover:not(:disabled) {
    background: #dcc08b;
    border-color: #dcc08b;
}

.btn-ghost {
    border-color: var(--line);
    color: var(--text);
}

.btn-ghost:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.66rem;
}

.btn-block {
    width: 100%;
}

.inline-form {
    display: inline;
}

.admin-page {
    background:
        radial-gradient(900px 500px at 15% -10%, rgba(201, 168, 106, 0.08), transparent 60%),
        var(--bg);
}

.admin-shell {
    max-width: 1560px;
    margin: 0 auto;
}

.admin-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px clamp(16px, 3vw, 34px);
    border-bottom: 1px solid var(--line);
    background: rgba(10, 10, 12, 0.86);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.admin-brand {
    font-size: 0.84rem;
    font-weight: 600;
    letter-spacing: 0.28em;
    text-transform: uppercase;
}

.admin-brand span {
    color: var(--accent);
    font-family: Georgia, serif;
    font-size: 1rem;
    font-style: italic;
    font-weight: 400;
    letter-spacing: 0.03em;
    text-transform: none;
}

.admin-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: clamp(16px, 2vw, 26px);
    padding: clamp(16px, 2.4vw, 30px);
    align-items: start;
}

.admin-sidebar {
    position: sticky;
    top: 88px;
    max-height: calc(100vh - 116px);
    overflow-y: auto;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.sidebar-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.sidebar-head h2,
.editor-head h2 {
    margin-top: 5px;
    font-family: Georgia, serif;
    font-size: 1.55rem;
    font-weight: 400;
    letter-spacing: -0.01em;
}

.count-pill {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.66rem;
    vertical-align: middle;
}

.sidebar-empty {
    padding: 18px 4px;
    color: var(--muted);
    font-size: 0.84rem;
}

.admin-gallery-list li {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 0;
    border-top: 1px solid var(--line);
}

.admin-thumb {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 5px;
    object-fit: cover;
    background: var(--surface-2);
}

.admin-thumb-empty {
    display: grid;
    place-items: center;
    color: var(--line-strong);
    font-family: Georgia, serif;
    font-size: 1.3rem;
}

.admin-gallery-meta {
    min-width: 0;
    flex: 1;
}

.admin-gallery-meta strong {
    display: block;
    overflow: hidden;
    font-family: Georgia, serif;
    font-size: 0.98rem;
    font-weight: 400;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-gallery-meta span {
    color: var(--muted);
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.admin-gallery-actions {
    display: flex;
    flex-shrink: 0;
    gap: 4px;
}

.icon-btn {
    padding: 5px 7px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--muted);
    font-size: 0.64rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.icon-btn:hover {
    border-color: var(--line-strong);
    color: var(--text);
}

.icon-btn-danger:hover {
    border-color: rgba(228, 137, 125, 0.5);
    color: var(--danger);
}

.admin-editor {
    padding: clamp(20px, 3vw, 36px);
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.editor-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.editor-state {
    padding: 5px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.66rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
}

.editor-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.field > span {
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.field input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--bg-soft);
    color: var(--text);
    font-size: 0.94rem;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.field input::placeholder {
    color: rgba(150, 145, 138, 0.62);
}

.field input:focus {
    border-color: var(--accent);
    outline: none;
    background: #101014;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: clamp(24px, 4vw, 40px) 20px;
    border: 1px dashed var(--line-strong);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.012);
    color: var(--muted);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.is-over {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--text);
    outline: none;
}

.dropzone-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin-bottom: 6px;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    font-size: 1.3rem;
    font-weight: 300;
}

.dropzone strong {
    color: var(--text);
    font-family: Georgia, serif;
    font-size: 1.12rem;
    font-weight: 400;
}

.dropzone span:last-child {
    font-size: 0.74rem;
}

.photo-list-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    margin: 26px 0 12px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.photo-list-head .muted {
    font-size: 0.68rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    text-transform: none;
}

.admin-photo-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.photo-item {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface-2);
    cursor: grab;
    transition: border-color 0.2s ease, opacity 0.2s ease;
}

.photo-item:hover {
    border-color: var(--line-strong);
}

.photo-item.is-dragging {
    opacity: 0.35;
}

.photo-item.is-drop-target {
    border-color: var(--accent);
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    user-select: none;
}

.photo-index {
    position: absolute;
    top: 7px;
    left: 7px;
    z-index: 2;
    min-width: 22px;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(6, 6, 8, 0.68);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-align: center;
}

.photo-badges {
    position: absolute;
    top: 7px;
    right: 7px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.photo-badge {
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--accent);
    color: #17130b;
    font-size: 0.53rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.photo-badge.is-new {
    background: rgba(6, 6, 8, 0.72);
    color: var(--text);
    border: 1px solid var(--line-strong);
}

.photo-item.has-progress .photo-tools {
    bottom: 34px;
}

.photo-item.has-stats .photo-tools {
    bottom: 26px;
}

.photo-stats {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2;
    padding: 5px 7px 6px;
    background: rgba(6, 6, 8, 0.84);
    color: var(--muted);
    font-size: 0.54rem;
    letter-spacing: 0.06em;
    text-align: center;
    text-transform: uppercase;
    white-space: nowrap;
}

.photo-item.is-busy {
    border-color: var(--accent);
}

.photo-item.is-busy .photo-tools {
    opacity: 0;
    pointer-events: none;
}

.photo-progress {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 7px 9px 9px;
    background: rgba(6, 6, 8, 0.9);
}

.photo-progress-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.56rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.photo-progress-text {
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.photo-progress-pct {
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.photo-progress-track {
    height: 3px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
}

.photo-progress-fill {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width 0.15s linear;
}

.photo-item.is-uploaded .photo-progress-text {
    color: var(--success);
}

.photo-item.is-uploaded .photo-progress-fill {
    background: var(--success);
}

.photo-item.is-error .photo-progress-text {
    color: var(--danger);
}

.photo-item.is-error .photo-progress-fill {
    background: var(--danger);
}

.photo-tools {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2;
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 18px 8px 8px;
    background: linear-gradient(to top, rgba(6, 6, 8, 0.88), transparent);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.photo-item:hover .photo-tools,
.photo-item:focus-within .photo-tools {
    opacity: 1;
}

.tool-btn {
    width: 27px;
    height: 27px;
    border: 1px solid var(--line-strong);
    border-radius: 5px;
    background: rgba(10, 10, 12, 0.7);
    color: var(--text);
    font-size: 0.82rem;
    line-height: 1;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.tool-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

.tool-btn:disabled {
    cursor: not-allowed;
    opacity: 0.28;
}

.tool-btn.is-danger:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.photo-list-empty {
    padding: 24px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.82rem;
    text-align: center;
}

.editor-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 26px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}

.save-hint {
    font-size: 0.7rem;
    letter-spacing: 0.04em;
}

.form-message {
    margin-top: 14px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 0.84rem;
}

.form-message:empty {
    display: none;
}

.form-message.is-error {
    border-color: rgba(228, 137, 125, 0.4);
    background: rgba(228, 137, 125, 0.08);
    color: var(--danger);
}

.form-message.is-success {
    border-color: rgba(159, 198, 164, 0.4);
    background: rgba(159, 198, 164, 0.08);
    color: var(--success);
}

.login-wrap {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
}

.login-card {
    width: min(420px, 100%);
    padding: clamp(30px, 6vw, 46px);
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
}

.login-card h1 {
    margin: 8px 0 6px;
    font-family: Georgia, serif;
    font-size: 2.1rem;
    font-weight: 400;
    letter-spacing: -0.02em;
}

.login-sub {
    margin-bottom: 26px;
    color: var(--muted);
    font-size: 0.88rem;
}

.login-card .field {
    margin-bottom: 18px;
}

.login-card .form-message {
    margin: 0 0 16px;
}

.login-back {
    display: block;
    margin-top: 20px;
    color: var(--muted);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-align: center;
    transition: color 0.2s ease;
}

.login-back:hover {
    color: var(--accent);
}

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

    .photo-grid {
        columns: 2;
    }

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

    .admin-sidebar {
        position: static;
        max-height: 360px;
    }
}

@media (max-width: 640px) {
    .site-header {
        padding-top: 20px;
    }

    .site-nav {
        gap: 16px;
        font-size: 0.68rem;
    }

    .hero {
        padding-top: 52px;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
    }

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

    .photo-grid {
        columns: 1;
    }

    .gallery-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .site-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .field-row {
        grid-template-columns: 1fr;
    }

    .editor-actions {
        flex-wrap: wrap;
    }

    .save-hint {
        flex-basis: 100%;
    }

    .admin-photo-list {
        grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    }

    .lightbox {
        padding: 54px 66px 78px 16px;
    }

    .lb-close {
        top: 8px;
        right: 10px;
    }

    .lb-nav {
        top: auto;
        bottom: 14px;
        width: 42px;
        height: 42px;
        font-size: 1.3rem;
        transform: none;
    }

    .lb-prev {
        left: calc(50% - 58px);
    }

    .lb-next {
        right: calc(50% - 58px);
    }

    .lb-counter {
        bottom: 20px;
    }

    .lb-hint {
        bottom: 44px;
        font-size: 0.5rem;
        letter-spacing: 0.08em;
    }

    .lb-actions {
        right: 8px;
        bottom: 106px;
        gap: 9px;
    }

    .lb-action {
        width: 48px;
        border-radius: 12px;
        padding: 7px 3px 5px;
    }

    .lb-action svg {
        width: 21px;
        height: 21px;
    }

    .lb-toast {
        bottom: 68px;
    }

    .lb-figure img {
        max-height: 68vh;
    }

    .photo-tools {
        opacity: 1;
    }
}

@media (hover: none) {
    .gallery-card::after {
        opacity: 1;
    }

    .card-overlay {
        opacity: 1;
        transform: none;
    }

    .photo-tools {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
