:root {
    --navy: #10223f;
    --navy-2: #183456;
    --gold: #c8a24a;
    --ink: #172033;
    --muted: #667085;
    --line: #d8dee8;
    --paper: #ffffff;
    --soft: #f5f7fa;
    --danger: #9f1d1d;
    --success: #1f7a4d;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--soft);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

a {
    color: var(--navy-2);
}

.site-header {
    background: var(--navy);
    color: #fff;
    padding: 18px clamp(16px, 4vw, 48px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}

.brand {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 20px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.nav a {
    color: #fff;
    text-decoration: none;
    padding: 7px 10px;
    border-radius: 6px;
}

.nav a:hover,
.nav a.active {
    background: rgba(255, 255, 255, 0.12);
}

.page {
    width: min(1120px, calc(100% - 32px));
    margin: 28px auto 48px;
}

.site-footer {
    border-top: 1px solid var(--line);
    color: var(--muted);
    display: flex;
    gap: 16px;
    justify-content: center;
    padding: 24px 16px;
    flex-wrap: wrap;
}

.hero,
.section,
.admin-panel {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: clamp(18px, 4vw, 36px);
    margin-bottom: 18px;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
    gap: 28px;
    align-items: center;
    border-top: 4px solid var(--gold);
}

.landing-header-image {
    background: #101828;
    border: 1px solid var(--line);
    border-radius: 8px;
    border-top: 4px solid var(--gold);
    margin-bottom: 18px;
    overflow: hidden;
}

.landing-header-image img {
    display: block;
    width: 100%;
    height: auto;
}

.hero img,
.dog-photo {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--line);
}

.hero .show-cover-image {
    background: #f8fafc;
    object-fit: contain;
}

h1,
h2,
h3 {
    line-height: 1.2;
    margin: 0 0 14px;
}

h1 {
    font-size: clamp(30px, 5vw, 48px);
}

h2 {
    font-size: 24px;
}

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

.actions,
.tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.button,
button {
    appearance: none;
    border: 1px solid var(--navy);
    background: var(--navy);
    color: #fff;
    text-decoration: none;
    padding: 9px 13px;
    border-radius: 6px;
    font: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
}

.button.secondary,
button.secondary {
    background: #fff;
    color: var(--navy);
}

.button.gold {
    background: var(--gold);
    border-color: var(--gold);
    color: #111827;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
}

.gallery-folder-grid,
.admin-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 260px));
    gap: 16px;
    justify-content: start;
}

.gallery-card {
    padding: 0;
    overflow: hidden;
}

.gallery-card a {
    color: inherit;
    display: grid;
    gap: 10px;
    text-decoration: none;
    padding-bottom: 16px;
    height: 100%;
}

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

.gallery-card .badge,
.gallery-card h2,
.gallery-card p {
    margin-left: 16px;
    margin-right: 16px;
}

.gallery-card p {
    color: var(--muted);
    margin-top: 0;
    margin-bottom: 0;
}

.breadcrumb {
    margin-bottom: 12px;
}

.gallery-viewer {
    background: #111827;
    border-radius: 8px;
    color: #fff;
    display: grid;
    gap: 14px;
    margin: 0 auto 18px;
    max-width: 940px;
    padding: clamp(12px, 3vw, 20px);
}

.gallery-stage {
    align-items: center;
    display: grid;
    height: clamp(300px, 52vh, 540px);
    overflow: hidden;
    position: relative;
}

.gallery-slide {
    display: none;
    margin: 0;
}

.gallery-slide.active {
    display: block;
}

.gallery-slide img {
    background: #0b1020;
    border-radius: 6px;
    display: block;
    height: clamp(300px, 52vh, 540px);
    width: 100%;
    object-fit: contain;
}

.gallery-slide figcaption {
    background: rgba(17, 24, 39, 0.76);
    border-radius: 4px;
    bottom: 10px;
    color: #d1d5db;
    left: 50%;
    max-width: calc(100% - 96px);
    padding: 4px 8px;
    position: absolute;
    text-align: center;
    transform: translateX(-50%);
}

.gallery-controls {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.gallery-counter {
    color: #d1d5db;
    min-width: 70px;
    text-align: center;
}

.gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(56px, 72px));
    gap: 8px;
    justify-content: center;
}

.gallery-thumbs button {
    background: transparent;
    border-color: transparent;
    min-height: auto;
    padding: 0;
}

.gallery-thumbs button.active {
    border-color: var(--gold);
}

.gallery-thumbs img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 4px;
}

.gallery-viewer:fullscreen {
    border-radius: 0;
    gap: 12px;
    height: 100vh;
    max-width: none;
    padding: 16px;
    width: 100vw;
}

.gallery-viewer:fullscreen .gallery-stage {
    height: calc(100vh - 88px);
}

.gallery-viewer:fullscreen .gallery-slide img {
    height: calc(100vh - 88px);
}

.gallery-viewer:fullscreen .gallery-thumbs {
    display: none;
}

.gallery-viewer:fullscreen .gallery-controls {
    margin: 0;
}

.gallery-arrow {
    background: rgba(255, 255, 255, 0.82);
    border-color: transparent;
    border-radius: 50%;
    color: var(--navy);
    font-size: 34px;
    height: 48px;
    min-height: 48px;
    padding: 0;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    z-index: 2;
}

.gallery-arrow:hover {
    background: #fff;
}

.gallery-arrow-prev {
    left: 12px;
}

.gallery-arrow-next {
    right: 12px;
}

.gallery-viewer:not(:fullscreen) .gallery-arrow {
    display: none;
}

.gallery-folder-summary {
    max-width: 940px;
    margin-left: auto;
    margin-right: auto;
}

.admin-gallery-image {
    display: grid;
    gap: 12px;
}

.admin-gallery-image img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.admin-gallery-image .actions,
.table-actions {
    margin-top: 0;
}

.meta {
    display: grid;
    gap: 6px;
    margin: 14px 0;
}

.badge {
    display: inline-flex;
    width: fit-content;
    border: 1px solid var(--gold);
    color: #59420d;
    background: #fff8df;
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 14px;
}

form {
    display: grid;
    gap: 14px;
}

fieldset {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 14px;
    margin: 0;
}

legend {
    font-weight: 700;
    padding: 0 6px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

label {
    display: grid;
    gap: 5px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 10px;
    font: inherit;
    background: #fff;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

.checkbox {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-weight: 400;
}

.checkbox input {
    width: auto;
    min-height: auto;
    margin-top: 5px;
}

.option-list {
    display: grid;
    gap: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

th,
td {
    text-align: left;
    padding: 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    background: #eef2f7;
}

.flash {
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 18px;
    background: #eef8f1;
    color: var(--success);
    border: 1px solid #b7e2c8;
}

.flash.error {
    background: #fff1f1;
    color: var(--danger);
    border-color: #f0b8b8;
}

.pedigree,
.pedigree ul {
    list-style: none;
    padding-left: 18px;
}

.pedigree li {
    margin: 8px 0;
    border-left: 2px solid var(--gold);
    padding-left: 10px;
}

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

.admin-page {
    width: min(1240px, calc(100% - 32px));
}

.admin-header {
    background: var(--navy-2);
}

@media (max-width: 760px) {
    .hero {
        grid-template-columns: 1fr;
    }

    .site-header {
        align-items: flex-start;
    }

    th,
    td {
        padding: 8px 6px;
        font-size: 14px;
    }

    .gallery-folder-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .gallery-stage,
    .gallery-slide img {
        height: 300px;
    }

    .gallery-viewer {
        max-width: none;
    }
}
