/* ==========================================================================
   avis.css — Page Avis Clients (proposition « Le nuancier »)
   Chaque avis est un ongle laqué dans une teinte différente.
   Le formulaire se lit comme une phrase à compléter.
   ========================================================================== */

/* Base */
:root {
    --bg-main: #FBF7F4;
    --bg-surface: #FFFFFF;
    --bg-card: #FAF6F3;
    --text-primary: #211C19;
    --text-muted: #6B7280;
    --accent-color: #C88B7B;
    --accent-hover: #B57868;
    --accent-deep: #8F4F40;
    --border-color: #EAE3DE;
    --border-light: #F0ECE7;
    --font-family: 'Plus Jakarta Sans', sans-serif;

    --star-on: #B9705D;
    --star-off: #E4D8D1;
    --star-size: 1rem;
    --star-shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z'/%3E%3C/svg%3E");
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-family);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

:focus-visible {
    outline: 2px solid var(--accent-deep);
    outline-offset: 3px;
}

/* Header : voir header.css */

/* Layout principal */
.page-container {
    flex-grow: 1;
    width: 100%;
    max-width: 1152px;
    margin: 0 auto;
    padding: 4rem 1.5rem 6rem;
}

.intro-title {
    font-size: clamp(2.4rem, 6vw, 4.25rem);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.02;
    max-width: 14ch;
}

.intro-summary {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 1.25rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Étoiles d'affichage */
.star-list {
    display: inline-flex;
    gap: 0.125rem;
    vertical-align: middle;
}

.star {
    display: inline-block;
    width: var(--star-size);
    height: var(--star-size);
    background: var(--star-off);
    -webkit-mask: var(--star-shape) center / contain no-repeat;
    mask: var(--star-shape) center / contain no-repeat;
}

.star--full { background: var(--star-on); }
.star--half { background: linear-gradient(90deg, var(--star-on) 50%, var(--star-off) 50%); }

/* Saisie de la note (demi-étoiles) */
.star-rating {
    display: inline-flex;
    gap: 0.25rem;
    padding: 0.25rem;
    border-radius: 0.5rem;
    cursor: pointer;
    --star-size: 1.9rem;
}

.star-pick {
    position: relative;
    width: var(--star-size);
    height: var(--star-size);
}

.star-pick .star {
    position: absolute;
    inset: 0;
}

.star-pick-half {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50%;
    z-index: 1;
}

.star-pick-half--left { left: 0; }
.star-pick-half--right { right: 0; }

/* Formulaire en phrase */
.sentence {
    margin: 3rem 0 4rem;
    padding: 2.25rem 2.5rem;
    background: #F1DDD3;
    border-radius: 2rem;
}

.sentence-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.9rem;
    font-size: clamp(1.15rem, 2.2vw, 1.6rem);
    font-weight: 600;
    line-height: 1.5;
}

.sentence-input {
    width: 11ch;
    min-width: 9rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--accent-deep);
    padding: 0.1rem 0.15rem;
    font: inherit;
    font-weight: 700;
    color: var(--text-primary);
}

.sentence-input::placeholder,
.sentence-area::placeholder {
    color: rgba(33, 28, 25, 0.5);
    font-weight: 500;
}

.sentence-input:focus {
    outline: none;
    border-bottom-color: var(--text-primary);
}

.sentence .star-rating {
    --star-on: #8F4F40;
    --star-off: rgba(143, 79, 64, 0.22);
}

.sentence-area {
    display: block;
    width: 100%;
    margin-top: 1.25rem;
    padding: 1rem 1.15rem;
    background: rgba(255, 255, 255, 0.6);
    border: 1.5px solid transparent;
    border-radius: 1.1rem;
    font: inherit;
    font-size: 1rem;
    line-height: 1.55;
    color: var(--text-primary);
    resize: vertical;
}

.sentence-area:focus {
    outline: none;
    background: #fff;
    border-color: var(--accent-deep);
}

.sentence-foot {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    margin-top: 1.25rem;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--text-primary);
    color: #fff;
    border: none;
    border-radius: 9999px;
    padding: 0.9rem 1.75rem;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-primary:hover { background: var(--accent-deep); }
.btn-primary:disabled { opacity: 0.6; cursor: wait; }

.form-message {
    font-size: 0.9rem;
    font-weight: 600;
    min-height: 1.25rem;
}

.form-message.is-success { color: #2F6B4B; }
.form-message.is-error { color: #B3261E; }

/* Nuancier (Grille responsive) */
.swatches {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
    gap: 1.5rem;
    align-items: start;
}

.swatches-state {
    color: var(--text-muted);
    grid-column: 1 / -1;
}

.nail {
    --shade-bg: #EBD3C6;
    --shade-fg: #211C19;
    --star-on: #8F4F40;
    --star-off: rgba(33, 28, 25, 0.16);

    position: relative;
    padding: 4.25rem 1.6rem 1.5rem;
    overflow: hidden;
    background: var(--shade-bg);
    color: var(--shade-fg);
    border-radius: 50% 50% 1.5rem 1.5rem / 4rem 4rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: auto;
    min-height: fit-content;
}

/* Reflet de vernis */
.nail::before {
    content: '';
    position: absolute;
    top: 0.9rem;
    left: 17%;
    width: 0.9rem;
    height: 2.9rem;
    border-radius: 9999px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0));
    transform: rotate(9deg);
}

.nail--2 { --shade-bg: #E6B4AA; }
.nail--3 { --shade-bg: #C9A3A8; }
.nail--4 { --shade-bg: #A85A4C; --shade-fg: #fff; --star-on: #FFE0D2; --star-off: rgba(255, 255, 255, 0.28); }
.nail--5 { --shade-bg: #6E2F3A; --shade-fg: #fff; --star-on: #F6C9BC; --star-off: rgba(255, 255, 255, 0.25); }
.nail--6 { --shade-bg: #F1E2C8; }

.nail-text {
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.6;
    margin-top: 0.9rem;
}

/* Intégration photo dans la carte avis */
.nail-photo-wrapper {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 0.85rem;
    overflow: hidden;
    width: 100%;
    height: 200px;
    flex-shrink: 0;
}

.nail-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.nail-foot {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-top: 1.4rem;
}

.nail-name {
    font-size: 1rem;
    font-weight: 800;
}

.nail-date {
    font-size: 0.8rem;
    opacity: 0.85;
    white-space: nowrap;
}

/* Mobile */
@media (max-width: 600px) {
    .sentence {
        padding: 1.5rem 1.25rem;
        border-radius: 1.5rem;
    }

    .swatches {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}
