/* ========================================================================== 
   SOMERSET COUNTY MDGENWEB
   Main Site Stylesheet

   Color palette inspired by Chesapeake water, marsh grass, weathered wood,
   and oyster shell tones used in the Somerset MDGenWeb artwork.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. SITE COLORS AND BASIC SETTINGS
   -------------------------------------------------------------------------- */

:root {
    --water-deep: #304649;
    --water: #587176;
    --water-light: #78908d;
    --marsh-dark: #4d4936;
    --marsh: #777256;
    --driftwood: #8c7654;
    --marsh-gold: #b5a27d;
    --oyster: #eee4cf;
    --oyster-light: #f7f1e5;
    --paper: #fbf8f0;
    --ink: #2d2b26;
    --ink-soft: #4d493f;
    --border: #a49374;
    --link: #245e70;
    --link-visited: #635074;
    --link-hover: #7b4f27;
    --shadow: rgba(35, 32, 25, 0.28);

    --site-width: 1180px;
    --reading-width: 78ch;
    --radius: 6px;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;
    color: var(--ink);
    font-family: Lexend, "Century Gothic", "Avenir Next", sans-serif;
    font-size: 1rem;
    line-height: 1.65;
    background:
        radial-gradient(circle at 15% 12%, rgba(255, 255, 255, 0.10), transparent 28%),
        radial-gradient(circle at 82% 38%, rgba(244, 231, 196, 0.09), transparent 30%),
        linear-gradient(180deg, #526c70 0%, #6c817e 48%, #77775f 76%, #665f49 100%);
    background-attachment: fixed;
}

img {
    max-width: 100%;
    height: auto;
}

p,
ul,
ol,
dl,
blockquote,
figure,
table {
    margin-top: 0;
}

p,
li,
dd,
dt,
td,
th,
label,
input,
select,
button,
small,
figcaption {
    font-size: 1rem;
}

/* --------------------------------------------------------------------------
   2. ACCESSIBILITY AND LINKS
   -------------------------------------------------------------------------- */

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 1000;
    padding: 0.7rem 1rem;
    color: #ffffff;
    background: #000000;
}

.skip-link:focus {
    left: 1rem;
    top: 1rem;
}

a {
    color: var(--link);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.16em;
}

a:visited {
    color: var(--link-visited);
}

a:hover,
a:focus {
    color: var(--link-hover);
    text-decoration-thickness: 2px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid #d3a34f;
    outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   3. OUTER PAGE SHELL
   -------------------------------------------------------------------------- */

.site-shell {
    width: min(calc(100% - 2rem), var(--site-width));
    margin: 1rem auto 2rem;
    background: var(--oyster);
    border: 1px solid rgba(59, 52, 39, 0.55);
    border-radius: var(--radius);
    box-shadow: 0 12px 34px var(--shadow);
    overflow: hidden;
}

.site-main {
    padding: 1.6rem clamp(1rem, 3vw, 2.6rem) 2.4rem;
    background:
        linear-gradient(rgba(247, 241, 229, 0.96), rgba(247, 241, 229, 0.96)),
        var(--oyster-light);
}

/* --------------------------------------------------------------------------
   4. SITE HEADER AND BRANDING
   -------------------------------------------------------------------------- */

.site-header {
    background: var(--water-deep);
}

.home-brand,
.interior-brand {
    margin: 0;
}

.home-brand img {
    display: block;
    width: 100%;
}

.interior-brand {
    display: none;
    align-items: center;
    gap: 1.25rem;
    padding: 1rem clamp(1rem, 3vw, 2rem);
    background:
        linear-gradient(115deg, rgba(34, 52, 54, 0.98), rgba(71, 88, 86, 0.95)),
        var(--water-deep);
}

.interior-brand img {
    width: 132px;
    max-width: 28vw;
    border: 1px solid rgba(235, 219, 178, 0.55);
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.28);
}

.interior-brand-text {
    color: var(--oyster-light);
}

.interior-brand-text strong {
    display: block;
    margin-bottom: 0.15rem;
    font-size: clamp(1.45rem, 4vw, 2.1rem);
    line-height: 1.15;
}

.interior-brand-text span {
    display: block;
    color: #e4d6b8;
    font-size: 1rem;
}

.interior-page .home-brand {
    display: none;
}

.interior-page .interior-brand {
    display: flex;
}

/* --------------------------------------------------------------------------
   5. PRIMARY NAVIGATION
   -------------------------------------------------------------------------- */

.site-nav {
    border-top: 1px solid rgba(230, 215, 180, 0.34);
    border-bottom: 1px solid #1f3032;
    background: #344f53;
}

.site-nav ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-nav li {
    margin: 0;
}

.site-nav a {
    display: block;
    padding: 0.78rem 0.88rem;
    color: #f4ead5;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    border-left: 1px solid rgba(237, 223, 190, 0.18);
}

.site-nav li:last-child a {
    border-right: 1px solid rgba(237, 223, 190, 0.18);
}

.site-nav a:visited {
    color: #f4ead5;
}

.site-nav a:hover,
.site-nav a:focus,
.site-nav a[aria-current="page"] {
    color: #ffffff;
    background: #6b654c;
}

.secondary-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.45rem 1.3rem;
    padding: 0.65rem 1rem;
    color: #f1e4c8;
    background: #283d40;
}

.secondary-nav a,
.secondary-nav a:visited {
    color: #f1e4c8;
    font-weight: 650;
}

.secondary-nav a:hover,
.secondary-nav a:focus {
    color: #ffffff;
}

/* --------------------------------------------------------------------------
   6. BREADCRUMBS AND PAGE HEADINGS
   -------------------------------------------------------------------------- */

.breadcrumbs {
    margin: 0 0 1rem;
    padding-bottom: 0.65rem;
    color: var(--ink-soft);
    border-bottom: 1px solid #c9b997;
}

.breadcrumbs a {
    font-weight: 650;
}

h1,
h2,
h3,
h4 {
    color: var(--water-deep);
    line-height: 1.25;
}

h1 {
    margin: 0 0 1rem;
    font-size: clamp(2rem, 5vw, 2.7rem);
}

h2 {
    margin: 2rem 0 0.8rem;
    font-size: clamp(1.55rem, 4vw, 2rem);
}

h3 {
    margin: 1.5rem 0 0.55rem;
    font-size: clamp(1.25rem, 3vw, 1.5rem);
}

h4 {
    margin: 1.25rem 0 0.45rem;
    font-size: 1.12rem;
}

.page-intro {
    max-width: 100%;
    margin-bottom: 1.6rem;
    color: #403c33;
    font-size: 1.08rem;
}

.section-rule {
    width: 100%;
    height: 1px;
    margin: 2rem 0;
    border: 0;
    background: linear-gradient(90deg, transparent, #9b8d70 12%, #9b8d70 88%, transparent);
}

/* --------------------------------------------------------------------------
   7. HOME PAGE LAYOUT
   -------------------------------------------------------------------------- */

.home-welcome {
    display: flow-root;
}

.home-welcome-text {
    width: 100%;
    max-width: none;
}

/* Float the Old Somerset map so the welcome/history paragraphs flow
   beside it and then continue at full width underneath it. */
.home-map {
    float: right;
    width: min(350px, 34%);
    margin: 0 0 1rem clamp(1.2rem, 3vw, 2rem);
    padding: 0.75rem;
    background: #e3d7be;
    border: 1px solid #ad9d7b;
    border-radius: var(--radius);
}

.home-map img {
    display: block;
    width: 100%;
}

.home-map figcaption {
    margin-top: 0.55rem;
    color: #514b40;
    text-align: center;
}

.history-quote {
    margin: 1.3rem 0;
    padding: 1rem 1.15rem;
    color: #38382e;
    background: #e8ddc5;
    border-left: 5px solid var(--marsh);
}

.history-quote p:last-child {
    margin-bottom: 0;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin: 1rem 0 2rem;
}

.resource-card,
.feature-card,
.search-card,
.notice-card {
    padding: 1.1rem 1.2rem;
    background: var(--paper);
    border: 1px solid #b8a98a;
    border-radius: var(--radius);
    box-shadow: 0 3px 8px rgba(61, 53, 41, 0.10);
}

.resource-card h3,
.feature-card h3,
.search-card h3,
.notice-card h3 {
    margin-top: 0;
}

.resource-card p:last-child,
.feature-card p:last-child,
.search-card p:last-child,
.notice-card p:last-child {
    margin-bottom: 0;
}

.card-link {
    font-weight: 750;
}

.feature-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.1rem;
    margin: 1rem 0 2rem;
}

.feature-card.feature-forum {
    background: linear-gradient(145deg, #e8dfca, #f8f3e8);
    border-top: 5px solid #526c70;
}

.feature-card.feature-album {
    background: linear-gradient(145deg, #e7ddc6, #f8f3e8);
    border-top: 5px solid #7b7253;
}

.quick-list {
    columns: 2;
    column-gap: 2rem;
    margin-bottom: 0;
}

.quick-list li {
    margin-bottom: 0.42rem;
    break-inside: avoid;
}

/* --------------------------------------------------------------------------
   8. SEARCH FORMS
   -------------------------------------------------------------------------- */

.search-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.search-card form {
    margin-top: 0.8rem;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: end;
}

.form-field {
    flex: 1 1 240px;
}

.form-field label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 700;
}

input[type="text"],
select {
    width: 100%;
    min-height: 44px;
    padding: 0.55rem 0.65rem;
    color: var(--ink);
    font-family: inherit;
    background: #ffffff;
    border: 1px solid #82775f;
    border-radius: 4px;
}

button,
input[type="submit"],
input[type="reset"] {
    min-height: 44px;
    padding: 0.55rem 0.9rem;
    color: #ffffff;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 750;
    cursor: pointer;
    background: var(--water-deep);
    border: 1px solid #223437;
    border-radius: 4px;
}

button:hover,
input[type="submit"]:hover,
input[type="reset"]:hover {
    background: #5b6048;
}

.search-tools {
    margin-top: 0.65rem;
}

.search-tools a {
    margin-right: 1rem;
    font-weight: 650;
}

/* --------------------------------------------------------------------------
   9. INTERIOR PAGE CONTENT HELPERS
   -------------------------------------------------------------------------- */

.content-narrow {
    max-width: var(--reading-width);
}

.link-list,
.record-list,
.book-list {
    padding-left: 1.3rem;
}

.link-list li,
.record-list li,
.book-list li {
    margin-bottom: 0.55rem;
}

.info-box {
    margin: 1.25rem 0;
    padding: 1rem 1.15rem;
    background: #e7ddc6;
    border: 1px solid #b3a17c;
    border-left: 5px solid var(--water);
    border-radius: 4px;
}

.warning-box {
    margin: 1.25rem 0;
    padding: 1rem 1.15rem;
    background: #f0e3ca;
    border: 1px solid #b89d6b;
    border-left: 5px solid #8a5b35;
    border-radius: 4px;
}

.table-wrap {
    max-width: 100%;
    overflow-x: auto;
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fffdf8;
}

.data-table th,
.data-table td {
    padding: 0.65rem 0.75rem;
    vertical-align: top;
    border: 1px solid #b7a98c;
}

.data-table th {
    color: #ffffff;
    text-align: left;
    background: var(--water-deep);
}

.data-table tr:nth-child(even) td {
    background: #f2ead9;
}



/* --------------------------------------------------------------------------
   9A. HISTORICAL RECORDS AND TRANSCRIPTIONS
   -------------------------------------------------------------------------- */

.records-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin: 1rem 0 2rem;
}

.records-panel {
    padding: 1rem 1.15rem;
    background: var(--paper);
    border: 1px solid #b8a98a;
    border-radius: var(--radius);
}

.records-panel h2,
.records-panel h3 {
    margin-top: 0;
}

.records-panel ul {
    margin-bottom: 0;
    padding-left: 1.25rem;
}

.records-panel li {
    margin-bottom: 0.5rem;
}

.record-document {
    max-width: 100%;
}

.record-document > :first-child {
    margin-top: 0;
}

.record-document p,
.record-document blockquote,
.record-document ul,
.record-document ol {
    max-width: 100%;
}

.record-document blockquote {
    margin-left: 1rem;
    padding: 0.8rem 1rem;
    background: #ece2cf;
    border-left: 4px solid var(--marsh-gold);
}

.record-document pre {
    max-width: 100%;
    overflow-x: auto;
    padding: 0.85rem 1rem;
    color: var(--ink);
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.55;
    white-space: pre;
    tab-size: 8;
    background: #fffdf8;
    border: 1px solid #c1b395;
    border-radius: 4px;
}

.text-center {
    text-align: center;
}

.text-right,
.back-to-top {
    text-align: right;
}

.record-subhead {
    margin-top: 1.3rem;
    color: var(--water-deep);
    font-weight: 700;
}

.record-note {
    font-style: italic;
}

.alpha-heading {
    margin-top: 2rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid #b8aa8a;
}

.alpha-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.7rem;
    margin: 1rem 0 1.5rem;
    padding: 0.75rem 0.9rem;
    background: #e7ddc6;
    border: 1px solid #b6a584;
    border-radius: 4px;
}

.alpha-nav a {
    font-weight: 700;
}

.pdf-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem 1.5rem;
    padding-left: 1.25rem;
}

.record-return {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #c7b898;
}

@media (max-width: 700px) {
    .records-grid,
    .pdf-list {
        grid-template-columns: 1fr;
    }
}


/* --------------------------------------------------------------------------
   10. SITE FOOTER
   -------------------------------------------------------------------------- */

.site-footer {
    padding: 1.35rem clamp(1rem, 3vw, 2rem) 1.5rem;
    color: #f3e8d2;
    background: #2d4144;
    border-top: 4px solid #82795a;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem 1.25rem;
    margin: 0 0 1rem;
    padding: 0;
    list-style: none;
}

.footer-links a,
.footer-links a:visited {
    color: #f3e8d2;
}

.footer-links a:hover,
.footer-links a:focus {
    color: #ffffff;
}

/* Keep every footer link clearly visible against the dark water background. */
.site-footer a,
.site-footer a:visited {
    color: #f4d79b;
    font-weight: 700;
}

.site-footer a:hover,
.site-footer a:focus {
    color: #ffffff;
}

.footer-meta {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.footer-meta p {
    margin: 0.25rem 0;
}

.footer-small {
    color: #dfd2b8;
}

/* --------------------------------------------------------------------------
   11. RESPONSIVE LAYOUT
   -------------------------------------------------------------------------- */

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

    .home-map {
        float: none;
        width: 100%;
        max-width: 440px;
        margin: 0 auto 1.2rem;
    }
}

@media (max-width: 700px) {
    .site-shell {
        width: min(calc(100% - 1rem), var(--site-width));
        margin-top: 0.5rem;
    }

    .site-nav ul {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    .site-nav a,
    .site-nav li:last-child a {
        border-right: 0;
        border-bottom: 1px solid rgba(237, 223, 190, 0.18);
    }

    .card-grid,
    .feature-row,
    .search-grid {
        grid-template-columns: 1fr;
    }

    .quick-list {
        columns: 1;
    }

    .interior-brand {
        align-items: flex-start;
    }

    .interior-brand img {
        width: 105px;
    }
}

@media (max-width: 460px) {
    .site-nav ul {
        grid-template-columns: 1fr;
    }

    .interior-brand {
        gap: 0.85rem;
    }

    .interior-brand-text span {
        display: none;
    }
}

/* --------------------------------------------------------------------------
   12. PRINT STYLES
   -------------------------------------------------------------------------- */

@media print {
    body {
        color: #000000;
        background: #ffffff;
    }

    .site-shell {
        width: 100%;
        margin: 0;
        border: 0;
        box-shadow: none;
    }

    .site-nav,
    .secondary-nav,
    .skip-link,
    .site-footer {
        display: none;
    }

    .site-main {
        padding: 0;
        background: #ffffff;
    }

    a {
        color: #000000;
    }
}


/* --------------------------------------------------------------------------
   9B. SOMERSET CEMETERIES PROJECT
   -------------------------------------------------------------------------- */


/* SOMERSET CEMETERIES PROJECT BRANDING
   The SCP logo and joint-project credit appear on every SCP page. */
.scp-branding {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    margin: 0.85rem 0 1.4rem;
    padding: 0.85rem 1rem;
    background: #e7ddc6;
    border: 1px solid #b6a584;
    border-left: 6px solid var(--water);
    border-radius: var(--radius);
}

.scp-branding-home {
    flex-direction: column;
    gap: 0.55rem;
    padding: 1.2rem 1rem 1rem;
    text-align: center;
    background: #eee4d0;
    border-left-width: 1px;
    border-top: 6px solid var(--water);
}

.scp-logo-link {
    display: block;
    flex: 0 0 auto;
    line-height: 0;
}

.scp-logo {
    display: block;
    width: min(210px, 34vw);
    height: auto;
    margin: 0;
}

.scp-branding-home .scp-logo {
    width: min(390px, 82vw);
    margin: 0 auto;
}

.scp-credit {
    min-width: 0;
    color: var(--ink-soft);
    line-height: 1.55;
}

.scp-credit strong,
.scp-credit span {
    display: block;
}

.scp-credit strong {
    margin-bottom: 0.15rem;
    color: var(--ink);
    font-size: 1.05rem;
}

.scp-credit a {
    font-weight: 700;
}

.scp-branding-home .scp-credit {
    font-size: 1.05rem;
}

@media (max-width: 640px) {
    .scp-branding {
        flex-direction: column;
        text-align: center;
    }

    .scp-logo {
        width: min(290px, 78vw);
        margin: 0 auto;
    }
}


.cemetery-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(250px, 0.42fr);
    gap: 1rem;
    align-items: start;
    margin-bottom: 1.5rem;
}

.cemetery-project-box {
    padding: 1rem 1.15rem;
    background: #e4d8bd;
    border: 1px solid #b2a07d;
    border-top: 5px solid var(--water);
    border-radius: var(--radius);
}

.cemetery-project-box h2,
.cemetery-project-box h3 {
    margin-top: 0;
}

.cemetery-directory {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
    margin: 1rem 0 2rem;
}

.cemetery-entry {
    padding: 0.9rem 1rem;
    background: var(--paper);
    border: 1px solid #b8a98a;
    border-left: 5px solid #6a7d78;
    border-radius: var(--radius);
}

.cemetery-entry h3 {
    margin: 0 0 0.25rem;
    font-size: 1.12rem;
}

.cemetery-entry p {
    margin: 0;
    color: var(--ink-soft);
}

.cemetery-entry .listing-note {
    display: inline-block;
    margin-top: 0.3rem;
    padding: 0.1rem 0.45rem;
    color: #443d2f;
    font-size: 1rem;
    font-weight: 700;
    background: #e6d6b3;
    border-radius: 3px;
}

.cemetery-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 1.4rem;
    margin: 0 0 1.4rem;
    padding: 0.75rem 0.9rem;
    background: #e7ddc6;
    border: 1px solid #b6a584;
    border-radius: 4px;
}

.cemetery-meta p {
    margin: 0;
}

.cemetery-document {
    max-width: 100%;
}

.cemetery-document p,
.cemetery-document blockquote,
.cemetery-document ul,
.cemetery-document ol {
    max-width: 100%;
}

.cemetery-document blockquote {
    margin-left: 1rem;
    padding: 0.8rem 1rem;
    background: #ece2cf;
    border-left: 4px solid var(--marsh-gold);
}

.grave-separator {
    width: 100%;
    height: 1px;
    margin: 1.25rem 0;
    border: 0;
    background: linear-gradient(90deg, transparent, #ab9c7e 10%, #ab9c7e 90%, transparent);
}

.photo-grid {
    display: grid;
    gap: 1rem;
    margin: 1.25rem 0 1.6rem;
}

.photo-grid-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.photo-grid-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.photo-grid figure {
    margin: 0;
    padding: 0.7rem;
    text-align: center;
    background: #f5eddd;
    border: 1px solid #b8a98a;
    border-radius: 4px;
}

.photo-grid img {
    display: block;
    max-height: 330px;
    margin: 0 auto;
    object-fit: contain;
}

.photo-grid figcaption {
    margin-top: 0.55rem;
}

.cemetery-image {
    border-radius: 3px;
}

.cemetery-photo-left {
    float: left;
    width: min(260px, 38%);
    margin: 0.25rem 1.2rem 0.8rem 0;
}

.map-embed {
    display: block;
    width: 100%;
    min-height: 430px;
    margin: 1rem 0 0.5rem;
    border: 1px solid #a89673;
    border-radius: 4px;
}

.underlined {
    text-decoration: underline;
}

.legacy-emphasis {
    color: #7a352e;
}

.example-box {
    margin: 1rem 0 1.4rem;
    padding: 1rem 1.15rem;
    background: #fffdf8;
    border: 1px solid #b8a98a;
    border-left: 5px solid var(--marsh);
    border-radius: 4px;
}

@media (max-width: 760px) {
    .cemetery-hero,
    .cemetery-directory,
    .photo-grid-two,
    .photo-grid-three {
        grid-template-columns: 1fr;
    }

    .cemetery-photo-left {
        float: none;
        width: min(320px, 100%);
        margin: 0 auto 1rem;
    }
}


/* --------------------------------------------------------------------------
   9C. MAPS, BOOKS, HISTORY, LETTERS, RESOURCES, AND GALLERIES
   -------------------------------------------------------------------------- */

.content-section {
    margin: 1.4rem 0 2rem;
}

.content-section > :first-child {
    margin-top: 0;
}

.directory-list {
    margin: 0;
    padding-left: 1.35rem;
}

.directory-list li {
    margin-bottom: 0.8rem;
}

.resource-directory {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin: 1rem 0 2rem;
}

.resource-entry {
    padding: 1rem 1.1rem;
    background: #fffdf8;
    border: 1px solid #b8a98a;
    border-radius: var(--radius);
}

.resource-entry h2,
.resource-entry h3 {
    margin-top: 0;
}

.map-gallery,
.postcard-gallery,
.atlas-gallery {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin: 1rem 0 2rem;
}

.gallery-card {
    margin: 0;
    padding: 0.75rem;
    background: #fffdf8;
    border: 1px solid #b8a98a;
    border-radius: var(--radius);
}

.gallery-card img {
    display: block;
    width: 100%;
    max-height: 260px;
    object-fit: contain;
    margin: 0 auto 0.6rem;
}

.gallery-card figcaption {
    text-align: center;
    font-weight: 650;
}

.full-image {
    display: block;
    width: 100%;
    height: auto;
    margin: 1rem auto;
    background: #ffffff;
    border: 1px solid #a8997b;
}

.ebook-frame,
.pdf-frame {
    display: block;
    width: 100%;
    min-height: 78vh;
    border: 1px solid #9e8f73;
    background: #ffffff;
}

.credit-line,
.source-note {
    color: var(--ink-soft);
    font-style: italic;
}

.letter-document {
    max-width: 100%;
}

.letter-document p {
    max-width: 100%;
}

dl.reference-terms dt {
    margin-top: 0.8rem;
    font-weight: 700;
    color: var(--water-deep);
}

dl.reference-terms dd {
    margin-left: 1.25rem;
}

.legacy-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: #fffdf8;
}

.legacy-content th,
.legacy-content td {
    padding: 0.6rem 0.7rem;
    vertical-align: top;
    border: 1px solid #b7a98c;
}

.legacy-content th {
    color: #ffffff;
    background: var(--water-deep);
}

.legacy-content pre {
    max-width: 100%;
    overflow-x: auto;
    padding: 0.9rem 1rem;
    font-family: Lexend, "Century Gothic", "Avenir Next", sans-serif;
    font-size: 1rem;
    line-height: 1.55;
    white-space: pre-wrap;
    background: #fffdf8;
    border: 1px solid #c1b395;
    border-radius: 4px;
}

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

@media (max-width: 650px) {
    .resource-directory,
    .map-gallery,
    .postcard-gallery,
    .atlas-gallery {
        grid-template-columns: 1fr;
    }
}
