
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
    color-scheme: dark;

    --bg: #0c1011;
    --text: #eeeeea;
    --muted: #aeb7b2;
    --accent: #f2a13d;
    --edge: #39413e;
}

/* base */

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: 'DM Sans', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.65;
}

/* garder le fond sur toutes les pages
   TODO: voir si on garde la même image pour le CTF */

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    background: url('background.png') center / cover no-repeat;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background: rgba(8, 12, 13, .91);
}

button,
input,
select,
textarea {
    font: inherit;
}

a {
    color: var(--accent);
}

a:hover {
    color: #ffc17a;
}

/* layout général */

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.wrap {
    width: min(1060px, calc(100% - 48px));
    margin: auto;
}

.header {
    padding: 20px 0;
    border-bottom: 1px solid var(--edge);
}

.identity {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    text-decoration: none;
    font-size: 21px;
    font-weight: 700;
}

.logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.content {
    flex: 1;
    padding: 55px 0 85px;
}

/* accueil */

.home {
    max-width: 720px;
    padding: 65px 0;
}

.eyebrow {
    font-size: 13px;
    color: var(--accent);
    font-weight: 600;
}

.home h1 {
    margin: 20px 0 25px;
    font-size: clamp(44px, 7vw, 80px);
    line-height: 1.12;
    letter-spacing: -2px;
}

.lead {
    max-width: 590px;
    color: #d0d6d1;
    font-size: 17px;
    line-height: 1.8;
}

.home-cta {
    margin-top: 30px;
}

/* boutons
   pas besoin de 15 variantes pour l'instant */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 20px;
    background: var(--accent);
    color: #171717;
    border: 1px solid var(--accent);
    border-radius: 4px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.button:hover {
    background: #ffb85c;
    color: #171717;
}

.button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.muted {
    color: var(--muted) !important;
}

.small {
    font-size: 13px;
}

/* footer */

.footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 0;
    border-top: 1px solid var(--edge);
    color: #a6afaa;
    font-size: 13px;
}

.footer a {
    color: #d3dad5;
    text-decoration: none;
}

.footer a:hover {
    color: var(--accent);
}

.secret {
    padding: 0 8px;
    color: #858f89 !important;
}

.secret:hover {
    color: var(--accent) !important;
}

/* CTF / énigmes
   j'ai viré les cartes, c'était trop chargé */

.paper {
    width: min(100%, 820px);
    margin: 0 auto;
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.archive-kicker {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding-bottom: 14px;
    color: #b3bbb5;
    font-size: 12px;
    font-weight: 500;
}

.slash {
    color: #7e8881;
}

.live-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: var(--accent);
    border-radius: 50%;
}

.paper-top {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    padding: 15px 0;
    border-top: 1px solid var(--edge);
    color: #b9c0bb;
    font-size: 13px;
}

.progress-track {
    height: 3px;
    margin: 0 0 48px;
    background: #343b38;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
}

/* contenu des épreuves */

.archive-body {
    padding: 0;
}

.chapter-meta {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
    color: #e6ad67;
    font-size: 13px;
    font-weight: 600;
}

.paper h2 {
    margin: 0 0 30px;
    font-size: clamp(32px, 5vw, 48px);
    line-height: 1.2;
    letter-spacing: -1px;
}

.paper h3 {
    margin: 32px 0 16px;
    font-size: 24px;
    line-height: 1.3;
}

.paper p {
    margin: 16px 0;
    color: #d9ded9;
    font-size: 16px;
    line-height: 1.8;
}

.paper strong,
.paper b {
    color: #fff;
}

/* notes dans les énigmes
   TODO: harmoniser les notes avec les journaux */

.note {
    margin: 28px 0;
    padding: 20px 24px;
    background: #1a201f;
    border-left: 3px solid #c68b4a;
    color: #e2e6e1;
}

.note p {
    margin: 10px 0;
}

.note p:first-child {
    margin-top: 0;
}

.note p:last-child {
    margin-bottom: 0;
}

/* papier trouvé / archive */

.handwriting {
    background: #e7dfce;
    border-left-color: #a67c45;
    color: #252723;
}

.handwriting p,
.handwriting b,
.handwriting strong {
    color: #252723 !important;
}

.paper code {
    font-family: Consolas, 'Courier New', monospace;
    font-size: .95em;
    color: #f0bd7d;
}

/* indices dépliables */

.paper details {
    margin-top: 18px;
    padding: 0;
    color: #cdd5ce;
    font-size: 14px;
}

.paper summary {
    display: list-item;
    margin-left: 18px;
    color: #f0b674;
    cursor: pointer;
    font-weight: 600;
}

.paper details[open] summary {
    margin-bottom: 12px;
}

.paper details + details {
    margin-top: 12px;
}

/* réponses
   on garde le formulaire simple */

.answer-form {
    margin-top: 45px;
    padding-top: 30px;
    border-top: 1px solid var(--edge);
}

.answer-form label,
.field-label {
    display: block;
    margin-bottom: 10px;
    color: #e0e5df;
    font-size: 14px;
    font-weight: 600;
}

.answer-row {
    display: flex;
    align-items: stretch;
    gap: 10px;
}

.answer-row input,
input:not([type=radio]):not([type=checkbox]),
select,
textarea {
    width: 100%;
    min-width: 0;
    padding: 11px 14px;
    background: #151b1a;
    border: 1px solid #68736c;
    border-radius: 4px;
    color: #f0f3ef;
}

input::placeholder,
textarea::placeholder {
    color: #a4ada6;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    outline: 1px solid var(--accent);
}

.error {
    margin: 18px 0;
    padding: 14px 18px;
    background: #39201d;
    border-left: 3px solid #e8917c;
    color: #ffd0c4 !important;
}

.return {
    margin-top: 40px !important;
    font-size: 14px;
}

.return a {
    color: #c4cdc5;
    text-decoration: none;
}

.return a:hover {
    color: var(--accent);
}

/* code Python et autres extraits
   éviter les blocs beaucoup trop gros */

.code-note {
    margin: 26px 0;
    padding: 20px 22px;
    overflow-x: auto;
    background: #101515;
    border: 1px solid #48534c;
    border-radius: 3px;
    color: #e6ede8;
    font: 14px/1.8 Consolas, monospace;
    tab-size: 4;
}

.code-note code {
    color: inherit;
    white-space: pre;
}

/* symboles cliquables */

.sigils {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 25px 0;
}

.sigils button {
    min-height: 90px;
    background: #171e1c;
    border: 1px solid #536058;
    border-radius: 3px;
    color: #e8bb7e;
    font-size: 38px;
    cursor: pointer;
}

.sigils button:hover,
.sigils button.active {
    background: #292921;
    border-color: var(--accent);
}

.sequence {
    text-align: center;
    font-size: 23px;
    letter-spacing: 2px;
    color: #e8bb7e !important;
}

.subtle-button {
    padding: 9px 15px;
    background: #1a211e;
    border: 1px solid #69756c;
    border-radius: 3px;
    color: #e0e6df;
    cursor: pointer;
}

.subtle-button:hover {
    border-color: var(--accent);
}

/* tableau de l'épreuve 07
   ancienne version pas lisible du tout
   là au moins les lignes et colonnes sont bien séparées */

.gridwrap {
    width: 100%;
    margin: 28px 0;
    overflow-x: auto;
}

.cipher-grid {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    background: #141a18;
    color: #f1f1eb;
    text-align: center;
    font-family: Consolas, monospace;
    font-size: 18px;
    font-weight: 600;
}

.cipher-grid caption,
.clues-table caption {
    padding-bottom: 12px;
    color: #bfc8bf;
    text-align: left;
    caption-side: top;
    font: 13px 'DM Sans', sans-serif;
}

.cipher-grid th,
.cipher-grid td {
    height: 58px;
    padding: 12px 8px;
    border: 1px solid #59655c;
    text-align: center;
    vertical-align: middle;
}

.cipher-grid thead th {
    background: #28302b;
    color: #f5c082;
    font-weight: 700;
}

.cipher-grid tbody th {
    background: #222b26;
    color: #f5c082;
}

.cipher-grid td {
    background: #141b18;
}

.cipher-grid tbody tr:nth-child(even) td {
    background: #1b231e;
}

.cipher-grid td:hover {
    background: #344035 !important;
}

.text-center {
    text-align: center;
}

/* autre tableau pour les indices
   à tester si on ajoute davantage de colonnes */

.clues-table {
    width: 100%;
    border-collapse: collapse;
    background: #161d19;
    font-size: 14px;
    line-height: 1.6;
}

.clues-table th,
.clues-table td {
    padding: 13px 15px;
    border: 1px solid #465148;
    text-align: left;
    vertical-align: top;
}

.clues-table thead th {
    background: #28302b;
    color: #f0bb7b;
}

.clues-table tbody tr:nth-child(even) {
    background: #222b25;
}

/* règlement */

.rules p {
    margin: 12px 0;
}

/* images éventuelles */

.gallery {
    display: grid;
    gap: 30px;
    margin: 30px 0;
}

.gallery figure {
    margin: 0;
}

.gallery img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid #536057;
}

.gallery figcaption {
    padding: 10px 0;
    color: #bdc7be;
    font-size: 13px;
}

/* questionnaire de fin
   TODO: vérifier les marges sur téléphone */

.survey {
    margin-top: 45px;
    padding-top: 35px;
    border-top: 1px solid var(--edge);
}

.survey fieldset {
    margin: 25px 0;
    padding: 0;
    border: none;
}

.survey legend {
    margin-bottom: 12px;
    color: #f1f1eb;
    font-weight: 600;
}

.radios {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.radios label {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 12px;
    border: 1px solid #647067;
    border-radius: 3px;
    background: #161d19;
    color: #dce3dc;
    cursor: pointer;
}

.radios label:has(input:checked) {
    border-color: var(--accent);
    background: #2b291f;
}

.radios input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.survey select,
.survey textarea {
    margin-bottom: 20px;
}

.survey .field-label {
    margin-top: 18px;
}

/* mobile
   le tableau doit rester scrollable, sinon c'est illisible */

@media (max-width: 680px) {
    .wrap {
        width: calc(100% - 32px);
    }

    .header {
        padding: 15px 0;
    }

    .content {
        padding: 35px 0 60px;
    }

    .paper h2 {
        font-size: 34px;
    }

    .paper h3 {
        font-size: 22px;
    }

    .paper p {
        font-size: 15px;
    }

    .progress-track {
        margin-bottom: 35px;
    }

    .archive-kicker {
        font-size: 11px;
    }

    .answer-row {
        flex-direction: column;
    }

    .sigils {
        gap: 6px;
    }

    .sigils button {
        min-height: 68px;
        font-size: 30px;
    }

    .cipher-grid {
        min-width: 400px;
        font-size: 16px;
    }

    .cipher-grid th,
    .cipher-grid td {
        height: 48px;
        padding: 10px 6px;
    }

    .home {
        padding: 45px 0;
    }

    .home h1 {
        font-size: 48px;
    }

    .lead {
        font-size: 16px;
    }

    .logo {
        width: 40px;
        height: 40px;
    }

    .note {
        padding: 18px;
    }

    .footer {
        flex-wrap: wrap;
    }
}
