/* What a colla did in a temporada (/colles/{id}/temporades/{temporada}) */

.ct {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
    max-width: 76rem;
    margin: 0 auto;

    h2 {
        font-size: 1.05rem;
        color: var(--color-secondary);
        margin-bottom: 0.75rem;
    }

    .ct-bloc {
        background: var(--color-white);
        border-radius: 0.75rem;
        box-shadow: var(--shadow-sm);
        padding: 1rem;

        @media (width >= 48rem) {
            padding: 1.25rem;
        }
    }

    .ct-buida {
        font-size: 0.85rem;
        font-style: italic;
        color: var(--color-gray-darker);
        margin: 0;
    }
}

/* Header: the colla, the temporada and the others */

.ct-capcalera {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;

    .ct-tornar {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        font-size: 0.85rem;
        color: var(--color-gray-darkest);
        text-decoration: none;

        svg {
            width: 0.6rem;
            height: 0.6rem;
            fill: currentColor;
        }

        &:hover {
            color: var(--color-secondary);
        }
    }

    .ct-capcalera-cos {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 1rem 1.25rem;
    }

    .ct-escut {
        border-radius: 1rem;
        padding: 0.6rem;
        line-height: 0;

        img {
            width: 4rem;
            height: 4rem;
            object-fit: contain;
        }
    }

    .ct-titol {
        flex: 1;
        min-width: 12rem;

        p {
            margin: 0;
            font-weight: 600;
            color: var(--color-gray-darker);
        }

        h1 {
            margin: 0;
            font-size: 1.6rem;
            font-weight: 800;

            @media (width >= 48rem) {
                font-size: 1.9rem;
            }
        }
    }

    .ct-temporades {
        display: flex;
        align-items: center;
        gap: 0.25rem;

        a,
        span {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex: 0 0 auto;
            width: 2.25rem;
            height: 2.25rem;
            border-radius: 50%;
            background: var(--color-white);
            box-shadow: var(--shadow-sm);

            svg {
                width: 0.75rem;
                height: 0.75rem;
                fill: var(--color-black);
            }
        }

        span {
            opacity: 0.35;
        }

        select {
            border: none;
            background: var(--color-white);
            box-shadow: var(--shadow-sm);
            border-radius: 1.25rem;
            padding: 0.45rem 0.9rem;
            font-weight: 600;
            max-width: 15rem;
        }
    }
}

.ct-frase {
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 0;
    padding-left: 1rem;
    border-left: 5px solid var(--colla-color);

    @media (width >= 48rem) {
        font-size: 1.2rem;
    }
}

/* The chronicle, and beside it the statistics, which stay in view while it scrolls */

.ct-cos {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;

    .ct-fites-bloc { order: 1; }
    .ct-lateral { order: 2; }
    .ct-cronica { order: 3; }

    @media (width >= 62rem) {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 22rem;
        grid-template-rows: auto 1fr;
        align-items: start;

        .ct-fites-bloc { grid-area: 1 / 1; }
        .ct-cronica { grid-area: 2 / 1; }

        .ct-lateral {
            grid-area: 1 / 2 / 3 / 3;
            position: sticky;
            top: 5rem;
        }
    }
}

.ct-lateral {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;

    .ct-grafic {
        margin: 0 -0.5rem;
    }
}

/* Castells */

.ct-grup {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 0.35rem;
    font-weight: 700;
    white-space: nowrap;
    background-color: var(--color-gray-lighter);
}

.ct-chip {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 0.3rem;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;

    &.ct-chip-d {
        background: var(--color-castell-d);
        color: #1F5C2E;
    }

    &.ct-chip-c {
        background: var(--color-castell-c);
        color: #6B5500;
    }

    &.ct-chip-id {
        background: var(--color-castell-id);
        color: var(--color-gray-darkest);
    }

    &.ct-chip-i {
        background: var(--color-castell-if);
        color: #8A2323;
    }
}

/* Milestones */

.ct-fites {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
    gap: 0.75rem;
}

.ct-fita {
    background: var(--color-white);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-sm);
    padding: 0.9rem 1rem;

    h2,
    h3 {
        display: flex;
        gap: 0.4rem;
        align-items: center;
        font-size: 0.75rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--color-gray-darker);
        margin-bottom: 0.5rem;

        svg {
            width: 0.85rem;
            height: 0.85rem;
            fill: currentColor;
        }
    }

    .ct-fita-gran {
        font-family: var(--font-title);
        font-size: 1.6rem;
        font-weight: 800;
        margin: 0 0 0.25rem;

        small {
            font-size: 0.85rem;
            font-weight: 500;
            color: var(--color-gray-darker);
        }

        .ct-grup {
            font-size: 1.3rem;
        }
    }

    .ct-fita-peu {
        font-size: 0.8rem;
        color: var(--color-gray-darkest);
        margin: 0;

        a {
            color: inherit;
        }
    }
}

/* What the colla did for the first time: a card like the milestones, a row per castell with its day and diada */

.ct-fites-bloc {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
}

.ct-estrenes {
    ol {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    li {
        display: grid;
        grid-template-columns: 4rem auto minmax(0, 1fr);
        align-items: center;
        gap: 0.75rem;
        padding: 0.45rem 0;
        border-top: 1px solid var(--color-gray-lighter);

        &:first-child {
            border-top: 0;
            padding-top: 0.1rem;
        }

        &:last-child {
            padding-bottom: 0;
        }
    }

    time {
        font-size: 0.75rem;
        font-weight: 700;
        text-transform: uppercase;
        color: var(--color-gray-darker);
    }

    .ct-grup {
        min-width: 3.6rem;
        text-align: center;
    }

    a {
        font-size: 0.9rem;
        color: var(--color-gray-darkest);
    }
}

/* Chronicle */

.ct-tram {
    margin: 1.25rem 0 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-gray-darker);

    &:first-of-type {
        margin-top: 0;
    }
}

.ct-linia {
    --ct-data: 3.6rem;

    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;

    &::before {
        content: '';
        position: absolute;
        left: calc(var(--ct-data) + 0.95rem);
        top: 0.5rem;
        bottom: 0.5rem;
        width: 2px;
        background: var(--color-gray-light);
    }

    li {
        display: flex;
        gap: 1.5rem;
        padding: 0 0 1.1rem;
        position: relative;

        &::before {
            content: '';
            position: absolute;
            left: calc(var(--ct-data) + 0.95rem - 5px);
            top: 0.35rem;
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background: var(--color-white);
            border: 3px solid var(--colla-color);
        }

        &.ct-millor::before {
            background: var(--colla-color);
            box-shadow: 0 0 0 4px color-mix(in srgb, var(--colla-color) 30%, transparent);
        }

        &:last-child {
            padding-bottom: 0;
        }
    }

    time {
        flex: 0 0 var(--ct-data);
        text-align: right;
        font-size: 0.8rem;
        color: var(--color-gray-darker);
        padding-top: 0.1rem;
    }

    .ct-actuacio {
        flex: 1;
        min-width: 0;
        padding-left: 0.6rem;
        display: flex;
        flex-direction: column;
        gap: 0.35rem;

        > a {
            color: var(--color-black);
            font-weight: 700;
            text-decoration: none;

            &:hover {
                text-decoration: underline;
            }
        }
    }

    .ct-castells {
        display: flex;
        flex-wrap: wrap;
        gap: 0.2rem;
    }

    .ct-barra {
        display: flex;
        align-items: center;
        gap: 0.5rem;

        span {
            height: 0.35rem;
            border-radius: 1rem;
            background: var(--colla-color);
            min-width: 0.35rem;
            max-width: 70%;
        }

        small {
            font-size: 0.75rem;
            color: var(--color-gray-darker);
            white-space: nowrap;
        }
    }
}

/* How many times it did each castell */

.ct-recompte {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;

    li {
        display: flex;
        align-items: center;
        border-radius: 0.5rem;
        overflow: hidden;
        border: 1px solid var(--color-gray-light);
        font-size: 0.8rem;
    }

    .ct-recompte-nom {
        background-color: var(--color-gray-lighter);
        padding: 0.3rem 0.55rem;
        font-weight: 700;
    }

    .ct-recompte-n {
        padding: 0.3rem 0.55rem;
        font-weight: 800;
        font-family: var(--font-title);
    }

    .ct-recompte-i {
        padding: 0.3rem 0.55rem 0.3rem 0;
        color: var(--color-castell-if-dark);
        font-size: 0.75rem;
    }
}
