/* Series page (series.html). Builds on home-format.css for the navbar, tokens,
   buttons, series tiles and footer. The characters page borrows the controls, pills,
   breadcrumb and pager from here. Same ledger look as home: hairlines, no boxed panels. */

.an-status {
    margin: 40px 0;
    text-align: center;
    color: var(--ff-text-secondary);
}

.an-status[hidden] {
    display: none;
}

.an-status a {
    color: var(--ff-text);
    text-underline-offset: 3px;
}

.an-input,
.an-select {
    height: 40px;
    padding: 0 12px;
    font: inherit;
    font-size: 14px;
    color: var(--ff-text);
    background: var(--ff-track);
    border: 1px solid var(--ff-card-border);
    border-radius: 6px;
    color-scheme: dark;
}

.an-input::placeholder {
    color: var(--ff-text-secondary);
}

.an-input:hover,
.an-select:hover {
    border-color: var(--ff-text-secondary);
}

.an-input:focus,
.an-select:focus {
    outline: none;
    border-color: var(--ff-gold);
}

/* ===== All series ===== */
.an-index-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 28px;
    padding: 24px 0 24px;
    border-bottom: 1px solid var(--ff-line);
}

.an-index-head h1 {
    margin: 0;
    font-size: clamp(30px, 3.4vw, 40px);
    font-weight: 650;
    line-height: 1.08;
    letter-spacing: -0.03em;
}

.an-index-head p {
    margin: 8px 0 0;
    font-size: 15px;
    color: var(--ff-text-secondary);
}

.an-index-tools {
    display: flex;
    gap: 8px;
}

.an-index-tools .an-input {
    width: 240px;
}

.an-empty {
    grid-column: 1 / -1;
    margin: 0;
    padding: 40px 0;
    text-align: center;
    color: var(--ff-text-secondary);
}

/* ===== Breadcrumb ===== */
.an-crumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 20px;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--ff-text-secondary);
}

.an-crumbs a {
    color: var(--ff-text-secondary);
    text-decoration: none;
}

.an-crumbs a:hover {
    color: var(--ff-text);
}

.an-crumbs a:focus-visible {
    outline: 2px solid var(--ff-gold);
    outline-offset: 2px;
}

.an-crumbs [aria-current] {
    font-weight: 500;
    color: var(--ff-text);
}

/* ===== Series header: cover photo beside the name, stats and actions ===== */
.an-hero {
    display: grid;
    grid-template-columns: 168px minmax(0, 1fr);
    gap: 40px;
    align-items: start;
    padding-bottom: 32px;
}

.an-hero__media {
    aspect-ratio: 4 / 5;
    overflow: hidden;
    background: var(--ff-photo);
    border-radius: 4px;
}

.an-hero__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
    display: block;
}

.an-hero__title {
    margin: 0 0 24px;
    font-size: clamp(30px, 3.6vw, 44px);
    font-weight: 650;
    line-height: 1.08;
    letter-spacing: -0.03em;
}

/* Stats as one ruled row, split by vertical hairlines */
.an-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-top: 1px solid var(--ff-line);
    border-bottom: 1px solid var(--ff-line);
}

.an-stat {
    display: flex;
    flex-direction: column-reverse;   /* label above the number, but the number comes first for screen readers */
    justify-content: flex-end;
    gap: 6px;
    padding: 14px 16px;
}

.an-stat + .an-stat {
    border-left: 1px solid var(--ff-line);
}

.an-stat:first-child {
    padding-left: 0;
}

.an-stat strong {
    font-size: 22px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

/* Market vs retail always carries a + or - sign, so colour isn't the only signal */
.an-stat strong.is-up { color: var(--ff-up); }
.an-stat strong.is-down { color: var(--ff-down); }

.an-stat span {
    font-size: 13px;
    color: var(--ff-text-secondary);
}

.an-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

button.hm-btn {
    font-family: inherit;
    cursor: pointer;
}

/* ===== Highlights: three ruled rows, not cards ===== */
.an-highlights {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0 32px;
    border-top: 1px solid var(--ff-line);
}

.an-highlights:empty {
    display: none;
}

.an-highlight {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 0;
    color: var(--ff-text);
    text-decoration: none;
    border-bottom: 1px solid var(--ff-line);
}

.an-highlight:hover .an-highlight__title {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.an-highlight:focus-visible {
    outline: 2px solid var(--ff-gold);
    outline-offset: 2px;
}

.an-highlight__media {
    flex: 0 0 56px;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    background: var(--ff-photo);
    border-radius: 4px;
}

.an-highlight__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
    display: block;
}

.an-highlight__body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
}

.an-highlight__label {
    font-size: 13px;
    color: var(--ff-text-secondary);
}

.an-highlight__title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* A price beside a name: plain tabular text, coloured only when it says which way */
.an-pill {
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--ff-text);
}

.an-pill--down { color: var(--ff-down); }
.an-pill--plain { font-weight: 500; color: var(--ff-text-secondary); }

/* ===== All figures ===== */
.an-all-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    padding-top: 20px;
    border-top: 1px solid var(--ff-line);
}

.an-all-head h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.an-sort {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--ff-text-secondary);
}

/* Product line filter: text tabs with a gold rule under the chosen one, like the navbar */
.an-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 24px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--ff-line);
}

.an-filter {
    position: relative;
    padding: 10px 0 12px;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--ff-text-secondary);
    background: none;
    border: none;
    cursor: pointer;
}

.an-filter b {
    margin-left: 4px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--ff-text-secondary);
}

.an-filter:hover {
    color: var(--ff-text);
}

.an-filter:focus-visible {
    outline: 2px solid var(--ff-gold);
    outline-offset: 2px;
}

.an-filter.is-active {
    color: var(--ff-text);
}

.an-filter.is-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: var(--ff-gold);
}

.an-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
    gap: 28px 20px;
}

/* ===== Pages ===== */
.an-pager {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--ff-line);
}

.an-pager:empty {
    display: none;
}

.an-page {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--ff-text);
    background: transparent;
    border: 1px solid var(--ff-card-border);
    border-radius: 6px;
    cursor: pointer;
}

.an-page:hover:not(:disabled) {
    border-color: var(--ff-text-secondary);
}

.an-page:focus-visible {
    outline: 2px solid var(--ff-gold);
    outline-offset: 2px;
}

.an-page[aria-current="page"] {
    font-weight: 600;
    color: #0E0F11;
    background: var(--ff-gold);
    border-color: var(--ff-gold);
}

.an-page:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.an-page-gap {
    color: var(--ff-text-secondary);
}

/* ===== Smaller screens ===== */
@media (max-width: 900px) {
    .an-hero {
        grid-template-columns: 128px minmax(0, 1fr);
        gap: 24px;
    }

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

    /* Two by two: the second row gets its own rule, the third stat starts flush left */
    .an-stat:nth-child(3) {
        border-left: none;
        padding-left: 0;
    }

    .an-stat:nth-child(n + 3) {
        border-top: 1px solid var(--ff-line);
    }
}

@media (max-width: 767px) {
    /* Text boxes match the 44px selects beside them */
    .an-input {
        height: 44px;
    }

    .an-page {
        min-width: 44px;
        height: 44px;
    }

    .an-filter {
        min-height: 44px;
    }
}

@media (max-width: 600px) {
    .an-index-head {
        padding-top: 8px;
    }

    .an-hero {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
    }

    .an-hero__media {
        width: 112px;
    }

    .an-stat strong {
        font-size: 19px;
    }

    .an-index-tools {
        width: 100%;
    }

    .an-index-tools .an-input {
        flex: 1;
        width: auto;
        min-width: 0;
    }

    /* Product lines scroll sideways rather than wrapping into a tall block */
    .an-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .an-filter {
        flex-shrink: 0;
    }

    .an-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 24px 12px;
    }
}
