/* main.css — Design system, reset et layout global */

:root {
    /* === Palette === */
    --color-primary: #0a4d68;       /* Bleu marine profond */
    --color-primary-dark: #053448;
    --color-primary-light: #1f7ea1;
    --color-accent: #f9a825;        /* Jaune signalisation maritime */
    --color-success: #2e7d32;
    --color-danger: #c62828;
    --color-warning: #ef6c00;

    --color-bg: #f4f8fb;
    --color-surface: #ffffff;
    --color-surface-alt: #eaf1f7;

    --color-text: #0f1d2b;
    --color-text-muted: #5a6b7a;
    --color-text-inverse: #ffffff;

    --color-border: #d6dee5;
    --color-focus: #1f7ea1;

    /* === Typographie === */
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                   "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --font-size-base: 16px;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-md: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.375rem;
    --font-size-2xl: 1.75rem;
    --font-size-3xl: 2.25rem;

    --line-height-tight: 1.25;
    --line-height-base: 1.55;

    /* === Espacement (échelle 4px) === */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-8: 3rem;

    /* === Rayons === */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-pill: 999px;

    /* === Ombres === */
    --shadow-sm: 0 1px 2px rgba(15, 29, 43, 0.06);
    --shadow-md: 0 4px 12px rgba(15, 29, 43, 0.10);
    --shadow-lg: 0 12px 32px rgba(15, 29, 43, 0.16);

    /* === Layout === */
    --header-height: 56px;
    --nav-height: 64px;
    --content-max-width: 720px;

    /* === Transitions === */
    --transition-fast: 120ms ease-out;
    --transition-base: 200ms ease-out;

    /* === Z-index === */
    --z-nav: 50;
    --z-header: 60;
    --z-modal: 100;
}

/* === Reset minimal === */
*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 { line-height: var(--line-height-tight); margin: 0 0 var(--space-3); }
h1 { font-size: var(--font-size-2xl); }
h2 { font-size: var(--font-size-xl); }
h3 { font-size: var(--font-size-lg); }
p  { margin: 0 0 var(--space-4); }

a {
    color: var(--color-primary);
    text-decoration: none;
}
a:hover { text-decoration: underline; }

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

button {
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    color: inherit;
}

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

.skip-link {
    position: absolute;
    top: -100px;
    left: var(--space-3);
    background: var(--color-primary);
    color: var(--color-text-inverse);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    z-index: var(--z-modal);
    transition: top var(--transition-base);
}
.skip-link:focus { top: var(--space-3); }

:focus-visible {
    outline: 3px solid var(--color-focus);
    outline-offset: 2px;
}

/* === Layout principal === */
.app-header {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0 var(--space-4);
    background: var(--color-primary);
    color: var(--color-text-inverse);
    box-shadow: var(--shadow-sm);
}
.app-header__menu {
    color: inherit;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
}
.app-header__menu:hover,
.app-header__menu:focus-visible { background: rgba(255, 255, 255, 0.12); }
.app-header__title {
    font-size: var(--font-size-lg);
    margin: 0;
}

.app-main {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: var(--space-5) var(--space-4);
    padding-bottom: calc(var(--nav-height) + var(--space-5));
    min-height: calc(100vh - var(--header-height) - var(--nav-height));
    min-height: calc(100dvh - var(--header-height) - var(--nav-height));
}

.app-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--z-nav);
    height: var(--nav-height);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding-bottom: env(safe-area-inset-bottom);
}
.app-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    color: var(--color-text-muted);
    font-size: var(--font-size-xs);
    text-decoration: none;
    min-height: 44px;
    transition: color var(--transition-fast);
}
.app-nav__item:hover { text-decoration: none; color: var(--color-primary); }
.app-nav__item.is-active {
    color: var(--color-primary);
    font-weight: 600;
}

/* === Loader (état initial) === */
.loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-8) 0;
}
.loader__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-primary-light);
    animation: loader-bounce 1.2s infinite ease-in-out both;
}
.loader__dot:nth-child(2) { animation-delay: 0.15s; }
.loader__dot:nth-child(3) { animation-delay: 0.3s; }

/* === Breakpoints === */
@media (min-width: 768px) {
    :root {
        --font-size-base: 17px;
    }
    .app-main { padding: var(--space-6) var(--space-5); }
}

@media (min-width: 1024px) {
    .app-main { padding: var(--space-8) var(--space-6); }
}

/* === Préférences utilisateur === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
