/* =========================================================================
   Base : police, reset, styles de texte, structure de la coquille
   ========================================================================= */

/* Qonto Sans est une police propriétaire : déposer les fichiers dans
   assets/fonts/ (QontoSans-Regular.woff2, -SemiBold, -Bold) et ils sont
   utilisés automatiquement. Sans eux, la police système prend le relais,
   ce qui est le repli prévu par le design system. */
@font-face {
    font-family: "Qonto Sans";
    src: url("../fonts/QontoSans-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Qonto Sans";
    src: url("../fonts/QontoSans-SemiBold.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Qonto Sans";
    src: url("../fonts/QontoSans-Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 100%;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    height: 100%;
}

body {
    margin: 0;
    height: 100%;
    background: var(--elevation-low);
    color: var(--content-primary-a);
    font-family: var(--font-family);
    font-size: var(--body-standard-font-size);
    line-height: var(--body-standard-line-height);
    letter-spacing: 0;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
    overflow: hidden; /* le défilement se fait dans .vue */
}

h1, h2, h3, h4, p, ul, ol, figure {
    margin: 0;
}

ul, ol {
    padding: 0;
    list-style: none;
}

a {
    color: var(--content-accent);
    text-decoration: none;
}

button, input, textarea {
    font: inherit;
    color: inherit;
    letter-spacing: inherit;
}

button {
    border: 0;
    background: none;
    padding: 0;
    cursor: pointer;
    touch-action: manipulation; /* pas de délai de 300 ms ni de zoom au double tap */
}

img, svg {
    display: block;
    max-width: 100%;
}

.sprite {
    display: none;
}

:focus-visible {
    outline: 2px solid var(--border-primary);
    outline-offset: 2px;
    border-radius: var(--radius-small);
}

/* --- Styles de texte du design system ------------------------------------------- */
.display {
    font-size: var(--display-font-size);
    line-height: var(--display-line-height);
    font-weight: 400;
}

.heading-page {
    font-size: var(--heading-page-font-size);
    line-height: var(--heading-page-line-height);
    font-weight: 600;
}

.heading-section {
    font-size: var(--heading-section-font-size);
    line-height: var(--heading-section-line-height);
    font-weight: 600;
}

.heading-subsection {
    font-size: var(--heading-subsection-font-size);
    line-height: var(--heading-subsection-line-height);
    font-weight: 700;
}

.body-prominent {
    font-size: var(--body-prominent-font-size);
    line-height: var(--body-prominent-line-height);
    font-weight: 400;
}

.body-standard {
    font-size: var(--body-standard-font-size);
    line-height: var(--body-standard-line-height);
    font-weight: 400;
}

.caption {
    font-size: var(--caption-font-size);
    line-height: var(--caption-line-height);
    font-weight: 400;
}

.caption-bold {
    font-size: var(--caption-font-size);
    line-height: var(--caption-line-height);
    font-weight: 600;
}

.secondaire {
    color: var(--content-secondary);
}

.tertiaire {
    color: var(--content-tertiary);
}

.tabulaire {
    font-variant-numeric: tabular-nums;
}

/* Texte de lecture (cours) : body-prominent, largeur de ligne bornée. */
.lecture {
    font-size: var(--body-prominent-font-size);
    line-height: var(--body-prominent-line-height);
    max-width: var(--reading-width);
}

.lecture p + p {
    margin-top: var(--spacing-medium-sm);
}

/* --- Coquille : entête / vue / tab bar --------------------------------------------- */
.app {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    max-width: 48rem;
    margin: 0 auto;
}

.entete {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-small);
    min-height: calc(var(--header-height) + var(--sa-top));
    padding: var(--sa-top) calc(var(--spacing-small) + var(--sa-right)) 0 calc(var(--spacing-small) + var(--sa-left));
    background: var(--elevation-low);
}

.entete__titre {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: var(--body-prominent-font-size);
    line-height: var(--body-prominent-line-height);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.entete__cote {
    flex: 0 0 var(--touch-target);
    display: flex;
    justify-content: center;
}

.vue {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    padding: 0 calc(var(--page-margin) + var(--sa-right)) var(--spacing-xxxlarge) calc(var(--page-margin) + var(--sa-left));
}

.vue:focus {
    outline: none;
}

.vue > .ecran {
    animation: ecran-entree var(--transition-duration-short) var(--motion-ease-out) both;
}

@keyframes ecran-entree {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Tab bar iOS : élévation high, ombre low, entrées de 56 px + home indicator,
   icône 20 px + libellé 12 px. */
.onglets {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding: 0 var(--sa-right) var(--sa-bottom) var(--sa-left);
    background: var(--elevation-high);
    box-shadow: 0 -3px 6px rgb(5 5 5 / 6%);
}

.onglet {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xsmall);
    height: var(--tabbar-height);
    padding: var(--spacing-small) 0;
    color: var(--content-tertiary);
    font-size: var(--caption-font-size);
    line-height: var(--caption-line-height);
    font-weight: 400;
    transition: color var(--transition-duration-short) var(--motion-ease-in-out);
}

.onglet:active {
    color: var(--content-primary-a);
}

.onglet__icone {
    width: 20px;
    height: 20px;
}

.onglet--actif {
    color: var(--content-primary-a);
}

.onglet--actif .onglet__libelle {
    font-weight: 600;
}

/* --- Pages hors coquille (connexion, création, hors connexion) -------------------- */
.page-auth {
    overflow: auto;
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    padding: calc(var(--spacing-xlarge) + var(--sa-top)) var(--page-margin) calc(var(--spacing-xlarge) + var(--sa-bottom));
    background: var(--elevation-low);
}

.auth {
    width: 100%;
    max-width: 26rem;
    margin: auto;
}

.auth__marque {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-small);
    margin-bottom: var(--spacing-xlarge);
    padding: var(--spacing-xsmall) var(--spacing-small);
    border-radius: var(--radius-xsmall);
    background: var(--background-primary);
    color: var(--content-primary-b);
    font-size: var(--caption-font-size);
    line-height: var(--caption-line-height);
    font-weight: 600;
}

.auth__titre {
    font-size: var(--heading-page-font-size);
    line-height: var(--heading-page-line-height);
    font-weight: 600;
}

.auth__sous-titre {
    margin-top: var(--spacing-small);
    margin-bottom: var(--spacing-large);
    font-size: var(--body-prominent-font-size);
    line-height: var(--body-prominent-line-height);
    color: var(--content-secondary);
}

/* --- Utilitaires -------------------------------------------------------------------- */
.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.lien-evitement {
    position: absolute;
    top: -100px;
    left: var(--spacing-medium);
    z-index: 100;
    padding: var(--spacing-small) var(--spacing-medium);
    background: var(--elevation-high);
    border-radius: var(--radius-small);
    box-shadow: var(--shadow-low);
}

.lien-evitement:focus {
    top: calc(var(--spacing-small) + var(--sa-top));
}
