/* Collections page (collections.html). Builds on home-format.css for the navbar, tokens
   and footer, and collection-cards.css for the cards. Same ledger look as home:
   hairlines between the parts of the page, no boxed panels. */

.cl-page {
    padding-top: 24px;
}

[hidden] {
    display: none !important;
}

/* ===== Heading and tabs ===== */
.cl-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px 24px;
    flex-wrap: wrap;
}

.cl-title {
    margin: 0 0 8px;
    font-size: clamp(30px, 3.4vw, 40px);
    font-weight: 650;
    line-height: 1.08;
    letter-spacing: -0.03em;
}

.cl-sub {
    margin: 0;
    font-size: 15px;
    line-height: 1.55;
    color: var(--ff-text-secondary);
}

.cl-new {
    gap: 6px;
}

/* Text tabs with a gold rule under the current one, like the navbar */
.cl-tabs {
    display: flex;
    gap: 28px;
    margin: 24px 0;
    border-bottom: 1px solid var(--ff-line);
}

.cl-tab {
    padding: 12px 0;
    margin-bottom: -1px;
    font: inherit;
    font-size: 15px;
    font-weight: 500;
    color: var(--ff-text-secondary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
}

.cl-tab:hover {
    color: var(--ff-text);
}

.cl-tab.is-active {
    color: var(--ff-text);
    border-bottom-color: var(--ff-gold);
}

.cl-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 200px 200px;
    gap: 8px;
}

.cl-search {
    position: relative;
}

.cl-search svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ff-text-secondary);
    pointer-events: none;
}

.cl-search .cl-control {
    padding-left: 38px;
}

/* ===== Sections ===== */
.cl-section {
    margin-top: 40px;
}

.cl-section__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 16px;
    margin-bottom: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--ff-line);
}

.cl-section__title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.cl-count {
    margin: 0;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    color: var(--ff-text-secondary);
}

.cl-empty {
    grid-column: 1 / -1;
    margin: 0;
    padding: 48px 0;
    text-align: center;
    color: var(--ff-text-secondary);
    border-top: 1px solid var(--ff-line);
    border-bottom: 1px solid var(--ff-line);
}

/* Discover with no public collections at all (showInvite): the toolbar and results
   heading go, and an invitation to start one takes their place */
#cl-discover.is-empty .cl-toolbar,
#cl-discover.is-empty .cl-section__head {
    display: none;
}

.cl-invite {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 56px 16px;
    text-align: center;
    border-top: 1px solid var(--ff-line);
    border-bottom: 1px solid var(--ff-line);
}

.cl-invite__title {
    margin: 0;
    font-size: 20px;
    font-weight: 650;
}

.cl-invite__text {
    max-width: 440px;
    margin: 0 0 8px;
    color: var(--ff-text-secondary);
    line-height: 1.5;
}

.cl-skeleton {
    min-height: 150px;
    background: var(--ff-card);
    border-radius: 4px;
}

/* ===== Collection of the week: photos beside the name. The next section's head
   draws the rule under it. ===== */
#cl-featured > .cl-section__title {
    margin-bottom: 0;
    padding: 20px 0 16px;
    border-top: 1px solid var(--ff-line);
}

.cl-feature {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    gap: 40px;
    align-items: center;
    color: var(--ff-text);
    text-decoration: none;
}

.cl-feature:hover .cl-feature__name {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.cl-feature:hover .cl-feature__btn {
    filter: brightness(1.08);
}

.cl-feature:focus-visible {
    outline: 2px solid var(--ff-gold);
    outline-offset: 4px;
}

.cl-feature__tiles {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
    overflow: hidden;
    border-radius: 4px;
}

.cl-feature__body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

/* "Collection of the week" label above the name */
.cl-feature__body .cc-pill {
    font-size: 13px;
    color: var(--ff-text-secondary);
}

.cl-feature__name {
    margin: 0;
    font-size: clamp(22px, 2.6vw, 30px);
    font-weight: 650;
    line-height: 1.15;
    letter-spacing: -0.02em;
    overflow-wrap: anywhere;
}

.cl-feature__meta,
.cl-feature__desc {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--ff-text-secondary);
    overflow-wrap: anywhere;
}

.cl-feature__btn {
    margin-top: 8px;
}

/* ===== Pagination (same look as Explore) ===== */
.cl-pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 40px;
}

.cl-pagination:not(:empty) {
    padding-top: 24px;
    border-top: 1px solid var(--ff-line);
}

.cl-page-btn {
    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;
}

.cl-page-btn:hover:not(:disabled):not(.is-current) {
    border-color: var(--ff-text-secondary);
}

.cl-page-btn.is-current {
    font-weight: 600;
    color: #0E0F11;
    background: var(--ff-gold);
    border-color: var(--ff-gold);
    cursor: default;
}

.cl-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.cl-page-gap {
    padding: 0 4px;
    color: var(--ff-text-secondary);
}

/* ===== My collections: totals as one ruled row, hanging from the tabs' rule ===== */
.cl-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: -24px;   /* the tabs' bottom margin; their rule is this row's top */
    border-bottom: 1px solid var(--ff-line);
}

.cl-stats--4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.cl-stat {
    display: flex;
    flex-direction: column-reverse;   /* label above the number; the number is read first */
    justify-content: flex-end;
    gap: 6px;
    padding: 16px 20px;
}

.cl-stat:first-child {
    padding-left: 0;
}

.cl-stat + .cl-stat {
    border-left: 1px solid var(--ff-line);
}

.cl-stat strong {
    font-size: 26px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.015em;
}

/* Kept as a hook; the value is a total, not a direction, so it isn't coloured */
.cl-stat__gold {
    color: var(--ff-text);
}

.cl-stat span {
    font-size: 13px;
    color: var(--ff-text-secondary);
}

/* All / Public / Private: text filters with a gold rule, like the tabs above */
.cl-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    margin: 20px 0 24px;
}

.cl-chip {
    position: relative;
    padding: 8px 0;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--ff-text-secondary);
    background: none;
    border: none;
    cursor: pointer;
}

.cl-chip span {
    margin-left: 2px;
    font-variant-numeric: tabular-nums;
}

.cl-chip:hover {
    color: var(--ff-text);
}

.cl-chip.is-active {
    color: var(--ff-text);
}

.cl-chip.is-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: var(--ff-gold);
}

/* Edit / Share / More under each card */
.cl-act {
    position: relative;
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 10px;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--ff-text);
    text-decoration: none;
    background: transparent;
    border: 1px solid var(--ff-card-border);
    border-radius: 6px;
    cursor: pointer;
}

.cl-act:hover {
    border-color: var(--ff-text-secondary);
}

.cl-act--icon {
    flex: 0 0 40px;
    padding: 0;
    font-size: 16px;
    letter-spacing: 1px;
}

.cl-more-wrap {
    position: relative;
    display: flex;
}

/* Dashed "Create a collection" tile, the same height as a card's photo strip */
.cl-create {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 150px;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--ff-text-secondary);
    background: none;
    border: 1px dashed var(--ff-card-border);
    border-radius: 4px;
    cursor: pointer;
}

.cl-create:hover {
    color: var(--ff-text);
    border-color: var(--ff-text-secondary);
}

.cl-create span {
    font-size: 24px;
    font-weight: 400;
    line-height: 1;
}

/* ===== Focus rings ===== */
.cl-tab:focus-visible,
.cl-new:focus-visible,
.cl-chip:focus-visible,
.cl-act:focus-visible,
.cl-create:focus-visible,
.cl-page-btn:focus-visible {
    outline: 2px solid var(--ff-gold);
    outline-offset: 2px;
}

/* ===== Smaller screens ===== */
@media (max-width: 900px) {
    .cl-toolbar {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .cl-search {
        grid-column: 1 / -1;
    }

    .cl-feature {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
    }
}

@media (max-width: 767px) {
    /* Edit / Share / ⋯ under each card: 44px to tap */
    .cl-act {
        min-height: 44px;
    }

    .cl-page-btn {
        min-width: 44px;
        height: 44px;
    }
}

@media (max-width: 600px) {
    .cl-page {
        padding-top: 8px;
    }

    .cl-stats,
    .cl-stats--4 {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    /* Two by two: the second row gets its own rule and starts flush left */
    .cl-stat:nth-child(3) {
        border-left: none;
        padding-left: 0;
    }

    .cl-stat:nth-child(n + 3) {
        border-top: 1px solid var(--ff-line);
    }

    .cl-stats:not(.cl-stats--4) .cl-stat:nth-child(3) {
        grid-column: 1 / -1;
    }

    .cl-stat strong {
        font-size: 22px;
    }

    .cl-feature__tiles {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .cl-feature__tiles .cc-tile:nth-child(n + 4) {
        display: none;
    }
}
