/**
 * Seção 9: O Que Entra na Mesa
 *
 * Layout fluido e mobile-first para a exibição de ingredientes recortados,
 * elevação suave e micro-interação de rotação e revelação no hover com 100% de paridade ao Figma.
 *
 * @package GrupoCasaNova
 */

/* --------------------------------------------------------------------------
   Container Principal da Seção
   -------------------------------------------------------------------------- */
.section-mesa {
    position: relative;
    width: 100%;
    background-color: var(--color-neutral-100, #F6F1E8);
    overflow: hidden;
    padding: clamp(64px, 8vw, 96px) clamp(20px, 5vw, 64px);
    box-sizing: border-box;
    isolation: isolate;
}

/* --------------------------------------------------------------------------
   Camadas de Fundo: Marca d'água (opacidade 0.15) e Fade Radial
   -------------------------------------------------------------------------- */
.section-mesa__bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.section-mesa__pattern {
    position: absolute;
    inset: 0;
    background-image: url('../images/pattern-casanova.svg');
    background-repeat: repeat;
    background-size: 400px auto;
    opacity: 0.15;
}

.section-mesa__fade {
    position: absolute;
    inset: 0;
    background: radial-gradient(50% 50% at 50% 50%, rgba(246, 241, 232, 0) 0%, rgba(246, 241, 232, 0.3) 60%, #F6F1E8 100%);
}

/* --------------------------------------------------------------------------
   Estrutura Interna e Alinhamento
   -------------------------------------------------------------------------- */
.section-mesa__container {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(32px, 4vw, 40px);
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   Cabeçalho Editorial (SectionTitle)
   -------------------------------------------------------------------------- */
.section-mesa__header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    width: 100%;
    max-width: 560px;
    text-align: center;
    margin: 0 auto;
}

/* Régua com a cor de acento de cada casa */
.section-mesa__ruler {
    width: 48px;
    height: 3px;
    border-radius: 2px;
    background-color: var(--casa-acento-600, #8A5B3B);
    flex-shrink: 0;
}

/* Cores contextuais estritas por casa */
.section-mesa--casanova .section-mesa__ruler {
    background-color: #8A5B3B;
}

.section-mesa--casanostra .section-mesa__ruler {
    background-color: #3F693B;
}

.section-mesa--pizza-a-pezzi .section-mesa__ruler {
    background-color: #D81814;
}

.section-mesa--grupo .section-mesa__ruler {
    background-color: #880922;
}

/* Bloco de Textos */
.section-mesa__text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
}

/* Sobretítulo (Eyebrow) */
.section-mesa__eyebrow {
    font-family: var(--font-sans, 'Source Sans 3', sans-serif);
    font-style: normal;
    font-weight: 600;
    font-size: 14px;
    line-height: 20px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--color-neutral-600, #6F6A63);
    margin: 0;
}

/* Título: Source Serif Pro / 4 · SemiBold (600) · 44px · line-height 106% · uppercase */
.section-mesa__title {
    font-family: var(--font-serif, 'Source Serif 4', 'Source Serif Pro', serif);
    font-style: normal;
    font-weight: 600;
    font-size: clamp(30px, 3.8vw, 44px);
    line-height: 1.06;
    letter-spacing: -0.015em;
    text-align: center;
    text-transform: uppercase;
    color: var(--color-neutral-900, #111111);
    margin: 0;
}

.section-mesa__title p {
    margin: 0;
    font: inherit;
    color: inherit;
    line-height: inherit;
    display: inline;
}

.section-mesa__title em,
.section-mesa__title i {
    font-style: italic;
    font-family: inherit;
}

.section-mesa__title strong,
.section-mesa__title b {
    font-weight: 700;
}

/* Subtítulo: Source Sans 3 · Regular (400) · 18px · line-height 150% */
.section-mesa__subtitle {
    font-family: var(--font-sans, 'Source Sans 3', sans-serif);
    font-style: normal;
    font-weight: 400;
    font-size: clamp(16px, 1.4vw, 18px);
    line-height: 1.5;
    text-align: center;
    color: var(--color-neutral-800, #3A3733);
    margin: 0;
    max-width: 560px;
}

.section-mesa__subtitle p {
    margin: 0 0 8px 0;
}

.section-mesa__subtitle p:last-child {
    margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Grelha de Ingredientes (Figma: width 1152px / gap 64px / height 300px)
   -------------------------------------------------------------------------- */
.section-mesa__grid {
    position: relative;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    gap: clamp(24px, 4.5vw, 64px);
    width: 100%;
    max-width: 1152px;
    margin: 0 auto;
    box-sizing: border-box;
    flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Item Individual (Figma: width 180px, height 300px, padding 8px 0, gap 16px)
   -------------------------------------------------------------------------- */
.section-mesa__item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
    gap: 16px;
    width: 180px;
    min-height: 280px;
    box-sizing: border-box;
    cursor: pointer;
    user-select: none;
    outline: none;
}

/* Recorte / Frame Flutuante (Elevation/2 do Figma) */
.section-mesa__photo-wrap {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 180px;
    height: 180px;
    position: relative;
    filter: drop-shadow(0px 2px 6px rgba(28, 26, 24, 0.05)) drop-shadow(0px 10px 28px rgba(28, 26, 24, 0.1));
    transition: filter 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Fotografia Recortada */
.section-mesa__photo {
    width: 180px;
    height: 180px;
    object-fit: contain;
    display: block;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}

/* --------------------------------------------------------------------------
   Micro-interação de Rotação Suave no Hover / Foco
   Odd items giram suavemente no sentido anti-horário (-6deg) como no Figma.
   Even items giram no sentido horário (+6deg) para dinamismo orgânico.
   -------------------------------------------------------------------------- */
.section-mesa__item:hover .section-mesa__photo,
.section-mesa__item:focus-visible .section-mesa__photo,
.section-mesa__item.is-active .section-mesa__photo {
    transform: rotate(-6deg);
}

.section-mesa__item:hover .section-mesa__photo-wrap,
.section-mesa__item:focus-visible .section-mesa__photo-wrap,
.section-mesa__item.is-active .section-mesa__photo-wrap {
    filter: drop-shadow(0px 4px 10px rgba(28, 26, 24, 0.08)) drop-shadow(0px 16px 36px rgba(28, 26, 24, 0.16));
}

/* --------------------------------------------------------------------------
   Nome do Ingrediente / Prato
   Figma: Body/Large · Source Sans 3 · 22px · line-height 150% · color #111111
   Oculto por padrão, revelado suavemente com fade-in e slide-up no hover/foco.
   -------------------------------------------------------------------------- */
.section-mesa__name {
    font-family: var(--font-sans, 'Source Sans 3', sans-serif);
    font-style: normal;
    font-weight: 400;
    font-size: clamp(18px, 1.8vw, 22px);
    line-height: 1.35;
    text-align: center;
    color: var(--color-neutral-900, #111111);
    width: 100%;
    max-width: 180px;
    margin: 0;
    word-break: break-word;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

/* Revelação no hover, foco do teclado e toque ativo */
.section-mesa__item:hover .section-mesa__name,
.section-mesa__item:focus-visible .section-mesa__name,
.section-mesa__item.is-active .section-mesa__name {
    opacity: 1;
    pointer-events: auto;
}

/* Foco acessível via teclado */
.section-mesa__item:focus-visible {
    outline: 2px solid var(--casa-acento-600, #8A5B3B);
    outline-offset: 4px;
    border-radius: 8px;
}

/* --------------------------------------------------------------------------
   Dispositivos Móveis e Touchscreens
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
    .section-mesa__grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        justify-items: center;
        gap: 20px 16px;
    }

    .section-mesa__item {
        width: 100%;
        max-width: 160px;
        min-height: 240px;
    }

    .section-mesa__photo-wrap,
    .section-mesa__photo {
        width: 140px;
        height: 140px;
    }
}

/* Dispositivos de toque onde o hover com mouse não existe */
@media (hover: none) {
    .section-mesa__name {
        opacity: 1;
        transform: none;
        pointer-events: auto;
    }
}

/* --------------------------------------------------------------------------
   Acessibilidade: Redução de Movimento
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .section-mesa__photo-wrap,
    .section-mesa__photo,
    .section-mesa__name {
        transition: none !important;
        transform: none !important;
    }

    .section-mesa__name {
        opacity: 1 !important;
        transform: none !important;
    }
}
