/* =========================================================
   COSYSENSE — Design tokens
   Palette : plâtre chaud / encre / argile / sauge
   Typo    : Fraunces (display) + Work Sans (texte)
   Signature : roofline (silhouette de toit du logo) utilisée
               comme séparateur de section + révélations douces
   ========================================================= */

:root {
    --bg: #F7F5F1;
    --paper: #FFFFFF;
    --ink: #211E1B;
    --ink-soft: #55504A;
    --clay: #A9714F;
    --clay-dark: #8C5C3E;
    --sage: #8A9182;
    --line: #DCD6CC;
    --radius: 2px;

    --font-display: "Fraunces", "Georgia", serif;
    --font-body: "Work Sans", "Helvetica Neue", Arial, sans-serif;

    --container: 1180px;
    --space-xs: .5rem;
    --space-sm: 1rem;
    --space-md: 2rem;
    --space-lg: 4rem;
    --space-xl: 7rem;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body { overflow-x: hidden; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 var(--space-md);
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 500;
    line-height: 1.15;
    margin: 0 0 var(--space-sm);
    color: var(--ink);
    letter-spacing: .2px;
}

h1 { font-size: clamp(2.6rem, 6vw, 4.4rem); font-weight: 400; }
h2 { font-size: clamp(1.9rem, 4vw, 2.7rem); }
h3 { font-size: 1.35rem; }

.eyebrow {
    display: inline-block;
    font-family: var(--font-body);
    font-size: .72rem;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--clay);
    margin-bottom: var(--space-sm);
}

p { margin: 0 0 var(--space-sm); color: var(--ink-soft); }
.lede { font-size: 1.15rem; color: var(--ink-soft); }

.btn {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    padding: .95rem 2rem;
    border: 1px solid var(--ink);
    color: var(--ink);
    font-size: .82rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    background: transparent;
    cursor: pointer;
    transition: background .25s ease, color .25s ease, border-color .25s ease;
}
.btn:hover { background: var(--ink); color: var(--bg); }
.btn.btn-light { border-color: rgba(255,255,255,.7); color: #fff; }
.btn.btn-light:hover { background: #fff; color: var(--ink); }
.btn.btn-primary { background: var(--clay); border-color: var(--clay); color: #fff; }
.btn.btn-primary:hover { background: var(--clay-dark); border-color: var(--clay-dark); }

/* -------------------- Roofline signature -------------------- */
img.roofline {
    width: 46px;
    height: auto;
    margin: 0 auto var(--space-md);
    display: block;
    opacity: .9;
}
.section-head { text-align: center; max-width: 640px; margin: 0 auto var(--space-lg); }

/* -------------------- Header / Nav -------------------- */
.site-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    padding: 1.5rem 0;
    transition: background .35s ease, padding .35s ease, box-shadow .35s ease;
}
.site-header.is-scrolled,
.site-header.is-solid {
    background: rgba(33,30,27,.94);
    backdrop-filter: blur(6px);
    padding: 1rem 0;
    box-shadow: 0 2px 24px rgba(0,0,0,.08);
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand img { height: 80px; width: auto; }

.main-nav { display: flex; align-items: center; gap: var(--space-lg); }
.main-nav ul { list-style: none; display: flex; gap: var(--space-md); margin: 0; padding: 0; }
.main-nav a {
    color: #fff;
    font-size: .82rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    position: relative;
    padding-bottom: 4px;
}
.main-nav a::after {
    content: "";
    position: absolute; left: 0; bottom: 0;
    width: 0; height: 1px;
    background: var(--clay);
    transition: width .25s ease;
}
.main-nav a:hover::after,
.main-nav a.is-active::after { width: 100%; }

.lang-switch { display: flex; gap: .4rem; font-size: .75rem; letter-spacing: .05em; }
.lang-switch a { color: rgba(255,255,255,.55); }
.lang-switch a.is-active { color: #fff; text-decoration: underline; text-underline-offset: 3px; }

.nav-icons { display: flex; gap: .5rem; }
.nav-icons a {
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(255,255,255,.1);
    display: flex; align-items: center; justify-content: center;
    transition: background .2s ease;
}
.nav-icons a:hover { background: var(--clay); }
.nav-icons svg { fill: #fff; }

.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 0; }
.nav-toggle span { display: block; width: 24px; height: 1.5px; background: #fff; margin: 5px 0; }

/* -------------------- Hero -------------------- */
.hero {
    position: relative;
    height: 100vh;
    min-height: 560px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #fff;
    overflow: hidden;
}
.hero__bg {
    position: absolute; top: 0; right: 0; bottom: 0; left: 0;
    background-size: cover;
    background-position: center;
    transform: scale(1.05);
}
.hero__bg::after {
    content: "";
    position: absolute; top: 0; right: 0; bottom: 0; left: 0;
    background: linear-gradient(180deg, rgba(20,18,16,.55) 0%, rgba(20,18,16,.4) 40%, rgba(20,18,16,.72) 100%);
}
.hero__content { position: relative; z-index: 2; padding: 0 var(--space-md); }

.hero__logo
 {
    width: 756px;
    margin-top: -50px;
    margin: 125px auto var(--space-sm);
    opacity: .95;
}
.hero__title {
 display: none;
    font-size: clamp(3rem, 9vw, 6rem);
    margin-bottom: .4rem;
    color: #fff;
    text-shadow: 0 2px 28px rgba(0,0,0,.55), 0 1px 4px rgba(0,0,0,.4);
}
.hero__subtitle {
    font-family: var(--font-body);
    font-size: .95rem;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: rgba(255,255,255,.85);
    margin-bottom: var(--space-lg);
}
.hero__scroll {
    position: absolute; bottom: var(--space-md); left: 50%; transform: translateX(-50%);
    z-index: 2; width: 1px; height: 46px; background: rgba(255,255,255,.5);
    overflow: hidden;
}
.hero__scroll::after {
    content: ""; position: absolute; top: -100%; left: 0; width: 100%; height: 100%;
    background: #fff; animation: scrollLine 2.2s ease-in-out infinite;
}
@keyframes scrollLine { 0% { top: -100%; } 60% { top: 100%; } 100% { top: 100%; } }

/* -------------------- Sections -------------------- */
section { padding: var(--space-xl) 0; }
.section-tight { padding: var(--space-lg) 0; }
.section-alt { background: var(--paper); }

.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s ease, transform .8s ease; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* Home intro */
.intro { display: grid; grid-template-columns: 1.1fr .9fr; gap: var(--space-xl); align-items: center; }
.intro img:not(.roofline) { width: 100%; }

/* Services */
.services-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-lg); }
.service-card { text-align: center; padding: 0 var(--space-sm); }
.service-card .roofline { margin-bottom: var(--space-sm); }
.service-card h3 { margin-bottom: .2rem; }
.service-card .service-sub {
    display: block; font-size: .82rem; color: var(--clay);
    font-style: italic; font-family: var(--font-display); margin-bottom: var(--space-sm);
}

/* About */
.about-hero { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-xl); align-items: center; }
.about-hero p:last-child { margin-bottom: 0; }
.founder { display: grid; grid-template-columns: .8fr 1.2fr; gap: var(--space-xl); align-items: center; margin-top: var(--space-xl); }
.founder img:not(.roofline) { width: 100%; }
.founder-role { color: var(--clay); font-style: italic; font-family: var(--font-display); font-size: 1.05rem; margin-bottom: var(--space-sm); }

/* Projects grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}
.projects-grid figure {
    position: relative; margin: 0; aspect-ratio: 1/1; overflow: hidden; background: #ece7df;
}
.projects-grid img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform .5s ease;
}
.projects-grid figure:hover img { transform: scale(1.06); }
.projects-grid figcaption {
    position: absolute; top: 0; right: 0; bottom: 0; left: 0;
    display: flex; align-items: flex-end;
    padding: var(--space-sm);
    background: linear-gradient(180deg, transparent 55%, rgba(20,18,16,.72) 100%);
    color: #fff; font-size: .82rem; letter-spacing: .04em;
    opacity: 0; transition: opacity .3s ease;
}
.projects-grid figure:hover figcaption { opacity: 1; }

.projects-follow { text-align: center; margin-top: var(--space-lg); }
.projects-follow a { border-bottom: 1px solid var(--clay); color: var(--clay); padding-bottom: 2px; }

.projects-grid figure { cursor: pointer; }

/* Fenêtre modale galerie projet */
.project-modal {
    position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 300;
    display: flex; align-items: center; justify-content: center;
    padding: var(--space-md);
    background: rgba(20,18,16,.82);
    opacity: 0; pointer-events: none;
    transition: opacity .3s ease;
}
.project-modal.is-open { opacity: 1; pointer-events: auto; }
.project-modal__box {
    background: var(--paper); width: 100%; max-width: 920px; max-height: 88vh;
    overflow-y: auto; border-radius: 4px; padding: var(--space-lg);
    position: relative;
    transform: translateY(16px); transition: transform .3s ease;
}
.project-modal.is-open .project-modal__box { transform: translateY(0); }
.project-modal__close {
    position: absolute; top: 1.2rem; right: 1.2rem;
    width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line);
    background: #fff; font-size: 1.3rem; line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center; color: var(--ink);
}
.project-modal__close:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.project-modal__title { padding-right: 3rem; }
.project-modal__desc { text-align: justify; color: var(--ink-soft); margin-bottom: var(--space-md); }
.project-modal__gallery {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px;
}
.project-modal__gallery img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 2px; }

@media (max-width: 600px) {
    .project-modal__box { padding: var(--space-md); max-height: 92vh; }
}

/* Contact */
.contact-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: var(--space-xl); }
.field { margin-bottom: var(--space-md); }
.field label {
    display: block; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase;
    color: var(--ink-soft); margin-bottom: .5rem;
}
.field input, .field textarea {
    width: 100%; border: none; border-bottom: 1px solid var(--line);
    background: transparent; padding: .6rem 0; font-family: var(--font-body);
    font-size: 1rem; color: var(--ink); resize: vertical;
}
.field input:focus, .field textarea:focus {
    outline: none; border-bottom-color: var(--clay);
}
.form-msg { padding: .9rem 1rem; margin-bottom: var(--space-md); font-size: .9rem; }
.form-msg.success { background: #EEF1EB; color: #4E5B44; border: 1px solid #C9D3C0; }
.form-msg.error { background: #F6E9E4; color: #8C4A2E; border: 1px solid #E3C2B2; }

.contact-info { border-left: 1px solid var(--line); padding-left: var(--space-lg); }
.contact-person { display: flex; align-items: center; gap: 1.1rem; margin-bottom: var(--space-md); }
.contact-person__photo { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.contact-person__name { font-family: 'Dancing Script', cursive; font-size: 2rem; font-weight: 700; color: var(--ink); margin: 0; line-height: 1.1; }
.contact-person__role { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); font-weight: 600; margin: .25rem 0 0; }
.contact-person__item { display: flex; align-items: center; gap: .8rem; margin-bottom: .8rem; font-size: .98rem; }
.contact-person__item a { color: var(--ink); }
.contact-person__item a:hover { color: var(--clay); }
.icon-badge {
    width: 32px; height: 32px; border-radius: 50%; background: var(--ink);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.icon-badge svg { width: 16px; height: 16px; fill: #fff; }

/* -------------------- Espace client (chat) -------------------- */
.chat-box {
    border: 1px solid var(--line); border-radius: 4px; background: var(--paper);
    display: flex; flex-direction: column; overflow: hidden;
}
.chat-thread {
    max-height: 420px; overflow-y: auto; padding: var(--space-md);
    display: flex; flex-direction: column; gap: .7rem;
}
.chat-msg {
    max-width: 78%; padding: .7rem .9rem; border-radius: 12px; font-size: .92rem;
    position: relative;
}
.chat-msg p { margin: 0 0 .2rem; color: inherit; }
.chat-msg--user { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 3px; }
.chat-msg--admin { align-self: flex-start; background: #EFE9DF; color: var(--ink); border-bottom-left-radius: 3px; }
.chat-msg--admin-self { align-self: flex-end; background: var(--clay); color: #fff; border-bottom-right-radius: 3px; }
.chat-time { display: block; font-size: .68rem; opacity: .65; margin-top: .2rem; }
.chat-file { display: inline-block; font-size: .85rem; text-decoration: underline; color: inherit; }
.chat-form { border-top: 1px solid var(--line); padding: var(--space-sm) var(--space-md); }
.chat-form textarea {
    width: 100%; border: 1px solid var(--line); border-radius: 4px; padding: .6rem .7rem;
    font-family: var(--font-body); font-size: .95rem; resize: vertical; margin-bottom: .6rem;
}
.chat-form__row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.chat-file-btn { position: relative; font-size: .82rem; color: var(--ink-soft); cursor: pointer; }
.chat-file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* -------------------- Footer -------------------- */
.site-footer {
    background: var(--ink); color: rgba(255,255,255,.7);
    padding: var(--space-lg) 0 var(--space-md);
}
.site-footer .container {
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--space-sm);
}
.site-footer .brand img { height: 26px; }
.site-footer .footer-links { display: flex; gap: var(--space-md); list-style: none; padding: 0; margin: 0; flex-wrap: wrap; justify-content: center; }
.site-footer .footer-links a { white-space: nowrap; }
.site-footer a:hover { color: #fff; }
.footer-bottom {
    margin-top: var(--space-md); padding-top: var(--space-md);
    border-top: 1px solid rgba(255,255,255,.12);
    font-size: .78rem; color: rgba(255,255,255,.45);
    text-align: center;
}

/* -------------------- Responsive -------------------- */
@media (max-width: 900px) {
    .intro, .about-hero, .founder, .contact-grid { grid-template-columns: 1fr; }
    .founder img { max-width: 260px; margin: 0 auto; }
    .contact-info { border-left: none; padding-left: 0; border-top: 1px solid var(--line); padding-top: var(--space-lg); }
    .services-grid { grid-template-columns: 1fr; gap: var(--space-lg); }
    .projects-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
    .nav-toggle { display: block; }
    .main-nav {
        position: fixed; top: 0; right: 0; bottom: 0; left: auto;
        height: 100vh; width: 78%; max-width: 340px; z-index: 150;
        background: var(--ink); flex-direction: column; align-items: flex-start;
        padding: 6rem var(--space-md) var(--space-md); gap: var(--space-lg);
        transform: translateX(100%); transition: transform .35s ease;
        overflow-y: auto;
    }
    .main-nav.is-open { transform: translateX(0); }
    .main-nav ul { flex-direction: column; gap: var(--space-md); }
    .site-footer { padding: 2.5rem 0 1.5rem; }
    .site-footer .container { flex-direction: column; text-align: center; gap: 1.4rem; }
    .site-footer .footer-links { flex-direction: column; gap: .8rem; }
    .footer-bottom { margin-top: 1.4rem; padding-top: 1rem; }
}

@media (max-width: 520px) {
    .projects-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .reveal { opacity: 1; transform: none; transition: none; }
    .hero__bg { transform: none; }
}
