: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;
}

.main_container{
    max-width: 1400px;
    width: 100%;
    margin: auto;
    display: flex;
    flex-direction: column;
    padding-top: 120px;
}

.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;
}

.main_title h2{
    color: var(--text-color);
    font-family: var(--text-font);
    font-size: 22px;
    font-weight: 300;
    line-height: 1.5;
}

.main_title h2 span{
    font-weight: 400;
}

/* DRIVERS */

.drivers{
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 80px;
}

.driver{
    max-width: calc((1400px - 20px) / 2);
    width: 100%;
    position: relative; 
    padding: 24px;
    height: 280px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    background-color: black;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    overflow: hidden;
    border-radius: var(--border-radius);
    border: var(--border-grey);
    cursor: pointer;
}

.driver::before {
    content: "";
    position: absolute;
    top: 0px;        
    bottom: 8px;
    left: 0;
    width: 4px;      
    border-radius: 12px 0 0 12px;
    pointer-events: none;
    height: 280px;
    background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.25),
    rgba(255, 255, 255, 0.05),
    rgba(255, 255, 255, 0.18)
    );
    opacity: 0.55;    
}

.driver_info{
    max-width: 300px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
    height: 210px;
}

.nationality{
    display: flex;
    gap: 12px;
    align-items: center;
}

.nationality img{
    width: 24px;
    height: auto;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.45));
}

.nationality p{
    font-family: var(--text-font);
    color: var(--grey-color);
    font-size: 16px;
    line-height: 1.3;
    font-weight: 700;
}

.name{
    font-family: var(--title-font);
    color: var(--white-color);
    font-weight: 700;
    font-size: 30px;
    line-height: 1;
    display: flex;
    flex-direction: column;
    gap: 25px;
    align-items: flex-start;
    position: relative;
}

.nickname{
    position: absolute;
    left: 0px;          /* movelo fino */
    top: 22px;           /* subilo/bajalo */
    transform: rotate(-6deg);
    font-family: "Caveat", cursive;
    font-style: italic;
    font-size: 32px;
    font-weight: 800;
    color: var(--red-color);      /* rojo vibrante tipo F1 */
    letter-spacing: 1px;
    z-index: 2;
    pointer-events: none;
    white-space: nowrap;
    text-shadow: 0 4px 12px rgba(0,0,0,0.6);
}

.name .surname {
    position: relative;
    z-index: 1;
}

.team{
    letter-spacing: 0.7px;
    font-family: var(--text-font);
    color: var(--red-color);
    font-size: 16px;
    line-height: 1.5;
    font-weight: 600;
}

.championships{
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: center;
    padding: 4px 10px;
    background-color: #ffc118;
    background-color: color-mix(in oklab, #ffc118 20%, transparent);
    border: 1px solid #ffb900;
    border-radius: 4px;
}

.championships svg{
    width: 15px;
    height: 15px;
}

.championships p{
    color: #ffb900;
    font-family: var(--text-font);
    font-size: 14px;
    font-weight: 600;
}

.driver_media{
    max-width: 350px;
    height: 100%;
    position: relative;
}

.number{
    position: absolute;
    top: 0;
    right: 0;
}

.number p{
    font-family: var(--title-font);
    font-style: italic;
    font-size: 48px;
    font-weight: 900;
    line-height: 1;
    color: var(--grey-color);
}

.driver_image{
    max-width: 250px;
    height: auto;   
    padding-right: 60px;
}

.driver_image img{
    width: 100%;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.45));
}

.mclaren{
    background-image: linear-gradient(
      rgba(0, 0, 0, 0.50),
      rgba(0, 0, 0, 0.50)
    ), url(../img/escuderia-bg-vertical/mclaren_bg.webp);
}

.mercedes{
    background-image: linear-gradient(
      rgba(0, 0, 0, 0.50),
      rgba(0, 0, 0, 0.50)
    ), url(../img/escuderia-bg-vertical/mercedes_bg.webp);
}

.ferrari{
    background-image: linear-gradient(
      rgba(0, 0, 0, 0.50),
      rgba(0, 0, 0, 0.50)
    ), url(../img/escuderia-bg-vertical/ferrari_bg.webp);
}

.redbull{
    background-image: linear-gradient(
      rgba(0, 0, 0, 0.50),
      rgba(0, 0, 0, 0.50)
    ), url(../img/escuderia-bg-vertical/redbull_bg.webp);
}

.williams{
    background-image: linear-gradient(
      rgba(0, 0, 0, 0.50),
      rgba(0, 0, 0, 0.50)
    ), url(../img/escuderia-bg-vertical/williams_bg.webp);
}

.racingbulls{
    background-image: linear-gradient(
      rgba(0, 0, 0, 0.50),
      rgba(0, 0, 0, 0.50)
    ), url(../img/escuderia-bg-vertical/racingbulls_bg.webp);
}

.astonmartin{
    background-image: linear-gradient(
      rgba(0, 0, 0, 0.50),
      rgba(0, 0, 0, 0.50)
    ), url(../img/escuderia-bg-vertical/astonmartin_bg.webp);
}

.audi{
    background-image: linear-gradient(
      rgba(0, 0, 0, 0.50),
      rgba(0, 0, 0, 0.50)
    ), url(../img/escuderia-bg-vertical/audi_bg.webp);
}

.haas{
    background-image: linear-gradient(
      rgba(0, 0, 0, 0.50),
      rgba(0, 0, 0, 0.50)
    ), url(../img/escuderia-bg-vertical/haas_bg.webp);
}

.alpine{
    background-image: linear-gradient(
      rgba(0, 0, 0, 0.50),
      rgba(0, 0, 0, 0.50)
    ), url(../img/escuderia-bg-vertical/apline_bg.webp);
}

.cadillac{
    background-image: linear-gradient(
      rgba(0, 0, 0, 0.50),
      rgba(0, 0, 0, 0.50)
    ), url(../img/escuderia-bg-vertical/cadillac_bg.webp);
}

/* Transiciones suaves */
.driver {
  transition: transform 0.3s ease;
  transform-origin: center;
}

.driver .name,
.driver .number p {
  transition: color 0.25s ease;
}

.lastname{
    text-transform: uppercase;
    font-size: 40px;
    font-style: italic;
}

/* Hover effects */
.driver:hover {
  transform: scale(1.01);
}

.driver:hover .lastname {
  color: var(--red-color);
}

.driver:hover .number p {
  color: var(--white-color);
}

/* 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;
}

.item h4{
    color: var(--grey-color);
    font-family: var(--text-font);
    font-size: 16px;
    font-weight: 500;
}

/* MODAL */

.driver-modal { 
    display:none; 
    position:fixed; 
    inset:0; 
    z-index:9999; 
    align-items: center;
    justify-content: center;
}

.driver-modal.active { 
    display:flex; 
}

.driver-modal__overlay { 
    position:absolute; 
    inset:0; 
    background:rgba(0,0,0,.65);
}

.driver-modal__dialog { 
    position:relative; 
    max-width: 660px;
    width: 100%;
    margin: auto; 
    color: #fff;
    border: var(--border-grey);
    border-radius: var(--border-radius);
    background-color: var(--dark-bg);
    background-size: cover;
    background-repeat: no-repeat;
    background-position: left;
}

.driver-modal__dialog::before {
    content: "";
    position: absolute;
    top: 0px;        
    bottom: 8px;
    left: 0;
    width: 4px;      
    border-radius: 12px 0 0 12px;
    pointer-events: none;
    height: 100%;
    background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.25),
    rgba(255, 255, 255, 0.05),
    rgba(255, 255, 255, 0.18)
    );
    opacity: 0.55;
}

.modal_title{
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    border-bottom: var(--border-grey);
}

.driver_name_cont{
    display: flex;
    flex-direction: column;
    width: auto;
    gap: 8px;
    align-items: flex-start;
}

.driver_name_cont p{
    font-family: var(--title-font);
    color: var(--white-color);
    font-size: 36px;
    font-weight: 700;
    line-height: 1.1;
}

.driver_name_cont span{
    letter-spacing: 0.7px;
    font-family: var(--text-font);
    color: var(--red-color);
    font-size: 16px;
    line-height: 1.5;
    font-weight: 600;
}

.modal_title button{
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 100%;
    background-color: #02040a8d;
    border: var(--border-grey);
    padding: 8px;
    cursor: pointer;
    transition: background-color 0.25s ease, transform 0.25s ease;
}

.modal_title button svg {
    transition: transform 0.25s ease;
}

/* Hover state */
.modal_title button:hover {
    background-color: rgba(255, 255, 255, 0.12); /* gris transparente */
}

.modal_title button:hover svg {
    transform: rotate(90deg);
}

.driver_data_container{
    padding: 24px;
    padding-bottom: 0;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
}

.driver_data{
    max-width: 137px;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 16px;
    gap: 8px;
    border-radius: var(--border-radius);
    border: var(--border-grey);
    background-color: #02040a8d;
}

.driver_data p{
    font-family: var(--text-font);
    color: var(--grey-color);
    font-size: 14px;
    line-height: 1.3;
    font-weight: 700;
}

.driver_data span{
    font-family: var(--title-font);
    color: var(--red-color);
    font-size: 30px;
    line-height: 1.2;
    font-weight: 700;
}

.driver_nationality_date{
    padding: 24px;
    padding-top: 32px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    width: 100%;
}

.driver_nationality, .driver_birth{
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
    max-width: 300px;
    width: 100%;
}

.driver_nationality h3, .driver_birth h3{
    font-family: var(--text-font);
    color: var(--grey-color);
    font-size: 14px;
    line-height: 1.3;
    font-weight: 700;
}

.driver_nationality div{
    display: flex;
    align-items: center;
    gap: 12px;
}

.driver_nationality div img{
    width: 20px;
    height: 20px;
}

.driver_nationality div p, .driver_birth p{
    font-family: var(--text-font);
    color: var(--white-color);
    font-size: 18px;
    line-height: 1.3;
    font-weight: 700;
}

.driver_stats_container{
    padding: 24px;
    padding-top: 0;
    width: 100%;
}

.driver_stats_container h4{
    font-family: var(--title-font);
    color: var(--white-color);
    font-size: 20px;
    line-height: 1.2;
    margin-bottom: 16px;
    font-weight: 700;
}

.driver_stats{
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    width: 100%;
}

.driver_stat{
    padding: 24px;
    max-width: 190px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: .5s all ease;
}

.driver_stat:hover{
    transform: scale(1.05);
}

.driver_stat p{
    font-family: var(--text-font);
    color: var(--grey-color);
    font-size: 14px;
    line-height: 1.3;
    font-weight: 700;
}

.driver_stat span{
    font-family: var(--title-font);
    font-size: 36px;
    font-weight: 700;
    line-height: 1.1;
}

.wins{
    background: linear-gradient(  to bottom right,rgba(234, 179, 8, 0.2),rgba(202, 138, 4, 0.1));
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: var(--border-radius);
}

.wins span{
    color: #ffdf20;
}

.podiums{
    border-radius: var(--border-radius);
    background: linear-gradient(  to bottom right,rgba(249, 115, 22, 0.2), rgba(234, 88, 12, 0.1));
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.podiums span{
    color: #ffdf20;
}

.poles{
    background: linear-gradient(to bottom right,rgba(6, 182, 212, 0.2),rgba(8, 145, 178, 0.1));
    border-radius: var(--border-radius);
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.poles span{
    color: #53eafd;
}

/* LOADING SPINNER */

/* Loading Spinner para el Modal de Pilotos */
.loading-spinner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    z-index: 1000;
    border-radius: inherit;
}

.spinner-ring {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-spinner p {
    margin-top: 20px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

@keyframes spin {
    0% { 
        transform: rotate(0deg); 
    }
    100% { 
        transform: rotate(360deg); 
    }
}

/* Ocultar contenido del modal mientras carga */
.driver-modal__dialog.loading .modal_title,
.driver-modal__dialog.loading .driver_data_container,
.driver-modal__dialog.loading .driver_nationality_date,
.driver-modal__dialog.loading .driver_stats_container {
    opacity: 0;
    pointer-events: none;
}

.driver-modal__dialog:not(.loading) .modal_title,
.driver-modal__dialog:not(.loading) .driver_data_container,
.driver-modal__dialog:not(.loading) .driver_nationality_date,
.driver-modal__dialog:not(.loading) .driver_stats_container {
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Variante con animación de pulso (opcional) */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading-spinner p {
    animation: pulse 1.5s ease-in-out infinite;
    font-family: var(--title-font);
    color: var(--white-color);
    font-size: 30px;
    font-weight: 700;
}

@media (max-width: 1024px) {
    .main_title h1{
        font-size: 64px;
        margin-right: auto;
    }
    .main_title{
        margin: auto;
        align-items: center;
    }
    .main_container{
        width: 90%;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .main_title h1{
        font-size: 50px;
        line-height: 1.2;
    }
    .lastname{
        font-size: 30px;
    }
    .driver_image{
        padding-right: 10px;
    }
    .nickname{
        font-size: 28px;
    }
    .items_container{
        flex-direction: column;
        gap: 20px;
    }
    .driver_data_container{
        justify-content: center;
        gap: 20px;
    }
    .driver_nationality_date{
        flex-direction: column;
        gap: 20px;
        align-items: flex-start;
    }
    .driver-modal__dialog {
        width: 90%;
        height: 90%;
        overflow-y: auto;
    }
    .driver_stats{
        flex-direction: column;
    }
}

@media (max-width: 375px) {
    .driver {
        height: auto;           /* quitar altura fija */
        min-height: 200px;
        padding: 20px;
        align-items: flex-end;
    }
    .driver_media {
        max-width: 100px;
        width: 80px;
        flex-shrink: 0;
        position: relative;
    }
    .driver_image {
        max-width: 120px;
        padding-right: 0;       /* ya lo tenés en 10px, dejalo */
    }
    .driver_image img {
        width: 100%;
        height: auto;
        object-fit: contain;
        object-position: bottom;
    }
    .number {
        position: absolute;
        top: 0;
        right: -10px;
    }
    .number p {
        font-size: 28px;        /* reducir número para que no tape */
    }
    .driver_info {
        max-width: unset;
        flex: 1;
        height: auto;
        min-height: 0;
    }
    .name, .lastname {
        font-size: 26px;
    }
    .nationality img{
        width: 18px;
    }
    .nationality p{
        font-size: 14px;
    }
}