/* ========================================================================
   Happy Pens Archive — Archive Milestones
   Frontend styles
======================================================================== */

.hpc-am-page {
    --am-ink: #111827;
    --am-muted: #677083;
    --am-line: #dfe4e1;
    --am-green: #135c43;
    --am-paper: #ffffff;
    --am-soft: #f8f7f4;

    max-width: 1180px;
    margin: 0 auto;
    padding: 42px 22px 70px;
    color: var(--am-ink);
    font-family: "Libre Baskerville", Georgia, serif;
}

/* ------------------------------------------------------------------------
   Hero
------------------------------------------------------------------------ */

.hpc-am-hero {
    margin: 0 0 34px;
}

.hpc-am-hero h1 {
    margin: 0 0 12px;
    font-family: inherit;
    font-size: clamp(42px, 5vw, 68px);
    font-weight: 700;
    line-height: 1.02;
    letter-spacing: -0.025em;
}

.hpc-am-hero p {
    margin: 0;
    color: #536070;
    font-size: 17px;
    line-height: 1.55;
}

/* ------------------------------------------------------------------------
   Current archive counters
------------------------------------------------------------------------ */

.hpc-am-counters {
    display: grid;
    grid-template-columns: repeat(var(--hpc-am-counter-count), minmax(0, 1fr));
    margin: 0 0 42px;
    padding: 16px 6px;
    border: 1px solid #e5e6e3;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 5px 24px rgba(20, 30, 24, 0.035);
}

.hpc-am-counter {
    min-width: 0;
    padding: 8px 14px;
    text-align: center;
}

.hpc-am-counter + .hpc-am-counter {
    border-left: 1px solid #e4e6e3;
}

.hpc-am-counter strong {
    display: block;
    font-family: inherit;
    font-size: 31px;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
}

.hpc-am-counter span {
    display: block;
    margin-top: 5px;
    color: #667083;
    font-size: 13px;
}

/* ------------------------------------------------------------------------
   History heading + sort
------------------------------------------------------------------------ */

.hpc-am-history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin: 0 0 22px;
}

.hpc-am-history h2 {
    margin: 0;
    font-family: inherit;
    font-size: 38px;
    line-height: 1.1;
}

.hpc-am-sort {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid #dfe3df;
    border-radius: 999px;
    background: #ffffff;
    color: #354239;
    box-shadow: none;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    transition: border-color 0.18s ease, background-color 0.18s ease;
}

.hpc-am-page .hpc-am-sort:hover {
    border-color: #285d49;
    background-color: #285d49;
    color: #ffffff;
}

.hpc-am-page .hpc-am-sort:focus-visible {
    border-color: #285d49;
    background-color: #285d49;
    color: #ffffff;
    outline: 2px solid rgba(40, 93, 73, 0.28);
    outline-offset: 2px;
}

.hpc-am-page .hpc-am-sort:focus:not(:focus-visible) {
    outline: none;
    box-shadow: none;
}

.hpc-am-sort-icon {
    font-size: 16px;
    font-weight: 400;
    line-height: 1;
}

/* ------------------------------------------------------------------------
   Timeline
------------------------------------------------------------------------ */

.hpc-am-timeline {
    position: relative;
}

.hpc-am-item {
    position: relative;
    display: grid;
    grid-template-columns: 112px 28px minmax(0, 1fr);
    align-items: stretch;
}

.hpc-am-date {
    padding: 18px 14px 26px 0;
    color: #687389;
    font-size: 13px;
    text-align: right;
    white-space: nowrap;
}

.hpc-am-line {
    position: relative;
}

.hpc-am-line::before {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    background: var(--am-line);
    content: "";
    transform: translateX(-50%);
}

.hpc-am-item:first-child .hpc-am-line::before {
    top: 24px;
}

.hpc-am-item:last-child .hpc-am-line::before {
    bottom: calc(100% - 24px);
}

.hpc-am-dot {
    position: absolute;
    top: 18px;
    left: 50%;
    z-index: 2;
    width: 13px;
    height: 13px;
    border: 3px solid var(--am-green);
    border-radius: 50%;
    background: #ffffff;
    transform: translateX(-50%);
}

.hpc-am-dot-known-variants {
    border-color: #756fa6;
}

.hpc-am-dot-photos {
    border-color: #668d83;
}

.hpc-am-dot-members {
    border-color: #9b5e55;
}

.hpc-am-dot-manual {
    border-color: var(--am-green);
}

/* ------------------------------------------------------------------------
   Milestone cards
------------------------------------------------------------------------ */

.hpc-am-card {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 24px;
    align-items: center;
    min-height: 138px;
    margin: 0 0 14px;
    padding: 9px;
    border: 1px solid #e7e7e4;
    border-radius: 7px;
    background: var(--am-paper);
    box-shadow: 0 4px 17px rgba(20, 30, 24, 0.035);
}

.hpc-am-visual {
    width: 250px;
    overflow: hidden;
    border-radius: 6px;
    background: linear-gradient(135deg, #f6f4ef, #fbfaf8);
}

.hpc-am-visual-pen {
    aspect-ratio: 16 / 9;
}

.hpc-am-visual-pen a {
    display: block;
    width: 100%;
    height: 100%;
}

.hpc-am-visual-pen img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.hpc-am-visual-pen a:hover img {
    transform: scale(1.015);
}

.hpc-am-image-empty {
    width: 100%;
    height: 100%;
    background: #f2f1ed;
}

.hpc-am-visual-number,
.hpc-am-visual-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 118px;
    padding: 12px;
    text-align: center;
}

.hpc-am-visual-number strong,
.hpc-am-visual-date strong {
    font-family: inherit;
    font-size: 39px;
    font-weight: 700;
    line-height: 1;
}

.hpc-am-visual-number span,
.hpc-am-visual-date span {
    margin-top: 9px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.11em;
}

.hpc-am-content {
    min-width: 0;
    padding: 8px 20px 8px 0;
}

.hpc-am-content h3 {
    margin: 0 0 5px;
    font-family: inherit;
    font-size: 23px;
    font-weight: 700;
    line-height: 1.25;
}

.hpc-am-secondary {
    margin: 0 0 4px;
    color: #535f70;
    font-size: 13px;
    font-weight: 700;
}

.hpc-am-content p {
    margin: 0;
    color: #6b7380;
    font-size: 13px;
    line-height: 1.6;
}

.hpc-am-empty {
    color: #6b7380;
}

/* ------------------------------------------------------------------------
   Tablet
------------------------------------------------------------------------ */

@media (max-width: 900px) {
    .hpc-am-counters {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .hpc-am-counter:nth-child(4) {
        border-left: 0;
    }

    .hpc-am-counter:nth-child(n + 4) {
        border-top: 1px solid #e4e6e3;
    }

    .hpc-am-item {
        grid-template-columns: 88px 24px minmax(0, 1fr);
    }

    .hpc-am-card {
        grid-template-columns: 210px minmax(0, 1fr);
    }

    .hpc-am-visual {
        width: 210px;
    }
}

/* ------------------------------------------------------------------------
   Mobile
------------------------------------------------------------------------ */

@media (max-width: 680px) {
    .hpc-am-page {
        padding: 28px 14px 50px;
    }

    .hpc-am-hero h1 {
        font-size: 44px;
    }

    .hpc-am-hero p {
        font-size: 15px;
    }

    .hpc-am-counters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 4px;
    }

    .hpc-am-counter {
        padding: 12px 6px;
    }

    .hpc-am-counter:nth-child(n) {
        border-top: 1px solid #e4e6e3;
        border-left: 0;
    }

    .hpc-am-counter:nth-child(-n + 2) {
        border-top: 0;
    }

    .hpc-am-counter:nth-child(even) {
        border-left: 1px solid #e4e6e3;
    }

    .hpc-am-counter strong {
        font-size: 25px;
    }

    .hpc-am-history-head {
        align-items: center;
        gap: 12px;
    }

    .hpc-am-history h2 {
        font-size: 32px;
    }

    .hpc-am-sort {
        min-height: 34px;
        padding: 7px 11px;
        font-size: 11px;
    }

    .hpc-am-item {
        grid-template-columns: 22px minmax(0, 1fr);
        padding-top: 28px;
    }

    .hpc-am-date {
        position: absolute;
        top: 0;
        left: 37px;
        padding: 0;
        font-size: 11px;
        text-align: left;
    }

    .hpc-am-line {
        grid-column: 1;
    }

    .hpc-am-card {
        grid-column: 2;
        grid-template-columns: 1fr;
        gap: 10px;
        margin-left: 4px;
        padding: 8px;
    }

    .hpc-am-visual {
        width: 100%;
    }

    .hpc-am-visual-number,
    .hpc-am-visual-date {
        min-height: 92px;
    }

    .hpc-am-content {
        padding: 7px 10px 10px;
    }

    .hpc-am-content h3 {
        font-size: 20px;
    }

    .hpc-am-dot {
        top: 18px;
    }

    .hpc-am-line::before {
        top: 0;
    }

    .hpc-am-item:first-child .hpc-am-line::before {
        top: 24px;
    }

    .hpc-am-item:last-child .hpc-am-line::before {
        bottom: calc(100% - 24px);
    }
}