/*
 * Custom collection headers (view/common/collection-header/*.phtml).
 *
 * Pennsylvania Genealogical Magazine: the 1895 title page lies on a band the
 * color of its binding cloth; a timeline drawn to scale shows the five eras of
 * the magazine, oldest darkest.
 */

.pgm-header {
    --pgm-cloth: #173319;          /* binding cloth behind the 1895 title page */
    --pgm-cloth-deep: #0f2511;
    --pgm-paper: #f9f4ef;          /* gsp-parchment */
    --pgm-paper-muted: #cfd8cc;
    --pgm-era-1: #e0a000;          /* gsp-keystone-gold, stepping lighter */
    --pgm-era-2: #e9b83a;
    --pgm-era-3: #f0cc70;
    --pgm-era-4: #f5dea3;
    --pgm-era-5: #faefd2;

    background:
        radial-gradient(ellipse 60% 90% at 18% 40%, rgba(255, 255, 255, 0.05), transparent 70%),
        linear-gradient(180deg, var(--pgm-cloth) 0%, var(--pgm-cloth-deep) 100%);
    color: var(--pgm-paper);
    padding: 1.75rem 0 5rem;
    margin-bottom: 0;
}

.pgm-header .pgm-header__back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--pgm-paper-muted);
    text-decoration: none;
    font-size: 0.9375rem;
}

.pgm-header .pgm-header__back:hover,
.pgm-header .pgm-header__back:focus-visible {
    color: var(--pgm-era-3);
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

.pgm-header a:focus-visible {
    outline: 3px solid var(--pgm-era-1);
    outline-offset: 3px;
    border-radius: 2px;
}

.pgm-header__grid {
    display: grid;
    grid-template-columns: minmax(150px, 15rem) minmax(0, 1fr);
    gap: 2rem 3.5rem;
    align-items: start;
    margin-top: 1.5rem;
}

/* The title page, set straight, lifted off the cloth. */
.pgm-header__cover {
    margin: 0;
}

.pgm-header__cover img {
    display: block;
    width: 100%;
    height: auto;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.25) inset,
        0 2px 4px rgba(0, 0, 0, 0.35),
        0 18px 40px -12px rgba(0, 0, 0, 0.65);
}

.pgm-header__cover figcaption {
    margin-top: 0.75rem;
    font-size: 0.8125rem;
    color: var(--pgm-paper-muted);
    text-align: center;
}

.pgm-header .pgm-header__title {
    font-family: var(--gsp-font-heading, Georgia, serif);
    font-weight: 700;
    font-size: clamp(2rem, 1.4rem + 2.4vw, 3.25rem);
    line-height: 1.05;
    letter-spacing: -0.01em;
    color: var(--pgm-paper);
    /* Pull the capitals up level with the top of the cover beside them. */
    margin: -0.12em 0 1rem;
    max-width: 16ch;
}

.pgm-header__lede {
    font-size: 1.0625rem;
    line-height: 1.6;
    color: var(--pgm-paper-muted);
    max-width: 58ch;
    margin: 0 0 1.75rem;
}

/* Timeline: segments grow in proportion to the years each era spans. */
.pgm-eras__scale {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.pgm-eras__year {
    font-family: var(--gsp-font-heading, Georgia, serif);
    font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.25rem);
    line-height: 1;
    font-variant-numeric: lining-nums;
    color: var(--pgm-paper);
}

.pgm-eras__bar {
    flex: 1;
    display: flex;
    gap: 3px;
    height: 0.875rem;
}

.pgm-eras__segment {
    flex-basis: 0;
    min-width: 6px;
    border-radius: 1px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.pgm-eras__segment--1, .pgm-eras__era--1 .pgm-eras__key { background: var(--pgm-era-1); }
.pgm-eras__segment--2, .pgm-eras__era--2 .pgm-eras__key { background: var(--pgm-era-2); }
.pgm-eras__segment--3, .pgm-eras__era--3 .pgm-eras__key { background: var(--pgm-era-3); }
.pgm-eras__segment--4, .pgm-eras__era--4 .pgm-eras__key { background: var(--pgm-era-4); }
.pgm-eras__segment--5, .pgm-eras__era--5 .pgm-eras__key { background: var(--pgm-era-5); }

.pgm-eras__list {
    list-style: none;
    margin: 1.25rem 0 0;
    padding: 0;
    border-top: 1px solid rgba(249, 244, 239, 0.18);
}

.pgm-eras__era {
    display: grid;
    grid-template-columns: 0.75rem 8.75rem 6.5rem minmax(0, 1fr);
    align-items: baseline;
    column-gap: 1rem;
    padding: 0.625rem 0.5rem;
    border-bottom: 1px solid rgba(249, 244, 239, 0.18);
    transition: background-color 0.15s ease;
}

.pgm-eras__key {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 1px;
    /* Sits on the first line of the row, however many lines follow. */
    align-self: start;
    margin-top: 0.4em;
}

.pgm-eras__volumes {
    font-weight: 600;
    white-space: nowrap;
    color: var(--pgm-paper);
}

.pgm-eras__dates {
    font-variant-numeric: tabular-nums;
    color: var(--pgm-paper-muted);
}

.pgm-eras__focus {
    color: var(--pgm-paper);
}

/* Pointing at an era lights its stretch of the timeline. */
.pgm-eras__era:hover {
    background-color: rgba(249, 244, 239, 0.06);
}

.pgm-eras:has(.pgm-eras__era--1:hover) .pgm-eras__segment--1,
.pgm-eras:has(.pgm-eras__era--2:hover) .pgm-eras__segment--2,
.pgm-eras:has(.pgm-eras__era--3:hover) .pgm-eras__segment--3,
.pgm-eras:has(.pgm-eras__era--4:hover) .pgm-eras__segment--4,
.pgm-eras:has(.pgm-eras__era--5:hover) .pgm-eras__segment--5 {
    transform: scaleY(1.6);
    box-shadow: 0 0 0 2px var(--pgm-paper);
}

@media (max-width: 991.98px) {
    .pgm-header__grid {
        grid-template-columns: 9rem minmax(0, 1fr);
        gap: 1.5rem 2rem;
        align-items: start;
    }
    .pgm-header__text {
        display: contents;
    }
    .pgm-header__title {
        grid-column: 2;
        align-self: start;
    }
    .pgm-header__lede,
    .pgm-eras {
        grid-column: 1 / -1;
    }
    .pgm-header__lede {
        margin-bottom: 0;
    }
}

@media (max-width: 575.98px) {
    .pgm-header__grid {
        grid-template-columns: 6.5rem minmax(0, 1fr);
        gap: 1.25rem;
    }
    .pgm-header__cover figcaption {
        display: none;
    }
    .pgm-eras__scale {
        gap: 0.5rem;
    }
}

/* Narrow screens: the focus goes under the volumes and dates. */
@media (max-width: 767.98px) {
    .pgm-eras__era {
        grid-template-columns: 0.75rem minmax(0, 1fr) auto;
        row-gap: 0.125rem;
    }
    .pgm-eras__focus {
        grid-column: 2 / -1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pgm-eras__segment,
    .pgm-eras__era {
        transition: none;
    }
}

/*
 * Ways to use the magazine: a parchment panel lifted onto the bottom of the
 * cloth band. The name search leads; volumes and articles follow as links.
 */
.pgm-ways {
    --pgm-ink: var(--gsp-evergreen, #01411d);
    --pgm-ink-muted: #4a5a4f;
    --pgm-rule: var(--gsp-parchment-border, #ddc0a3);
    position: relative;
    margin: -3rem 0 2.5rem;
}

.pgm-ways__panel {
    background: var(--gsp-parchment, #f9f4ef);
    border: 1px solid var(--pgm-rule);
    border-top: 4px solid var(--gsp-keystone-gold, #e0a000);
    border-radius: 2px;
    box-shadow: 0 14px 30px -18px rgba(0, 29, 13, 0.55);
    padding: 1.75rem 2rem 2rem;
    color: var(--gsp-text, #001d0d);
}

.pgm-ways .pgm-ways__heading {
    font-family: var(--gsp-font-heading, Georgia, serif);
    font-size: 1.625rem;
    line-height: 1.2;
    color: var(--pgm-ink);
    margin: 0 0 1.25rem;
}

.pgm-ways__grid {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 2rem 3rem;
}

.pgm-ways .pgm-ways__title {
    display: inline-block;
    font-family: var(--gsp-font-heading, Georgia, serif);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--pgm-ink);
    margin: 0 0 0.375rem;
}

.pgm-ways__text {
    color: var(--pgm-ink-muted);
    line-height: 1.55;
    margin: 0;
    max-width: 60ch;
}

/* Name search */
.pgm-ways__form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: end;
    margin-top: 1rem;
}

.pgm-ways__field label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--pgm-ink);
    margin-bottom: 0.25rem;
}

.pgm-ways__optional {
    font-weight: 400;
    color: var(--pgm-ink-muted);
}

.pgm-ways__field input {
    width: 100%;
    height: 2.75rem;
    padding: 0 0.75rem;
    font: inherit;
    color: var(--gsp-text, #001d0d);
    background: #fff;
    border: 1px solid #b9a58f;
    border-radius: 2px;
}

.pgm-ways__field input:focus-visible {
    outline: 3px solid rgba(224, 160, 0, 0.6);
    outline-offset: 1px;
    border-color: var(--pgm-ink);
}

.pgm-ways__submit {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    height: 2.75rem;
    padding: 0 1.25rem;
    font: inherit;
    font-weight: 600;
    color: var(--gsp-parchment, #f9f4ef);
    background: var(--pgm-ink);
    border: 0;
    border-radius: 2px;
    white-space: nowrap;
    cursor: pointer;
}

.pgm-ways__submit:hover {
    background: var(--gsp-evergreen-light, #015727);
}

.pgm-ways__submit:focus-visible {
    outline: 3px solid var(--gsp-keystone-gold, #e0a000);
    outline-offset: 2px;
}

.pgm-ways__note {
    margin: 0.75rem 0 0;
    font-size: 0.875rem;
    color: var(--pgm-ink-muted);
}

.pgm-ways__note a {
    display: inline-block;
    margin-top: 0.25rem;
}

/* Volumes and articles */
.pgm-ways__links {
    list-style: none;
    margin: 0;
    padding: 0 0 0 2rem;
    border-left: 1px solid var(--pgm-rule);
}

.pgm-ways__links li + li {
    margin-top: 1.5rem;
}

.pgm-ways .pgm-ways__links a.pgm-ways__title {
    text-decoration: underline;
    text-decoration-color: rgba(224, 160, 0, 0.8);
    text-decoration-thickness: 2px;
    text-underline-offset: 0.22em;
}

.pgm-ways .pgm-ways__links a.pgm-ways__title:hover {
    color: var(--gsp-commonwealth-clay-dark, #893c10);
    text-decoration-color: currentColor;
}

.pgm-ways a:focus-visible {
    outline: 3px solid var(--gsp-keystone-gold, #e0a000);
    outline-offset: 2px;
}

@media (max-width: 991.98px) {
    .pgm-ways__grid {
        grid-template-columns: minmax(0, 1fr);
    }
    .pgm-ways__links {
        padding: 1.5rem 0 0;
        border-left: 0;
        border-top: 1px solid var(--pgm-rule);
    }
}

@media (max-width: 575.98px) {
    .pgm-ways__panel {
        padding: 1.25rem 1.125rem 1.5rem;
    }
    .pgm-ways__form {
        grid-template-columns: minmax(0, 1fr);
    }
    .pgm-ways__submit {
        justify-content: center;
    }
}

/*
 * Collection home pages built like the Library Catalog home page
 * (collection-header/pgma01.phtml reuses library-home.css).
 */
.collection-home .collection-home-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--gsp-commonwealth-clay-dark, #893c10);
    text-decoration: none;
    font-size: 0.9375rem;
}

.collection-home .collection-home-back:hover,
.collection-home .collection-home-back:focus-visible {
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

/* Collection titles are longer than "Library Catalog": give them the width. */
.collection-home .lh-intro {
    max-width: 52rem;
}

/*
 * PGM volume gallery (collection-header/pgma02.phtml): the first page of
 * every volume, in order, grouped by era.
 */
.pgm-volumes {
    padding: 0.5rem 0 3rem;
}

.pgm-volumes__era + .pgm-volumes__era {
    margin-top: 3rem;
}

.pgm-volumes__era-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 1.25rem;
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--gsp-keystone-gold, #e0a000);
}

.pgm-volumes .pgm-volumes__era-title {
    font-family: var(--gsp-font-heading, Georgia, serif);
    font-size: 1.75rem;
    line-height: 1.15;
    color: var(--gsp-evergreen, #01411d);
    margin: 0;
}

.pgm-volumes__era-note {
    margin: 0;
    color: #4a5a4f;
}

.pgm-volumes__era-years {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--gsp-evergreen, #01411d);
    margin-right: 0.5rem;
}

.pgm-volumes__grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
    gap: 2rem 1.5rem;
}

.pgm-volumes .pgm-volume {
    display: block;
    color: var(--gsp-evergreen, #01411d);
    text-decoration: none;
}

/* A page of the magazine: one portrait shape for all, title at the top. */
.pgm-volume__page {
    display: block;
    aspect-ratio: 7 / 10;
    overflow: hidden;
    background: #f3efe8;
    border: 1px solid #d9cfc0;
    box-shadow: 0 1px 2px rgba(0, 29, 13, 0.12), 0 6px 14px -8px rgba(0, 29, 13, 0.35);
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.pgm-volume__page img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

.pgm-volume__number {
    display: block;
    margin-top: 0.75rem;
    font-family: var(--gsp-font-heading, Georgia, serif);
    font-size: 1.1875rem;
    font-weight: 700;
    line-height: 1.2;
}

.pgm-volume__years {
    display: block;
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
    color: #4a5a4f;
}

.pgm-volumes .pgm-volume:hover .pgm-volume__page,
.pgm-volumes .pgm-volume:focus-visible .pgm-volume__page {
    border-color: var(--gsp-evergreen, #01411d);
    box-shadow: 0 0 0 1px var(--gsp-evergreen, #01411d), 0 10px 22px -10px rgba(0, 29, 13, 0.5);
}

.pgm-volumes .pgm-volume:hover .pgm-volume__number {
    text-decoration: underline;
    text-decoration-color: var(--gsp-keystone-gold, #e0a000);
    text-decoration-thickness: 2px;
    text-underline-offset: 0.2em;
}

.pgm-volumes .pgm-volume:focus-visible {
    outline: 3px solid var(--gsp-keystone-gold, #e0a000);
    outline-offset: 4px;
}

@media (max-width: 575.98px) {
    .pgm-volumes__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.5rem 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pgm-volume__page {
        transition: none;
    }
}

/* Buttons to the other ways into the magazine (PGM home, articles, indexes). */
.pgm-entry-points {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.collection-home .pgm-entry-point {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    padding: 0 1.25rem;
    font-weight: 600;
    color: var(--gsp-evergreen, #01411d);
    background: #fff;
    border: 2px solid var(--gsp-evergreen, #01411d);
    border-radius: var(--gsp-radius-md, 0.5rem);
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.collection-home .pgm-entry-point:hover,
.collection-home .pgm-entry-point:focus-visible {
    color: #fff;
    background: var(--gsp-evergreen, #01411d);
}

.collection-home .pgm-entry-point:focus-visible {
    outline: 3px solid var(--gsp-keystone-gold, #e0a000);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .collection-home .pgm-entry-point {
        transition: none;
    }
}

/* PGM Indexes: the name search takes a surname and a given name. */
.lh-search--names .lh-search-input--given {
    flex: 0.8;
    border-left: 1px solid #c9d3cc;
}

.pgm-index-note {
    margin: 0.75rem 0 0;
    font-size: 0.9375rem;
    color: #4a5a4f;
}

.pgm-index-note a {
    margin-left: 0.25rem;
    font-weight: 600;
}

@media (max-width: 575.98px) {
    .lh-search--names {
        flex-wrap: wrap;
    }
    .lh-search--names .lh-search-input {
        flex: 1 1 100%;
    }
    .lh-search--names .lh-search-input--given {
        border-left: 0;
        border-top: 1px solid #c9d3cc;
    }
    .lh-search--names .lh-search-button {
        flex: 1 1 100%;
        justify-content: center;
        padding: 0.8rem 1.4rem;
    }
}

/* Room between a collection header and the breadcrumbs right below it
   (Indexes; on Articles and Volumes the browse sections and gallery have
   their own bottom padding). */
.collection-home + .container {
    padding-top: 1.75rem;
}
