/* =============================================
   demo.css — Search UI responsive
   ============================================= */

/* ── Reset ── */
*,
*::after,
*::before {
    box-sizing: border-box;
}

/* ── Base ── */
body {
    margin: 0;
    font-family: 'Inconsolata', monospace;
}

.hidden {
    position: absolute;
    overflow: hidden;
    width: 0;
    height: 0;
    pointer-events: none;
}

kbd {
    display: inline-block;
    padding: 1px 6px;
    border: 1px solid currentColor;
    border-radius: 3px;
    font-family: inherit;
    font-size: 0.85em;
    opacity: 0.7;
}

/* ============================================
   BOUTONS
   ============================================ */
.btn {
    margin: 0;
    padding: 0;
    cursor: pointer;
    border: none;
    background: none;
    text-decoration: none;
    color: #E95895;
    outline: none;
}

.btn:focus-visible {
    outline: 2px solid #E95895;
    outline-offset: 3px;
    border-radius: 4px;
}

.btn--search {
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.btn--search:hover {
    transform: scale(1.1);
    opacity: 0.8;
}

.btn--hidden {
    pointer-events: none;
    opacity: 0;
}

/* ── Bouton fermer — cercle avec croix parfaitement centrée ── */
.btn--search-close {
    position: absolute !important;
    top: clamp(12px, 3vw, 20px) !important;
    right: clamp(12px, 3vw, 20px) !important;
    z-index: 10;
    width: 48px !important;
    height: 48px !important;
    border-radius: 50%;
    background: #E95895;
    color: #fff;
    font-size: 0 !important;   /* neutralise le font-size:2em de style1.css */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0;
    line-height: 1;
    transition: background 0.2s ease, transform 0.25s ease;
    box-shadow: 0 2px 12px rgba(233, 88, 149, 0.45);
}

.btn--search-close:hover {
    background: #d4407a;
    transform: rotate(90deg) !important;
}

/* ============================================
   ICÔNES
   ============================================ */
.icon {
    display: block;
    width: clamp(40px, 5vw, 64px);
    height: clamp(40px, 5vw, 64px);
    fill: currentColor;
    flex-shrink: 0;
}

/* L'icône dans le bouton fermer garde sa taille fixe indépendamment */
.btn--search-close .icon {
    width: 22px !important;
    height: 22px !important;
    fill: #fff !important;
    display: block !important;
    margin: 0 !important;
    flex-shrink: 0;
}

/* ============================================
   WRAPPER BOUTON OUVERTURE
   ============================================ */
.btn-search-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
}

/* ============================================
   PANNEAU RECHERCHE — plein écran sans bande
   ============================================ */
.search {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;

    background: #ffffff;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* État ouvert */
.search--open {
    opacity: 1;
    pointer-events: auto;
}

/* ── Contenu centré verticalement ── */
.search__inner {
    width: 100%;
    max-width: 860px;
    padding: clamp(32px, 5vw, 72px) clamp(24px, 5vw, 60px);
    color: #222;
    text-align: center;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ── Animation formulaire — translateY plus propre que le scale3d de style1.css ── */
.js .search__form {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.js .search--open .search__form {
    opacity: 1;
    transform: translateY(0);
}

/* ── Titre ── */
.search__title {
    font-size: clamp(16px, 2.5vw, 26px);
    font-weight: 400;
    letter-spacing: 0.04em;
    margin: 0 0 clamp(20px, 4vw, 36px);
    opacity: 0.9;
    line-height: 1.4;
    width: 100%;
}

/* ============================================
   FORMULAIRE
   ============================================ */
.search__form {
    position: relative;
    width: 100%;
}

.search__input {
    width: 100%;
    border: 0;
    border-bottom: 2px solid rgba(0, 0, 0, 0.15);
    background: transparent;
    border-radius: 0;
    -webkit-appearance: none;
    appearance: none;

    font-family: 'Inconsolata', monospace;
    font-size: clamp(26px, 5vw, 52px);
    font-weight: 400;
    color: #222;
    padding: 14px 4px;
    text-align: center;

    transition: border-color 0.25s ease;
    -webkit-search-cancel-button: none;
    -webkit-search-decoration: none;
}

.search__input::placeholder {
    color: rgba(0, 0, 0, 0.3);
}

.search__input:focus {
    outline: none;
    border-bottom-color: #E95895;
}

/* ── Message d'aide ── */
.search__info {
    display: block;
    margin-top: clamp(8px, 1.5vw, 14px);
    font-size: clamp(9px, 1.1vw, 11px);
    color: rgba(0, 0, 0, 0.35);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    width: 100%;
}

/* ============================================
   SUGGESTIONS — 3 colonnes responsive
   Hors de .search__inner → pleine largeur du panneau,
   non contraint par le max-width: 860px du formulaire.
   ============================================ */
.search__related {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    width: 100%;
    /* Espacement latéral propre, aligné sur celui de search__inner */
    padding: 0 clamp(16px, 4vw, 48px);
    margin-top: clamp(24px, 3vw, 40px);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
    /* Neutralise pointer-events:none de style1.css */
    pointer-events: auto;
}

/* ── Colonne ── */
.search__suggestion {
    padding: clamp(20px, 3vw, 36px) clamp(16px, 2.5vw, 32px);
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    /* ✅ Écrase width:33.33% de style1.css qui bridait le contenu */
    width: 100% !important;
    box-sizing: border-box;
}

.search__suggestion:last-child {
    border-right: none;
}

/* ── En-tête colonne ── */
.search__suggestion h3 {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #E95895;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Numéro de colonne */
.search__suggestion h3::before {
    content: attr(data-index);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #E95895;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    flex-shrink: 0;
}

/* ── Zone de tags — display:block + inline-block sur les tags
   plus fiable que flex-wrap dans un contexte grid/flex imbriqué ── */
.search__suggestion .tags {
    display: block;
    line-height: 2;
}

/* ── Tag individuel ── */
.search__tag {
    display: inline-block;
    padding: 4px 10px;
    margin: 2px 3px 2px 0;
    border: 1px solid rgba(233, 88, 149, 0.25);
    border-radius: 20px;
    font-family: 'Inconsolata', monospace;
    font-size: clamp(10px, 1.2vw, 12px);
    color: rgba(0, 0, 0, 0.45);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
    cursor: pointer;
}

.search__tag:hover {
    background: #E95895;
    color: #fff;
    border-color: #E95895;
}

/* ============================================
   TABLETTE  (≤ 768px)
   ============================================ */
@media screen and (max-width: 768px) {
    .search__related {
        grid-template-columns: repeat(2, 1fr);
    }

    /* La 3e colonne passe en pleine largeur */
    .search__suggestion:nth-child(3) {
        grid-column: 1 / -1;
        border-right: none;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
    }

    .search__suggestion:nth-child(2) {
        border-right: none;
    }

    .search__input {
        text-align: left;
    }

    .btn-search-wrapper .icon {
        width: 52px;
        height: 52px;
    }
}

/* ============================================
   MOBILE  (≤ 480px) — plein écran strict
   ============================================ */
@media screen and (max-width: 480px) {

    .search {
        justify-content: center;
        overflow-y: auto;
    }

    .search__inner {
        padding: 60px 16px 32px;
        justify-content: flex-start;
        min-height: 100vh;
    }

    .search__related {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .search__suggestion {
        border-right: none;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
    }

    .search__suggestion:nth-child(3) {
        grid-column: auto;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
    }

    .search__suggestion:nth-child(2) {
        border-right: none;
    }

    .search__input {
        font-size: 22px;
        text-align: left;
    }

    .search__info {
        font-size: 11px;
    }

    .btn-search-wrapper .icon {
        width: 48px;
        height: 48px;
    }
}

/* ============================================
   PAYSAGE MOBILE  (hauteur réduite)
   ============================================ */
@media screen and (max-height: 480px) and (orientation: landscape) {

    .search {
        overflow-y: auto;
        justify-content: flex-start;
    }

    .search__inner {
        padding: 40px 20px 20px;
        justify-content: flex-start;
    }

    .search__title {
        margin-bottom: 14px;
        font-size: 14px;
    }

    .search__input {
        font-size: 18px;
        padding: 6px 4px;
    }

    .search__related {
        margin-top: 20px;
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
}

/* ============================================
   NEUTRALISER LES BORDURES NOIRES DE style1.css
   (::before et ::after avec border: 2.5em solid #000)
   ============================================ */
.search::before,
.search::after {
    display: none;
}