/* ==========================================================================
   app.css — Global styles for Clair-obscur Builds
   Extracted from base.html inline <style> block.
   ========================================================================== */

/* DEBUG: Sticky footer sans affecter la mise en page */
html, body { height: 100%; }
body { display: flex; flex-direction: column; }
body > nav, body > div, body > main, body > footer { flex-shrink: 0; width: 100%; }
body > main { flex-grow: 1; }

/* DEBUG: Mobile lock removed — site is now fully responsive. */

/* DEBUG: Prevent horizontal scroll on all pages */
html, body { overflow-x: hidden; }

/* DEBUG: Mobile hamburger bars → X animation */
.mobile-hamburger-bar {
    display: block;
    position: absolute;
    width: 20px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.mobile-hamburger-bar--1 { transform: translateY(-6px); }
.mobile-hamburger-bar--2 { transform: translateY(0); }
.mobile-hamburger-bar--3 { transform: translateY(6px); }

/* DEBUG: Open state — bars morph into X */
.mobile-nav-open .mobile-hamburger-bar--1 { transform: rotate(45deg); }
.mobile-nav-open .mobile-hamburger-bar--2 { opacity: 0; }
.mobile-nav-open .mobile-hamburger-bar--3 { transform: rotate(-45deg); }

/* DEBUG: Global custom select to avoid inconsistent native mobile dropdown rendering. */
.app-custom-select {
    position: relative;
    width: 100%;
}
.app-custom-select__native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    opacity: 0;
    pointer-events: none;
}
.app-custom-select__button {
    width: 100%;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    border: 1px solid rgb(209 213 219);
    border-radius: 0.75rem;
    background: rgb(255 255 255);
    color: rgb(31 41 55);
    padding: 0.625rem 0.875rem;
    text-align: left;
    font-size: 0.95rem;
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}
.app-custom-select__button:hover {
    background: rgb(249 250 251);
    border-color: rgb(156 163 175);
}
.app-custom-select__button:focus {
    outline: 2px solid rgb(59 130 246);
    outline-offset: 2px;
}
.app-custom-select__button[aria-expanded="true"] {
    border-color: rgb(59 130 246);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.app-custom-select__button[disabled] {
    background: rgb(243 244 246);
    color: rgb(107 114 128);
    cursor: not-allowed;
}
.app-custom-select__label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app-custom-select__chevron {
    flex: 0 0 auto;
    width: 1rem;
    height: 1rem;
    color: rgb(107 114 128);
    transition: transform 150ms ease;
}
.app-custom-select.is-open .app-custom-select__chevron {
    transform: rotate(180deg);
}
.app-custom-select__menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 0.375rem);
    z-index: 80;
    background: rgb(255 255 255);
    border: 1px solid rgb(229 231 235);
    border-radius: 0.9rem;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.16);
    padding: 0.35rem;
    max-height: min(18rem, 50vh);
    overflow-y: auto;
}
.app-custom-select__menu[hidden] {
    display: none;
}
.app-custom-select__option {
    width: 100%;
    border: 0;
    background: transparent;
    border-radius: 0.7rem;
    padding: 0.75rem 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    color: rgb(31 41 55);
    text-align: left;
    font-size: 0.95rem;
    line-height: 1.45;
    cursor: pointer;
}
.app-custom-select__option:hover,
.app-custom-select__option:focus-visible {
    background: rgb(239 246 255);
    outline: none;
}
.app-custom-select__option.is-selected {
    background: rgb(219 234 254);
    color: rgb(30 64 175);
    font-weight: 700;
}
.app-custom-select__option.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.app-custom-select__check {
    flex: 0 0 auto;
    color: currentColor;
    opacity: 0;
}
.app-custom-select__option.is-selected .app-custom-select__check {
    opacity: 1;
}

/* DEBUG: Bigger dropdown/select on mobile for easier touch interaction.
   All properties use !important to override Tailwind utility classes (py-2, px-3, etc.)
   which have higher specificity than bare element selectors. */
@media (max-width: 767px) {
    select,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="search"],
    input[type="url"],
    textarea {
        font-size: 16px !important;
        min-height: 48px !important;
        padding: 0.625rem 0.75rem !important;
        line-height: 1.5 !important;
    }

    .app-custom-select__button {
        min-height: 48px;
        font-size: 1rem;
        padding: 0.75rem 0.9rem;
    }

    .app-custom-select__menu {
        max-height: min(20rem, 55vh);
    }

    .app-custom-select__option {
        min-height: 48px;
        font-size: 1rem;
        padding: 0.85rem 0.9rem;
    }
}

/* DEBUG: Style unique pour les liens "← Retour ..." en haut de page (bouton de navigation). */
.app-back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: rgb(30 64 175);
    background: rgb(239 246 255);
    border: 1px solid rgb(191 219 254);
    border-radius: 0.75rem;
    padding: 0.4rem 0.75rem;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
    text-decoration: none;
}
.app-back-button:hover {
    background: rgb(219 234 254);
    border-color: rgb(147 197 253);
    color: rgb(30 58 138);
}
.app-back-button:focus {
    outline: 2px solid rgb(59 130 246);
    outline-offset: 2px;
}

.app-like-button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: rgb(30 64 175);
    background: rgb(239 246 255);
    border: 1px solid rgb(191 219 254);
    border-radius: 0.75rem;
    padding: 0.45rem 0.75rem;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
    text-decoration: none;
    user-select: none;
}
.app-like-button:hover {
    background: rgb(219 234 254);
    border-color: rgb(147 197 253);
    color: rgb(30 58 138);
}
.app-like-button:active {
    transform: scale(0.98);
}
.app-like-button:focus {
    outline: 2px solid rgb(59 130 246);
    outline-offset: 2px;
}
.app-like-button[disabled] {
    opacity: 0.7;
    cursor: not-allowed;
}

.app-like-button--active {
    background: rgb(254 242 242);
    border-color: rgb(254 202 202);
    color: rgb(153 27 27);
}
.app-like-button--active:hover {
    background: rgb(254 226 226);
    border-color: rgb(252 165 165);
    color: rgb(127 29 29);
}

.app-like-button--on-dark {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.35);
    color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(6px);
}
.app-like-button--on-dark:hover {
    background: rgba(255, 255, 255, 0.26);
    border-color: rgba(255, 255, 255, 0.45);
    color: rgba(255, 255, 255, 1);
}
.app-like-button--on-dark.app-like-button--active {
    background: rgba(239, 68, 68, 0.22);
    border-color: rgba(239, 68, 68, 0.45);
    color: rgba(255, 255, 255, 0.98);
}

.app-like-button--secondary {
    color: rgba(255, 255, 255, 0.92);
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.28);
    backdrop-filter: blur(6px);
}
.app-like-button--secondary:hover {
    color: rgba(255, 255, 255, 0.98);
    background: rgba(255, 255, 255, 0.20);
    border-color: rgba(255, 255, 255, 0.36);
}

.app-like-button--sm {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
    border-radius: 0.65rem;
    font-weight: 700;
}

.app-like-button--selected {
    background: rgb(191 219 254);
    border-color: rgb(96 165 250);
    color: rgb(30 64 175);
}
.app-like-button--selected:hover {
    background: rgb(147 197 253);
    border-color: rgb(59 130 246);
    color: rgb(30 58 138);
}

/* DEBUG: Reusable spoiler gate for anonymous public build / expedition pages. */
.app-spoiler-gate {
    position: relative;
}
.app-spoiler-gate__content {
    transition: filter 180ms ease, opacity 180ms ease;
}
.app-spoiler-gate:not(.app-spoiler-gate--accepted) .app-spoiler-gate__content {
    filter: blur(14px);
    opacity: 0.72;
    pointer-events: none;
    user-select: none;
}
.app-spoiler-gate__overlay {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(8px);
}
/* DEBUG: Le display:flex ci-dessus écrase l'attribut HTML hidden. On force display:none. */
.app-spoiler-gate__overlay[hidden] {
    display: none;
}
.app-spoiler-gate__modal {
    width: min(100%, 32rem);
    background: rgba(255, 255, 255, 0.98);
    color: rgb(17 24 39);
    border: 1px solid rgba(191, 219, 254, 0.9);
    border-radius: 1rem;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
    padding: 1.25rem;
}
.app-spoiler-gate__badge {
    display: inline-flex;
    align-items: center;
    margin-bottom: 0.85rem;
    padding: 0.3rem 0.65rem;
    border-radius: 9999px;
    background: rgb(219 234 254);
    color: rgb(30 64 175);
    font-size: 0.78rem;
    font-weight: 700;
}
.app-spoiler-gate__title {
    margin: 0 0 0.55rem;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.4;
}
.app-spoiler-gate__text {
    margin: 0;
    color: rgb(75 85 99);
    line-height: 1.6;
}
.app-spoiler-gate__button {
    margin-top: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0.8rem;
    background: rgb(37 99 235);
    color: white;
    font-weight: 700;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 150ms ease, transform 150ms ease;
}
.app-spoiler-gate__button:hover {
    background: rgb(29 78 216);
}
.app-spoiler-gate__button:active {
    transform: scale(0.99);
}
.app-spoiler-gate__button:focus {
    outline: 2px solid rgb(96 165 250);
    outline-offset: 2px;
}
.app-spoiler-gate.app-spoiler-gate--accepted .app-spoiler-gate__content {
    filter: none;
    opacity: 1;
    pointer-events: auto;
    user-select: auto;
}

@media (max-width: 767px) {
    .app-spoiler-gate__overlay {
        padding: 1rem;
        align-items: flex-end;
    }
    .app-spoiler-gate__modal {
        width: 100%;
        padding: 1rem;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }
    .app-spoiler-gate__button {
        width: 100%;
    }
}
