/* ==========================================================================
   Variables et configuration
   ========================================================================== */
:root {
    --color-cream: #f5f1e8;
    --color-ink: #1c1c1c;
    --color-red: #b22222;
    --color-red-dark: #9c1c1c;
    --color-gray: #8b8680;
    --color-white: #ffffff;
    --color-paper: #F8F5E9;

    --font-handwritten: 'Permanent Marker', cursive;
    --font-typewriter: 'Special Elite', monospace;

    --space-sm: 1rem;
    --space-md: 2rem;
    --space-lg: 4rem;
    --space-xl: 6rem;

    --shadow-solid: 6px 6px 0 var(--color-ink);
    --shadow-solid-light: 4px 4px 0 var(--color-gray);

    --header-height: clamp(90px, 13vh, 120px);
    --tear-height: 50px;
}

/* ==========================================================================
   Reset et base
   ========================================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--header-height);
}

body {
    background-color: var(--color-cream);
    color: var(--color-ink);
    font-family: var(--font-typewriter);
    font-size: 1.1rem;
    line-height: 1.6;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
}

/* Texte destiné aux lecteurs d'écran uniquement */
.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;
}

/* ==========================================================================
   Typographie
   ========================================================================== */
h1, h2, h3, .logo {
    font-family: var(--font-handwritten);
    line-height: 1.2;
    font-weight: normal;
}

.ink-title {
    text-transform: uppercase;
    letter-spacing: 2px;
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: var(--space-lg);
    display: inline-block;
    position: relative;
}

.center-text { text-align: center; }

.large-text {
    font-size: 1.3rem;
    margin-bottom: var(--space-md);
}

.text-light { color: var(--color-cream); }

a {
    color: var(--color-ink);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover,
a:focus {
    color: var(--color-red);
}

:focus-visible {
    outline: 3px dashed var(--color-red);
    outline-offset: 4px;
}

/* ==========================================================================
   Mise en page
   ========================================================================== */
.container {
    width: 90%;
    max-width: 1100px;
    margin: 0 auto;
}

.section-spacing {
    padding: var(--space-xl) 0;
}

.bg-dark {
    background-color: var(--color-ink);
    color: var(--color-cream);
}

.bg-red {
    background-color: var(--color-red);
    color: var(--color-cream);
}

.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
}

@media (min-width: 768px) {
    .grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

/* ==========================================================================
   Navigation
   ========================================================================== */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;

    background: url('images/fond_nav.webp') center top / 100% 100% no-repeat;

    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: clamp(0.6rem, 1.5vh, 1rem) max(5%, calc((100vw - 1100px) / 2)) clamp(1.8rem, 4vh, 3rem);
    min-height: var(--header-height);
}

.logo {
    display: inline-block;
    transition: transform 0.2s ease-in-out;
}

.logo img {
    height: clamp(42px, 6vh, 60px);
    width: auto;
    display: block;
}

.logo:hover,
.logo:focus {
    transform: scale(1.05) rotate(-2deg);
}

/* Bouton hamburger */
.menu-toggle {
    display: block;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

.hamburger,
.hamburger::before,
.hamburger::after {
    display: block;
    width: 30px;
    height: 3px;
    background: var(--color-cream);
    transition: transform 0.3s, top 0.3s, background-color 0.3s;
}

.hamburger {
    position: relative;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    left: 0;
}

.hamburger::before { top: -8px; }
.hamburger::after  { top: 8px; }

.menu-toggle[aria-expanded="true"] .hamburger {
    background: transparent;
}

.menu-toggle[aria-expanded="true"] .hamburger::before {
    transform: rotate(45deg);
    top: 0;
}

.menu-toggle[aria-expanded="true"] .hamburger::after {
    transform: rotate(-45deg);
    top: 0;
}

/* Menu mobile : plein écran, masqué par translation */
.main-nav {
    position: fixed;
    inset: 0;
    height: 100vh;
    height: 100dvh;
    z-index: 999;

    background: var(--color-ink) url('images/fond_nav_mobile.jpg') center / cover no-repeat;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;

    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.3s ease-in-out, visibility 0s linear 0.3s;
}

.main-nav.open {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.3s ease-in-out, visibility 0s;
}

.main-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
    padding: 0;
    margin: 0;
}

.main-nav a {
    color: var(--color-cream);
    font-family: var(--font-typewriter);
    font-size: 1.3rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.main-nav a:hover,
.main-nav a:focus {
    color: var(--color-cream);
    text-decoration: underline;
    text-decoration-color: var(--color-red);
    text-decoration-thickness: 3px;
    text-underline-offset: 6px;
}

/* Desktop */
@media (min-width: 768px) {
    .menu-toggle {
        display: none;
    }

    .main-nav {
        position: static;
        inset: auto;
        height: auto;
        width: auto;
        background: transparent;
        padding: 0;
        transform: none;
        visibility: visible;
        transition: none;
    }

    .main-nav ul {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: flex-end;
        gap: 1.5rem;
    }

    .main-nav a {
        font-size: 1.1rem;
        white-space: nowrap;
        /* À trancher selon fond_nav.webp : var(--color-cream) ou var(--color-ink) */
        color: var(--color-cream);
    }

    .main-nav a:hover,
    .main-nav a:focus {
        color: var(--color-red);
        text-decoration: none;
    }
}

/* ==========================================================================
   Effets visuels « collage »
   ========================================================================== */
.tape-effect-red {
    position: relative;
}

.tape-effect-red::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    transform: rotate(-10deg);
    width: 50px;
    height: 20px;
    background-color: var(--color-red);
    opacity: 0.9;
}

.torn-edge-dark {
    background-color: var(--color-ink);
    padding: 0.5rem 1rem;
    border-radius: 2px 255px 3px 25px / 255px 5px 225px 3px;
}

/* Déchirures en image (Parcours) */
.paper-tear {
    position: absolute;
    left: 0;
    width: 100%;
    height: var(--tear-height);
    object-fit: fill;
    z-index: 15;
    display: block;
    pointer-events: none;
}

.tear-haut { top: -48px; }
.tear-bas  { bottom: -48px; }

/* ==========================================================================
   Boutons
   ========================================================================== */
.btn {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    font-family: var(--font-handwritten);
    font-size: 1.4rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn:active {
    transform: translate(3px, 3px);
}

/* Boutons dont le fond est une image SVG */
.btn-svg {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    background-color: transparent;
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    color: var(--color-cream);
    border: none;
    box-shadow: none;
    font-weight: bold;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.btn-svg:hover,
.btn-svg:focus {
    color: var(--color-cream);
    transform: scale(1.05);
}

.btn-projets,
.btn-contact {
    padding: 8px 50px;
}

.btn-projets { background-image: url('images/btn_rouge.svg'); }
.btn-contact { background-image: url('images/btn_noir.svg'); }

.btn-primary {
    background-image: url('images/btn_rouge.svg');
    padding: 15px 35px;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 1.2rem;
}

/* Bouton "Découvrir" des cartes projets */
.project-content .btn-small {
    background-image: url('images/btn_rouge.svg');
    background-color: transparent;
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    color: var(--color-cream);
    border: none;
    box-shadow: none;
    padding: 10px 25px;
    display: inline-block;
    transition: transform 0.2s ease;
}

.project-content .btn-small:hover,
.project-content .btn-small:focus {
    transform: scale(1.05);
    color: var(--color-cream);
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
    background: url('images/fond_header.png') center bottom / cover no-repeat;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;

    min-height: 100vh;
    min-height: 100dvh;
    padding-top: clamp(110px, 16vh, 160px);
    padding-bottom: clamp(120px, 18vh, 220px);

    position: relative;
    z-index: 10;
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 900px;
    margin: 0 auto;
}

.hero-title {
    margin: clamp(10px, 2vh, 25px) auto;
    line-height: 0;
}

.hero-logo {
    display: block;
    width: clamp(220px, min(32vw, 42vh), 400px);
    max-width: 90%;
    height: auto;
}

.subtitle {
    font-size: clamp(0.95rem, min(1.8vw, 2.5vh), 1.4rem);
    background: var(--color-ink);
    color: var(--color-cream);
    display: inline-block;
    padding: 0.3rem 1rem;
    transform: rotate(-2deg);
    margin-bottom: clamp(5px, 1vh, 15px);
}

.intro-text {
    font-size: clamp(1rem, min(1.8vw, 2.6vh), 1.5rem);
    margin-bottom: clamp(15px, 3vh, 35px);
    max-width: 750px;
    line-height: 1.5;
}

.actions {
    display: flex;
    gap: clamp(1rem, 2vw, 1.5rem);
    flex-wrap: wrap;
    justify-content: center;
}

@media (min-width: 850px) {
    .subtitle {
        font-size: 1.3rem;
        padding: 0.4rem 1.3rem;
    }
}

@media (max-width: 767.98px) {
    .hero {
        padding-top: 120px;
        padding-bottom: 70px;
    }

    .intro-text {
        padding: 0 15px;
    }
}

/* ==========================================================================
   À propos
   ========================================================================== */
.about {
    background-image:
        linear-gradient(rgba(28, 28, 28, 0.7), rgba(28, 28, 28, 0.7)),
        url('images/fond_a_propos.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: var(--color-ink);

    position: relative;
    z-index: 1;

    margin-top: -250px;
    padding-top: 300px;
    padding-bottom: 250px;
}

.about-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 3rem;
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 0;
}

/* Polaroid */
.polaroid {
    position: relative;
    flex: 0 0 300px;
    background-color: var(--color-white);
    padding: 15px 15px 60px 15px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
    transform: rotate(-6deg);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.polaroid:hover {
    transform: rotate(0deg) scale(1.05);
    box-shadow: 0 15px 25px rgba(0, 0, 0, 0.6);
}

.polaroid-img {
    width: 100%;
    height: auto;
    display: block;
}

.polaroid-caption {
    position: absolute;
    bottom: 12px;
    left: 0;
    width: 100%;
    text-align: center;

    font-family: var(--font-handwritten);
    font-size: 1.3rem;
    color: #1a1a1a;
    margin: 0;

    transform: rotate(-2deg);
    opacity: 0.9;
}

/* Scotch jaune */
.polaroid::before {
    content: "";
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%) rotate(-4deg);

    width: 120px;
    height: 35px;

    background-color: rgba(223, 255, 0, 0.8);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    z-index: 10;

    clip-path: polygon(2% 0, 98% 4%, 100% 95%, 0 100%);
}

/* Bloc texte (papier) */
.about-text-bg {
    flex: 1;
    max-width: 750px;
    margin: 0;

    background-image: url('images/fond_texte.webp');
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;

    padding: 3rem 2rem 3rem 6rem;
    line-height: 2rem;
    color: var(--color-ink);
}

.about-text-bg p + p {
    margin-top: 1.5rem;
}

/* ==========================================================================
   Projets
   ========================================================================== */
.projects {
    position: relative;
    background-color: var(--color-paper);
}

.projects::before,
.projects::after {
    content: "";
    position: absolute;
    left: 0;
    width: 100%;
    height: var(--tear-height);
    background-size: 100% 100%;
    background-repeat: no-repeat;
    z-index: 15;
}

.projects::before {
    top: -50px;
    background-image: url('images/dech_haut_projets.png');
}

.projects::after {
    bottom: -50px;
    background-image: url('images/dech_bas_projets.png');
}

.project-card {
    background-image: url('images/fond_cartes.webp');
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    color: var(--color-cream);
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

/* Cartes légèrement désordonnées */
.project-card:nth-child(1) { transform: rotate(-3deg) translateY(15px); }
.project-card:nth-child(2) { transform: rotate(2deg) translateY(-10px); }
.project-card:nth-child(3) { transform: rotate(-4deg) translateY(20px); }

.project-content {
    padding: var(--space-md);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    text-align: center;
    justify-content: center;
    align-items: center;
}

.project-content h3 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.project-content p {
    margin-bottom: 1rem;
}

/* Logos projets */
.project-logo {
    display: block;
    margin: 0 auto 15px auto;
}

.project-logo--lg { max-width: 250px; }
.project-logo--sm { max-width: 150px; }

.project-card:nth-child(3) .project-logo {
    margin-top: 30px;
}

.project-card:nth-child(3) .project-content p {
    margin-top: 30px;
    margin-bottom: 30px;
}

/* ==========================================================================
   Compétences
   ========================================================================== */
#competences {
    background-image: url('images/fond_competance.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    padding-top: 150px;
    padding-bottom: 160px;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.skill-group {
    background-image: url('images/cartes_comp.webp');
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    color: var(--color-ink);
    padding: 60px 20px 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.skill-group h3 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    border-bottom: 2px dashed var(--color-ink);
    padding-bottom: 0.5rem;
    text-align: center;
    width: 100%;
}

.skill-group ul {
    list-style-type: none;
    padding-left: 0;
    margin: 0 auto;
    text-align: center;
}

.skill-group li {
    margin-bottom: 0.8rem;
    font-size: 1.2rem;
    line-height: 1.4;
}

/* Rotations désordonnées des cartes de compétences */
.skill-group:nth-child(1) { transform: rotate(-3deg) translateY(10px); }
.skill-group:nth-child(2) { transform: rotate(4deg) translateY(-5px); }
.skill-group:nth-child(3) { transform: rotate(-2deg) translateY(15px); }
.skill-group:nth-child(4) { transform: rotate(3deg) translateY(-10px); }

/* ==========================================================================
   Parcours
   ========================================================================== */
#parcours {
    position: relative;
    z-index: 20;
    padding-top: 100px;
    padding-bottom: 100px;
    background-color: var(--color-cream);
}

/* ==========================================================================
   Contact
   ========================================================================== */
#contact {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.contact-info {
    background-image: url('images/fond_texte.webp');
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    max-width: 600px;
    margin: 20px auto;
    padding: 60px 40px;
    text-align: center;
    color: var(--color-ink);
}

.contact-info p {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
}

.contact-links {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.contact-links li {
    margin-bottom: 0.8rem;
    font-size: 1.2rem;
}

.contact-links a {
    font-weight: bold;
    text-decoration: underline;
    text-decoration-color: var(--color-red);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.main-footer {
    background-image: url('images/fond_footer.webp');
    background-size: 100% 120px;
    background-position: top center;
    background-repeat: no-repeat;
    color: var(--color-gray);
    text-align: center;
    position: relative;
    z-index: 10;
    margin-top: -60px;
    padding-top: 80px;
    padding-bottom: 30px;
    font-size: 0.9rem;
}

/* ==========================================================================
   Accessibilité : mouvement réduit
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==========================================================================
   Responsive : tablettes (≤ 992px)
   ========================================================================== */
@media (max-width: 992px) {
    .about-container {
        flex-direction: column;
        gap: 2rem;
        padding: 1rem;
    }

    .about-text-bg {
        max-width: 90%;
        width: 100%;
        padding: 2.5rem 2rem 2.5rem 4rem;
    }
}

/* ==========================================================================
   Responsive : smartphones (≤ 576px)
   ========================================================================== */
@media (max-width: 576px) {
    .about-text-bg {
        padding: 2rem 1.5rem 2rem 2rem;
        font-size: 0.95rem;
        line-height: 1.6rem;
    }

    .polaroid {
        flex: 0 0 180px;
        padding: 10px 10px 45px 10px;
    }

    .polaroid-caption {
        font-size: 1rem;
        bottom: 8px;
    }

    .polaroid::before {
        width: 90px;
        height: 25px;
        top: -10px;
    }
}