:root {
    --title-font:     "Chakra Petch", system-ui, sans-serif;
    --text-font:      "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --subtitle-font:  "Rajdhani", system-ui, sans-serif;
    --red-color:      #cc0000;
    --text-color:     #94a3b8;
    --white-color:    #fff;
    --grey-color:     #96999d;
    --border-radius:  8px;
    --padding-top:    60px;
    --padding-bottom: 60px;
    --border-grey:    1px solid #FFFFFF1A;
    --redbg-hover:    #bf0000;
    --red-gradient:   linear-gradient(to right, var(--red-color) 0%, rgba(255, 0, 59, 0.6) 100%);
    --dark-bg:        #0a0d12;
}

/* AFTER TITLES GRADIENT ADD
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
*/

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body { height: 100%; }

body {
    background-color: var(--dark-bg);
    overflow-x: hidden;
}

/* ─── LAYOUT ──────────────────────────────────────────────────────────────── */

.main_container {
    max-width: 1400px;
    width: 100%;
    margin: auto;
    display: flex;
    flex-direction: column;
    padding-top: 120px;
    padding-bottom: 80px;
}

.main_title {
    max-width: 680px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-bottom: var(--padding-bottom);
}

.main_title h1 {
    color: var(--white-color);
    font-size: 96px;
    font-family: var(--title-font);
    font-style: italic;
    line-height: 0.8;
}

.main_title h1 span {
    background: var(--red-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.positions_container {
    width: 100%;
    display: flex;
    gap: 60px;
    flex-direction: column;
    align-items: flex-start;
}

.panel {
    width: 100%;
}

/* ─── TABS ────────────────────────────────────────────────────────────────── */

.buttons_container {
    display: flex;
    width: 100%;
    gap: 20px;
    align-items: center;
    justify-content: flex-start;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.driver_button,
.team_button {
    padding: 24px;
    background-color: transparent;
    border: none;
    color: var(--grey-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: var(--title-font);
    font-size: 18px;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
}

.driver_button svg,
.team_button svg {
    width: 18px;
    height: auto;
}

.tab-panel {
    display: none;
    width: 100%;
}

.tab-panel.active {
    display: block;
}

.tab-btn.active {
    color: var(--red-color);
    border-bottom: 1px solid var(--red-color);
}

/* ─── CONTENEDORES ────────────────────────────────────────────────────────── */

#pilots-container,
#constructors-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    align-items: flex-start;
    gap: 12px;
}

/* ─── FILA ────────────────────────────────────────────────────────────────── */

.standing-row {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: flex-start;
    padding: 24px;
    padding-bottom: 0;
    border: var(--border-grey);
    border-radius: var(--border-radius);
    gap: 0;
    transition: .5s all ease-in;
}

/* ─── POSICIÓN ────────────────────────────────────────────────────────────── */

.pos-number {
    min-width: 180px;
    flex-shrink: 0;
    font-family: var(--title-font);
    color: var(--grey-color);
    font-weight: 700;
    font-size: 30px;
    font-style: italic;
}

/* ─── COLUMNAS ────────────────────────────────────────────────────────────── */

.driver-info {
    min-width: 350px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
    justify-content: center;
    margin-bottom: 24px;
}

.team-info {
    min-width: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
    justify-content: center;
    margin-bottom: 24px;
}

.points-info {
    min-width: 230px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
    justify-content: center;
    margin-bottom: 24px;
}

.constructor-info {
    min-width: 500px;
    flex-shrink: 0;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 24px;
}

/* ─── CONTENIDO PILOTOS ───────────────────────────────────────────────────── */

.driver-data {
    font-family: var(--title-font);
    color: var(--white-color);
    font-weight: 600;
    font-size: 18px;
}

.driver-family-name {
    text-transform: uppercase;
    font-weight: 700;
    font-style: italic;
    font-size: 20px;
}

.driver-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.driver-nationality {
    font-family: var(--text-font);
    color: var(--grey-color);
    font-weight: 500;
    font-size: 16px;
}

/* ─── CONTENIDO CONSTRUCTORES ─────────────────────────────────────────────── */

.constructor-name {
    font-family: var(--title-font);
    color: var(--white-color);
    font-weight: 700;
    font-size: 20px;
    text-transform: uppercase;
}

/* ─── LABELS Y VALORES ────────────────────────────────────────────────────── */

.team-label,
.points-label {
    font-family: var(--text-font);
    color: var(--grey-color);
    font-weight: 600;
    font-size: 16px;
    text-transform: uppercase;
}

.team-name {
    font-family: var(--title-font);
    color: var(--white-color);
    font-weight: 600;
    font-size: 18px;
}

.points-value {
    font-family: var(--title-font);
    color: var(--red-color);
    font-weight: 700;
    font-size: 24px;
}

/* ─── TENDENCIA ───────────────────────────────────────────────────────────── */

.trend-info {
    margin-left: auto;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.trend-medal { font-size: 1.3rem; }
.trend-up    { color: #05df72;           font-weight: 700; font-size: 2rem; }
.trend-down  { color: var(--red-color);  font-weight: 700; font-size: 2rem; }
.trend-same  { color: var(--grey-color); font-weight: 700; font-size: 2rem; }
.trend-new   { color: var(--grey-color); font-size: 2rem; }

.standing-row:hover .pos-number,
.standing-row:hover .constructor-name{
    color: var(--red-color);
}

.standing-row:hover .driver-family-name {
    color: var(--red-color);
    font-size: 22px;
}

/* ─── FOTO PILOTO (card pilotos) ──────────────────────────────────────────── */

.driver-photo-wrap {
    width: 120px;
    height: 80px;
    flex-shrink: 0;
    overflow: hidden;
    margin-right: 16px;
}

.driver-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.45));
}

/* ─── FOTOS PILOTOS (card constructores) ──────────────────────────────────── */

.constructor-photos-wrap {
    position: relative;
    width: 160px;
    height: 80px;
    flex-shrink: 0;
    margin-right: 16px;
    overflow: hidden;
}

.constructor-driver-photo {
    position: absolute;
    width: 120px;
    height: 100px;
    object-fit: cover;
    object-position: top center;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.45));
}

.constructor-driver-photo:first-child {
    left: 0;
    z-index: 2;
}

.constructor-driver-photo--second {
    left: 50px;
    z-index: 1;
}

/* ─── ELEMENTOS SOLO MOBILE — ocultos en desktop ─────────────────────────── */

.mobile-card-body {
    display: none;
}

/* ─── ANIMACIONES ─────────────────────────────────────────────────────────── */

@keyframes fadeDown {
    from { opacity: 0; transform: translateY(-20px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-24px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* Título */
.main_title {
    animation: fadeDown 0.6s ease both;
}

/* Tabs */
.buttons_container {
    animation: fadeIn 0.5s ease 0.3s both;
}

/* Filas — el delay por posición ya viene del JS */
.standing-row {
    opacity: 0;
    animation: slideInLeft 0.4s ease both;
}


/* SECOND SECTION */

.secondsection_wrapper{
    padding: 64px 10px;
    background-color: #02040a;
    border-top: var(--border-grey);
    width: 100%;
}

.secondsection_container{
    max-width: 1300px;
    width: 100%;
    margin: auto;
}

.items_container{
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: auto;
}

.item{
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    max-width: 250px;
    width: 100%;
}

.item h3{
    font-size: 32px;
    font-family: var(--title-font);
    color: var(--red-color);
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: 2px;
    text-align: center;
}

.item h4{
    color: var(--grey-color);
    font-family: var(--text-font);
    font-size: 16px;
    font-weight: 500;
}


/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE TABLET (≤ 1100px) — achica columnas, mantiene layout horizontal
═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1100px) {

    .main_container   { width: 94%; padding-top: 100px; }
    .main_title h1    { font-size: 72px; }

    .standing-row     { padding: 16px 20px 0; }

    .pos-number       { min-width: 60px; font-size: 24px; }

    .driver-photo-wrap { width: 80px; height: 64px; margin-right: 12px; }
    .driver-info      { min-width: 200px; }
    .team-info        { min-width: 160px; }
    .points-info      { min-width: 110px; }

    .constructor-photos-wrap          { width: 110px; }
    .constructor-driver-photo         { width: 90px; height: 80px; }
    .constructor-driver-photo--second { left: 36px; }
    .constructor-info { min-width: 260px; }

    .driver-data        { font-size: 15px; }
    .driver-family-name { font-size: 17px; }
    .driver-nationality { font-size: 13px; }
    .team-label,
    .points-label       { font-size: 13px; }
    .team-name          { font-size: 15px; }
    .points-value       { font-size: 20px; }
    .constructor-name   { font-size: 16px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE MOBILE (≤ 768px)
═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

    .main_container      { width: 92%; padding-top: 120px; }
    .main_title h1       { font-size: 40px; }
    .main_title          { padding-bottom: 32px; }
    .positions_container { gap: 32px; padding-bottom: 60px; }

    .driver_button,
    .team_button         { padding: 16px 12px; font-size: 14px; }

    /* ── CARD PILOTOS ─────────────────────────────────────────────────────── */

    .standing-row.driver-row {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        grid-template-areas:
            "pos   trend"
            "body  body";
        padding: 16px 16px 0;
        gap: 8px;
        align-items: center;
        overflow: hidden;
    }

    /* Ocultar todos los elementos de desktop */
    .standing-row.driver-row .driver-photo-wrap,
    .standing-row.driver-row .driver-info,
    .standing-row.driver-row .team-info,
    .standing-row.driver-row .points-info { display: none; }

    .standing-row.driver-row .pos-number {
        grid-area: pos;
        min-width: unset;
        font-size: 22px;
        line-height: 1;
    }

    .standing-row.driver-row .trend-info {
        grid-area: trend;
        margin-left: 0;
    }

    /* Body: texto izquierda + foto derecha */
    .standing-row.driver-row .mobile-card-body {
        grid-area: body;
        display: flex;
        flex-direction: row;
        align-items: flex-end;
        gap: 0;
    }

    /* Columna izquierda: todo el texto */
    .mobile-card-body .mobile-text {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding-bottom: 16px;
    }

    .mobile-text .mobile-driver-name {
        font-family: var(--title-font);
        color: var(--white-color);
        font-size: 17px;
        font-weight: 600;
        font-style: italic;
        line-height: 1.2;
    }

    .mobile-text .mobile-nat {
        display: flex;
        align-items: center;
        gap: 6px;
    }
    .mobile-text .mobile-nat img  { width: 16px; height: 16px; }
    .mobile-text .mobile-nat span {
        font-family: var(--text-font);
        color: var(--grey-color);
        font-size: 13px;
    }

    .mobile-text .mobile-team,
    .mobile-text .mobile-points {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .mobile-text .mobile-label {
        font-family: var(--text-font);
        color: var(--grey-color);
        font-weight: 600;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    .mobile-text .mobile-team-value {
        font-family: var(--title-font);
        color: var(--white-color);
        font-weight: 600;
        font-size: 15px;
    }

    .mobile-text .mobile-points-value {
        font-family: var(--title-font);
        color: var(--red-color);
        font-weight: 700;
        font-size: 22px;
    }

    /* Columna derecha: foto, pegada al borde inferior */
    .standing-row.driver-row .mobile-card-body .mobile-driver-photo {
        display: block;
        width: 120px;
        flex-shrink: 0;
        align-self: flex-end;
        object-fit: cover;
        object-position: top center;
        /* Sin border-radius arriba para que fluya hasta el borde de la card */
        border-radius: 0;
        /* La foto empieza desde donde empiece y llega hasta el borde inferior */
        max-height: 160px;
    }

    /* ── CARD CONSTRUCTORES ───────────────────────────────────────────────── */

    .standing-row.constructor-row {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        grid-template-areas:
            "pos   trend"
            "body  body";
        padding: 16px 16px 0;
        gap: 8px;
        align-items: center;
        overflow: hidden;
    }

    .standing-row.constructor-row .constructor-photos-wrap,
    .standing-row.constructor-row .constructor-info,
    .standing-row.constructor-row .points-info { display: none; }

    .standing-row.constructor-row .pos-number {
        grid-area: pos;
        min-width: unset;
        font-size: 22px;
        line-height: 1;
    }

    .standing-row.constructor-row .trend-info {
        grid-area: trend;
        margin-left: 0;
    }

    .standing-row.constructor-row .mobile-card-body {
        grid-area: body;
        display: flex;
        flex-direction: row;
        align-items: flex-end;
        gap: 0;
    }

    .standing-row.constructor-row .mobile-card-body .mobile-text {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding-bottom: 16px;
    }

    .mobile-constructor-header {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .mobile-constructor-name {
        font-family: var(--title-font);
        color: var(--white-color);
        font-weight: 700;
        font-size: 17px;
        font-style: italic;
    }

    /* Fotos de los 2 pilotos superpuestas, pegadas al borde inferior */
    .standing-row.constructor-row .mobile-card-body .mobile-constructor-photos {
        display: flex;
        flex-direction: row;
        align-items: flex-end;
        flex-shrink: 0;
    }

    .mobile-driver-photo-small {
        display: block;
        width: 70px;
        height: 90px;
        object-fit: cover;
        object-position: top center;
        border-radius: 0;
    }

    .mobile-driver-photo-small:last-child {
        margin-left: -24px;
    }

        .items_container{
        flex-direction: column;
        gap: 20px;
    }
}