/* ============================================================
   COMMEMORAZIONI — Frontend CSS v1.1.0
   Author: mlcom adv
   Compatibile: Enfold / Avia Builder
   ============================================================ */

/* ---- RESET BASE ---- */
.comm-memorial *,
.comm-grid *,
.comm-card *,
.comm-search-wrap * {
    box-sizing: border-box;
}

/* ============================================================
   RICERCA ANIMALE — Scroll + pannello risultati multipli
   ============================================================ */

.comm-search-wrap {
    margin: 0 0 48px;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ---- Barra input ---- */
.comm-search-form {
    display: -webkit-flex;
    display: flex;
    max-width: 560px;
    margin: 0 auto;
    border: 2px solid #e8e2d8;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    -webkit-transition: border-color 0.2s, -webkit-box-shadow 0.2s;
            transition: border-color 0.2s, box-shadow 0.2s;
}

.comm-search-form:focus-within {
    border-color: #8b7355;
    -webkit-box-shadow: 0 0 0 3px rgba(139,115,85,0.12);
            box-shadow: 0 0 0 3px rgba(139,115,85,0.12);
}

.comm-search-input {
    -webkit-flex: 1;
            flex: 1;
    border: none;
    outline: none;
    padding: 14px 18px;
    font-size: 1rem;
    font-family: inherit;
    color: #2c2c2c;
    background: transparent;
    min-width: 0;
    /* Rimuove stile nativo del type=search su Safari */
    -webkit-appearance: none;
}

.comm-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.comm-search-input::-ms-clear {
    display: none;
}

.comm-search-input::placeholder {
    color: #b0a898;
}

.comm-search-btn {
    background: #8b7355;
    color: #fff;
    border: none;
    padding: 14px 22px;
    font-size: 0.88rem;
    font-weight: 700;
    font-family: inherit;
    letter-spacing: 0.4px;
    cursor: pointer;
    white-space: nowrap;
    -webkit-flex-shrink: 0;
            flex-shrink: 0;
    -webkit-transition: background 0.2s;
            transition: background 0.2s;
}

.comm-search-btn:hover {
    background: #6f5c3e;
}

/* ---- Messaggio stato ---- */
.comm-search-status {
    text-align: center;
    margin-top: 12px;
    font-size: 0.86rem;
    color: #7a7370;
    font-family: inherit;
    min-height: 20px;
    line-height: 1.4;
}

/* ---- Pannello risultati multipli ---- */
.comm-search-results {
    position: relative;
    max-width: 560px;
    margin: 10px auto 0;
    background: #fff;
    border: 2px solid #8b7355;
    border-radius: 6px;
    -webkit-box-shadow: 0 8px 32px rgba(44,44,44,0.14);
            box-shadow: 0 8px 32px rgba(44,44,44,0.14);
    overflow: hidden;
    z-index: 100;
}

.comm-search-results-header {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
            align-items: center;
    -webkit-justify-content: space-between;
            justify-content: space-between;
    padding: 12px 16px;
    background: #8b7355;
    color: #fff;
    font-size: 0.84rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.comm-search-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 1rem;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    -webkit-transition: color 0.15s;
            transition: color 0.15s;
}

.comm-search-close:hover {
    color: #fff;
}

/* ---- Lista risultati ---- */
.comm-search-results-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 320px;
    overflow-y: auto;
}

.comm-search-result-item {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
            align-items: center;
    gap: 14px;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0ece4;
    -webkit-transition: background 0.15s;
            transition: background 0.15s;
    outline: none;
}

.comm-search-result-item:last-child {
    border-bottom: none;
}

.comm-search-result-item:hover,
.comm-search-result-item:focus {
    background: #faf8f5;
}

.comm-search-result-thumb {
    -webkit-flex-shrink: 0;
            flex-shrink: 0;
}

.comm-search-result-photo {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    -o-object-fit: cover;
       object-fit: cover;
    border: 2px solid #e8e2d8;
    display: block;
}

.comm-search-result-photo--empty {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #f0ece4;
    border: 2px solid #e8e2d8;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
            align-items: center;
    -webkit-justify-content: center;
            justify-content: center;
    font-size: 1.3rem;
}

.comm-search-result-info {
    -webkit-flex: 1;
            flex: 1;
    min-width: 0;
}

.comm-search-result-name {
    display: block;
    font-size: 0.97rem;
    font-weight: 700;
    color: #2c2c2c;
    font-family: Georgia, serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.comm-search-result-species {
    display: block;
    font-size: 0.78rem;
    color: #8b7355;
    margin-top: 2px;
}

.comm-search-result-arrow {
    font-size: 0.76rem;
    color: #8b7355;
    font-weight: 700;
    white-space: nowrap;
    -webkit-flex-shrink: 0;
            flex-shrink: 0;
}

/* ---- Highlight animato dopo lo scroll ---- */
@-webkit-keyframes comm-highlight {
    0%   { -webkit-box-shadow: 0 0 0 0 rgba(139,115,85,0); box-shadow: 0 0 0 0 rgba(139,115,85,0); }
    20%  { -webkit-box-shadow: 0 0 0 6px rgba(139,115,85,0.35); box-shadow: 0 0 0 6px rgba(139,115,85,0.35); }
    100% { -webkit-box-shadow: 0 0 0 0 rgba(139,115,85,0); box-shadow: 0 0 0 0 rgba(139,115,85,0); }
}
@keyframes comm-highlight {
    0%   { box-shadow: 0 0 0 0 rgba(139,115,85,0); }
    20%  { box-shadow: 0 0 0 6px rgba(139,115,85,0.35); }
    100% { box-shadow: 0 0 0 0 rgba(139,115,85,0); }
}

.comm-memorial--highlight {
    -webkit-animation: comm-highlight 2s ease-out forwards;
            animation: comm-highlight 2s ease-out forwards;
    border-radius: 8px;
}

/* ============================================================
   SINGOLA COMMEMORAZIONE
   ============================================================ */

.comm-memorial {
    max-width: 780px;
    margin: 0 auto 60px;
    font-family: Georgia, 'Times New Roman', serif;
    color: #2c2c2c;
}

/* ---- HEADER ---- */
.comm-header {
    position: relative;
    background: #1e1e1e;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    padding: 60px 40px 50px;
    text-align: center;
}

.comm-header-bg {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background: -webkit-radial-gradient(50% 0%, ellipse, rgba(139,115,85,0.22) 0%, transparent 65%),
                -webkit-linear-gradient(top, #1a1a1a 0%, #242424 100%);
    background:         radial-gradient(ellipse at 50% 0%, rgba(139,115,85,0.22) 0%, transparent 65%),
                        linear-gradient(180deg, #1a1a1a 0%, #242424 100%);
    pointer-events: none;
}

.comm-header-content {
    position: relative;
    z-index: 2;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
            flex-direction: column;
    -webkit-align-items: center;
            align-items: center;
    gap: 28px;
}

/* ---- FOTO ---- */
.comm-photo-wrap {
    position: relative;
    width: 160px;
    height: 160px;
    -webkit-flex-shrink: 0;
            flex-shrink: 0;
}

.comm-photo {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    -o-object-fit: cover;
       object-fit: cover;
    display: block;
    position: relative;
    z-index: 2;
    -webkit-filter: sepia(8%) contrast(1.04);
            filter: sepia(8%) contrast(1.04);
}

.comm-photo-placeholder {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: #2e2e2e;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
            align-items: center;
    -webkit-justify-content: center;
            justify-content: center;
    font-size: 3.5rem;
    position: relative;
    z-index: 2;
}

.comm-photo-ring {
    position: absolute;
    top: -6px; right: -6px; bottom: -6px; left: -6px;
    border-radius: 50%;
    border: 2px solid rgba(139,115,85,0.5);
    z-index: 1;
    -webkit-animation: comm-ring-pulse 3s ease-in-out infinite;
            animation: comm-ring-pulse 3s ease-in-out infinite;
}

@-webkit-keyframes comm-ring-pulse {
    0%, 100% { opacity: 0.5; -webkit-transform: scale(1); transform: scale(1); }
    50%       { opacity: 1;   -webkit-transform: scale(1.03); transform: scale(1.03); }
}
@keyframes comm-ring-pulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50%       { opacity: 1;   transform: scale(1.03); }
}

/* ---- IDENTITÀ ---- */
.comm-identity {
    color: #f5f0e8;
}

.comm-label-top {
    font-size: 0.76rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: rgba(245,240,232,0.5);
    margin: 0 0 10px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* NOME ANIMALE — bianco su sfondo scuro */
.comm-name {
    font-size: 2.6rem;
    font-weight: 400;
    color: #ffffff;
    margin: 0 0 8px;
    line-height: 1.1;
    letter-spacing: 1px;
}

@media (max-width: 600px) {
    .comm-name { font-size: 2rem; }
}
@media (max-width: 380px) {
    .comm-name { font-size: 1.7rem; }
}

.comm-species {
    font-size: 0.88rem;
    color: rgba(245,240,232,0.55);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin: 0 0 16px;
    letter-spacing: 0.5px;
}

.comm-dates {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
            align-items: center;
    -webkit-justify-content: center;
            justify-content: center;
    -webkit-flex-wrap: wrap;
            flex-wrap: wrap;
    gap: 8px 16px;
    margin: 0 0 8px;
}

.comm-date-item {
    display: -webkit-inline-flex;
    display: inline-flex;
    -webkit-align-items: center;
            align-items: center;
    gap: 5px;
    font-size: 0.86rem;
    color: rgba(245,240,232,0.7);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.comm-date-icon {
    font-size: 0.8rem;
}

.comm-date-sep {
    color: rgba(139,115,85,0.6);
    font-size: 1.1rem;
}

.comm-years-lived {
    font-size: 0.78rem;
    color: rgba(139,115,85,0.85);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin: 0 0 14px;
    letter-spacing: 0.3px;
}

.comm-owner {
    display: -webkit-inline-flex;
    display: inline-flex;
    -webkit-align-items: center;
            align-items: center;
    gap: 6px;
    font-size: 0.86rem;
    color: rgba(245,240,232,0.6);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    border-top: 1px solid rgba(245,240,232,0.1);
    padding-top: 14px;
    margin-top: 6px;
}

/* ---- DEDICA ---- */
.comm-dedication-wrap {
    background: #faf8f4;
    border-left: 4px solid #8b7355;
    padding: 40px 44px;
}

.comm-dedication-inner {
    max-width: 620px;
    margin: 0 auto;
    position: relative;
}

.comm-dedication-mark {
    font-size: 5rem;
    line-height: 0.8;
    color: rgba(139,115,85,0.18);
    font-family: Georgia, serif;
    position: absolute;
    left: -8px;
    top: -8px;
    pointer-events: none;
    -webkit-user-select: none;
       -moz-user-select: none;
        -ms-user-select: none;
            user-select: none;
}

.comm-dedication-mark--close {
    left: auto;
    top: auto;
    right: -8px;
    bottom: -28px;
}

.comm-dedication-text {
    font-size: 1.08rem;
    line-height: 1.85;
    color: #3a3530;
    font-style: italic;
    position: relative;
    z-index: 1;
    padding: 10px 20px;
}

/* ---- DIVISORE ---- */
.comm-divider {
    background: #f0ece4;
    padding: 20px 0;
    text-align: center;
    border-top: 1px solid #e5dfd6;
    border-bottom: 1px solid #e5dfd6;
}

.comm-divider-icon {
    font-size: 1.2rem;
    opacity: 0.65;
    -webkit-animation: comm-sway 4s ease-in-out infinite;
            animation: comm-sway 4s ease-in-out infinite;
    display: inline-block;
}

@-webkit-keyframes comm-sway {
    0%, 100% { -webkit-transform: rotate(-5deg); transform: rotate(-5deg); }
    50%       { -webkit-transform: rotate(5deg);  transform: rotate(5deg); }
}
@keyframes comm-sway {
    0%, 100% { transform: rotate(-5deg); }
    50%       { transform: rotate(5deg); }
}

/* ---- SEZIONE REAZIONI ---- */
.comm-reactions-section {
    background: #fff;
    /* padding orizzontale contenuto: la griglia emoji usa width:100%
       e non ha bisogno di spazio laterale extra */
    padding: 44px 20px 40px;
    text-align: center;
    border: 1px solid #e8e2d8;
    border-top: none;
    /* previene overflow su contenitori Enfold con overflow:hidden */
    overflow: hidden;
}

.comm-reactions-title {
    font-size: 1.2rem;
    font-weight: 400;
    color: #2c2c2c;
    margin: 0 0 8px;
    font-family: Georgia, serif;
    letter-spacing: 0.3px;
}

.comm-reactions-subtitle {
    font-size: 0.86rem;
    color: #7a7370;
    margin: 0 0 28px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.55;
}

/* ---- GRIGLIA EMOJI ----
   Sempre 5 colonne per riga (2 righe × 5 = 10 emoji).
   Con 1fr ogni cella scala proporzionalmente al contenitore:
   nessun overflow, nessuna rottura imprevedibile su Enfold/Avia.
   ---------------------------------------------------------------- */
.comm-emoji-grid {
    display: -ms-grid;
    display: grid;
    -ms-grid-columns: 1fr 8px 1fr 8px 1fr 8px 1fr 8px 1fr;
        grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    width: 100%;
    max-width: 480px;
    margin: 0 auto 22px;
    /* evita che Enfold aggiunga padding extra */
    -webkit-box-sizing: border-box;
            box-sizing: border-box;
}

.comm-emoji-btn {
    background: #faf8f5;
    border: 1.5px solid #e8e2d8;
    border-radius: 10px;
    /* padding verticale fisso, orizzontale zero: la cella si adatta */
    padding: 10px 2px 9px;
    cursor: pointer;
    -webkit-transition: background 0.2s, border-color 0.2s, -webkit-transform 0.15s, -webkit-box-shadow 0.2s;
            transition: background 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.2s;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
            flex-direction: column;
    -webkit-align-items: center;
            align-items: center;
    -webkit-justify-content: center;
            justify-content: center;
    gap: 4px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    /* width al 100% della cella grid — niente larghezze fisse */
    width: 100%;
    min-width: 0;
}

.comm-emoji-btn:hover {
    background: #f0ece4;
    border-color: #8b7355;
    -webkit-transform: translateY(-2px);
            transform: translateY(-2px);
    -webkit-box-shadow: 0 5px 14px rgba(139,115,85,0.15);
            box-shadow: 0 5px 14px rgba(139,115,85,0.15);
}

.comm-emoji-btn:focus-visible {
    outline: 3px solid #8b7355;
    outline-offset: 2px;
}

.comm-emoji-btn--active {
    background: rgba(139,115,85,0.1);
    border-color: #8b7355;
    -webkit-box-shadow: 0 4px 12px rgba(139,115,85,0.18);
            box-shadow: 0 4px 12px rgba(139,115,85,0.18);
}

.comm-emoji-btn--active .comm-emoji-glyph {
    -webkit-animation: comm-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
            animation: comm-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@-webkit-keyframes comm-pop {
    0%   { -webkit-transform: scale(0.7); transform: scale(0.7); }
    100% { -webkit-transform: scale(1);   transform: scale(1); }
}
@keyframes comm-pop {
    0%   { transform: scale(0.7); }
    100% { transform: scale(1); }
}

/* Emoji glyph più piccola */
.comm-emoji-glyph {
    font-size: 1.5rem;
    line-height: 1;
    display: block;
    -webkit-transition: -webkit-transform 0.15s;
            transition: transform 0.15s;
}

.comm-emoji-btn:hover .comm-emoji-glyph {
    -webkit-transform: scale(1.12);
            transform: scale(1.12);
}

/* Label sotto l'emoji */
.comm-emoji-label {
    font-size: 0.6rem;
    color: #7a7370;
    text-align: center;
    line-height: 1.25;
    display: block;
    word-break: break-word;
    max-width: 72px;
}

.comm-emoji-btn--active .comm-emoji-label {
    color: #6f5c3e;
    font-weight: 600;
}

/* Contatore piccolo in alto a destra */
.comm-emoji-count {
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 0.6rem;
    font-weight: 700;
    color: #8b7355;
    line-height: 1;
    min-width: 14px;
    text-align: right;
}

/* ---- MESSAGGIO FEEDBACK ---- */
.comm-reaction-msg {
    font-size: 0.86rem;
    color: #6b7b5e;
    min-height: 22px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-transition: opacity 0.3s;
            transition: opacity 0.3s;
}

/* ---- FOOTER NOTE ---- */
.comm-footer-note {
    text-align: center;
    padding: 18px;
    font-size: 0.76rem;
    color: #b0a898;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #faf8f5;
    border: 1px solid #e8e2d8;
    border-top: none;
    border-radius: 0 0 8px 8px;
    letter-spacing: 0.3px;
}

/* ============================================================
   GRIGLIA COMMEMORAZIONI
   Usa flexbox invece di grid puro: le card si adattano
   al numero di colonne rimanendo della stessa altezza.
   ============================================================ */

.comm-grid {
    display: -webkit-flex;
    display: flex;
    -webkit-flex-wrap: wrap;
            flex-wrap: wrap;
    gap: 24px;
    /* Allineamento item dall'alto */
    -webkit-align-items: stretch;
            align-items: stretch;
}

/* Calcolo larghezza card in base alle colonne */
.comm-grid--cols-1 .comm-card { -webkit-flex: 0 0 100%; flex: 0 0 100%; max-width: 100%; }
.comm-grid--cols-2 .comm-card { -webkit-flex: 0 0 calc(50% - 12px); flex: 0 0 calc(50% - 12px); max-width: calc(50% - 12px); }
.comm-grid--cols-3 .comm-card { -webkit-flex: 0 0 calc(33.333% - 16px); flex: 0 0 calc(33.333% - 16px); max-width: calc(33.333% - 16px); }
.comm-grid--cols-4 .comm-card { -webkit-flex: 0 0 calc(25% - 18px); flex: 0 0 calc(25% - 18px); max-width: calc(25% - 18px); }

.comm-card {
    font-family: Georgia, 'Times New Roman', serif;
    /* altezza uniforme tra card nella stessa riga */
    display: -webkit-flex;
    display: flex;
}

.comm-card-inner {
    background: #fff;
    border: 1px solid #e8e2d8;
    border-radius: 8px;
    overflow: hidden;
    -webkit-transition: -webkit-transform 0.22s, -webkit-box-shadow 0.22s;
            transition: transform 0.22s, box-shadow 0.22s;
    width: 100%;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
            flex-direction: column;
}

.comm-card-inner:hover {
    -webkit-transform: translateY(-4px);
            transform: translateY(-4px);
    -webkit-box-shadow: 0 10px 32px rgba(44,44,44,0.1);
            box-shadow: 0 10px 32px rgba(44,44,44,0.1);
}

.comm-card-photo-wrap {
    background: #1e1e1e;
    padding: 24px;
    display: -webkit-flex;
    display: flex;
    -webkit-justify-content: center;
            justify-content: center;
    -webkit-align-items: center;
            align-items: center;
    -webkit-flex-shrink: 0;
            flex-shrink: 0;
}

.comm-card-photo {
    width: 86px;
    height: 86px;
    border-radius: 50%;
    -o-object-fit: cover;
       object-fit: cover;
    border: 2px solid rgba(139,115,85,0.4);
    display: block;
    -webkit-filter: sepia(8%);
            filter: sepia(8%);
}

.comm-card-photo--placeholder {
    width: 86px;
    height: 86px;
    border-radius: 50%;
    background: #2e2e2e;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
            align-items: center;
    -webkit-justify-content: center;
            justify-content: center;
    font-size: 2rem;
    border: 2px solid rgba(139,115,85,0.3);
}

.comm-card-body {
    padding: 18px 18px 22px;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
            flex-direction: column;
    -webkit-align-items: center;
            align-items: center;
    text-align: center;
    -webkit-flex: 1;
            flex: 1;
}

.comm-card-label {
    font-size: 0.66rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #b0a898;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin: 0 0 6px;
}

.comm-card-name {
    font-size: 1.2rem;
    font-weight: 400;
    color: #2c2c2c;
    margin: 0 0 5px;
    line-height: 1.2;
}

.comm-card-species {
    font-size: 0.78rem;
    color: #8b7355;
    margin: 0 0 6px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.comm-card-date {
    font-size: 0.78rem;
    color: #7a7370;
    margin: 0 0 6px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.comm-card-reactions {
    font-size: 0.78rem;
    color: #6b7b5e;
    margin: 0 0 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.comm-card-link {
    display: inline-block;
    color: #8b7355;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    letter-spacing: 0.3px;
    border-bottom: 1px solid transparent;
    -webkit-transition: border-color 0.2s;
            transition: border-color 0.2s;
    margin-top: auto;
}

.comm-card-link:hover {
    border-bottom-color: #8b7355;
    color: #6f5c3e;
    text-decoration: none;
}

/* ============================================================
   LOADING STATE
   ============================================================ */
.comm-emoji-btn.comm-loading {
    opacity: 0.45;
    pointer-events: none;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet */
@media (max-width: 900px) {
    .comm-grid--cols-4 .comm-card {
        -webkit-flex: 0 0 calc(50% - 12px);
                flex: 0 0 calc(50% - 12px);
        max-width: calc(50% - 12px);
    }
}

@media (max-width: 768px) {
    .comm-header {
        padding: 44px 20px 38px;
        border-radius: 6px 6px 0 0;
    }

    .comm-dedication-wrap {
        padding: 28px 24px 28px 22px;
    }

    .comm-dedication-mark {
        font-size: 3.5rem;
        left: -4px;
        top: -4px;
    }

    .comm-dedication-mark--close {
        right: -4px;
        bottom: -22px;
    }

    .comm-reactions-section {
        padding: 32px 18px 28px;
    }

    /* 2 colonne → 1 colonna su tablet */
    .comm-grid--cols-3 .comm-card,
    .comm-grid--cols-4 .comm-card {
        -webkit-flex: 0 0 calc(50% - 12px);
                flex: 0 0 calc(50% - 12px);
        max-width: calc(50% - 12px);
    }
}

@media (max-width: 540px) {
    .comm-photo-wrap,
    .comm-photo,
    .comm-photo-placeholder {
        width: 120px;
        height: 120px;
    }

    /* Tutte le colonne → 1 sola su mobile */
    .comm-grid--cols-2 .comm-card,
    .comm-grid--cols-3 .comm-card,
    .comm-grid--cols-4 .comm-card {
        -webkit-flex: 0 0 100%;
                flex: 0 0 100%;
        max-width: 100%;
    }

    .comm-dedication-text {
        font-size: 1rem;
        padding: 8px 12px;
    }

    /* Emoji grid: il gap si riduce su mobile, le celle rimangono 5 per riga */
    .comm-emoji-grid {
        gap: 6px;
    }

    .comm-emoji-btn {
        padding: 8px 2px 7px;
    }

    .comm-emoji-glyph {
        font-size: 1.3rem;
    }

    .comm-emoji-label {
        font-size: 0.54rem;
    }

    .comm-search-btn {
        padding: 14px 14px;
        font-size: 0.8rem;
    }
}

@media (max-width: 360px) {
    /* Su schermi molto piccoli: label emoji nascosta, solo glyph */
    .comm-emoji-label {
        display: none;
    }
    .comm-emoji-grid {
        gap: 5px;
    }
    .comm-emoji-btn {
        padding: 8px 0 8px;
    }
    /* Sezione reazioni con padding minimo */
    .comm-reactions-section {
        padding: 24px 10px 22px;
    }
}

/* ============================================================
   CONDIVISIONE SOCIAL
   ============================================================ */

.comm-share-section {
    background: #f5f0e8;
    border: 1px solid #e8e2d8;
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 20px 16px 18px;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    /* Impedisce overflow fuori dal contenitore */
    overflow: hidden;
    -webkit-box-sizing: border-box;
            box-sizing: border-box;
}

.comm-share-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: #4a4540;
    margin: 0 0 12px;
    letter-spacing: 0.2px;
}

.comm-share-buttons {
    display: -webkit-flex;
    display: flex;
    -webkit-flex-wrap: wrap;
            flex-wrap: wrap;
    -webkit-justify-content: center;
            justify-content: center;
    gap: 7px;
    /* Evita che i bottoni escano dal padding del contenitore */
    max-width: 100%;
    -webkit-box-sizing: border-box;
            box-sizing: border-box;
}

/* Bottone / link social base — solo icona, senza testo */
.comm-share-btn {
    display: -webkit-inline-flex;
    display: inline-flex;
    -webkit-align-items: center;
            align-items: center;
    -webkit-justify-content: center;
            justify-content: center;
    /* Bottone quadrato piccolo: solo icona */
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
    background: var(--comm-share-color, #8b7355);
    color: #fff !important;
    text-decoration: none !important;
    font-size: 0;          /* nasconde testo residuo */
    font-family: inherit;
    border: none;
    cursor: pointer;
    -webkit-transition: opacity 0.18s, -webkit-transform 0.15s;
            transition: opacity 0.18s, transform 0.15s;
    -webkit-tap-highlight-color: transparent;
    -webkit-flex-shrink: 0;
            flex-shrink: 0;
    -webkit-box-sizing: border-box;
            box-sizing: border-box;
}

.comm-share-btn:hover {
    opacity: 0.85;
    -webkit-transform: translateY(-2px);
            transform: translateY(-2px);
    color: #fff !important;
    text-decoration: none !important;
}

.comm-share-btn:active {
    -webkit-transform: translateY(0);
            transform: translateY(0);
    opacity: 1;
}

.comm-share-btn svg {
    width: 18px;
    height: 18px;
    -webkit-flex-shrink: 0;
            flex-shrink: 0;
    display: block;
}

/* Label sempre nascosta: bottoni sono solo icona */
.comm-share-label {
    display: none;
}

/* Messaggio copia link */
.comm-share-copy-msg {
    margin-top: 10px;
    font-size: 0.8rem;
    color: #6b7b5e;
    font-weight: 600;
    min-height: 18px;
    -webkit-transition: opacity 0.3s;
            transition: opacity 0.3s;
}
