.gallery-main {
    padding: 0;
}

html.gallery-modal-open { overflow:hidden; }

.gallery-title-card h1,
.gallery-view-item h2,
.gallery-card h3,
.gallery-album-info strong {
    min-width:0;
    white-space:normal;
    overflow-wrap:anywhere;
}

.gallery-page-section {
    padding: 0 0 56px;
}

body.gallery-page-shell .gallery-page-section > .container {
    max-width: var(--home-page-max, 1180px);
    padding: 0;
}

@media (max-width: 1024px) {
    body.gallery-page-shell .gallery-page-section > .container {
        padding: 0 var(--gutter, 28px);
    }
}

.gallery-title-card,
.gallery-content-card {
    background: linear-gradient(135deg, #ead4ab 0%, #f3e3c6 58%, #fbf1df 100%);
    border: 1px solid rgba(154, 122, 44, 0.22);
    border-left: 6px solid #b88712;
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(91, 7, 16, 0.08);
    box-sizing: border-box;
    padding: var(--home-card-padding, clamp(28px, 4vw, 42px));
}

.gallery-title-card {
    margin-bottom: 26px;
    background: linear-gradient(135deg, #3d040a 0%, #52070f 58%, #6f0b16 100%);
    border: 1px solid rgba(210, 168, 39, 0.46);
    border-left: 4px solid var(--dalesmen-gold, #d2a827);
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.34);
    padding: clamp(26px, 3vw, 34px) var(--home-card-padding, clamp(28px, 4vw, 42px));
}

.gallery-title-card h1 {
    margin: 0 0 12px;
    color: var(--dalesmen-gold, #d2a827);
    font-family: "Libre Baskerville", "Cormorant Garamond", Georgia, "Times New Roman", serif;
    font-size: var(--section-title-size, clamp(30px, 3.4vw, 42px));
    font-weight: 500;
    line-height: 1.08;
}

.gallery-intro {
    max-width: 760px;
    margin: 0;
    color: rgba(255, 255, 255, 0.84);
    font-size: 18px;
    line-height: 1.5;
}

.gallery-public-actions { display:flex; flex-wrap:wrap; gap:12px; margin-top:22px; }
.gallery-toolbar { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:20px; margin-bottom:28px; padding-bottom:20px; border-bottom:1px solid rgba(91,7,16,.18); }
.gallery-tabs { display:grid; grid-template-columns:repeat(4,minmax(88px,1fr)); gap:10px; }
body.gallery-page-shell .gallery-tabs a { display:inline-flex; align-items:center; justify-content:center; min-width:88px; min-height:42px; box-sizing:border-box; padding:8px 14px; color:var(--dalesmen-burgundy,#5b0710) !important; font-weight:700; text-align:center; text-decoration:none; background:#fffaf0; border:1px solid rgba(91,7,16,.34); border-radius:6px; box-shadow:0 3px 8px rgba(91,7,16,.1); }
body.gallery-page-shell .gallery-tabs a:hover,body.gallery-page-shell .gallery-tabs a:focus-visible,body.gallery-page-shell .gallery-tabs a.is-active { color:#fff !important; background:var(--dalesmen-burgundy,#5b0710); border-color:var(--dalesmen-gold,#d2a827); outline:none; }
.gallery-sort { display:flex; align-items:center; gap:10px; font-weight:700; color:var(--dalesmen-burgundy,#5b0710); }
.gallery-sort select { min-width:220px; min-height:42px; padding:7px 34px 7px 10px; color:#221712; background:#fff; border:1px solid rgba(91,7,16,.35); border-radius:5px; font:inherit; }
.gallery-view-tools { display:flex; align-items:center; justify-content:center; gap:10px; margin-left:auto; }
.gallery-view-tools > span,.gallery-view-tools button { min-height:42px; padding:8px 13px; border:1px solid rgba(91,7,16,.34); border-radius:6px; font-weight:700; }
.gallery-view-tools > span { display:inline-flex; align-items:center; color:var(--dalesmen-burgundy,#5b0710); background:rgba(255,250,240,.72); }
.gallery-view-tools button { display:inline-flex; align-items:center; box-sizing:border-box; min-height:40px; padding:7px 14px; color:#fff; background:var(--dalesmen-burgundy,#5b0710); cursor:pointer; }
.gallery-pagination { display:flex; align-items:center; justify-content:center; gap:18px; margin-top:28px; }
.gallery-pagination a,body.gallery-page-shell .gallery-pagination a { display:inline-flex; align-items:center; min-height:40px; padding:7px 14px; color:#fff !important; font-weight:700; text-decoration:none; background:var(--dalesmen-burgundy,#5b0710); border:1px solid var(--dalesmen-gold,#d2a827); border-radius:6px; }
.gallery-pagination a:hover,.gallery-pagination a:focus-visible { color:var(--dalesmen-burgundy,#5b0710) !important; background:#fffaf0; }
.gallery-pagination span { color:#675a50; }
.gallery-view-tools .gallery-pagination { flex-wrap:wrap; gap:10px; margin-top:0; }
.gallery-view-tools .gallery-pagination a,.gallery-view-tools .gallery-pagination span { white-space:nowrap; }
.gallery-pagination > a,
.gallery-pagination > .gallery-page-disabled { box-sizing:border-box; flex:0 0 100px; justify-content:center; white-space:nowrap; font-size:13px; line-height:1.4; }
.gallery-pagination > .gallery-page-disabled { display:inline-flex; align-items:center; min-height:40px; padding:7px 14px; border:1px solid rgba(91,7,16,.25); border-radius:6px; font-weight:700; color:#807468; background:rgba(255,250,240,.4); }
.gallery-pagination > span:not(.gallery-page-disabled) { white-space:nowrap; font-variant-numeric:tabular-nums; }
.gallery-pagination,.gallery-view-tools .gallery-pagination { flex-wrap:nowrap; gap:10px; }
@media(min-width:1100px) {
    .gallery-toolbar { flex-wrap:nowrap; gap:12px; }
    .gallery-tabs { grid-template-columns:repeat(4,minmax(70px,1fr)); gap:8px; }
    body.gallery-page-shell .gallery-tabs a { min-width:70px; padding-inline:10px; }
    .gallery-view-tools { flex-shrink:0; gap:8px; }
    .gallery-sort { min-width:0; gap:8px; }
    .gallery-sort label { flex:0 0 48px; }
    .gallery-sort select { width:210px; min-width:0; font-size:14px; }
}
@media(max-width:420px) {
    .gallery-pagination > a,.gallery-pagination > .gallery-page-disabled { flex-basis:80px; padding-inline:6px; font-size:12px; }
    .gallery-pagination,.gallery-view-tools .gallery-pagination { gap:6px; }
}
.gallery-index { display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:10px 20px; }
.gallery-index a { display:flex; justify-content:space-between; gap:15px; padding:13px 15px; color:var(--dalesmen-burgundy,#5b0710); text-decoration:none; background:rgba(255,250,240,.75); border:1px solid rgba(154,122,44,.24); border-radius:6px; }
.gallery-index a:hover,.gallery-index a:focus-visible { border-color:var(--dalesmen-gold,#d2a827); box-shadow:0 5px 14px rgba(91,7,16,.12); }
.gallery-index span { flex:0 0 auto; color:#675a50; font-size:.9rem; }
.gallery-index a { min-width:0; align-items:flex-start; }
.gallery-index a strong { min-width:0; white-space:normal; overflow-wrap:anywhere; }
.gallery-index a { justify-content:flex-start; align-items:center; gap:12px; padding:12px; }
.gallery-index .gallery-index-preview { flex:0 0 56px; width:56px; height:56px; overflow:hidden; border-radius:4px; background:#160104; }
.gallery-index-preview img,.gallery-index-preview video { display:block; width:100%; height:100%; object-fit:contain; pointer-events:none; }
.gallery-index .gallery-index-copy { flex:1 1 0; min-width:0; color:var(--dalesmen-burgundy,#5b0710); font-size:1rem; }
.gallery-index-copy strong { display:block; }
.gallery-index-copy small { display:block; margin-top:5px; color:#675a50; font-size:.8rem; }
.gallery-upload-group + .gallery-upload-group { margin-top:30px; padding-top:20px; border-top:1px solid rgba(91,7,16,.22); }
.gallery-upload-group > h2 { display:flex; flex-wrap:wrap; align-items:baseline; gap:7px; margin:0 0 12px; color:var(--dalesmen-burgundy,#5b0710); font-size:1rem; }
.gallery-upload-group > h2 span { font-weight:400; }
.gallery-card-meta { min-height:58px; padding:10px 12px; text-align:center; background:rgba(234,212,171,.48); border-bottom:1px solid rgba(91,7,16,.22); }
.gallery-card-meta strong,.gallery-card-meta small { display:block; }
.gallery-card-meta strong { color:var(--dalesmen-burgundy,#5b0710); font-size:.88rem; line-height:1.25; }
.gallery-card-meta small { margin-top:3px; color:#4d4038; font-size:.8rem; }
.gallery-library-section + .gallery-library-section { margin-top:32px; }
.gallery-library-section > h2 { color:var(--dalesmen-burgundy,#5b0710); font-family:"Libre Baskerville",Georgia,serif; }
.gallery-album-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:18px; }
.gallery-album-card { display:block; overflow:hidden; color:inherit; text-decoration:none; background:#fffaf0; border:2px solid rgba(210,168,39,.55); border-radius:8px; box-shadow:0 10px 24px rgba(91,7,16,.14); }
.gallery-album-cover { display:block; height:190px; overflow:hidden; background:#180104; }
.gallery-album-cover img,.gallery-album-cover video { width:100%; height:100%; object-fit:cover; }
.gallery-album-info { display:block; padding:16px 18px; }
.gallery-album-info strong,.gallery-album-info small { display:block; }
.gallery-album-info strong { color:var(--dalesmen-burgundy,#5b0710); font-size:1.15rem; }
.gallery-album-info small { margin-top:6px; color:#675a50; }
.gallery-thumb { display:block; width:100%; padding:0; border:0; background:#000; cursor:pointer; }
.gallery-card video { display:block; width:100%; height:190px; object-fit:contain; background:#000; }
.gallery-card h3 { margin:0 0 .5rem; color:var(--dalesmen-burgundy,#5b0710); font-family:"Libre Baskerville",Georgia,serif; }
.gallery-back { color:#f1d173; }
.gallery-view-grid { display:grid; gap:30px; }
.gallery-view-item { overflow:hidden; background:#fffaf0; border:2px solid rgba(210,168,39,.55); border-radius:8px; box-shadow:0 12px 28px rgba(91,7,16,.15); }
.gallery-view-item img,.gallery-view-item video { display:block; width:100%; max-height:75vh; object-fit:contain; background:#120104; }
.gallery-view-item h2,.gallery-view-item p { margin-left:20px; margin-right:20px; }
.gallery-view-item h2 { color:var(--dalesmen-burgundy,#5b0710); }
.gallery-view-item p { margin-bottom:22px; }

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

.gallery-card {
    background: rgba(255, 250, 240, 0.82);
    border: 1px solid rgba(154, 122, 44, 0.16);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(91, 7, 16, 0.08);
    transition: transform .18s ease, box-shadow .18s ease;
}

.gallery-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 30px rgba(91, 7, 16, 0.14);
}

.gallery-card a {
    color: inherit;
    text-decoration: none;
    display: block;
}

.gallery-card img {
    width: 100%;
    height: 190px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    background: #000;
}

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

.gallery-card-body {
    padding: 1rem 1rem 1.1rem;
}

.gallery-card h2 {
    margin: 0 0 .5rem;
    color: var(--dalesmen-burgundy, #5b0710);
    font-family: "Libre Baskerville", "Cormorant Garamond", Georgia, "Times New Roman", serif;
    font-size: 1.15rem;
    font-weight: 500;
    line-height: 1.35;
}

.gallery-card h3 {
    margin: 0 0 .4rem;
    color: var(--dalesmen-burgundy, #5b0710);
    font-family: "Libre Baskerville", "Cormorant Garamond", Georgia, "Times New Roman", serif;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.3;
}

.gallery-card p {
    margin: 0;
    color: var(--dalesmen-ink, #221712);
    line-height: 1.55;
}

.gallery-empty {
    text-align: center;
    padding: 2rem 1rem;
}

.gallery-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.88);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    z-index: 9999;
}

dialog.gallery-lightbox { width:100%; max-width:none; height:100%; max-height:none; box-sizing:border-box; overflow:hidden; border:0; }
dialog.gallery-lightbox::backdrop { background:rgba(0,0,0,.88); }
dialog.gallery-lightbox[open] { display:flex; }

.gallery-lightbox.open {
    display: flex;
}

.gallery-lightbox-inner {
    width: min(1000px, 95vw);
    max-height: 90vh;
    overflow: hidden;
    background: #111;
    border-radius: 14px;
    padding: 1rem;
    color: #fff;
    position: relative;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.gallery-lightbox-close {
    position: static;
    flex: 0 0 auto;
    background: #5b0710;
    color: #fff;
    border: 1px solid #d2a827;
    border-radius: 6px;
    width: auto;
    padding: 0 15px;
    height: 42px;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
}

.gallery-lightbox-toolbar { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:12px; }
.gallery-lightbox-copy { flex:0 0 auto; padding-top:10px; }
.gallery-lightbox-controls { display:flex; justify-content:flex-start; gap:10px; }
.gallery-lightbox-controls button { min-height:42px; padding:8px 16px; color:#fff; background:#5b0710; border:1px solid #d2a827; border-radius:6px; font-weight:700; cursor:pointer; }

.gallery-lightbox img {
    width: 100%;
    height: auto;
    max-height: calc(90vh - 155px);
    min-height: 0;
    object-fit: contain;
    display: block;
    border-radius: 10px;
    margin: 0;
    background: #000;
}

.gallery-lightbox h3 {
    margin: 0 0 .5rem;
}

.gallery-lightbox p {
    margin: 0;
    line-height: 1.6;
    color: #f0f0f0;
}

@media (max-width: 760px) {
    body.gallery-page-shell .gallery-page-section > .container {
        padding: 0 var(--gutter, 18px);
    }

    .gallery-title-card,
    .gallery-content-card {
        padding: 20px;
    }

    .gallery-toolbar { align-items:stretch; flex-direction:column; }
    .gallery-tabs { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
    .gallery-tabs a { justify-content:center; }
    .gallery-sort { align-items:stretch; flex-direction:column; }
    .gallery-sort select { width:100%; min-width:0; }
    .gallery-view-tools { margin-left:0; flex-wrap:wrap; }
    .gallery-lightbox-toolbar { align-items:stretch; }
    .gallery-lightbox-controls { flex-wrap:wrap; }
}

@media (max-width: 620px) {
    .gallery-lightbox { padding:10px; }
    .gallery-lightbox-inner { width:100%; max-height:96vh; padding:10px; }
    .gallery-lightbox-toolbar { gap:8px; }
    .gallery-lightbox-controls { gap:6px; }
    .gallery-lightbox-controls button,.gallery-lightbox-close { min-height:38px; height:auto; padding:6px 9px; font-size:.78rem; }
    .gallery-lightbox img { max-height:calc(96vh - 145px); }
}

@media (max-width: 520px) {
    .gallery-grid,
    .gallery-album-grid {
        grid-template-columns: 1fr;
    }
}
