/* ---------------------------------------------------------------------------
   Chesapeake Quarterly — database-driven archive.
   Scoped to .archive-article / .archive-issue so nothing here can affect the
   hand-built modern issue pages.
   --------------------------------------------------------------------------- */

/* --- accessibility utilities ---------------------------------------------- */

/* Visible to screen readers, not to sighted users. Uses the clip-path technique
   rather than display:none, which would remove it from the accessibility tree. */
.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* Off-screen until focused, so keyboard users can jump past the masthead and nav. */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 1000;
    padding: .7em 1.2em;
    background: #336699;
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}
.skip-link:focus {
    left: 0;
    outline: 3px solid #ffcc00;
    outline-offset: 2px;
}

/* The legacy stylesheets suppress focus rings in places. Put a visible one back —
   without it the site is unusable by keyboard. */
.archive-article a:focus-visible,
.archive-issue a:focus-visible,
.issue-toc a:focus-visible {
    outline: 3px solid #b34700;
    outline-offset: 2px;
    border-radius: 2px;
}

/* --- images and figures ---------------------------------------------------- */

/* Every image in the archive is fluid and never overflows its column. The legacy
   width/height attributes were stripped during extraction, so sizing is entirely
   CSS-driven. */
.archive-article img,
.archive-issue img {
    max-width: 100%;
    height: auto;
    border: 0;
    display: block;
}

/* Figures are the main rhythm of an article; give them real breathing room rather
   than the zero-margin table cells they came out of. */
.archive-article figure {
    margin: 2rem 0;
    padding: 0;
}

.archive-article figure img {
    margin: 0 auto;
    border-radius: 2px;
}

.archive-article figcaption,
.archive-article .LEGEND {
    margin-top: .6rem;
    padding: 0 .2rem;
    font-size: .875rem;
    line-height: 1.5;
    color: #4a4a4a;
    border-left: 3px solid #d6d6d6;
    padding-left: .75rem;
}

/* The lead image of an article sits tighter to the headline than body figures. */
.archive-article figure.cq-masthead {
    margin: 1rem 0 2.25rem;
}

/* Trailing gallery for pre-V08 articles whose images sat outside the prose. */
.archive-article .article-figures {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.75rem 1.5rem;
}
.archive-article .article-figures figure {
    margin: 0;
}

/* Legacy float containers, kept but tamed: float only where there is room for it. */
.archive-article .img_aside {
    margin: .5rem 0 1.5rem;
}
@media (min-width: 768px) {
    .archive-article .img_aside.right {
        float: right;
        width: 42%;
        margin: .4rem 0 1.5rem 2rem;
    }
    .archive-article .img_aside.left {
        float: left;
        width: 42%;
        margin: .4rem 2rem 1.5rem 0;
    }
}

/* --- article typography ---------------------------------------------------- */

.archive-article .article-head {
    margin-bottom: 1.5rem;
}
.archive-article h1 {
    margin-bottom: .35rem;
    line-height: 1.2;
}
.archive-article .sub-title {
    margin: 0 0 .6rem;
    font-size: 1.15rem;
    font-style: italic;
    color: #444;
}
.archive-article .author {
    margin: 0 0 .3rem;
    font-weight: 600;
}
.archive-article .issue-stamp {
    margin: 0;
    font-size: .875rem;
    color: #666;
}

/* Subheadings promoted out of the legacy SUB-HEAD divs. */
.archive-article .article-body h2 {
    margin: 2.25rem 0 .75rem;
    font-size: 1.35rem;
    line-height: 1.3;
}
.archive-article .article-body h3 {
    margin: 1.75rem 0 .6rem;
    font-size: 1.15rem;
}

.archive-article .article-body p {
    margin: 0 0 1.15rem;
    line-height: 1.65;
}

/* Clear any legacy float before the article footer nav. */
.archive-article .article-nav {
    clear: both;
    margin-top: 2.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e0e0e0;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
}
.archive-article .article-nav a {
    max-width: 48%;
}
@media (max-width: 600px) {
    .archive-article .article-nav a { max-width: 100%; }
}

/* --- issue cover page ------------------------------------------------------ */

.archive-issue .issue-head {
    margin-bottom: 1.5rem;
}
.archive-issue .issue-dateline {
    margin: .25rem 0 .75rem;
    color: #555;
}
/* --- issue cover page, matching the original hand-built layout --------------- */

.issue-cover-page .issue-head { margin-bottom: .6rem; }

.issue-cover-page h1.MAIN-HEAD {
    margin: 0 0 .15rem;
    font-size: 24px;
    line-height: 1.25;
}
.issue-cover-page h1.MAIN-HEAD a { color: inherit; }

.issue-cover-page .issue-dateline {
    margin: 0 0 10px;
    font-weight: 600;
}

/* Full-width hero, with the credit set small and right-aligned as in the original. */
.issue-splash {
    margin: 0 0 1.2rem;
}
.issue-splash img {
    width: 100%;
    height: auto;
    border: 0;
    display: block;
}
.issue-splash-credit {
    margin: .2em 0 0;
    text-align: right;
    font-style: italic;
    font-size: 11px;
    color: #555;
}

.issue-cover-page .issue-article {
    /* the rule between entries the original drew with a table cell border-top */
    padding: .9rem 0 .2rem;
    border-top: 1px solid #a0a3a5;
    overflow: hidden;            /* contains the floated thumbnail */
}
.issue-cover-page .issue-article.is-lead {
    padding-top: 0;
    border-top: 0;
}

.issue-cover-page .issue-article-title {
    margin: 0 0 .1rem;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
}
.issue-cover-page .is-lead .issue-article-title { font-size: 17px; }

.issue-cover-page .issue-article-subtitle {
    margin: 0 0 .2rem;
    font-style: italic;
    color: #444;
}
.issue-cover-page .byline {
    margin: .4em 0 .6em;
    font-weight: 600;
}

/* Thumbnail floats beside the teaser above small screens, stacks below. */
.issue-article-thumb {
    margin: .2em 0 .8em 0;
}
.issue-article-thumb img {
    width: 100%;
    height: auto;
    border: 0;
    display: block;
}
.issue-article-thumb figcaption {
    margin-top: .2em;
    text-align: right;
    font-style: italic;
    font-size: 11px;
    color: #555;
}
@media (min-width: 576px) {
    .issue-article-thumb {
        float: right;
        width: 170px;
        margin: .6em 0 .8em .8em;
    }
    .issue-cover-page .is-lead .issue-article-thumb { width: 200px; }
}

.issue-article-summary {
    padding: .2em .2em .8em 0;
    line-height: 1.55;
}
.issue-article-summary .more-link {
    font-style: italic;
    white-space: nowrap;
}

.archive-issue .section-head {
    margin: 2.5rem 0 1rem;
    padding-bottom: .35rem;
    border-bottom: 2px solid #336699;
    font-variant: small-caps;
}
.archive-issue .article-teaser {
    margin-bottom: 2.25rem;
}
.archive-issue .article-teaser h3 {
    margin: 0 0 .35rem;
    line-height: 1.3;
}
.archive-issue .article-teaser .author {
    margin: .2rem 0 .5rem;
    font-size: .95rem;
    color: #555;
}
.archive-issue .issue-nav {
    clear: both;
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

/* --- sidebar: cover + PDF --------------------------------------------------- */

.issue-aside {
    text-align: left;
    padding: .75rem .75rem 0;
}

.issue-cover {
    /* sits under the download button */
    margin: 0 0 .9rem;
    text-align: center;
}
.issue-cover img {
    max-width: 100%;
    height: auto;
    border: 1px solid #d0d0d0;
    /* covers are the one place a drop shadow reads as "this is a magazine" */
    box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
}
.issue-cover-blurb {
    margin-top: .55rem;
    font-size: .8rem;
    font-style: italic;
    line-height: 1.45;
    color: #4a4a4a;
    text-align: left;
}

.issue-pdf {
    margin: 0 0 .85rem;
    text-align: center;
}
.issue-pdf .btn {
    display: inline-block;
    width: 100%;
}
.issue-pdf .fa {
    margin-right: .35rem;
}

/* The archive rules above set display:block on images so figures stack cleanly. That
   stops the shared sidebar's `text-align: center` from centring anything — a block box
   is centred by auto margins, not by text-align. Put it back for everything in the
   sidebar, which is where the Maryland Sea Grant / NOAA logo lives. */
.issue-sidebar img {
    margin-left: auto;
    margin-right: auto;
}

/* --- sidebar table of contents --------------------------------------------- */

.issue-toc {
    text-align: left;
    padding: .5rem .75rem 1rem;
}
.issue-toc .issue-toc-head {
    margin: 0 0 .3rem;
    font-size: 1.05rem;
    line-height: 1.3;
}
.issue-toc .issue-toc-date {
    margin: 0 0 .75rem;
    font-size: .85rem;
    color: #666;
}
.issue-toc-list {
    list-style: none;
    margin: 0 0 .75rem;
    padding: 0;
}
.issue-toc-list li {
    margin-bottom: .45rem;
    line-height: 1.35;
}
.issue-toc-list li.current > a {
    font-weight: 700;
    /* not colour alone — the current item stays distinguishable without colour vision */
    border-left: 3px solid #336699;
    padding-left: .5rem;
    display: inline-block;
}

/* --- archive + search page -------------------------------------------------- */

.archive-page .archive-intro {
    margin: .35rem 0 1.25rem;
    color: #555;
}

.archive-search {
    margin: 0 0 1.5rem;
    padding: 1.1rem 1.15rem .9rem;
    background: #f2f5f8;
    border: 1px solid #dbe3ea;
    border-radius: 4px;
}
.archive-search-row {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
}
.archive-search input[type="search"] {
    flex: 1 1 18rem;
    min-width: 0;
    padding: .6rem .75rem;
    font-size: 1.05rem;
    border: 1px solid #b9c4ce;
    border-radius: 3px;
    background: #fff;
}
.archive-search input[type="search"]:focus-visible {
    outline: 3px solid #b34700;
    outline-offset: 1px;
}
.archive-search-help {
    margin: .55rem 0 0;
    font-size: .8rem;
    color: #5c6873;
}

.search-region {
    margin-bottom: 1.5rem;
    min-height: 0;
    transition: opacity .12s ease-in-out;
}
.search-region.is-empty { margin-bottom: 0; }
.search-region.is-loading { opacity: .55; }

.search-count {
    margin: 0 0 .9rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid #e0e0e0;
}

.search-results {
    list-style: none;
    margin: 0;
    padding: 0;
}
.search-result {
    margin: 0 0 1.5rem;
    padding-bottom: 1.15rem;
    border-bottom: 1px solid #ededed;
}
.search-result:last-child { border-bottom: 0; }
.search-result-title {
    margin: 0 0 .2rem;
    font-size: 1.2rem;
    line-height: 1.3;
}
.search-result-meta {
    margin: 0 0 .4rem;
    font-size: .85rem;
    color: #5c6873;
}
.search-result-author { font-weight: 600; }
.search-result-snippet {
    margin: 0;
    line-height: 1.6;
    color: #333;
}
/* Highlighted terms need contrast, not just a colour wash. */
.search-result-snippet mark {
    background: #fff2a8;
    color: inherit;
    padding: 0 .12em;
    border-radius: 2px;
}
.search-empty, .search-error {
    padding: .9rem 1rem;
    background: #fdf6e7;
    border-left: 4px solid #d9a441;
}

.archive-divider {
    margin: 2rem 0 .5rem;
    padding: .6rem .75rem;
    background: #e0e0e0;
    font-size: 1.25rem;
}
/* When results are on screen the archive is secondary — de-emphasise, never hide, so
   it stays reachable and in the tab order. */
.archive-divider.is-secondary {
    opacity: .82;
}

.archive-entry {
    margin-bottom: .5rem;
}
.archive-entry img {
    max-width: 100%;
    height: auto;
    border: 1px solid #d8d8d8;
}
.archive-issue-head {
    margin: 0 0 .15rem;
    font-size: 1.1rem;
    line-height: 1.3;
}
.archive-issue-meta {
    margin: 0 0 .5rem;
    font-size: .85rem;
    color: #5c6873;
}
.archive-blurb {
    margin-top: .4rem;
    margin-right: 10px;
    font-style: italic;
    font-size: .8rem;
    line-height: 1.45;
}
.archive-contents div {
    margin-bottom: .3rem;
    line-height: 1.35;
}
/* Companion pieces nested under their parent article. */
.archive-subitem {
    margin: .2rem 0 .2rem 1rem;
    font-size: .92em;
    color: #5c6873;
}
.archive-subitem a { color: inherit; }

/* --- pagination ------------------------------------------------------------- */

.archive-pagination {
    margin: 2rem 0 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}
.archive-pagination-status {
    margin: 0 0 .6rem;
    font-size: .875rem;
    color: #5c6873;
}
.archive-pagination-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .35rem;
}
.archive-pagination-list a,
.archive-pagination-list span {
    display: block;
    /* a comfortable target size — the numbers are otherwise tiny tap areas */
    min-width: 2.5rem;
    padding: .45rem .6rem;
    border: 1px solid #ccd5dd;
    border-radius: 3px;
    text-decoration: none;
    line-height: 1.2;
}
.archive-pagination-list a:hover { background: #eef3f7; }
.archive-pagination-list .is-current {
    background: #336699;
    border-color: #336699;
    color: #fff;
    font-weight: 700;
}
.archive-pagination-list .is-disabled {
    color: #a5aeb6;
    border-color: #e6e9ec;
}
.archive-pagination-gap {
    border: 0;
    padding: .45rem .2rem;
    color: #98a2ab;
}
.archive-pagination a:focus-visible {
    outline: 3px solid #b34700;
    outline-offset: 2px;
}

.archive-backtotop {
    display: block;
    text-align: right;
    font-size: .85rem;
}

/* --- motion ---------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .archive-article *,
    .archive-issue * {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}
