/* =========================================
   HISTORIKK.COM – KARRIERETIDSLINJE
   ========================================= */

.tl-app {
    --tl-bg: #f4f6f9;
    --tl-border: #e0e5ec;
    --tl-text: #172033;
    --tl-muted: #718096;
    --tl-blue: #2563eb;

    min-width: 0;
    max-width: 1250px;
    margin: 20px auto;
    padding: 24px;
    background: var(--tl-bg);
    border: 1px solid var(--tl-border);
    border-radius: 20px;
    color: var(--tl-text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.tl-app * {
    box-sizing: border-box;
}

.tl-app [hidden] {
    display: none !important;
}

.tl-app button,
.tl-app select {
    font: inherit;
}

.tl-app button {
    cursor: pointer;
    transition: background .18s, border-color .18s,
                box-shadow .18s, transform .18s;
}

.tl-app button:focus-visible,
.tl-app select:focus-visible {
    outline: 3px solid #93c5fd;
    outline-offset: 3px;
}

.tl-app h1,
.tl-app h2,
.tl-app p {
    margin: 0;
}

.tl-app h2 {
    font-size: 19px;
    font-weight: 750;
}

/* KATEGORIFARGAR */

.tl-color-kamp {
    --tl-color: #2563eb;
    --tl-soft: #eff6ff;
}

.tl-color-maal {
    --tl-color: #16a34a;
    --tl-soft: #f0fdf4;
}

.tl-color-assist {
    --tl-color: #9333ea;
    --tl-soft: #faf5ff;
}

.tl-color-gul {
    --tl-color: #ca8a04;
    --tl-soft: #fefce8;
}

.tl-color-rod {
    --tl-color: #dc2626;
    --tl-soft: #fef2f2;
}

.tl-color-hattrick {
    --tl-color: #b7791f;
    --tl-soft: #fffbeb;
}

/* OVERSKRIFT */

.tl-header {
    padding: 4px 0 12px;
}

.tl-eyebrow {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--tl-muted);
}

.tl-header h1 {
    margin: 5px 0;
    font-size: clamp(25px, 4vw, 36px);
    line-height: 1.2;
    font-weight: 800;
}

.tl-header p {
    color: var(--tl-muted);
}

/* STATISTIKKBOKSAR */

.tl-stats {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.tl-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-width: 0;
    padding: 9px 8px;
    background: #fff;
    border: 1px solid var(--tl-border);
    border-top: 3px solid var(--tl-color);
    border-radius: 12px;
    color: var(--tl-text);
}

.tl-stat:hover,
.tl-stat[aria-pressed="true"] {
    background: var(--tl-soft);
    border-color: var(--tl-color);
    box-shadow: 0 3px 10px #0000000a;
}

.tl-stat-icon {
    font-size: 20px;
}

.tl-stat strong {
    font-size: 30px;
    font-weight: 800;
    line-height: 1.2;
    color: var(--tl-color);
}

.tl-stat > span:last-child {
    font-size: 12px;
    font-weight: 600;
}

/* HORISONTAL KARRIERELINJE */

.tl-overview {
    padding: 14px 16px;
    margin-bottom: 12px;
    background: #fff;
    border: 1px solid var(--tl-border);
    border-radius: 14px;
}

.tl-overview > p {
    color: var(--tl-muted);
    font-size: 13px;
    margin-top: 3px;
}

.tl-years {
    display: flex;
    align-items: stretch;
    overflow-x: auto;
    padding: 8px 0 8px;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.tl-year {
    position: relative;
    flex: 1 0 38px;
    min-width: 38px;
    padding: 0;
    background: transparent;
    border: 0;
    color: var(--tl-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}

.tl-year::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 35px;
    height: 3px;
    background: #dbe3ee;
}

.tl-year:first-child::before {
    left: 50%;
}

.tl-year:last-child::before {
    right: 50%;
}

.tl-year-dots {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: flex-end;
    gap: 3px;
    width: 32px;
    min-height: 28px;
    margin-bottom: 7px;
}

.tl-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--tl-color);
}

.tl-year-point {
    position: relative;
    z-index: 1;
    display: block;
    width: 11px;
    height: 11px;
    border: 2px solid #a8b6c8;
    border-radius: 50%;
    background: #fff;
    margin-bottom: 6px;
}

.tl-year-label {
    display: block;
    padding: 5px 3px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.4;
}

.tl-year:hover .tl-year-label {
    background: #eaf0fa;
    color: var(--tl-blue);
}

.tl-year[aria-pressed="true"] .tl-year-label {
    background: var(--tl-blue);
    color: #fff;
}

.tl-year[aria-pressed="true"] .tl-year-point {
    background: var(--tl-blue);
    border-color: var(--tl-blue);
    box-shadow: 0 0 0 4px #dbeafe;
}

/* STORE AUGEBLINK */

.tl-highlights {
    padding: 14px 16px;
    margin-bottom: 12px;
    background: #fff;
    border: 1px solid var(--tl-border);
    border-radius: 14px;
}

.tl-highlight-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.tl-highlight {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 9px 12px;
    text-align: left;
    background: #fafbfc;
    color: var(--tl-text);
    border: 1px solid var(--tl-border);
    border-radius: 10px;
    border-left: 3px solid #d4a64a;
}

.tl-highlight:hover {
    background: #fffbeb;
    border-color: #d4a64a;
    transform: translateY(-2px);
}

.tl-highlight-icon {
    font-size: 23px;
}

.tl-highlight strong {
    font-size: 14px;
}

.tl-highlight > span:not(.tl-highlight-icon) {
    font-size: 12px;
    color: var(--tl-muted);
}

.tl-highlight small {
    font-size: 11px;
    color: var(--tl-muted);
}

/* Knapp for å vise høgdepunkta igjen */

.tl-show-highlights {
    display: block;
    width: 100%;
    padding: 8px 12px;
    margin: 0 0 12px;
    background: #fffbeb;
    border: 1px solid #e4d19c;
    border-radius: 8px;
    color: #92701c;
    font-size: 12px;
    font-weight: 700;
}

.tl-show-highlights:hover {
    background: #fef3c7;
}

/* NAVIGASJON OG FILTER */

.tl-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px;
    margin-bottom: 12px;
    background: #fff;
    border: 1px solid var(--tl-border);
    border-radius: 12px;
}

.tl-year-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tl-year-nav button {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--tl-border);
    border-radius: 8px;
    background: #f4f6f9;
    color: var(--tl-text);
    font-size: 24px;
}

.tl-year-nav button:hover {
    background: #dbeafe;
}

.tl-year-nav button:disabled {
    opacity: .35;
    cursor: default;
}

.tl-selected-year {
    min-width: 70px;
    text-align: center;
    font-size: 20px;
}

.tl-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tl-sort,
.tl-expand {
    padding: 9px 12px;
    border: 1px solid var(--tl-border);
    border-radius: 8px;
    background: #fff;
    color: var(--tl-text);
}

.tl-expand {
    background: var(--tl-blue);
    color: #fff;
    border-color: var(--tl-blue);
    font-weight: 600;
}

.tl-expand:hover {
    background: #1d4ed8;
}

/* DETALJERT TIDSLINJE */

.tl-year-group {
    position: relative;
    margin: 0 0 20px 15px;
    padding: 0 0 4px 25px;
    border-left: 3px solid #dce4ee;
}

.tl-group-title {
    position: relative;
    margin: 0 0 12px !important;
    color: var(--tl-blue);
    font-size: 24px !important;
}

.tl-group-title::before {
    content: "";
    position: absolute;
    left: -33px;
    top: 10px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--tl-blue);
    border: 3px solid var(--tl-bg);
}

.tl-event {
    position: relative;
    background: #fff;
    border: 1px solid var(--tl-border);
    border-radius: 12px;
    padding: 14px 17px;
    margin-bottom: 10px;
    box-shadow: 0 2px 5px #00000004;
}

.tl-event::before {
    content: "";
    position: absolute;
    left: -32px;
    top: 23px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #a8b6c8;
    border: 2px solid var(--tl-bg);
}

.tl-event-date {
    display: block;
    font-size: 12px;
    color: var(--tl-muted);
    font-weight: 600;
    margin-bottom: 8px;
}

.tl-event-line {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 11px;
    margin-bottom: 5px;
    border-radius: 7px;
    background: var(--tl-soft);
    color: var(--tl-color);
}

.tl-event-line strong {
    font-size: 14px;
}

.tl-match {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 9px;
    font-size: 13px;
}

.tl-match > strong {
    flex-shrink: 0;
    background: #edf1f6;
    color: var(--tl-text);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 15px;
}

.tl-match-number {
    display: block;
    margin-top: 5px;
    color: var(--tl-muted);
    font-size: 11px;
}

/* LENKE TIL KAMPREFERAT */

.tl-match-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #edf0f4;
}

.tl-match-link {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 6px;
    background: #eff6ff;
    color: #2563eb;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: background .2s, color .2s;
}

.tl-match-link:hover {
    background: #2563eb;
    color: #fff;
}

.tl-event.tl-flash {
    border-color: var(--tl-blue);
    box-shadow: 0 0 0 3px #dbeafe;
}

.tl-empty {
    padding: 30px 15px;
    text-align: center;
    color: var(--tl-muted);
}

.tl-note {
    padding: 15px 0 0;
    border-top: 1px solid var(--tl-border);
    font-size: 11px;
    color: var(--tl-muted);
}

/* MOBIL OG MINDRE SKJERMAR */

@media (max-width: 800px) {

    .tl-app {
        padding: 15px;
        margin: 10px auto;
    }

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

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

    .tl-controls {
        justify-content: center;
    }

    .tl-filter-row {
        width: 100%;
    }

    .tl-sort,
    .tl-expand {
        flex: 1;
    }

    .tl-year {
        flex-basis: 42px;
    }
}

@media (max-width: 450px) {

    .tl-app {
        padding: 10px;
        border-radius: 12px;
    }

    .tl-stat {
        padding: 10px 5px;
    }

    .tl-stat strong {
        font-size: 24px;
    }

    .tl-overview,
    .tl-highlights {
        padding: 13px;
    }

    .tl-highlight {
        padding: 10px;
    }

    .tl-year-group {
        margin-left: 5px;
        padding-left: 17px;
    }

    .tl-group-title::before {
        left: -25px;
    }

    .tl-event::before {
        left: -24px;
    }

    .tl-event {
        padding: 12px;
    }
}

/* Visningsmodus og aktivt utval */
.tl-mode { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.tl-mode button, .tl-controls [data-action="reset"] { border: 1px solid #d1d5db; border-radius: 8px; padding: 8px 12px; background: #fff; color: #334155; font: inherit; }
.tl-mode button[aria-pressed="true"] { background: #1e293b; color: #fff; border-color: #1e293b; }
.tl-selection { font-size: .85rem; color: #64748b; margin: 0 0 10px; }
.tl-filter-row { flex-wrap: wrap; }
