/* ==========================================================================
   ketsu 2026 — refonte statique légère
   ========================================================================== */

:root {
    --coin-size: 400px;            /* même taille que l'ancien site */
    --coin-thickness: 22px;
    --coin-left-x: 26vw;           /* position du centre du cercle quand il est à gauche */
    --ease-smooth: cubic-bezier(0.65, 0, 0.25, 1);
    --t-move: 500ms;               /* recentrage / décalage du cercle */
    --t-flip: 750ms;               /* retournement de la pièce */
    --t-text: 550ms;               /* apparition du texte */
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

/* Desktop : la molette est paginée par JS ; snap léger pour la barre de défilement */
@media (pointer: fine) {
    html { scroll-snap-type: y proximity; }
    .panel { scroll-snap-align: start; }
}
/* Tactile : défilement natif, une section par écran */
@media (pointer: coarse) {
    html { scroll-snap-type: y mandatory; }
    .panel { scroll-snap-align: start; scroll-snap-stop: always; }
}

body {
    margin: 0;
    font-family: 'Varela Round', sans-serif;
    color: #fff;
    -webkit-font-smoothing: antialiased;
}

img { vertical-align: middle; max-width: 100%; }

a { color: inherit; }

.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   Navigation haute
   ========================================================================== */

.topnav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.2rem;
    pointer-events: none;           /* seuls les liens sont cliquables */
}
.topnav a { pointer-events: auto; }

/* Logo ketsu avec son cercle (le cercle fait partie du logo) */
.logo-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #ED228A;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
.logo-circle img { display: block; }
.logo-circle-big { width: 76px; height: 76px; }

/* Le logo en haut à gauche n'apparaît qu'à partir du 2e écran (cliquable vers l'accueil) */
.topnav-logo {
    opacity: 1;
    transition: opacity 400ms ease;
}
body.on-hero .topnav-logo {
    opacity: 0;
    pointer-events: none;
}

.topnav-links {
    display: flex;
    gap: 1.6rem;
    align-items: center;
}
.topnav-links a {
    color: #fff;
    text-decoration: none;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    opacity: 0.92;
    transition: opacity 200ms ease;
    text-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.topnav-links a:hover,
.topnav-links a:focus-visible { opacity: 1; text-decoration: underline; text-underline-offset: 4px; }

.lang-switch {
    border: 1.5px solid rgba(255,255,255,0.85);
    border-radius: 999px;
    padding: 0.15em 0.7em;
    font-size: 0.85rem !important;
}

/* Picto lien externe (SVG, identique desktop et mobile) */
.ext-ico { vertical-align: -2px; margin-left: 0.15em; }

/* ==========================================================================
   Menu burger (mobile)
   ========================================================================== */

.burger {
    display: none;                 /* visible uniquement en mobile */
    pointer-events: auto;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.18);
    cursor: pointer;
    z-index: 300;
}
.burger span {
    display: block;
    height: 2.5px;
    border-radius: 2px;
    background: #fff;
    transition: transform 300ms var(--ease-smooth), opacity 200ms ease;
}
.burger.open span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

.mobile-menu {
    position: fixed;
    inset: 0;
    z-index: 250;
    background: rgba(29, 88, 159, 0.97);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    padding: 4rem 1.5rem 2rem;
    overflow-y: auto;
}
.mobile-menu[hidden] { display: none; }
.mobile-menu a {
    color: #fff;
    text-decoration: none;
    font-size: 1.25rem;
    padding: 0.2em 0.6em;
}
.mobile-menu-sep {
    width: 56px;
    height: 1.5px;
    background: rgba(255,255,255,0.4);
    margin: 0.4rem 0;
}

/* ==========================================================================
   Points de navigation (droite)
   ========================================================================== */

.dots {
    position: fixed;
    right: 1.1rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 190;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.dots button {
    width: 10px;
    height: 10px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.55);
    cursor: pointer;
    transition: transform 250ms var(--ease-smooth), background 250ms ease;
}
.dots button:hover { background: rgba(255,255,255,0.85); }
.dots button.active {
    background: #fff;
    transform: scale(1.5);
}

/* ==========================================================================
   Sections plein écran
   ========================================================================== */

.panel {
    position: relative;
    height: 100svh;
    min-height: 520px;
    background-color: var(--bg);
    overflow: hidden;
}

/* le contenu des sections passe toujours AU-DESSUS du cercle */
.panel > * { position: relative; z-index: 40; }

/* ---------- 1. Hero ---------- */

.hero-title {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    translate: 0 -50%;                 /* texte centré dans la hauteur */
    margin: 0;
    font-weight: 400;
    font-size: 2.5vw;    /* identique à l'ancien site (.bounce-upfirst p) */
    line-height: 1.5;
    opacity: 0;
    transform: translateY(30px);
    animation: hero-text-in 900ms var(--ease-smooth) 1200ms forwards;
}

@keyframes hero-text-in {
    to { opacity: 1; transform: translateY(0); }
}

/* Flèche de scroll (affichée par JS après 5 s d'inactivité) */
.scroll-hint {
    position: absolute;
    left: 50%;
    bottom: clamp(1rem, 4vh, 2.2rem);
    transform: translateX(-50%);
    color: #fff;
    opacity: 0;
    pointer-events: none;
    transition: opacity 600ms ease;
}
.scroll-hint.visible {
    opacity: 0.9;
    pointer-events: auto;
    animation: hint-bounce 1.6s ease-in-out infinite;
}
@keyframes hint-bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50%      { transform: translateX(-50%) translateY(10px); }
}

/* ---------- Sections de contenu ---------- */

.service-text {
    position: absolute;
    top: 50%;
    left: 46vw;                       /* démarre après le cercle décalé : jamais de chevauchement */
    width: min(44vw, 620px);
    transform: translateY(-50%) translateX(50px);
    opacity: 0;
    transition: opacity var(--t-text) var(--ease-smooth), transform var(--t-text) var(--ease-smooth);
}

.panel.is-active .service-text {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
    transition-delay: 220ms;          /* laisse le cercle finir son décalage */
}

.panel.is-leaving .service-text {
    opacity: 0;
    transform: translateY(-50%) translateX(90px);   /* le texte disparaît sur la droite */
    transition: opacity 400ms ease-in, transform 400ms ease-in;
    transition-delay: 0ms;
}

.service-text p {
    margin: 0 0 1.1rem;
    font-size: clamp(1rem, 1.3vw, 1.25rem);
    line-height: 1.75;
}
.service-text p:last-child { margin-bottom: 0; }

/* Lien vers les projets */
.projects-link {
    display: inline-block;
    margin-top: 0.4rem;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    text-decoration: none;
    border: 1.5px solid currentColor;
    border-radius: 999px;
    padding: 0.45em 1.1em;
    transition: background 250ms ease, color 250ms ease;
}
.panel:not(.panel-light) .projects-link:hover { background: #fff; color: var(--bg); }

/* Bloc Gensai dans "Qui sommes-nous" : liseret blanc autour du logo rond */
.gensai-inline {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}
.gensai-inline > a {
    flex: 0 0 auto;         /* c'est le lien qui est l'élément flex : il ne doit jamais être comprimé */
    display: block;
    width: 44px;
    height: 44px;
}
.gensai-inline img {
    display: block;
    width: 44px;
    height: 44px;
    max-width: none;        /* neutralise le max-width global qui écrasait le logo */
    object-fit: contain;
    border-radius: 50%;
    border: 2px solid #fff;
    background: transparent;
    padding: 0;
    box-sizing: border-box;
}

/* Section claire : texte foncé pour la lisibilité */
.panel-light { color: #0B2249; }
.panel-light .projects-link:hover { background: #0B2249; color: #BBD2E1; }

/* ---------- Écran final ---------- */

/* Gensai : texte à gauche, logo rond (liseret blanc) à droite du texte */
.final-gensai {
    position: absolute;
    right: 1.4rem;
    bottom: 6.5rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.9rem;
    text-align: right;
}
.final-gensai > a {
    flex: 0 0 auto;         /* le lien ne doit jamais être comprimé par le flex */
    display: block;
    width: 56px;
    height: 56px;
}
.final-gensai img {
    display: block;
    width: 56px;
    height: 56px;
    max-width: none;        /* neutralise le max-width global qui écrasait le logo */
    object-fit: contain;
    border-radius: 50%;
    border: 2px solid #fff;
    background: transparent;
    padding: 0;
    box-sizing: border-box;
    transition: transform 250ms var(--ease-smooth);
}
.final-gensai a:hover img { transform: scale(1.07); }
.final-gensai p {
    margin: 0;
    font-size: clamp(0.9rem, 1.1vw, 1.05rem);
    line-height: 1.5;
}

/* Lien Références (page dédiée, même onglet) */
.clickref {
    position: absolute;
    left: 1.4rem;
    bottom: 6.5rem;
    z-index: 45;
    display: inline-block;
    padding: 0.45em 1em;
    font-family: inherit;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    color: #fff;
    text-decoration: none;
    background-color: #FD6C9E;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 200ms var(--ease-smooth);
}
.clickref:hover { transform: scale(1.05); }

.final-footer {
    position: absolute;
    left: 0; right: 0;
    bottom: 0.9rem;
    text-align: center;
}
.socialmedia { display: inline; }
.socialmedia a { text-decoration: none; }
.socialmedia a:hover { text-decoration: underline; text-underline-offset: 4px; }
.final-footer .copyright {
    margin: 0.4rem 0 0;
    font-size: 0.8rem;
    opacity: 0.75;
}

/* ==========================================================================
   La pièce (cercle 3D)
   ========================================================================== */

#coin-wrap {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 10;                      /* toujours SOUS le texte des sections */
    width: var(--coin-size);
    height: var(--coin-size);
    margin: calc(var(--coin-size) / -2) 0 0 calc(var(--coin-size) / -2);
    perspective: 1400px;
    transform: translateX(0);
    transition: transform var(--t-move) var(--ease-smooth);
    /* zoom d'arrivée (le cercle vient de loin), puis léger battement continu */
    animation: coin-arrive 1200ms var(--ease-smooth) forwards,
               coin-beat 4.5s ease-in-out 1600ms infinite;
}

@keyframes coin-arrive {
    from { opacity: 0; scale: 0.05; }
    to   { opacity: 1; scale: 1; }
}

@keyframes coin-beat {
    0%, 100% { scale: 1; }
    50%      { scale: 1.035; }
}

#coin-wrap.coin-left {
    transform: translateX(calc(var(--coin-left-x) - 50vw));
}

#coin {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transform: rotateY(0deg);
    transition: transform var(--t-flip) var(--ease-smooth);
}

.coin-face {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--coin-color);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transition: background 600ms ease;
}

.coin-front { transform: translateZ(calc(var(--coin-thickness) / 2)); }
.coin-back  { transform: rotateY(180deg) translateZ(calc(var(--coin-thickness) / 2)); }

/* Épaisseur de la pièce : disques intermédiaires assombris */
.coin-edge {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: color-mix(in srgb, var(--coin-color) 62%, black);
    transition: background 600ms ease;
}
.coin-edge.e1 { transform: translateZ(calc(var(--coin-thickness) * 0.30)); }
.coin-edge.e2 { transform: translateZ(calc(var(--coin-thickness) * 0.15)); }
.coin-edge.e3 { transform: translateZ(0); }
.coin-edge.e4 { transform: translateZ(calc(var(--coin-thickness) * -0.15)); }
.coin-edge.e5 { transform: translateZ(calc(var(--coin-thickness) * -0.30)); }

.coin-face p {
    margin: 0;
    padding: 0 1.2em;
    font-size: 2vw;
    line-height: 1.35;
}
.coin-face a { text-decoration: none; }

.face-logo {
    width: 34.5%;    /* taille naturelle du SVG sur l'ancien site : 137px pour un cercle de 400px */
    height: auto;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media only screen and (max-width: 1024px) {
    :root {
        --coin-size: 280px;
        --coin-left-x: 21vw;
    }
    .service-text {
        left: 42vw;
        width: min(50vw, 520px);
    }
    .coin-face p { font-size: 2.6vw; }
}

@media only screen and (max-width: 767px) {
    :root {
        --coin-size: 190px;
        --coin-thickness: 16px;
    }

    .topnav { padding: 0.7rem 0.9rem; align-items: center; }
    .topnav-links { display: none; }          /* remplacé par le menu burger */
    .burger { display: flex; }
    .logo-circle { width: 42px; height: 42px; }
    .logo-circle img { width: 18px; height: auto; }

    /* la couleur de la rubrique occupe TOUT l'écran (barre d'adresse mobile comprise) */
    .panel { height: 100dvh; min-height: 100svh; }

    /* le logo ketsu reste présent en haut à gauche sur les rubriques */
    body.on-final .topnav-logo { opacity: 1; pointer-events: auto; }

    /* footer simplifié : les liens sont dans le menu burger */
    .final-footer .socialmedia { display: none; }
    .clickref { display: none; }              /* Références accessible via le burger */

    /* le texte s'estompe avant de passer sur le cercle (piloté par --fade en JS) */
    .service-text,
    .hero-title,
    .final-gensai {
        filter: opacity(var(--fade, 1));
    }

    .dots { right: 0.55rem; gap: 0.55rem; }
    .dots button { width: 8px; height: 8px; }

    /* Cercle en haut de l'écran, texte en dessous — jamais de chevauchement */
    #coin-wrap { top: 30%; }
    #coin-wrap.coin-left { transform: translateX(0); }

    .face-logo { width: 50%; }          /* logo 100px pour un cercle de 200px */
    .coin-face p { font-size: 5.6vw; }

    .service-text,
    .panel.is-active .service-text,
    .panel.is-leaving .service-text {
        top: auto;
        left: 50%;
        width: 88vw;
        text-align: center;
    }
    .service-text {
        bottom: 7svh;
        transform: translateX(-50%) translateY(30px);
    }
    .panel.is-active .service-text { transform: translateX(-50%) translateY(0); }
    .panel.is-leaving .service-text { transform: translateX(-20%) translateY(0); }

    .service-text p {
        font-size: 0.92rem;
        line-height: 1.55;
        margin-bottom: 0.7rem;
    }

    .hero-title {
        left: 50%;
        top: 58%;                      /* sous le cercle (cercle en haut sur mobile) */
        translate: none;
        transform: translate(-50%, 30px);
        width: 90vw;
        text-align: center;
        font-size: 6vw;
    }
    @keyframes hero-text-in {
        to { opacity: 1; transform: translate(-50%, 0); }
    }

    .final-gensai {
        left: 50%;
        right: auto;
        bottom: 5.5rem;
        transform: translateX(-50%);
        width: 88vw;
        justify-content: center;
        text-align: center;
    }
    .clickref { top: auto; bottom: 44%; right: auto; left: 50%; transform: translateX(-50%); }
    .clickref:hover { transform: translateX(-50%) scale(1.05); }
    .final-footer .copyright { font-size: 0.7rem; padding: 0 1rem; }
}

/* ==========================================================================
   Accessibilité : mouvement réduit
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    #coin-wrap { animation: none; opacity: 1; scale: 1; transition: none; }
    #coin { transition: none; }
    .hero-title { animation: none; opacity: 1; transform: none; }
    .service-text,
    .panel.is-active .service-text { transition: opacity 300ms ease; transition-delay: 0ms; }
    .scroll-hint.visible { animation: none; }
}
