/* Zera as margens e espaçamentos, aplica o modelo de box-sizing e define a fonte padrão */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Times New Roman', Times, serif;
}

/* Define as cores primárias usando variáveis CSS */
:root {
    --primary-color: #f6f7fb;
    --white-color: #fff;
    --black-color: #18191A;
    --red-color: #e74c3c;
}

/* Estilo para o corpo do site, define o layout centralizado */
body {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
}

/* Modo escuro, alterando as cores */
body.dark {
    --primary-color: #242526;
    --white-color: #18191A;
    --black-color: #fff;
    --red-color: #e74c3c;
}

/* Define o layout flexível para o container principal */
.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 60px;
}

/* Estilo para o relógio, definindo seu tamanho, centralização e aparência circular */
.container .clock {
    display: flex;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    background: var(--white-color);
    box-shadow: 0 15px 25px rgba(0, 0, 0, 0.3), 0 25px 45px rgba(0, 0, 0, 0.3);
    position: relative;
}

/* Adicionando traços para segundos */
.container .clock .second-marks {
    position: absolute;
    width: 100%;
    height: 98%;
    top: 0;
    left: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container .clock .second-marks div {
    position: absolute;
    width: 2px;
    height: 10px;
    background-color: var(--black-color);
    transform-origin: center bottom;
}

/* Estilo para os múltiplos de 5 (big-mark) */
.container .clock .second-marks .big-mark {
    width: 4px;
    background-color: var(--red-color);
}

/* Sombra ao redor do relógio */
.container .clock::before {
    content: '';
    width: 425px;
    height: 425px;
    position: absolute;
    border-radius: 50%;
    box-shadow: 0 0 15px 15px rgba(0, 0, 0, 0.3);
}

/* Define a posição e rotação dos números no relógio */
.clock label {
    position: absolute;
    inset: 13px;
    text-align: center;
    transform: rotate(calc(var(--n) * (360deg / 12)));
}

/* Estilo dos números, incluindo tamanho da fonte, cor e sombra */
.clock label span {
    display: inline-block;
    font-size: 38px;
    font-weight: 600;
    text-shadow: gray 0 0 20px;
    color: var(--black-color);
    transform: rotate(calc(var(--n) * (-360deg / 12)));
}

/* Indicador central no relógio */
.container .indicator {
    position: absolute;
    width: 9px;
    height: 9px;
    display: flex;
    justify-content: center;
}

/* Estilo do círculo central do relógio */
.indicator::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    z-index: 100;
    background: var(--black-color);
    border: 4px solid var(--red-color);
}

/* Estilo do ponteiro dos segundos */
.indicator .hand {
    position: absolute;
    height: 168px;
    width: 6px;
    bottom: 0;
    transform-origin: bottom;
    border-radius: 50%; 
    box-shadow: #e74c3c 0 0 10px;
    background: var(--red-color);
}

/* Estilo do ponteiro dos minutos */
.hand.minute {
    width: 8px;
    height: 150px;
    border-radius: 50%;
    box-shadow: #18191A 0 0 10px;
    background: var(--black-color);
}

/* Estilo do ponteiro das horas */
.hand.hour {
    width: 10px;
    height: 129px;
    border-radius: 50%;
    box-shadow: #18191A 0 0 10px;
    background: var(--black-color);
}

/* Container para alinhar os botões na horizontal */
.switches {
    display: flex;
    justify-content: space-between; /* Garante que haja espaço entre os botões */
    gap: 10px; /* Espaço entre os botões */
}

/* Botão para alternar entre os modos claro e escuro */
.mode-switch {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 22px;
    font-weight: 400;
    display: inline-block;
    color: var(--white-color);
    background: var(--black-color);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    white-space: nowrap; /* Evita quebra de linha no texto */
}

/* Estilo para o botão de controle de som */
.sound-switch {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 22px;
    font-weight: 400;
    color: var(--white-color);
    background: var(--red-color);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    white-space: nowrap; /* Evita quebra de linha no texto */
}

/* --- Estilos Responsivos --- */

/* Ajustes para telas de tablet */
@media (max-width: 768px) {
    .container .clock {
        width: 400px; /* Reduz o tamanho do relógio */
        height: 400px;
    }
    .container .clock .second-marks div {
        width: 1.5px;
        height: 7px; /* Traço menor para telas menores */
    }
    .container .clock .second-marks .big-mark {
        width: 3.4px;
    }
    .container .clock::before {
        width: 425px; /* Tamanho menor para borda do relógio */
        height: 425px;
    }
    .clock label span {
        font-size: 30px; /* Diminui o tamanho da fonte dos números */
    }
    .indicator .hand {
        height: 168px; /* Ajusta o tamanho do ponteiro dos segundos */
    }
    .hand.minute {
        height: 149px; /* Ajusta o tamanho do ponteiro dos minutos */
    }
    .hand.hour {
        height: 129px;  /* Ajusta o tamanho do ponteiro das horas */
    }
    .mode-switch {
        padding: 8px 16px; /* Reduz o padding para se ajustar melhor em telas menores */
        font-size: 18px;   /* Diminui o tamanho da fonte */
        border-radius: 6px; /* Ajusta a borda arredondada */
        cursor: pointer;
    }
    .sound-switch {
        padding:8px 16px;
        font-size: 18px;
    }
}

/* Ajustes para telas de celular */
@media (max-width: 480px) {
    .container .clock {
        width: 300px; /* Tamanho menor para o relógio */
        height: 300px;
    }
    .container .clock .second-marks div {
        width: 1px;
        height: 7px; /* Traço ainda menor para telas muito pequenas */
    }
    .container .clock .second-marks .big-mark {
        width: 2.5px;
    }
    .container .clock::before {
        width: 325px;  /* Tamanho menor para borda do relógio */
        height: 325px;
    }
    .clock label span {
        font-size: 24px; /* Diminui ainda mais os números */
    }
    .indicator .hand {
        height: 127px;  /* Ajusta o tamanho do ponteiro dos segundos */
    }
    .hand.minute {
        height: 111px; /* Ajusta o tamanho do ponteiro dos minutos */
    }
    .hand.hour {
        height: 91px;  /* Ajusta o tamanho do ponteiro das horas */
    }
    .mode-switch {
        padding: 6px 14px; /* Padding ainda menor para dispositivos pequenos */
        font-size: 16px;   /* Fonte menor para se adaptar ao espaço */
        border-radius: 5px; /* Borda levemente reduzida */
    }
    .sound-switch {
        padding:6px 14px;
        font-size: 16px;
        border-radius: 5px;
    }
}