/* ╔══════════════════════════════════════════════════════════════╗
   ║  Shift Happens — Shared Styles v2                            ║
   ║  Design tokens, typography scale, reset, shared components.  ║
   ╚══════════════════════════════════════════════════════════════╝ */

/* ── Custom Properties ──────────────────────────────────────────────────────── */

:root {
    /* Palette */
    --bg: #0a0a0f;
    --card: #14141f;
    --card-bg: #14141f;   /* alias */
    --border: #2a2a3a;
    --accent: #ff6b35;
    --accent-hover: #ff8c5a;
    --accent-glow: rgba(255, 107, 53, 0.18);
    --accent-soft: rgba(255, 107, 53, 0.08);
    --text: #e8e8ed;
    --text-secondary: #9a9ab2;
    --text-muted: #82829a;        /* AA+ (~5.1:1 sur fond sombre) */
    --success: #3fb950;
    --danger: #f85149;
    --warning: #d2991d;
    --danger-bg: rgba(248, 81, 73, 0.10);

    /* Typography scale — 7 stops, modular */
    --text-xs: 0.72rem;    /* labels, badges, legalese */
    --text-sm: 0.82rem;    /* meta, hints, footer */
    --text-base: 0.95rem;  /* body, buttons, inputs */
    --text-md: 1.1rem;     /* secondary headings */
    --text-lg: 1.35rem;    /* main content — citations */
    --text-xl: 1.7rem;     /* page titles */
    --text-2xl: 2.2rem;    /* hero / site title */

    /* Spacing scale */
    --space-xs: 0.35rem;
    --space-sm: 0.6rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Radii */
    --radius-sm: 8px;
    --radius: 14px;
    --radius-full: 100px;

    /* Shadows */
    --shadow-card: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-glow: 0 4px 24px var(--accent-glow);

    /* Transitions */
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.15s ease;
}

/* ── Light mode ────────────────────────────────────────────────────────────── */

@media (prefers-color-scheme: light) {
    :root {
        --bg: #f5f5f7;
        --card: #ffffff;
        --card-bg: #ffffff;
        --border: #d8d8dc;
        --text: #1a1a2e;
        --text-secondary: #5a5a70;
        --text-muted: #6e6e88;        /* AA+ (~5.2:1 sur fond clair) */
        --accent-glow: rgba(255, 107, 53, 0.12);
        --accent-soft: rgba(255, 107, 53, 0.06);
        --danger-bg: rgba(248, 81, 73, 0.06);
        --shadow-card: 0 1px 4px rgba(0,0,0,0.06);
    }
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */

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

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-weight: 400;
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Focus ──────────────────────────────────────────────────────────────────── */

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ── Reduced motion ─────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    html { scroll-behavior: auto; }
    .logo { animation: none !important; }
}

/* ── Utility ────────────────────────────────────────────────────────────────── */

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ── Typography defaults ────────────────────────────────────────────────────── */

h1 { font-size: var(--text-xl); font-weight: 700; line-height: 1.2; }
h2 { font-size: var(--text-md); font-weight: 600; }
p  { font-size: var(--text-base); }

/* ── Shared Buttons ─────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    min-height: 44px;
    min-width: 44px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}
.btn:hover { border-color: var(--text-muted); color: var(--text); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.97); }
.btn:disabled { opacity: 0.5; pointer-events: none; }

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    font-weight: 600;
    box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); box-shadow: var(--shadow-glow); }

.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--accent-soft); border-color: var(--border); }

.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm { padding: 0.35rem 0.75rem; font-size: var(--text-xs); }
.btn-xs { padding: 0.25rem 0.55rem; font-size: var(--text-xs); }

/* Bouton principal avec pulse */
.btn-cta {
    animation: pulse-glow 3s ease-in-out infinite;
}
.btn-cta:disabled { animation: none; opacity: 0.6; }

/* État liked (cœur) */
.btn-liked {
    color: var(--danger) !important;
    border-color: var(--danger) !important;
    background: var(--danger-bg) !important;
    animation: like-pop 0.5s ease;
}
@keyframes like-pop {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.18); }
    60%  { transform: scale(0.95); }
    100% { transform: scale(1); }
}

/* État copied */
.btn-copied {
    color: var(--success) !important;
    border-color: var(--success) !important;
    background: rgba(63,185,80,0.08) !important;
}

/* ── Toast notifications ────────────────────────────────────────────────────── */

.toast {
    position: fixed;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--accent);
    border-radius: var(--radius-full);
    padding: 0.6rem 1.3rem;
    font-size: var(--text-xs);
    z-index: 999;
    opacity: 0;
    transition: all 0.35s ease;
    pointer-events: none;
    box-shadow: 0 4px 24px var(--accent-glow);
    max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Link button ────────────────────────────────────────────────────────────── */

.link-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: var(--text-base);
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    border-bottom: 1px dashed var(--border);
    padding-bottom: 2px;
    transition: all var(--transition);
    -webkit-tap-highlight-color: transparent;
}
.link-btn:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Badge ──────────────────────────────────────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: var(--text-xs);
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    letter-spacing: 0.02em;
}
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-success { background: rgba(63,185,80,0.12); color: var(--success); }
.badge-warning { background: rgba(210,153,29,0.12); color: var(--warning); }

/* ── Secret footer links ────────────────────────────────────────────────────── */

.secret-links {
    text-align: center;
    margin-top: 0.3rem;
    font-size: var(--text-xs);
    opacity: 0.35;
    transition: opacity 0.3s;
}
.secret-links:hover { opacity: 0.8; }
.secret-links a { color: var(--text-muted); text-decoration: none; margin: 0 0.5rem; transition: color 0.2s; }
.secret-links a:hover { color: var(--accent); }

/* ── Animations partagées ───────────────────────────────────────────────────── */

@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 2px 12px var(--accent-glow); }
    50%      { box-shadow: 0 4px 28px var(--accent-glow); }
}

@keyframes springboard-pop {
    0%   { opacity: 1; transform: translate(-50%,-50%) scale(0); }
    50%  { opacity: 1; transform: translate(-50%,-50%) scale(2.5); }
    100% { opacity: 0; transform: translate(-50%,-50%) scale(4); }
}
