/* ============================================================
   VARIABLES
   ============================================================ */

:root {
    --bg-color: #f4f7f6;

    --card-bg: #ffffff;

    --text-color: #18212b;

    --muted-color: #65717d;

    --primary: #243b64;

    --primary-hover: #1b2f51;

    --border-color: #d9e0e6;

    --soft-bg: #f7f9fb;

    --success-bg: #edf7f0;

    --success-border: #b8ddc2;

    --success-text: #245d36;

    --error-bg: #fff1f1;

    --error-border: #e0b9b9;

    --error-text: #8b2727;

    --shadow: 0 12px 35px rgba(20, 35, 50, 0.08);

    --radius: 14px;
}

/* ============================================================
   RESET
   ============================================================ */

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;

    min-height: 100vh;

    background: radial-gradient(circle at 50% 0%, #263653 0%, #172238 38%, #111827 75%);

    color: var(--text-color);

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        'Segoe UI',
        Roboto,
        Arial,
        sans-serif;

    line-height: 1.55;
}

/* ============================================================
   CONTENEUR
   ============================================================ */

.container {
    width: min(1080px, calc(100% - 32px));

    margin: 0 auto;

    padding: 40px 0 60px;
}

/* ============================================================
   HEADER
   ============================================================ */

.header {
    margin-bottom: 30px;

    text-align: center;
}

.header h1 {
    margin: 0 0 10px;

    color: #34cc34;

    font-size: clamp(1.4rem, 3vw, 2.1rem);
    line-height: 1.15;
}

.header p {
    max-width: 760px;
    margin: 0 auto;

    color: #A3AAB8;
}

#red-title {
    color: #ffc7c7;
    margin-top: 10px;
}

/* ============================================================
   LAYOUT
   ============================================================ */

.main-grid {
    display: grid;

    grid-template-columns:
        minmax(280px, 370px)
        minmax(0, 1fr);

    gap: 24px;

    align-items: start;
}

/* ============================================================
   CARD
   ============================================================ */

.card {
    background: var(--card-bg);

    border: 1px solid var(--border-color);

    border-radius: var(--radius);

    box-shadow: var(--shadow);

    padding: 26px;
}

.card h2 {
    margin: 0 0 20px;

    color: var(--primary);

    font-size: 1.25rem;
}

/* ============================================================
   FORMULAIRE
   ============================================================ */

.form-group {
    margin-bottom: 19px;
}

.form-group label {
    display: block;

    margin-bottom: 7px;

    font-weight: 650;

    font-size: 0.92rem;
}

.date-grid {
    display: grid;

    grid-template-columns:
        0.8fr
        1.4fr
        1.2fr;

    gap: 9px;
}

input,
select {
    width: 100%;

    min-height: 46px;

    padding: 9px 11px;

    border: 1px solid var(--border-color);

    border-radius: 9px;

    background: #fff;

    color: var(--text-color);

    font: inherit;

    outline: none;

    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

input:focus,
select:focus {
    border-color: var(--primary);

    box-shadow: 0 0 0 3px rgba(36, 59, 100, 0.12);
}

.help {
    display: block;

    margin-top: 6px;

    color: var(--muted-color);

    font-size: 0.79rem;
}

/* ============================================================
   BOUTON
   ============================================================ */

button {
    width: 100%;

    min-height: 48px;

    margin-top: 4px;

    padding: 10px 16px;

    border: 0;

    border-radius: 9px;

    background: var(--primary);

    color: #fff;

    font: inherit;

    font-weight: 700;

    cursor: pointer;

    transition:
        background 0.15s ease,
        transform 0.1s ease;
}

button:hover {
    background: var(--primary-hover);
}

button:active {
    transform: translateY(1px);
}

/* ============================================================
   RESULTAT
   ============================================================ */

.result-main {
    padding: 25px;

    background: var(--soft-bg);

    border: 1px solid var(--border-color);

    border-radius: 12px;

    text-align: center;
}

.result-label {
    margin-bottom: 8px;

    color: var(--muted-color);

    font-size: 0.78rem;

    font-weight: 750;

    text-transform: uppercase;

    letter-spacing: 0.09em;
}

.roman-date {
    margin: 0;

    color: var(--primary);

    font-family: Georgia, 'Times New Roman', serif;

    font-size: clamp(1.15rem, 2vw, 1.6rem);

    font-weight: 700;

    overflow-wrap: anywhere;
}

.latin-full {
    margin-top: 13px;

    font-family: Georgia, 'Times New Roman', serif;

    font-size: 1.08rem;

    font-style: italic;

    overflow-wrap: anywhere;
}

.leap {
    display: inline-block;

    margin-top: 13px;

    padding: 5px 10px;

    background: var(--success-bg);

    border: 1px solid var(--success-border);

    border-radius: 999px;

    color: var(--success-text);

    font-size: 0.78rem;

    font-weight: 650;
}

/* ============================================================
   INFORMATIONS
   ============================================================ */

.info-grid {
    display: grid;

    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: 11px;

    margin-top: 20px;
}

.info-item {
    padding: 14px;

    background: #fff;

    border: 1px solid var(--border-color);

    border-radius: 10px;
}

.info-label {
    color: var(--muted-color);

    font-size: 0.72rem;

    font-weight: 750;

    text-transform: uppercase;

    letter-spacing: 0.05em;
}

.info-value {
    margin-top: 3px;

    font-weight: 650;
}

/* ============================================================
   EXPLICATION
   ============================================================ */

.explanation {
    margin-top: 20px;

    padding: 20px;

    background: #edfdee;

    border-left: 4px solid #1ed62d;

    border-radius: 8px;
}

.explanation h3 {
    margin: 0 0 12px;

    color: var(--primary);

    font-size: 1rem;
}

.explanation p {
    margin: 8px 0;
}

/* ============================================================
   ETAPES DU CALCUL
   ============================================================ */

.calculation {
    margin-top: 16px;

    padding: 15px;

    background: #edfdee;

    border: 2px solid #1ed62d;

    border-radius: 9px;
}

.calculation-row {
    display: flex;

    justify-content: space-between;

    gap: 20px;

    padding: 7px 0;

    border-bottom: 1px solid var(--border-color);
}

.calculation-row:last-child {
    border-bottom: 0;
}

.calculation-label {
    color: var(--muted-color);
}

.calculation-value {
    font-weight: 650;

    text-align: right;
}

/* ============================================================
   ERREUR
   ============================================================ */

.error {
    margin-bottom: 20px;

    padding: 14px 16px;

    background: var(--error-bg);

    border: 1px solid var(--error-border);

    border-radius: 9px;

    color: var(--error-text);
}

/* ============================================================
   DOCUMENTATION
   ============================================================ */

.documentation {
    margin-top: 24px;
}

.documentation p {
    color: var(--muted-color);
}

.roman-table {
    width: 100%;

    margin-top: 16px;

    border-collapse: collapse;
}

.roman-table th,
.roman-table td {
    padding: 10px;

    border-bottom: 1px solid var(--border-color);

    text-align: left;
}

.roman-table th {
    color: var(--primary);

    font-size: 0.82rem;
}

/* ============================================================
   FOOTER
   ============================================================ */

footer {
    margin-top: 32px;

    color: var(--muted-color);

    text-align: center;

    font-size: 0.8rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 760px) {
    .container {
        width: calc(100% - 20px);

        padding-top: 25px;
    }

    .main-grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 20px;
    }

    .date-grid {
        grid-template-columns: 1fr;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .calculation-row {
        flex-direction: column;

        gap: 2px;
    }

    .calculation-value {
        text-align: left;
    }
}

@media (max-width: 420px) {
    .container {
        width: calc(100% - 14px);
    }

    .card {
        padding: 16px;

        border-radius: 11px;
    }

    .result-main {
        padding: 19px 12px;
    }

    .roman-date {
        font-size: 1.3rem;
    }

    .latin-full {
        font-size: 0.98rem;
    }
}
