/* Reuse theme cards, Bootstrap grid and existing palette. */
.cdg-resource-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    align-items: end;
}
.cdg-resource-filters .journal-filter-field { min-width: 0; }
.cdg-resource-filters label { display: block; margin-bottom: .4rem; font-weight: 700; }
.cdg-resource-filter-actions { display: flex; justify-content: end; grid-column: 1 / -1; }
.cdg-resource-reset { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 2.8rem; height: 2.8rem; border: 1px solid var(--color-gold); border-radius: 8px; color: var(--color-gold); }
.cdg-resource-reset:focus-visible { outline: 2px solid var(--color-gold); outline-offset: 3px; }
.cdg-resource-reset-tooltip { position: absolute; right: 0; bottom: calc(100% + .5rem); z-index: 2; width: max-content; max-width: 15rem; padding: .4rem .65rem; border-radius: 6px; background: var(--color-bg-dark); color: var(--color-text); font-size: .85rem; visibility: hidden; pointer-events: none; }
.cdg-resource-reset:hover .cdg-resource-reset-tooltip,
.cdg-resource-reset:focus .cdg-resource-reset-tooltip { visibility: visible; }
.cdg-resource-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem; align-items: start; }
.cdg-resource-layout > * { min-width: 0; }
.cdg-resource-content { margin-top: 2rem; overflow-wrap: anywhere; }
.cdg-resource-cover img { display: block; width: 100%; height: auto; margin: auto; border-radius: var(--radius-panel); }
.cdg-resource-details { overflow-wrap: anywhere; }
.cdg-resource-detail-row { display: flex; flex-wrap: wrap; gap: .25rem .4rem; margin-bottom: .75rem; }
.cdg-resource-details dt { margin: 0; font-weight: 700; }
.cdg-resource-details dd { margin: 0; }

.cdg-resource-details dl:empty { display: none; }
@media (min-width: 992px) {
    .cdg-resource-filters { grid-template-columns: repeat(4, minmax(0, 1fr)) auto; }
    .cdg-resource-filter-actions { grid-column: auto; }
}
@media (max-width: 767px) {
    .cdg-resource-layout { grid-template-columns: minmax(0, 1fr); }
    .cdg-resource-filters { grid-template-columns: minmax(0, 1fr); }
}

.cdg-resource-heading .cdg-resource-badges { justify-content: center; margin-top: 1rem; }
.cdg-resource-summary { max-width: 65ch; margin: 1.25rem auto 0; }
.cdg-resource-layout.is-without-cover { grid-template-columns: minmax(0, 1fr); max-width: 900px; margin-inline: auto; }
.cdg-resource-details h2 { margin: 0 0 1rem; }
.cdg-resource-details dl { margin-bottom: 0; }
.cdg-resource-downloads { margin-top: 1.5rem; }
.cdg-resource-downloads:first-child { margin-top: 0; }
.cdg-resource-file-meta { display: block; margin: .4rem 0 1rem; font-size: .9rem; opacity: .85; }
.cdg-resource-file-list { padding-left: 1.2rem; margin-bottom: 0; }
.cdg-resource-file-list li + li { margin-top: .8rem; }
.cdg-resource-file-list .cdg-resource-file-meta { margin-bottom: 0; }
.cdg-resource-downloads .btn { max-width: 100%; white-space: normal; }
.cdg-resource-cover .maps-masonry-button { border-radius: var(--radius-panel); overflow: hidden; }

.cdg-resource-heading .cdg-resource-badge { background: var(--color-parchment); color: var(--color-ink); border-color: var(--color-gold); }
.cdg-resource-heading .cdg-resource-badge:hover { background: var(--color-gold-soft); }

.cdg-resource-pdf-link { display: inline-block; margin: .5rem 0 .5rem .75rem; }
.cdg-resource-downloads > .cdg-resource-pdf-link { margin-left: 0; margin-right: .75rem; }
.cdg-resource-pdf { margin-top: 2rem; scroll-margin-top: 7rem; }
.cdg-resource-pdf[hidden] { display: none; }
.cdg-resource-pdf-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.cdg-resource-pdf-heading h2 { margin: 0; }
.cdg-resource-pdf iframe { display: block; width: 100%; height: 75vh; min-height: 28rem; border: 1px solid var(--color-gold); border-radius: 8px; background: #fff; }

/* Native modal supplies focus containment, inert background and Escape support. */
html.cdg-pdf-confirm-open { overflow: hidden; }
.cdg-pdf-confirm {
    position: fixed;
    inset: 0;
    width: min(33rem, calc(100% - 2rem));
    max-height: calc(100dvh - 2rem);
    margin: auto;
    padding: 2rem;
    overflow: auto;
    border: 1px solid rgba(203, 165, 103, .65);
    border-radius: 18px;
    background: radial-gradient(ellipse at top left, rgba(203, 165, 103, .12), transparent 60%), #17212c;
    color: #f5ecd9;
    box-shadow: 0 28px 90px rgba(0, 0, 0, .6);
}
.cdg-pdf-confirm::backdrop { background: rgba(4, 9, 15, .78); backdrop-filter: blur(5px); }
.cdg-pdf-confirm form { margin: 0; }
.cdg-pdf-confirm-close { position: absolute; top: .6rem; right: .6rem; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #cdbfa8; font-size: 1.75rem; cursor: pointer; }
.cdg-pdf-confirm-close:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.cdg-pdf-confirm-icon { display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 1.4rem; border: 1px solid rgba(203, 165, 103, .4); border-radius: 14px; background: rgba(203, 165, 103, .08); color: #dbba7e; }
.cdg-pdf-confirm-eyebrow { margin: 0 0 .5rem; color: #dbba7e; font-size: .72rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.cdg-pdf-confirm h2 { margin: 0 0 1.25rem; color: #f5ecd9; font-family: var(--font-title); font-size: 1.9rem; line-height: 1.2; }
.cdg-pdf-confirm-file { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; padding: .85rem 1rem; border: 1px solid rgba(203, 165, 103, .18); border-radius: 8px; background: rgba(0, 0, 0, .18); }
.cdg-pdf-confirm-filename { min-width: 0; overflow-wrap: anywhere; color: #e1d9c9; font-size: .85rem; line-height: 1.5; }
.cdg-pdf-confirm-size { flex-shrink: 0; margin-left: auto; padding: .2rem .5rem; border-radius: 4px; background: rgba(203, 165, 103, .15); color: #ebca8c; font-size: .8rem; font-weight: 700; }
#cdg-pdf-confirm-description { margin: 0; color: #c4bcae; font-size: .95rem; line-height: 1.65; }
.cdg-pdf-confirm-actions { display: flex; align-items: center; justify-content: flex-end; gap: .75rem; margin-top: 1.75rem; padding-top: 1.25rem; border-top: 1px solid rgba(203, 165, 103, .18); }
.cdg-pdf-confirm-cancel { min-height: 44px; padding: .7rem 1rem; border: 1px solid rgba(203, 165, 103, .35); border-radius: 999px; background: transparent; color: #e1d9c9; font: inherit; cursor: pointer; }
.cdg-pdf-confirm-cancel:hover { background: rgba(203, 165, 103, .1); color: #fff; }
.cdg-pdf-confirm-actions .btn { display: inline-flex; align-items: center; gap: .65rem; border: 1px solid rgba(203, 165, 103, .3); }
.cdg-pdf-confirm button:focus-visible { outline: 2px solid #ebca8c; outline-offset: 3px; }
@media (max-width: 575px) {
    .cdg-pdf-confirm { padding: 1.5rem; }
    .cdg-pdf-confirm h2 { font-size: 1.65rem; }
    .cdg-pdf-confirm-file { flex-wrap: wrap; }
    .cdg-pdf-confirm-size { margin-left: 0; }
    .cdg-pdf-confirm-actions { flex-direction: column-reverse; align-items: stretch; }
    .cdg-pdf-confirm-actions .btn { justify-content: center; }
}

/* Portrait covers for the document catalogue. */
.cdg-resource-card-cover {
    position: relative;
    isolation: isolate;
    display: grid;
    width: 100%;
    min-width: 0;
    min-height: 25rem;
    aspect-ratio: 3 / 4;
    border: 1px solid rgba(244, 233, 211, .75);
    border-radius: 11px;
    background: #18222d;
    color: #fff;
    box-shadow: 0 3px 8px rgba(0, 0, 0, .35);
}
.cdg-resource-card-cover .article-card-media {
    position: absolute;
    inset: 0;
    aspect-ratio: auto;
}
.cdg-resource-card-cover .article-card-media img {
    display: block;
    height: 100%;
    object-fit: cover;
}
.cdg-resource-card-cover.cdg-resource-map .article-card-media img {
    object-fit: cover;
}
.cdg-resource-card-cover .article-card-media::after {
    background: linear-gradient(180deg, transparent 20%, rgba(9, 15, 22, .25) 38%, rgba(9, 15, 22, .88) 68%, #111b26 100%);
}
.cdg-resource-card-cover .cdg-resource-placeholder {
    padding-bottom: 12rem;
    background: radial-gradient(circle at 50% 20%, rgba(203, 165, 103, .2), transparent 55%), #18222d;
}
.cdg-resource-card-cover .article-card-body {
    align-self: end;
    z-index: 1;
    gap: .65rem;
    min-width: 0;
    padding: 11rem .85rem .65rem;
    pointer-events: none;
}
.cdg-resource-card-cover .article-card-body a { pointer-events: auto; }
.cdg-resource-card-cover .article-card-title {
    font-size: 1.25rem;
    line-height: 1.15;
    text-shadow: 0 2px 5px #000;
}
.cdg-resource-card-cover .article-card-title a { color: #fff; text-decoration: none; }
.cdg-resource-card-cover .article-card-title a:hover { color: #f3d697; }
.cdg-resource-card-cover .cdg-resource-badges { gap: .3rem; }
.cdg-resource-card-cover .cdg-resource-badge {
    padding: .18rem .4rem;
    border: 1px solid #d7c5a5;
    border-radius: 4px;
    background: #eee4d2;
    color: #302519;
    font-size: .7rem;
    line-height: 1.3;
    letter-spacing: .02em;
}
.cdg-resource-card-cover .cdg-resource-badge.is-resource_system {
    border-color: #d8a298;
    background: #f1d2cb;
    color: #7b231c;
}
.cdg-resource-card-cover .cdg-resource-badge:hover { background: #fff4dc; }
.cdg-resource-card-meta { display: grid; gap: .25rem; color: #e0e3e6; font-size: .78rem; line-height: 1.4; }
.cdg-resource-card-cover .cdg-resource-card-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-top: .3rem;
    padding-top: .4rem;
    border-top: 1px solid rgba(255, 255, 255, .22);
    text-align: left;
}
.cdg-resource-card-link {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    min-height: 44px;
    color: #f3d697;
    font-size: .85rem;
    font-weight: 700;
    text-decoration: none;
}
.cdg-resource-card-download { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 6px; color: #65c7ef; }
.cdg-resource-card-link:hover { color: #fff; }
.cdg-resource-card-download:hover { background: rgba(101, 199, 239, .15); color: #b8ecff; }
.cdg-resource-card-cover a:focus-visible,
.cdg-resource-card-cover button:focus-visible { outline: 2px solid #f3d697; outline-offset: -3px; }
@media (max-width: 575px) {
    .cdg-resource-card-cover { min-height: 28rem; }
}
@media (prefers-reduced-motion: reduce) {
    .cdg-resource-card-cover { transition: none; }
    .cdg-resource-card-cover:hover { transform: none; }
}
