:root {
    color-scheme: dark;

    --bg: #0f0f0f;
    --surface: #171717;
    --surface-raised: #1d1d1d;
    --line: #2a2a2a;
    --line-strong: #3d3d3d;
    --text: #f2f2f2;
    --text-muted: #9a9a9a;
    --accent: #7cc4ff;
    --ok: #6ddba0;
    --ko: #ff8a7a;

    font-family:
            Inter,
            system-ui,
            -apple-system,
            BlinkMacSystemFont,
            "Segoe UI",
            sans-serif;

    background: var(--bg);
    color: var(--text);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}


/* ── En-tête ───────────────────────────────── */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;

    padding: 32px 48px;

    border-bottom: 1px solid var(--line);
}

.header h1 {
    margin: 0 0 8px;
    font-size: 22px;
    letter-spacing: -0.01em;
}

.header p {
    margin: 0;
    color: var(--text-muted);
}


/* ── Contenu ───────────────────────────────── */

main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 48px;
}

main h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.section-note {
    max-width: 62ch;
    margin: 12px 0 0;
    color: var(--text-muted);
    line-height: 1.6;
}

.empty {
    color: var(--text-muted);
}


/* ── Cartes ────────────────────────────────── */

.api-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 28px;
    align-items: stretch;
}

.api-card {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;

    height: 100%;

    width: 100%;

    padding: 24px;
    text-align: left;

    font: inherit;
    color: inherit;

    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;

    cursor: pointer;

    transition:
            border-color 120ms ease,
            transform 120ms ease;
}

.api-card:hover {
    border-color: var(--line-strong);
    transform: translateY(-2px);
}

.api-card h3 {
    margin: 0 0 8px;
    font-size: 17px;
}

.api-card-description {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.55;
}

.requirements {
    display: flex;
    gap: 8px;
    align-items: baseline;

    margin: 16px 0 0;

    font-size: 13px;
        margin-bottom: 24px;
    
}

.requirements dt {
    color: var(--text-muted);
}

.requirements dd {
    margin: 0;
    font-variant-numeric: tabular-nums;
}

.open {
    display: inline-block;
    margin-top: 16px;
    font-weight: 600;
    color: var(--accent);
}


/* ── Modale ────────────────────────────────── */

.dialog {
    width: min(480px, calc(100vw - 32px));
    padding: 0;

    color: var(--text);
    background: var(--surface-raised);

    border: 1px solid var(--line-strong);
    border-radius: 12px;
}

.dialog::backdrop {
    background: rgb(0 0 0 / 0.6);
}

.dialog-form {
    display: flex;
    flex-direction: column;
    gap: 24px;

    padding: 28px;
}

.dialog-header h3 {
    margin: 6px 0 8px;
    font-size: 20px;
    letter-spacing: -0.01em;
}

.eyebrow {
    margin: 0;
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.dialog-subtitle {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.55;
}

.dialog-body {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.dialog-error {
    margin: 0;
    padding: 12px 14px;

    color: var(--ko);
    line-height: 1.5;

    background: rgb(255 138 122 / 0.08);
    border: 1px solid rgb(255 138 122 / 0.3);
    border-radius: 8px;
}


/* ── Champs ────────────────────────────────── */

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field > label,
.field-label {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.token-section {
    padding-top: 24px;
    border-top: 1px solid var(--line);
}

.optional {
    margin-left: 8px;
    font-weight: 400;
    font-size: 12px;
    color: var(--text-muted);
}

/* Champs imbriqués dans la section token : rythme plus serré. */
.token-section .field {
    gap: 6px;
    margin-top: 16px;
}

.input-row {
    display: flex;
    gap: 8px;
}

.input-row input {
    flex: 1;
    min-width: 0;
}

.grid-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

input,
textarea {
    width: 100%;
    padding: 10px 12px;

    font: inherit;
    color: var(--text);

    background: #121212;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
}

textarea {
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px;
}

input::placeholder,
textarea::placeholder {
    color: #6b6b6b;
}

.hint {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-muted);
}

.token-status {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-muted);
}

.token-status.ok {
    color: var(--ok);
}

.token-status.ko {
    color: var(--ko);
}

.manual-token summary {
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
}

.manual-token[open] summary {
    margin-bottom: 8px;
}


/* ── Boutons ───────────────────────────────── */

.button {
    align-self: flex-start;

    padding: 10px 16px;

    font: inherit;
    font-weight: 500;
    color: var(--text);

    background: #262626;
    border: 1px solid var(--line-strong);
    border-radius: 8px;

    cursor: pointer;

    transition:
            background-color 120ms ease,
            border-color 120ms ease;
}

.button:hover:not(:disabled) {
    border-color: #555;
    background: #2f2f2f;
}

.button:disabled {
    opacity: 0.55;
    cursor: default;
}

.button.primary {
    color: #0f0f0f;
    background: var(--accent);
    border-color: var(--accent);
    font-weight: 600;
}

.button.primary:hover:not(:disabled) {
    background: #9ad2ff;
    border-color: #9ad2ff;
}

.button.ghost {
    background: transparent;
}

.button.small {
    padding: 10px 12px;
    font-size: 13px;
}

.mode-switch {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: #121212;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
}

.mode-option {
    padding: 6px 12px;
    font: inherit;
    font-size: 13px;
    color: var(--text-muted);
    background: transparent;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
}

.mode-option.is-active {
    color: var(--text);
    background: #2a2a2a;
}

/* Respiration entre le switch, les champs et l'action. */
.token-section [data-role="mode-request"][hidden],
.token-section [data-role="mode-paste"][hidden] {
    display: none;
}
.token-section [data-role="mode-request"],
.token-section [data-role="mode-paste"] {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
}

.token-section [data-action="request-token"] {
    margin-top: 4px;
}

.token-section .token-status {
    margin-top: 12px;
}
/* ── Pied de page ──────────────────────────── */

.footer {
    padding: 0 48px 48px;
    margin-top: 64px;
}

/*
   La ligne est composée de deux pseudo-éléments qui
   s'étirent de part et d'autre du texte : elle reste
   centrée quelle que soit la longueur du libellé.
*/
.footer-mark {
    display: flex;
    align-items: center;
    gap: 10px;

    max-width: 1400px;
    margin: 0 auto;

    font-size: 13px;
    color: var(--text-muted);
}

.footer-mark::before,
.footer-mark::after {
    content: "";
    flex: 1;
    height: 1px;

    background: linear-gradient(
            to right,
            transparent,
            var(--line) 40%,
            var(--line));
}

.footer-mark::after {
    background: linear-gradient(
            to left,
            transparent,
            var(--line) 40%,
            var(--line));
}

.footer-mark strong {
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.01em;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 12px;

    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}
.card-footer .open {
    display: inline-flex;
    align-items: center;
    margin-top: 0;
}

/*
   Le changelog n'est pas encore actionnable : la puce le
   signale par son relief plutôt que par un simple gris, qui
   se lisait comme un défaut d'affichage.
*/
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;

    padding: 5px 10px;

    font-size: 12px;
    color: #6e6e6e;

    background: #1c1c1c;
    border: 1px solid #2e2e2e;
    border-radius: 999px;

    cursor: not-allowed;
    user-select: none;
    white-space: nowrap;
}

.chip svg {
    width: 13px;
    height: 13px;

    fill: none;
    stroke: currentColor;
    stroke-width: 1.4;
    stroke-linecap: round;
}
.footer-year {
    padding-left: 10px;
    border-left: 1px solid var(--line-strong);
    font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
    .footer {
        padding: 0 24px 32px;
        margin-top: 40px;
    }
}
/* ── Petits écrans ─────────────────────────── */

@media (max-width: 640px) {
    .header,
    main {
        padding: 24px;
    }

    .grid-two {
        grid-template-columns: 1fr;
    }
}


@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}
