/* ===== VARIABLES ===== */
:root {
    /* Couleurs */
    --primary-color: #B3C7D6;
    --secondary-color: #E6D8D8;
    --accent-color: #D1D6B3;
    --text-color: #555555;
    --background-color: #F9F5F0;
    --card-background: #FFFFFF;
    --shadow-color: rgba(147, 147, 147, 0.1);

    /* Couleurs spécifiques Guestbook */
    --input-bg: #FFFFFF;
    --input-border: #E0E0E0;

    /* Contrast fix variable */
    --on-primary-color: #4A4A4A;

    /* Dark Theme Colors */
    --dark-primary: #7A8F9E;
    --dark-secondary: #B29494;
    --dark-accent: #8A927F;
    --dark-text: #E0E0E0;
    --dark-background: #2B2B2B;
    --dark-card-background: #3A3A3A;

    /* Espacements responsives */
    --space-xs: clamp(0.5rem, 1.5vw, 0.75rem);
    --space-sm: clamp(1rem, 2vw, 1.5rem);
    --space-md: clamp(1.5rem, 3vw, 2rem);
    --space-lg: clamp(2rem, 4vw, 3rem);

    /* Typographie */
    --text-sm: clamp(0.875rem, 1.5vw, 1rem);
    --text-base: clamp(1rem, 2vw, 1.25rem);
    --text-lg: clamp(1.25rem, 3vw, 1.5rem);
    --text-xl: clamp(1.5rem, 4vw, 2.25rem);
    --text-2xl: clamp(2rem, 5vw, 3rem);

    /* Rayons */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Ombres */
    --shadow-sm: 0 2px 8px var(--shadow-color);
}

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

/* ===== BASE STYLES ===== */
body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    padding: var(--space-sm);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* ===== ACCESSIBILITÉ ===== */
.skip-link {
    position: absolute;
    top: -100px;
    left: var(--space-sm);
    background: var(--primary-color);
    color: var(--on-primary-color) !important;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-sm);
    transition: top 0.3s ease;
    z-index: 10000;
    text-decoration: none;
}

.skip-link:focus {
    top: var(--space-sm);
    left: var(--space-sm);
}

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

/* ===== HEADER ===== */
header {
    background: linear-gradient(135deg,
            rgba(179, 199, 214, 0.9) 0%,
            rgba(240, 201, 201, 0.7) 50%,
            rgba(209, 214, 179, 0.9) 100%);
    color: var(--text-color);
    padding: var(--space-md) var(--space-sm);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-sm);
    text-align: center;
    position: relative;
}

header h1 {
    font-size: var(--text-2xl);
    line-height: 1.2;
}

/* ===== NAVIGATION ===== */
nav {
    margin: var(--space-md) 0;
    position: sticky;
    top: 0;
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 1000;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-hidden {
    transform: translateY(-150%);
}

nav ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-xs);
    list-style: none;
}

nav ul li {
    flex: 1 1 auto;
    min-width: 150px;
    text-align: center;
}

nav ul li a {
    padding: var(--space-xs) var(--space-sm);
    color: var(--text-color);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    min-height: 44px;
}

/* ===== MAIN & SECTIONS ===== */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-md);
    flex-grow: 1;
    width: 100%;
}

.section {
    background: var(--card-background);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    animation: fadeIn 0.6s ease-out;
}

.section h2 {
    color: var(--primary-color);
    margin-bottom: var(--space-sm);
    font-size: var(--text-xl);
    position: relative;
    padding-bottom: var(--space-xs);
}

.section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background: var(--accent-color);
}

/* ===== GUESTBOOK (Livre d'Or) STYLES ===== */
.guestbook-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
}

@media (min-width: 768px) {
    .guestbook-container {
        grid-template-columns: 1fr 1.5fr;
        /* Formulaire à gauche, Messages à droite */
    }
}

/* Formulaire */
.guestbook-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-color);
}

.guestbook-input,
.guestbook-textarea {
    padding: 0.8rem;
    border-radius: var(--radius-sm);
    border: 2px solid var(--input-border);
    background-color: var(--input-bg);
    color: var(--text-color);
    font-family: inherit;
    transition: border-color 0.3s ease;
    width: 100%;
}

.guestbook-textarea {
    min-height: 100px;
    resize: vertical;
}

.guestbook-input:focus,
.guestbook-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-submit {
    padding: 0.8rem 1.5rem;
    background-color: var(--primary-color);
    color: var(--on-primary-color);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s;
    align-self: flex-start;
}

.btn-submit:hover {
    background-color: var(--accent-color);
    transform: translateY(-2px);
}

.btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Liste des messages */
.messages-wrapper {
    max-height: 500px;
    overflow-y: auto;
    padding-right: 10px;
    /* Scrollbar personnalisée */
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
}

.message-card {
    background-color: rgba(0, 0, 0, 0.02);
    /* Très léger fond */
    border-left: 4px solid var(--primary-color);
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    animation: slideIn 0.4s ease-out;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    opacity: 0.8;
}

.message-author {
    font-weight: bold;
    color: var(--primary-color);
}

.message-date {
    font-style: italic;
    font-size: 0.75rem;
}

.message-content {
    white-space: pre-wrap;
    /* Conserve les retours à la ligne */
    word-break: break-word;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ===== BOUTONS & TOGGLE ===== */
.toggle-button {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: var(--text-base);
    margin-top: var(--space-sm);
    transition: var(--transition);
}

.toggle-content {
    display: none;
    margin-top: var(--space-sm);
    text-align: justify;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.toggle-content.visible {
    display: block;
    opacity: 1;
}

/* ===== COMPÉTENCES ===== */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
    gap: var(--space-md);
}

.skill-card {
    padding: var(--space-md);
    background: linear-gradient(135deg,
            rgba(179, 199, 214, 0.4) 0%,
            rgba(230, 216, 216, 0.4) 50%,
            rgba(209, 214, 179, 0.4) 100%);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    text-align: center;
}

.skill-card p {
    margin-top: var(--space-xs);
    text-align: justify;
}

/* ===== CONTACT ===== */
.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    justify-content: center;
    margin-top: var(--space-md);
}

.contact-link {
    padding: var(--space-sm);
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--text-color);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
}

/* ===== THEME TOGGLE ===== */
.theme-toggle {
    position: fixed;
    bottom: var(--space-md);
    right: var(--space-md);
    z-index: 1000;
}

.theme-toggle button {
    padding: var(--space-sm);
    border: none;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    min-width: 44px;
    min-height: 44px;
}

/* ===== DARK THEME ===== */
[data-theme="dark"] {
    --primary-color: var(--dark-primary);
    --secondary-color: var(--dark-secondary);
    --accent-color: var(--dark-accent);
    --text-color: var(--dark-text);
    --background-color: var(--dark-background);
    --card-background: var(--dark-card-background);
    --shadow-color: rgba(255, 255, 255, 0.05);
    --input-bg: #4A4A4A;
    --input-border: #5A5A5A;
    --on-primary-color: #000000;
}

[data-theme="dark"] nav {
    background-color: rgba(58, 58, 58, 0.8);
}

[data-theme="dark"] .message-card {
    background-color: rgba(255, 255, 255, 0.05);
}

/* ===== SCROLLBAR STYLES ===== */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--background-color);
    border-radius: var(--radius-md);
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: var(--radius-md);
    border: 3px solid var(--background-color);
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--background-color);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== MEDIA QUERIES ===== */
@media (hover: hover) {
    nav ul li a:hover {
        background-color: var(--primary-color);
        transform: translateY(-2px);
    }

    .skill-card:hover {
        background: linear-gradient(135deg,
                rgba(179, 199, 214, 0.6) 0%,
                rgba(230, 216, 216, 0.6) 50%,
                rgba(209, 214, 179, 0.6) 100%);
        transform: scale(1.02);
    }

    .contact-link:hover {
        background: var(--accent-color);
        transform: rotate(15deg) scale(1.1);
    }

    .theme-toggle button:hover {
        transform: rotate(180deg) scale(1.1);
    }

    .section:hover {
        transform: translateY(-5px);
    }
}

@media (max-width: 768px) {
    .section {
        padding: var(--space-sm);
    }

    .contact-link i {
        font-size: var(--text-lg);
    }

    nav ul {
        flex-direction: column;
        display: flex;
        gap: var(--space-xs);
    }

    nav ul li {
        width: auto;
        min-width: unset;
    }

    nav ul li a {
        padding: 0.5rem;
        font-size: 0.9rem;
    }

    header h1 {
        font-size: var(--text-xl);
    }
}

@media (max-width: 480px) {
    :root {
        --space-md: 1rem;
    }

    .contact-link i {
        font-size: 1.5rem;
    }
}

.back-to-top {
    position: fixed;
    bottom: 20px;
    left: 20px;
    padding: 0.75rem 1rem;
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    color: var(--on-primary-color);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
}

.back-to-top:hover {
    background: var(--accent-color);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.logo-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

/* Lite Mode Overrides */
.lite-mode * {
    box-shadow: none !important;
}

.lite-mode .background-image,
.lite-mode .parallax,
.lite-mode .banner-img,
.lite-mode video,
.lite-mode iframe {
    display: none !important;
}

.lite-mode img {
    filter: grayscale(50%) !important;
}

.lite-mode .animate,
.lite-mode [class*="anim-"],
.lite-mode a,
.lite-mode button {
    transition: none !important;
    animation: none !important;
}

.lite-mode button {
    color: #333 !important;
    border: 1px solid #ccc !important;
}

.lite-mode button:hover {
    color: #007BFF !important;
}

.lite-mode nav ul li a:hover,
.lite-mode .contact-link:hover,
.lite-mode .theme-toggle button:hover {
    transform: none !important;
    color: inherit !important;
    border-color: inherit !important;
    background-color: inherit !important;
}

.lite-mode .skill-card:hover {
    background-color: inherit !important;
}

.lite-mode .section {
    background: var(--card-background) !important;
    transition: none !important;
    animation: none !important;
}

.lite-mode .section:hover {
    background: var(--card-background) !important;
    transform: none !important;
}

/* === Footer === */
.footer-container {
    background: linear-gradient(135deg, var(--accent-color), var(--primary-color));
    border-radius: var(--radius-md);
    margin-top: auto;
}

footer {
    text-align: center;
    padding: var(--space-md);
    position: relative;
}

footer p {
    display: inline-block;
    margin: 0 auto;
    padding-right: min(200px, 20vw);
    position: relative;
    transition: padding 0.3s ease;
}

#lite-mode-toggle {
    position: absolute;
    right: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    padding: 0.5em 1.25em;
    min-width: 12ch;
    max-width: 150px;
    white-space: nowrap;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: inherit;
    font-size: 0.9em;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    backdrop-filter: blur(2px);
    transition: all 0.3s ease;
}

@media (max-width: 768px) {
    footer p {
        padding-right: 0 !important;
        text-align: center;
    }

    #lite-mode-toggle {
        position: static;
        display: block;
        margin: var(--space-xs) auto 0;
        transform: none;
        min-width: auto;
        width: max-content;
    }
}

@media (max-width: 480px) {
    #lite-mode-toggle {
        font-size: 0.8em;
        padding: 0.4em 1em;
    }
}

/* ===== GUESTBOOK PRIVATE MODE ===== */
.mode-toggle {
    display: inline-flex;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
    gap: 0.25rem;
}

.toggle-btn {
    border: none;
    background: transparent;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--text-color);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toggle-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.toggle-btn.active {
    background-color: var(--primary-color);
    color: var(--on-primary-color);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.private-content {
    animation: fadeIn 0.4s ease-out;
}

.explanation-card {
    background-color: var(--card-background);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    padding: var(--space-md);
    text-align: left;
}

.explanation-card h3 {
    color: var(--primary-color);
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.explanation-card ul {
    margin-left: 1.5rem;
    margin-top: 1rem;
    list-style-type: disc;
}

.checkbox-label {
    user-select: none;
    font-size: var(--text-sm);
    color: var(--text-color);
}

input[type="checkbox"] {
    accent-color: var(--primary-color);
    width: 1.25em;
    height: 1.25em;
}.guestbook-write-column { display: flex; flex-direction: column; gap: var(--space-md); }
