/**
 * ecc-flip-cards.css
 * v1 — 2026-05-20
 * AI Generator: Claude Sonnet 4.6
 */

/* =====================================================
   GRID
   ===================================================== */

.ecc-fc-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* =====================================================
   CARD WRAPPER
   ===================================================== */

.ecc-fc-card {
    position: relative;
    perspective: 1200px;
    cursor: pointer;
    min-height: 150px; /* default: evita collasso quando nessun valore è impostato in Elementor */
}

/* =====================================================
   SIZER
   Due celle in CSS Grid sovrapposte (stessa riga/colonna):
   altezza finale = max(sizer-front, sizer-back).
   Tutto invisibile ma in normal-flow per il calcolo altezza.
   ===================================================== */

.ecc-fc-sizer {
    visibility: hidden;
    pointer-events: none;
    user-select: none;
    display: grid;
    grid-template-columns: 1fr;
    min-height: 150px; /* specchia il default della card */
}

.ecc-fc-sizer-front,
.ecc-fc-sizer-back {
    grid-row: 1;
    grid-column: 1;
    padding: 30px; /* default, sovrascritto da Elementor */
}

/* Il sizer-front usa la stessa struttura del front reale ma senza flex spacing */
.ecc-fc-sizer-front .ecc-fc-front-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.ecc-fc-sizer-front .ecc-fc-front-footer {
    /* stacking naturale, nessun margin-top: auto */
}

/* =====================================================
   INNER (contiene fronte e retro, ruota in blocco)
   ===================================================== */

.ecc-fc-inner {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
}

/* =====================================================
   FRONT & BACK — comune
   ===================================================== */

.ecc-fc-front,
.ecc-fc-back {
    position: absolute;
    inset: 0;
    overflow: hidden;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    padding: 30px;
    background-color: #ffffff;
    transition: opacity 0.6s ease;
}

/* =====================================================
   FRONT — layout
   ===================================================== */

.ecc-fc-front {
    justify-content: space-between;
}

.ecc-fc-front-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

/* Placeholder quando non c'è numero: spingi la sep a dx */
.ecc-fc-number-placeholder {
    flex: 1;
}

.ecc-fc-number {
    font-size: 72px;
    line-height: 1;
    color: #c9a9a9;
    font-family: Georgia, 'Times New Roman', serif;
    font-weight: 400;
    user-select: none;
    line-height: 0.85;
}

/* ---- Separatore linea ---- */
.ecc-fc-sep-line {
    display: inline-block;
    width: 40px;
    height: 2px;
    background-color: #6b0f1a;
    flex-shrink: 0;
}

/* Sul fronte: la linea è in alto a destra — allineata in cima */
.ecc-fc-front-header .ecc-fc-sep-line {
    margin-top: 14px; /* allinea al top del numero */
}

/* Sul retro (e nel sizer): gestito da .ecc-fc-back-hd — vedi sotto */

/* ---- Separatore icona ---- */
.ecc-fc-sep-icon {
    color: #6b0f1a;
    font-size: 24px;
}

.ecc-fc-front-header .ecc-fc-sep-icon {
    margin-top: 6px;
}

/* ---- Footer fronte ---- */
.ecc-fc-front-footer {
    margin-top: auto;
}

.ecc-fc-front-title {
    font-size: 22px;
    font-weight: 400;
    line-height: 1.3;
    color: #1a1a1a;
    margin: 0 0 18px;
    font-family: Georgia, 'Times New Roman', serif;
}

.ecc-fc-cta {
    display: inline-block;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    text-decoration: none;
    color: #6b0f1a;
    transition: color 0.3s ease;
}

.ecc-fc-cta:hover {
    color: #1a1a1a;
    text-decoration: none;
}

.ecc-fc-cta-arrow {
    display: inline-block;
    margin-left: 4px;
    transition: transform 0.3s ease;
}

.ecc-fc-cta:hover .ecc-fc-cta-arrow {
    transform: translateX(4px);
}

/* =====================================================
   BACK — layout
   ===================================================== */

.ecc-fc-back {
    background-color: #6b0f1a;
    justify-content: flex-start;
    overflow-y: auto;
}

.ecc-fc-back-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/*
 * ecc-fc-back-hd: zona header del retro.
 * Stessa altezza del numero frontale (via --ecfc-num-size)
 * → il testo riparte esattamente dove inizia il footer del fronte.
 * width: 100% esplicito garantisce che margin-left:auto sul numero funzioni.
 */
.ecc-fc-back-hd {
    width: 100%;
    min-height: var(--ecfc-num-size, 72px);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-shrink: 0;
}

/* Trattino sul retro: stesso margin-top del fronte per allineamento visivo coerente */
.ecc-fc-back-hd .ecc-fc-sep-line {
    margin-top: 14px;
}

.ecc-fc-back-hd .ecc-fc-sep-icon {
    margin-top: 6px; /* uguale al fronte */
    display: inline-block;
}

/*
 * Numero decorativo sul retro (a destra).
 * Reso in DOM solo quando il toggle è attivo (PHP condizionale).
 * margin-left: auto lo spinge sempre all'estrema destra nel flex container,
 * indipendentemente da justify-content o numero di altri elementi.
 */
.ecc-fc-back-number {
    margin-left: auto;
    font-size: var(--ecfc-num-size, 72px);
    line-height: 0.85;
    color: rgba(255, 255, 255, 0.18);
    font-family: Georgia, 'Times New Roman', serif;
    font-weight: 400;
    user-select: none;
    flex-shrink: 0;
}

/* Separatore sul retro: colore chiaro di default (non si confonde con lo sfondo scuro) */
.ecc-fc-back .ecc-fc-sep-line {
    background-color: rgba(255, 255, 255, 0.7);
}

.ecc-fc-back .ecc-fc-sep-icon {
    color: rgba(255, 255, 255, 0.7);
}

/* ecc-fc-back-bd: corpo testo + bottoni */
.ecc-fc-back-bd {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.ecc-fc-back-text {
    font-size: 16px;
    line-height: 1.75;
    color: #f5f0f0;
    margin: 0 0 20px;
    flex: 1;
}

/* =====================================================
   EXTRA BUTTONS
   ===================================================== */

.ecc-fc-extra-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: auto;
    padding-top: 12px;
}

.ecc-fc-extra-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    letter-spacing: 0.05em;
    text-decoration: none;
    color: #f5f0f0;
    transition: color 0.3s ease, opacity 0.3s ease;
}

.ecc-fc-extra-btn:hover {
    color: #c9a9a9;
    text-decoration: none;
}

.ecc-fc-btn-icon {
    font-size: 16px;
    flex-shrink: 0;
}

/* =====================================================
   EFFETTI: FLIP-LEFT (default, come da screenshot)
   Front gira verso sinistra: rotateY(-180deg)
   ===================================================== */

.ecc-fc-card.ecc-fc-effect-flip-left .ecc-fc-back {
    transform: rotateY(-180deg);
}

.ecc-fc-card.ecc-fc-effect-flip-left:hover .ecc-fc-inner,
.ecc-fc-card.ecc-fc-effect-flip-left.ecc-flipped .ecc-fc-inner {
    transform: rotateY(-180deg);
}

/* =====================================================
   EFFETTI: FLIP-RIGHT
   ===================================================== */

.ecc-fc-card.ecc-fc-effect-flip-right .ecc-fc-back {
    transform: rotateY(180deg);
}

.ecc-fc-card.ecc-fc-effect-flip-right:hover .ecc-fc-inner,
.ecc-fc-card.ecc-fc-effect-flip-right.ecc-flipped .ecc-fc-inner {
    transform: rotateY(180deg);
}

/* =====================================================
   EFFETTI: FLIP-UP
   ===================================================== */

.ecc-fc-card.ecc-fc-effect-flip-up .ecc-fc-back {
    transform: rotateX(180deg);
}

.ecc-fc-card.ecc-fc-effect-flip-up:hover .ecc-fc-inner,
.ecc-fc-card.ecc-fc-effect-flip-up.ecc-flipped .ecc-fc-inner {
    transform: rotateX(180deg);
}

/* =====================================================
   EFFETTI: FLIP-DOWN
   ===================================================== */

.ecc-fc-card.ecc-fc-effect-flip-down .ecc-fc-back {
    transform: rotateX(-180deg);
}

.ecc-fc-card.ecc-fc-effect-flip-down:hover .ecc-fc-inner,
.ecc-fc-card.ecc-fc-effect-flip-down.ecc-flipped .ecc-fc-inner {
    transform: rotateX(-180deg);
}

/* =====================================================
   EFFETTI: FADE (dissolvenza, niente 3D)
   ===================================================== */

.ecc-fc-card.ecc-fc-effect-fade {
    perspective: none;
}

.ecc-fc-card.ecc-fc-effect-fade .ecc-fc-inner {
    transform-style: flat;
}

.ecc-fc-card.ecc-fc-effect-fade .ecc-fc-front,
.ecc-fc-card.ecc-fc-effect-fade .ecc-fc-back {
    backface-visibility: visible;
    -webkit-backface-visibility: visible;
}

.ecc-fc-card.ecc-fc-effect-fade .ecc-fc-back {
    opacity: 0;
    transform: none;
}

.ecc-fc-card.ecc-fc-effect-fade:hover .ecc-fc-back,
.ecc-fc-card.ecc-fc-effect-fade.ecc-flipped .ecc-fc-back {
    opacity: 1;
}

.ecc-fc-card.ecc-fc-effect-fade:hover .ecc-fc-front,
.ecc-fc-card.ecc-fc-effect-fade.ecc-flipped .ecc-fc-front {
    opacity: 0;
}

/* =====================================================
   TRIGGER: CLICK — disabilita :hover quando trigger = click
   La classe .ecc-flipped è gestita via JS
   ===================================================== */

.ecc-fc-card[data-trigger="click"]:hover .ecc-fc-inner {
    /* reset: non ruotare su hover se trigger è click */
    transform: none;
}

/* Per fade + click */
.ecc-fc-card.ecc-fc-effect-fade[data-trigger="click"]:hover .ecc-fc-back  { opacity: 0; }
.ecc-fc-card.ecc-fc-effect-fade[data-trigger="click"]:hover .ecc-fc-front { opacity: 1; }

/* =====================================================
   RESPONSIVE DEFAULTS (override da Elementor responsive controls)
   ===================================================== */

@media (max-width: 1024px) {
    .ecc-fc-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .ecc-fc-grid {
        grid-template-columns: 1fr;
    }

    .ecc-fc-number {
        font-size: 56px;
    }
}
