:root {
    --bg: #0f1419;
    --surface: #1a2332;
    --border: #2d3a4d;
    --text: #e8eef5;
    --muted: #8fa3bd;
    --accent: #3d9cf0;
    --radius: 12px;
    --font: "Segoe UI", system-ui, sans-serif;
}

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

html {
    font-size: 16px;
}

body {
    margin: 0;
    min-height: 100vh;
    padding-top: 3rem;
    font-family: var(--font);
    background: radial-gradient(1200px 600px at 20% -10%, #1c2d45 0%, var(--bg) 55%);
    color: var(--text);
    line-height: 1.5;
}

body.lightbox-open {
    overflow: hidden;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(10, 14, 20, 0.95);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

.site-nav-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0.55rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
}

.site-nav-start,
.site-nav-end {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.site-nav-end {
    margin-left: auto;
}

.site-nav-filter-btn {
    cursor: pointer;
    font: inherit;
}

.site-nav-filter-btn.is-pressed {
    border-color: rgba(61, 156, 240, 0.55);
    color: var(--accent);
}

.nav-filter-panel {
    border-bottom: 1px solid var(--border);
    background: rgba(15, 20, 25, 0.97);
    padding: 0.75rem 1rem 1rem;
}

.nav-filter-panel[hidden] {
    display: none !important;
}

.nav-filter-inner {
    max-width: 1180px;
    margin: 0 auto;
}

.nav-filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.65rem 0.75rem;
}

.nav-filter-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.nav-filter-input {
    flex: 1 1 200px;
    min-width: 160px;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

.nav-filter-select {
    padding: 0.5rem 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    min-width: 11rem;
}

.nav-filter-submit {
    flex: 0 0 auto;
}

.site-nav-home {
    padding: 0.42rem 0.55rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.site-nav-home-icon {
    display: block;
    vertical-align: middle;
}

.site-nav-brand {
    font-weight: 700;
    font-size: clamp(1.4rem, 4vw, 2.05rem);
    color: #d96d1b;
    letter-spacing: -0.02em;
    line-height: 1.15;
    text-decoration: none;
}

.site-nav-brand:hover {
    color: #e88a35;
    text-decoration: none;
}

.site-nav-link {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 600;
}

.site-nav-link:hover {
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}

.site-nav-link.is-active {
    border-color: rgba(61, 156, 240, 0.55);
    color: var(--accent);
}

.site-nav-accent {
    border-color: rgba(61, 156, 240, 0.45);
    background: rgba(61, 156, 240, 0.12);
}

.site-nav-accent:hover {
    background: rgba(61, 156, 240, 0.22);
}

.flash {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0.65rem 1rem 0;
}

.flash-msg {
    padding: 0.65rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 0.92rem;
}

.flash-msg.ok {
    border-color: rgba(72, 199, 142, 0.5);
    background: rgba(72, 199, 142, 0.1);
}

.flash-msg.error {
    border-color: rgba(240, 100, 100, 0.5);
    background: rgba(240, 100, 100, 0.1);
}

.crud-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.75rem;
}

.crud-inline-form {
    display: inline;
    margin: 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.9rem;
    border-radius: 8px;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
}

.btn:hover {
    text-decoration: none;
    border-color: var(--accent);
    color: var(--accent);
}

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

.btn-primary:hover {
    filter: brightness(1.06);
    color: #0a0f14;
}

.btn-secondary {
    background: transparent;
}

.btn-danger {
    border-color: rgba(240, 100, 100, 0.45);
    color: #f0a0a0;
}

.btn-danger:hover {
    background: rgba(240, 100, 100, 0.12);
    color: #ffb4b4;
}

.crud-form {
    max-width: 720px;
}

.form-fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    margin: 0 0 1.25rem;
    background: var(--surface);
}

.form-fieldset legend {
    padding: 0 0.35rem;
    font-weight: 600;
}

.form-label {
    display: block;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--muted);
}

.form-input,
.form-textarea {
    display: block;
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #131a23;
    color: var(--text);
    font: inherit;
}

.form-textarea {
    resize: vertical;
    min-height: 8rem;
}

.form-hint {
    font-size: 0.85rem;
    color: var(--muted);
    margin: 0 0 0.75rem;
}

.form-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.form-photo-slot {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.65rem;
    background: #131a23;
}

.form-photo-label {
    display: block;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 0.35rem;
}

.form-photo-preview {
    margin-bottom: 0.5rem;
}

.form-photo-preview img {
    width: 100%;
    max-width: 140px;
    height: auto;
    border-radius: 6px;
    display: block;
    margin-bottom: 0.35rem;
}

.form-check {
    font-size: 0.85rem;
    color: var(--text);
    cursor: pointer;
}

.form-file {
    width: 100%;
    font-size: 0.82rem;
    margin-top: 0.35rem;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
    box-sizing: border-box;
    padding: 0 1rem 0.85rem;
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.15);
}

.card-actions a {
    font-size: 0.82rem;
    font-weight: 600;
}

.site-header {
    padding: 1.25rem 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: rgba(15, 20, 25, 0.85);
    backdrop-filter: blur(10px);
}

.site-header .inner {
    max-width: 1180px;
    margin: 0 auto;
}

.site-header h1 {
    margin: 0 0 0.75rem;
    font-weight: 600;
    font-size: clamp(1.25rem, 3vw, 1.65rem);
    letter-spacing: -0.02em;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.toolbar input[type="search"] {
    flex: 1;
    min-width: 180px;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

.toolbar select {
    padding: 0.5rem 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

.toolbar button {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #0a0f14;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.toolbar button:hover {
    filter: brightness(1.08);
}

.wrap {
    max-width: 1180px;
    margin: 0 auto;
    padding: 1.25rem 1rem 3rem;
}

.grid {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}

.card {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    overflow: hidden;
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.card:hover {
    transform: translateY(-2px);
    border-color: rgba(61, 156, 240, 0.45);
}

.card-link {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

.card-link:hover {
    text-decoration: none;
}

.card-media {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    background: #131a23;
    overflow: hidden;
}

.card-media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.gallery-missing {
    display: block;
    cursor: help;
}

.card-media-ph {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 0.95rem;
}

.card-body {
    width: 100%;
    box-sizing: border-box;
    padding: 0.95rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1 1 auto;
    min-width: 0;
}

.plate {
    font-weight: 700;
    letter-spacing: 0.06em;
    font-size: 1.05rem;
}

.model {
    color: var(--muted);
    font-size: 0.9rem;
}

.card .plate,
.card .model {
    overflow-wrap: break-word;
    max-width: 100%;
}

.excerpt {
    margin: 0.35rem 0 0;
    font-size: 0.88rem;
    color: var(--text);
    opacity: 0.92;
}

time {
    margin-top: auto;
    padding-top: 0.5rem;
    font-size: 0.78rem;
    color: var(--muted);
}

.empty {
    text-align: center;
    padding: 2rem;
    color: var(--muted);
}

.detail {
    display: grid;
    gap: 2rem;
}

@media (min-width: 840px) {
    .detail {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
}

.gallery {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.65rem;
}

.gallery img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.gallery a {
    display: block;
    border-radius: 10px;
    overflow: hidden;
}

.gallery a:hover img {
    filter: brightness(1.08);
}

.gallery-open {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 10px;
    overflow: hidden;
    cursor: zoom-in;
    background: transparent;
    line-height: 0;
}

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

.gallery-open:hover img {
    filter: brightness(1.08);
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(5, 8, 12, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
}

.lightbox.is-hidden {
    display: none !important;
}

.lightbox-chrome {
    width: 100%;
    max-width: min(1200px, 100vw);
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.lightbox-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    justify-content: space-between;
}

.lightbox-toolbar-right {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.lightbox-caption {
    color: var(--muted);
    font-size: 0.85rem;
    flex: 1;
    text-align: center;
    min-width: 4rem;
}

.lightbox-btn {
    padding: 0.45rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

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

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

.lightbox-btn-link {
    text-decoration: none;
    font-weight: 600;
}

.lightbox-btn-close {
    border-color: rgba(61, 156, 240, 0.45);
}

.lightbox-stage {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    overflow: hidden;
    background: #0a0d12;
    border: 1px solid var(--border);
}

.lightbox-stage img {
    max-width: 100%;
    max-height: min(78vh, 900px);
    width: auto;
    height: auto;
    object-fit: contain;
}

.prose {
    font-size: 0.95rem;
    white-space: pre-wrap;
}

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

.sub {
    margin: -0.25rem 0 0.35rem;
    color: var(--muted);
}

.back {
    margin-bottom: 0.65rem;
    font-size: 0.9rem;
}

.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;
}
