/* ============================================================
   Trophies page: "Titles by date" timeline
   File: css/trophy-timeline.css (filters in js/trophyTimeline.js)
   Each year is a <section>, each trophy an <li> laid out as:
   date | dot on the line | card (trophy tile, trophy + club, badge)
   --tnf-team-colour is set on each <li> from teams.colour
   ============================================================ */

.tnf-tl {
    --tnf-tl-date-w: 64px;
    --tnf-tl-rail-w: 28px;
    --tnf-tl-line: #d1d5db;
    --tnf-tl-green: #8bee68;
    --tnf-team-colour: #6b7280;
}

/* Anything hidden by the filters (and the no-JS default) */
.tnf-tl [hidden] {
    display: none !important;
}

/* ============================================================
   Filters (only shown once the script runs; without it the
   page simply lists the major titles)
   ============================================================ */

.tnf-tl-toolbar {
    display: none;
    padding: 15px 15px 5px 15px;
}

.tnf-tl.has-js .tnf-tl-toolbar {
    display: block;
}

.tnf-tl-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.tnf-tl-row + .tnf-tl-row {
    margin-top: 10px;
}

/* Major titles / All titles */
.tnf-tl-scope {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: #fff;
    border: 1px solid #e5e7eb;
}

.tnf-tl-scope-button {
    border: none;
    background: transparent;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 700;
    color: #4b5563;
    transition: background 0.15s ease;
}

.tnf-tl-scope-button.is-active {
    background: var(--tnf-tl-green);
    color: #000;
}

/* Club dropdown */
.tnf-tl-club {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 0 auto;
    font-weight: normal;
}

.tnf-tl-label {
    font-size: 12px;
    font-weight: 700;
    color: #4b5563;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tnf-tl-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    min-width: 200px;
    height: 40px;
    padding: 0 32px 0 10px;
    border: 1px solid #e5e7eb;
    border-radius: 0;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    font-size: 14px;
    color: #000;
    cursor: pointer;
}

.tnf-tl-select:focus {
    outline: none;
    border-color: var(--tnf-tl-green);
}

/* Type chips */
.tnf-tl-chip {
    border: 1px solid #e5e7eb;
    background: #fff;
    padding: 6px 14px;
    font-size: 14px;
}

.tnf-tl-chip.is-active {
    background: var(--tnf-tl-green);
    border-color: var(--tnf-tl-green);
}

/* "12 titles · Reset filters" */
.tnf-tl-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px 0 15px;
    font-size: 13px;
    color: #6b7280;
}

.tnf-tl-reset {
    border: none;
    background: none;
    padding: 0;
    font-size: 13px;
    color: #1c66d9;
    text-decoration: underline;
}

/* ============================================================
   Year groups
   ============================================================ */

.tnf-tl-years {
    padding: 0 15px 10px 15px;
}

.tnf-tl-year-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 22px 0 12px 0;
}

.tnf-tl-year-label {
    margin: 0;
    font-family: 'Basement Grotesque', 'Inter', sans-serif;
    font-size: 30px;
    line-height: 1;
    color: #000;
}

.tnf-tl-year-count {
    font-size: 13px;
    color: #6b7280;
}

/* ============================================================
   Timeline items
   ============================================================ */

.tnf-tl-items {
    position: relative;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* The vertical line, through the middle of the rail column */
.tnf-tl-items::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(var(--tnf-tl-date-w) + (var(--tnf-tl-rail-w) / 2) - 1px);
    width: 2px;
    background: var(--tnf-tl-line);
}

.tnf-tl-item {
    position: relative;
    display: grid;
    grid-template-columns: var(--tnf-tl-date-w) var(--tnf-tl-rail-w) minmax(0, 1fr);
    align-items: center;
    padding: 5px 0;
}

.tnf-tl-date {
    padding-right: 4px;
    text-align: right;
    font-size: 13px;
    font-weight: 700;
    color: #4b5563;
    white-space: nowrap;
}

/* Dot on the line, in the club's colour */
.tnf-tl-dot {
    position: relative;
    z-index: 1;
    justify-self: center;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--tnf-team-colour);
    box-shadow: 0 0 0 3px #fff, 0 0 0 4px var(--tnf-tl-line);
}

/* Card */
.tnf-tl-card {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 10px 12px 10px 10px;
    background: #fff;
    border: 1px solid #e5e7eb;
}

/* Trophy on the club's colour (same look as the Visual section) */
.tnf-tl-tile {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 5px;
    background: var(--tnf-team-colour);
}

.tnf-tl-tile img {
    display: block;
    width: auto;
    height: auto;
    max-width: 44px;
    max-height: 44px;
}

.tnf-tl-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tnf-tl-trophy {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.25;
    color: #000;
}

.tnf-tl-team {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 7px;
    max-width: 100%;
    font-size: 15px;
    line-height: 1.2;
    color: #111827;
}

.tnf-tl-team:hover,
.tnf-tl-team:focus {
    color: #1c66d9;
    text-decoration: none;
}

.tnf-tl-team img {
    flex-shrink: 0;
    width: 24px;
    height: auto;
}

.tnf-tl-team span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* "2020 edition" (desktop); date + edition on small phones */
.tnf-tl-meta {
    font-size: 13px;
    color: #6b7280;
}

.tnf-tl-meta:not(.has-edition) {
    display: none;
}

.tnf-tl-date-inline {
    display: none;
}

/* Running title count */
.tnf-tl-badges {
    flex-shrink: 0;
}

.tnf-tl-badge {
    display: inline-block;
    padding: 4px 9px;
    background: #f3f4f6;
    color: #374151;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.tnf-tl-badge.is-first {
    background: var(--tnf-tl-green);
    color: #000;
}

.tnf-tl-badge.is-milestone {
    background: #000;
    color: #fff;
}

/* Major count in "Major titles", overall count in "All titles" */
.tnf-tl.is-major-only .tnf-tl-badge-all,
.tnf-tl:not(.is-major-only) .tnf-tl-badge-major {
    display: none;
}

/* Nothing matches */
.tnf-tl-empty {
    padding: 30px 15px;
    text-align: center;
    color: #4b5563;
}

.tnf-tl-empty .tnf-tl-reset {
    margin-left: 6px;
}

.tnf-tl-notes {
    padding-top: 15px !important;
    border-top: 1px solid #e5e7eb;
}

/* ============================================================
   Hover (desktop only)
   ============================================================ */

@media (min-width: 769px) {
    .tnf-tl-scope-button:hover,
    .tnf-tl-chip:hover {
        background: #e5e7eb;
    }

    .tnf-tl-scope-button.is-active:hover,
    .tnf-tl-chip.is-active:hover {
        background: var(--tnf-tl-green);
    }
}

/* ============================================================
   Tablets and phones
   ============================================================ */

@media (max-width: 768px) {
    .tnf-tl {
        --tnf-tl-date-w: 56px;
        --tnf-tl-rail-w: 24px;
    }

    .tnf-tl-tile {
        width: 48px;
        height: 48px;
    }

    .tnf-tl-tile img {
        max-width: 38px;
        max-height: 38px;
    }

    .tnf-tl-trophy {
        font-size: 15px;
    }

    .tnf-tl-team {
        font-size: 14px;
    }

    .tnf-tl-year-label {
        font-size: 26px;
    }
}

/* Small phones: no date column (the date moves into the card), full-width filters */
@media (max-width: 480px) {
    .tnf-tl {
        --tnf-tl-rail-w: 20px;
    }

    .tnf-tl-toolbar {
        padding: 10px 10px 5px 10px;
    }

    .tnf-tl-scope {
        display: flex;
        width: 100%;
    }

    .tnf-tl-scope-button {
        flex: 1;
        padding: 8px 4px;
        font-size: 13px;
    }

    .tnf-tl-club {
        width: 100%;
        margin: 0;
    }

    .tnf-tl-select {
        flex: 1;
        min-width: 0;
        font-size: 16px; /* iOS doesn't zoom in at 16px */
    }

    .tnf-tl-chip {
        padding: 5px 10px;
        font-size: 13px;
    }

    .tnf-tl-row.tnf-tl-types {
        gap: 6px;
    }

    .tnf-tl-status {
        padding: 10px 10px 0 10px;
    }

    .tnf-tl-years {
        padding: 0 10px 10px 10px;
    }

    .tnf-tl-year-label {
        font-size: 24px;
    }

    .tnf-tl-items::before {
        left: calc((var(--tnf-tl-rail-w) / 2) - 1px);
    }

    .tnf-tl-item {
        grid-template-columns: var(--tnf-tl-rail-w) minmax(0, 1fr);
        padding: 4px 0;
    }

    .tnf-tl-date {
        display: none;
    }

    .tnf-tl-dot {
        width: 10px;
        height: 10px;
    }

    .tnf-tl-card {
        gap: 10px;
        padding: 8px;
    }

    .tnf-tl-tile {
        width: 44px;
        height: 44px;
    }

    .tnf-tl-tile img {
        max-width: 34px;
        max-height: 34px;
    }

    .tnf-tl-trophy {
        font-size: 14px;
    }

    .tnf-tl-team {
        gap: 6px;
        font-size: 13px;
    }

    .tnf-tl-team img {
        width: 20px;
    }

    .tnf-tl-meta,
    .tnf-tl-meta:not(.has-edition) {
        display: block;
        font-size: 12px;
    }

    .tnf-tl-date-inline {
        display: inline;
    }

    .tnf-tl-meta.has-edition .tnf-tl-edition::before {
        content: " \00B7  ";
    }

    .tnf-tl-badge {
        padding: 3px 6px;
        font-size: 11px;
    }
}