/* Moto Aventure — thème moderne, SEO + IA */
:root {
    --bg: #0c0f14;
    --bg-card: #141922;
    --text: #e8eaef;
    --text-muted: #8b92a0;
    --accent: #f59e0b;
    --accent-hover: #fbbf24;
    --border: #2a3142;
    --font: 'Outfit', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --radius: 12px;
    --radius-lg: 20px;
    --container: min(1200px, 100% - 2rem);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    background: var(--bg);
}

body {
    margin: 0;
    font-family: var(--font);
    background: transparent;
    color: var(--text);
    line-height: 1.6;
    font-size: 1rem;
    position: relative;
}

/* Fond vectoriel — lignes de niveau topographiques (courbes fermées) */
.bg-contours {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.bg-contours .contour-svg {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120vw;
    height: 120vh;
    min-width: 1600px;
    min-height: 1200px;
    transform: translate(-50%, -50%);
}
/* Animations subtiles par groupe de sommets */
.bg-contours .contour-group {
    transform-origin: center center;
    animation: topo-drift-1 40s ease-in-out infinite;
}
.bg-contours .contour-group-1 { animation-delay: 0s; }
.bg-contours .contour-group-2 { animation-name: topo-drift-2; animation-delay: -14s; }
.bg-contours .contour-group-3 { animation-name: topo-drift-3; animation-delay: -28s; }
@keyframes topo-drift-1 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(6px, -4px); }
}
@keyframes topo-drift-2 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-5px, 5px); }
}
@keyframes topo-drift-3 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(4px, 3px); }
}

.container {
    width: var(--container);
    margin-inline: auto;
    padding-inline: 1rem;
}

.main-content {
    position: relative;
    z-index: 1;
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(12, 15, 20, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-block: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

.logo-img {
    height: 36px;
    width: auto;
    display: block;
    transition: opacity 0.2s;
}

.logo:hover .logo-img {
    opacity: 0.85;
}

@media (min-width: 769px) {
    .logo-img {
        height: 42px;
    }
}

.nav-main {
    display: flex;
    align-items: center;
    gap: 1.75rem;
}

.nav-main a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

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

.lang-switch {
    font-size: 0.9rem;
    opacity: 0.85;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    padding: 0.5rem;
    cursor: pointer;
    font-size: 1.25rem;
}

@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }
    .nav-main {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        padding: 1rem;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border);
    }
    .nav-main.is-open {
        display: flex;
    }
}

/* Hero */
.hero {
    padding: 4rem 0 5rem;
    text-align: center;
    background: transparent;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    margin: 0 0 0.75rem;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.hero p {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 560px;
    margin: 0 auto 2rem;
}

.cta {
    display: inline-block;
    padding: 0.85rem 1.75rem;
    background: var(--accent);
    color: var(--bg);
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius);
    transition: background 0.2s, transform 0.15s;
}

.cta:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

/* Sections */
.section {
    padding: 4rem 0;
}

.section h2 {
    font-size: 1.75rem;
    margin: 0 0 1.5rem;
    letter-spacing: -0.02em;
}

.section p {
    color: var(--text-muted);
    max-width: 65ch;
}

.section-mission ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.section-mission li {
    padding: 0.5rem 0 0.5rem 1.5rem;
    position: relative;
    color: var(--text-muted);
}

.section-mission li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 1rem;
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
}

/* Cards (services) */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.card {
    background: rgba(20, 25, 34, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
    border-color: var(--accent);
    box-shadow: 0 8px 32px rgba(245, 158, 11, 0.08);
}

.card h3 {
    margin: 0 0 0.5rem;
    font-size: 1.15rem;
}

.card p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* Footer */
.site-footer {
    position: relative;
    z-index: 1;
    padding: 3rem 0 2rem;
    border-top: 1px solid var(--border);
    margin-top: 4rem;
}

.footer-contact h2 {
    font-size: 1rem;
    margin: 0 0 0.5rem;
    color: var(--text-muted);
}

.footer-contact p {
    margin: 0 0 0.5rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.footer-contact a {
    color: var(--accent);
    text-decoration: none;
}

.footer-nav {
    margin-top: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
}

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

.footer-copy {
    margin-top: 2rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Page content */
.page-header {
    padding: 3rem 0 2rem;
    text-align: center;
}

.page-header h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    margin: 0 0 0.5rem;
}

.page-header p {
    color: var(--text-muted);
    margin: 0;
}

/* Contact form */
.contact-form {
    max-width: 480px;
    margin: 0 auto 4rem;
}

.contact-form label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.contact-form textarea {
    min-height: 140px;
    resize: vertical;
}

.form-message {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.form-message.success {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
}

.form-message.error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

/* Blog list */
.blog-list {
    display: grid;
    gap: 1.5rem;
    max-width: 720px;
    margin: 0 auto 4rem;
}

.blog-item {
    display: block;
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s;
}

.blog-item:hover {
    border-color: var(--accent);
}

.blog-item h2 {
    font-size: 1.2rem;
    margin: 0 0 0.35rem;
}

.blog-item .meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Blog post */
.article {
    max-width: 720px;
    margin: 0 auto 4rem;
}

.article h1 {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    margin: 0 0 0.5rem;
}

.article .meta {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.article .body {
    color: var(--text-muted);
}

.article .body h2 { font-size: 1.35rem; margin-top: 2rem; }
.article .body h3 { font-size: 1.1rem; margin-top: 1.5rem; }
.article .body p { margin: 0 0 1rem; }
.article .body ul, .article .body ol { margin: 0 0 1rem; padding-left: 1.5rem; }
.article .body a { color: var(--accent); }

/* Chat widget */
.chat-widget {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 999;
}

.chat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--bg);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}
.chat-toggle .chat-toggle-icon {
    flex-shrink: 0;
}

.chat-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(245, 158, 11, 0.5);
}

.chat-panel {
    display: none;
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 2rem);
    height: 480px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    flex-direction: column;
    overflow: hidden;
}

.chat-panel.is-open {
    display: flex;
}

.chat-panel-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-panel-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-msg {
    max-width: 90%;
    padding: 0.65rem 1rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    line-height: 1.5;
}

.chat-msg.user {
    align-self: flex-end;
    background: var(--accent);
    color: var(--bg);
}

.chat-msg.assistant {
    align-self: flex-start;
    background: var(--border);
    color: var(--text);
}

/* Markdown dans les bulles assistant */
.chat-msg.assistant p {
    margin: 0 0 0.5rem;
}
.chat-msg.assistant p:last-child {
    margin-bottom: 0;
}
.chat-msg.assistant h3,
.chat-msg.assistant h4 {
    margin: 0.65rem 0 0.35rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}
.chat-msg.assistant h3:first-child,
.chat-msg.assistant h4:first-child {
    margin-top: 0;
}
.chat-msg.assistant strong {
    color: var(--text);
    font-weight: 600;
}
.chat-msg.assistant em {
    font-style: italic;
    color: var(--text-muted);
}
.chat-msg.assistant code {
    display: inline;
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: rgba(0,0,0,0.3);
    padding: 0.1em 0.35em;
    border-radius: 4px;
}
.chat-msg.assistant pre.chat-code {
    margin: 0.5rem 0;
    padding: 0.65rem 0.75rem;
    background: rgba(0,0,0,0.35);
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.85rem;
}
.chat-msg.assistant pre.chat-code code {
    display: block;
    background: transparent;
    padding: 0;
    white-space: pre;
    font-family: var(--font-mono);
}
.chat-msg.assistant ul,
.chat-msg.assistant ol {
    margin: 0.35rem 0 0.5rem;
    padding-left: 1.25rem;
}
.chat-msg.assistant li {
    margin-bottom: 0.2rem;
}
.chat-msg.assistant hr {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin: 0.5rem 0;
}
.chat-msg.assistant a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.chat-msg.assistant a:hover {
    color: var(--accent-hover);
}

.chat-msg.typing {
    color: var(--text-muted);
    font-style: italic;
}

.chat-panel-form {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.5rem;
}

.chat-panel-form input {
    flex: 1;
    padding: 0.65rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.95rem;
}

.chat-panel-form input:focus {
    outline: none;
    border-color: var(--accent);
}

.chat-panel-form button {
    padding: 0.65rem 1rem;
    background: var(--accent);
    color: var(--bg);
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
}

.chat-panel-form button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Admin */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 220px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 1.5rem 0;
}

.admin-sidebar a {
    display: block;
    padding: 0.6rem 1.25rem;
    color: var(--text-muted);
    text-decoration: none;
}

.admin-sidebar a:hover,
.admin-sidebar a.active {
    color: var(--accent);
}

.admin-main {
    flex: 1;
    padding: 2rem;
}

.admin-login {
    max-width: 360px;
    margin: 4rem auto;
    padding: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.admin-login h1 {
    margin: 0 0 1.5rem;
    font-size: 1.5rem;
}

.admin-login label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
}

.admin-login input {
    width: 100%;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
}

.admin-login button {
    width: 100%;
    padding: 0.85rem;
    background: var(--accent);
    color: var(--bg);
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
}

.admin-login .error {
    color: #fca5a5;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* Blog editor admin */
.blog-editor textarea {
    width: 100%;
    min-height: 320px;
    padding: 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    resize: vertical;
}

.blog-editor .ai-block {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.blog-editor .ai-block input[type="text"] {
    width: 100%;
    padding: 0.65rem 1rem;
    margin-bottom: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
}

.blog-editor .ai-block button {
    padding: 0.6rem 1rem;
    background: var(--accent);
    color: var(--bg);
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    margin-right: 0.5rem;
}

.blog-editor .ai-response {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    white-space: pre-wrap;
    font-size: 0.9rem;
    max-height: 400px;
    overflow-y: auto;
}

.blog-editor .conversation {
    margin-top: 1rem;
}

.blog-editor .conversation .msg {
    margin-bottom: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.blog-editor .conversation .msg strong {
    color: var(--accent);
}
