:root {
    --ink: #141821;
    --text: #263142;
    --muted: #6f7785;
    --line: #dfe4ea;
    --paper: #ffffff;
    --soft: #f4f6f8;
    --deep: #101720;
    --brand: #08756f;
    --brand-2: #0f8f83;
    --accent: #c9902e;
    --danger: #bc3b35;
    --ok: #20855f;
    --shadow: 0 24px 70px rgba(16, 23, 32, .14);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

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

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

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

button,
input,
textarea {
    font: inherit;
}

button {
    color: inherit;
}

.page-shell {
    width: min(1040px, calc(100% - 40px));
    margin: 0 auto;
}

.section-kicker {
    margin: 0 0 12px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.page-shell {
    padding: 34px 0 84px;
}

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

.toolbar h2,
.admin-topbar h1,
.panel-form h2,
.project-list-panel h2 {
    margin: 0;
    color: var(--ink);
    letter-spacing: 0;
}

.toolbar h2 {
    font-size: clamp(30px, 4vw, 48px);
    line-height: 1;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 9px;
}

.filter-btn,
.button,
.icon-btn,
.thumb {
    border: 0;
    cursor: pointer;
}

.filter-btn {
    min-height: 40px;
    padding: 0 15px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    font-weight: 850;
    background: var(--paper);
    transition: border-color .18s ease, background .18s ease, color .18s ease;
}

.filter-btn:hover {
    border-color: var(--brand);
}

.filter-btn.is-active {
    color: #fff;
    border-color: var(--brand);
    background: var(--brand);
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.project-card {
    aspect-ratio: 9 / 16;
    border-radius: 8px;
    overflow: hidden;
    background: var(--paper);
    box-shadow: 0 10px 34px rgba(16, 23, 32, .09);
    position: relative;
    transition: box-shadow .2s ease;
}

.project-card:hover {
    box-shadow: var(--shadow);
}

.project-card.is-hidden {
    display: none;
}

.card-media {
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: #d8dde5;
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.card-media::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(16, 23, 32, 0) 0%, rgba(16, 23, 32, .04) 54%, rgba(16, 23, 32, .42) 100%);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}

.project-card.has-copy .card-media::after {
    opacity: 1;
}

.card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border: 0;
}

.card-media video,
.card-media iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border: 0;
    background: #05070a;
}

.card-media video:fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    object-fit: contain !important;
    object-position: center !important;
    background: #000 !important;
}

.card-media video:-webkit-full-screen {
    width: 100vw !important;
    height: 100vh !important;
    object-fit: contain !important;
    object-position: center !important;
    background: #000 !important;
}

.card-media video:-moz-full-screen {
    width: 100vw !important;
    height: 100vh !important;
    object-fit: contain !important;
    object-position: center !important;
    background: #000 !important;
}

.project-card.is-video.has-copy .card-media::after {
    background: linear-gradient(180deg, rgba(16, 23, 32, .62) 0%, rgba(16, 23, 32, .2) 34%, rgba(16, 23, 32, 0) 68%);
}

.card-body {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 18px;
    color: #fff;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.project-card.is-video .card-body {
    top: 0;
    bottom: auto;
    justify-content: flex-start;
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.card-meta span {
    padding: 6px 9px;
    border-radius: 8px;
    color: #fff;
    font-size: 12px;
    font-weight: 900;
    background: rgba(255, 255, 255, .16);
    backdrop-filter: blur(8px);
}

.card-body h3 {
    margin: 0;
    color: #fff;
    font-size: 19px;
    line-height: 1.08;
    letter-spacing: 0;
}

.card-body p {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 8px 0 0;
    color: rgba(255, 255, 255, .82);
    font-size: 14px;
    line-height: 1.45;
}

.empty-state {
    min-height: 180px;
    display: grid;
    place-items: center;
    padding: 34px 22px;
    text-align: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
}

.empty-state h2 {
    margin: 0 0 10px;
    font-size: 20px;
    line-height: 1.2;
}

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

.button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 17px;
    border-radius: 8px;
    color: var(--ink);
    font-weight: 900;
    background: #e8edf2;
}

.button.primary {
    color: #fff;
    background: var(--brand);
}

.button.primary:hover {
    background: var(--brand-2);
}

.button.ghost {
    border: 1px solid var(--line);
    background: #fff;
}

.button.mini {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
}

.button.danger {
    color: #fff;
    background: var(--danger);
}

.admin-body,
.login-body {
    min-height: 100vh;
    background:
        linear-gradient(180deg, #f7f9fb 0%, #edf1f5 100%);
}

.admin-body {
    display: grid;
    grid-template-columns: 272px minmax(0, 1fr);
}

.admin-sidebar {
    min-height: 100vh;
    padding: 24px;
    color: #fff;
    background: linear-gradient(180deg, #101720 0%, #182334 100%);
    position: sticky;
    top: 0;
}

.admin-brand {
    margin-bottom: 34px;
}

.admin-menu {
    display: grid;
    gap: 8px;
}

.admin-menu a {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    border-radius: 8px;
    color: rgba(255, 255, 255, .74);
    font-weight: 850;
}

.admin-menu a.is-active,
.admin-menu a:hover {
    color: #fff;
    background: rgba(255, 255, 255, .1);
}

.admin-main {
    padding: 32px;
}

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

.admin-topbar h1 {
    font-size: 26px;
    line-height: 1.08;
}

.panel-form h2,
.project-list-panel h2 {
    font-size: 20px;
    line-height: 1.15;
}

.notice {
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 8px;
    color: #0f5132;
    font-weight: 800;
    background: #d9f1e7;
}

.notice.error {
    color: #842029;
    background: #f8d7da;
}

.admin-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 430px;
    gap: 22px;
    align-items: start;
}

.panel-form,
.project-list-panel,
.login-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 48px rgba(16, 23, 32, .09);
}

.panel-form {
    display: grid;
    gap: 18px;
    padding: 24px;
}

.form-head,
.list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.field-grid,
.upload-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

label {
    display: grid;
    gap: 8px;
    color: var(--ink);
    font-weight: 850;
}

label span,
.upload-box span {
    font-size: 14px;
}

input,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 13px;
    color: var(--ink);
    background: #fff;
    outline: none;
}

input:focus,
textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(8, 117, 111, .13);
}

textarea {
    resize: vertical;
}

.switch {
    display: inline-flex;
    grid-template-columns: auto auto;
    align-items: center;
    gap: 9px;
}

.switch input {
    width: 18px;
    height: 18px;
    accent-color: var(--brand);
}

.upload-box {
    padding: 16px;
    border: 1px dashed #b7c2cf;
    border-radius: 8px;
    background: #f8fafc;
}

.upload-box small {
    color: var(--muted);
    font-weight: 600;
}

.current-media h3 {
    margin: 0 0 12px;
}

.media-admin-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.media-admin-grid figure {
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.media-admin-grid img,
.media-admin-grid video {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: #e8edf2;
}

.media-admin-grid button {
    width: 100%;
    min-height: 34px;
    border: 0;
    color: #fff;
    background: var(--danger);
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 10px;
}

.project-list-panel {
    padding: 18px;
}

.admin-project-list {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.admin-project-item {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.admin-project-item img {
    width: 74px;
    height: 64px;
    border-radius: 8px;
    object-fit: cover;
    background: #e8edf2;
}

.admin-project-item h3 {
    margin: 0 0 3px;
    color: var(--ink);
    font-size: 15px;
}

.admin-project-item p,
.muted {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.status-on,
.status-off {
    display: inline-flex;
    margin-top: 8px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}

.status-on {
    color: #0f5132;
    background: #d9f1e7;
}

.status-off {
    color: #842029;
    background: #f8d7da;
}

.item-actions {
    display: grid;
    gap: 8px;
}

.login-body {
    display: grid;
    place-items: center;
    padding: 20px;
}

.login-card {
    width: min(430px, 100%);
    display: grid;
    gap: 20px;
    padding: 28px;
}

.login-logo {
    display: block;
}

.login-logo img {
    width: 110px;
    height: 67px;
    border-radius: 8px;
    object-fit: contain;
    background: #101720;
    box-shadow: 0 12px 28px rgba(16, 23, 32, .12);
}

.login-card form {
    display: grid;
    gap: 16px;
}

.gallery-body {
    background: #f3f5f7;
}

.gallery-body .page-shell {
    padding-top: 24px;
    padding-bottom: 54px;
}

.gallery-title {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.gallery-logo-link {
    display: block;
    flex: 0 0 116px;
}

.gallery-logo {
    width: 116px !important;
    height: 71px !important;
    border-radius: 8px;
    object-fit: contain;
    box-shadow: 0 6px 14px rgba(16, 23, 32, .10);
    background: #101720;
}

.gallery-title h1 {
    margin: 0;
    color: var(--ink);
    font-size: clamp(24px, 3vw, 34px);
    line-height: 1.08;
    letter-spacing: 0;
}

.admin-logo-link {
    display: block;
    width: fit-content;
    margin-bottom: 26px;
}

.admin-logo-link img {
    width: 88px;
    height: 54px;
    border-radius: 8px;
    object-fit: contain;
    background: #101720;
    box-shadow: 0 10px 22px rgba(0, 0, 0, .18);
}

@media (max-width: 1080px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .page-shell {
        width: min(100% - 28px, 1180px);
    }

    .toolbar,
    .admin-topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .gallery-title {
        align-items: center;
        flex-direction: row;
    }

    .gallery-logo {
        width: 96px !important;
        height: 59px !important;
    }

    .gallery-logo-link {
        flex-basis: 96px;
    }

    .gallery-title h1 {
        font-size: 22px;
    }

    .filters {
        justify-content: flex-start;
    }

    .project-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .card-body {
        padding: 12px;
    }

    .card-body h3 {
        font-size: 15px;
    }

    .card-body p {
        font-size: 12px;
        -webkit-line-clamp: 2;
    }

    .field-grid,
    .upload-grid,
    .media-admin-grid {
        grid-template-columns: 1fr;
    }

    .admin-body {
        display: block;
    }

    .admin-sidebar {
        min-height: auto;
        position: static;
    }

    .admin-main {
        padding: 18px;
    }

    .admin-project-item {
        grid-template-columns: 64px minmax(0, 1fr);
    }

    .item-actions {
        grid-column: 1 / -1;
        grid-template-columns: repeat(2, 1fr);
    }

}

@media (max-width: 430px) {
    .page-shell {
        width: min(100% - 24px, 1040px);
    }

    .toolbar {
        gap: 16px;
    }

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