/* ═══════════════════════════════════════════════════════════
   CARD DEI SERVIZI CHE SI GIRANO · romanovskis.xyz v3 (home, sezione Services; AD 8 ott 2026)
   "Card con illustrazioni infografiche, clicchi sulla card e si gira"; poi "le card nuove mettile nella homepage,
   non voglio che le singole card portino al dettaglio": il dettaglio sta solo nel bottone "Services in detail".
   Fronte: l'infografica della disciplina (SVG isometrico nel markup), titolo, testo, "What's included".
   Retro: cosa comprende, esempi dal portfolio, Start a project, "Turn back". JS: js/flip-cards.js.
   Senza JS le due facce stanno una sotto l'altra e tutto si legge.
═══════════════════════════════════════════════════════════ */

/* ── Disegni isometrici delle card: stessa penna delle infografiche ── */
.svx-art .g { fill: none; stroke: rgba(15, 15, 15, 0.14); stroke-width: 1; vector-effect: non-scaling-stroke; transition: stroke 0.6s var(--ease); }
.svx-art .f { fill: #FCFBF8; transition: fill 0.45s var(--ease); }
.svx-art .e { fill: none; stroke: #0F0F0F; stroke-width: 1.15; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; transition: stroke 0.45s var(--ease); }
.svx-art .sol { transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1); }
.svx-art .sh { opacity: 0; transform-box: fill-box; transform-origin: center; transform: scale(0.72); transition: opacity 0.6s var(--ease), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1); }
.svx-art .pl { fill: #FCFBF8; stroke: #0F0F0F; stroke-width: 1.1; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.svx-art .ln { fill: none; stroke: #0F0F0F; stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.45; vector-effect: non-scaling-stroke; }
.svx-art .ln2 { fill: none; stroke: rgba(15, 15, 15, 0.42); stroke-width: 1; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; transition: stroke 0.45s var(--ease); }

/* ── Card che si girano ───────────────────────────────────
   .svx-card fa da prospettiva; .svx-in porta in un solo transform sollevamento, inclinazione verso il mouse e giro
   (--flip 0 o 180deg). Le facce stanno nella stessa cella della griglia: la card è alta quanto la faccia più alta.
   La curva del giro è simmetrica, quindi a metà tempo (0,4 s) la card è di taglio: lì la faccia nascosta diventa
   visibility:hidden (oltre a backface-visibility), così nessun browser la mostra in trasparenza. */
.svx-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.svx-card {
  --c: 255, 0, 0; --cl: #FF0000; --pad: clamp(22px, 1.9vw, 30px);
  position: relative; perspective: 1800px; cursor: pointer; -webkit-tap-highlight-color: transparent;
  scroll-margin-top: calc(var(--pb-h, 56px) + 24px);
}
.svx-card[data-svc="g"] { --c: 0, 255, 0; --cl: #14B014; }
.svx-card[data-svc="b"] { --c: 0, 0, 255; --cl: #0000FF; }
.svx-card[data-svc="k"] { --c: 15, 15, 15; --cl: #0F0F0F; }
.svx-card.flipped { --flip: 180deg; }
.svx-in {
  position: relative; display: grid; height: 100%; transform-style: preserve-3d;
  transform: translateY(var(--lift, 0px)) rotateX(var(--rx, 0deg)) rotateY(calc(var(--ry, 0deg) + var(--flip, 0deg)));
  transition: transform 0.8s cubic-bezier(0.65, 0, 0.35, 1);
}
.svx-card.lit .svx-in { transition: transform 0.25s ease-out; }
.svx-card.turning .svx-in, .svx-card.lit.turning .svx-in { transition: transform 0.8s cubic-bezier(0.65, 0, 0.35, 1); }
.svx-face {
  grid-area: 1 / 1; position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column; min-width: 0; padding: var(--pad);
  border-radius: var(--radius); background: #FCFBF8; box-shadow: inset 0 0 0 1px rgba(15, 15, 15, 0.06);
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
}
.svx-back { transform: rotateY(180deg); }
html.js .svx-front { transition: visibility 0s linear 0.4s, box-shadow 0.5s var(--ease); }
html.js .svx-back { visibility: hidden; transition: visibility 0s linear 0.4s, box-shadow 0.5s var(--ease); }
html.js .svx-card.flipped .svx-front { visibility: hidden; }
html.js .svx-card.flipped .svx-back { visibility: visible; }
.svx-card.lit .svx-face { box-shadow: inset 0 0 0 1px rgba(15, 15, 15, 0.08), 0 34px 60px -36px rgba(15, 15, 15, 0.42); }

/* la tinta della disciplina sale dal fondo (come nella home); sul retro copre già tutta la card */
.svx-face::before {
  content: ''; position: absolute; inset: 0; z-index: -2; pointer-events: none;
  background: linear-gradient(to top, rgba(var(--c), 0.2) 0, rgba(var(--c), 0.1) 50%, rgba(var(--c), 0) 100%) no-repeat 50% 100% / 100% 64%;
  opacity: 0.75; transition: background-size 1.1s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.8s var(--ease);
}
.svx-card.lit .svx-face::before, .svx-back::before { opacity: 1; background-size: 100% 230%; }
/* la luce che segue il puntatore */
.svx-face::after {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(440px circle at var(--mx, 50%) var(--my, 18%), rgba(var(--c), 0.18), rgba(var(--c), 0) 62%);
  opacity: 0; transition: opacity 0.5s var(--ease);
}
.svx-card.lit .svx-face::after { opacity: 1; }
/* il retro è il foglio del progetto: la griglia isometrica del pavimento, nel colore della disciplina, sfuma verso l'alto */
.svx-tex {
  position: absolute; inset: 0; z-index: -1; pointer-events: none; background: var(--cl); opacity: 0.16;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='41.57' height='24' viewBox='0 0 41.57 24'%3E%3Cpath d='M0 0L41.57 24M0 24L41.57 0' stroke='%23000' stroke-width='1' fill='none'/%3E%3C/svg%3E"), linear-gradient(to top, #000 0, rgba(0, 0, 0, 0.5) 45%, transparent 85%);
  -webkit-mask-size: 41.57px 24px, 100% 100%; -webkit-mask-repeat: repeat, no-repeat; -webkit-mask-composite: source-in;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='41.57' height='24' viewBox='0 0 41.57 24'%3E%3Cpath d='M0 0L41.57 24M0 24L41.57 0' stroke='%23000' stroke-width='1' fill='none'/%3E%3C/svg%3E"), linear-gradient(to top, #000 0, rgba(0, 0, 0, 0.5) 45%, transparent 85%);
  mask-size: 41.57px 24px, 100% 100%; mask-repeat: repeat, no-repeat; mask-composite: intersect;
}
.svx-card[data-svc="g"] .svx-tex { opacity: 0.22; }

/* fronte */
.svx-top { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; color: var(--muted); line-height: 1; }
.svx-top .prim { width: 9px; height: 9px; }
.svx-bt { margin-left: auto; font-family: var(--display); font-size: 14px; font-weight: 600; letter-spacing: -0.01em; color: var(--fg); }
.svx-art { display: block; width: calc(100% + 2 * var(--pad)); max-width: none; height: auto; margin: 4px calc(-1 * var(--pad)) 6px; overflow: visible; }
.svx-front h3 { font-family: var(--display); font-weight: 600; font-size: clamp(1.35rem, 1.75vw, 1.75rem); line-height: 1.05; letter-spacing: -0.03em; }
.svx-front p { margin: 12px 0 24px; color: var(--muted-card); font-size: 14.5px; line-height: 1.55; }

/* il bottone che gira la card: in fondo al fronte (Cosa comprende) e al retro (Torna indietro) */
.svx-turn {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 44px;
  margin-top: auto; padding: 14px 0 0; border-top: 1px solid rgba(15, 15, 15, 0.1);
  font-size: 14px; font-weight: 500; text-align: left; color: var(--fg);
}
.svx-turn .ti { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(15, 15, 15, 0.16); transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.3s, color 0.3s, box-shadow 0.3s; }
.svx-card.lit .svx-turn .ti, .svx-turn:focus-visible .ti { background-color: var(--fg); color: var(--bg); box-shadow: none; }
.svx-card.lit .svx-front .svx-turn .ti { transform: rotate(-180deg); }
.svx-turn:focus-visible { outline-offset: 2px; }

/* retro: cosa comprende, esempi, Start a project */
.svx-k { font-family: var(--mono); font-size: 10.5px; font-weight: 400; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.svx-back h4 { margin-top: 26px; }
.svx-back h4:focus { outline: none; }
.svx-list { list-style: none; margin: 12px 0 0; }
.svx-list li { position: relative; padding: 11px 0 11px 20px; border-top: 1px solid rgba(15, 15, 15, 0.1); font-size: 14.5px; line-height: 1.4; color: var(--fg); }
.svx-list li:last-child { border-bottom: 1px solid rgba(15, 15, 15, 0.1); }
.svx-list li::before { content: ''; position: absolute; left: 1px; top: calc(11px + 0.7em - 3.5px); width: 7px; height: 7px; border-radius: 1.5px; background: rgb(var(--c)); box-shadow: inset 0 0 0 0.6px rgba(15, 15, 15, 0.3); }
.svx-ex { margin: 18px 0 22px; font-size: 13.5px; line-height: 1.6; color: var(--muted-card); }
.svx-ex .svx-k { display: block; margin-bottom: 4px; }
.svx-ex a { white-space: nowrap; color: var(--fg); text-decoration: underline; text-decoration-color: rgba(15, 15, 15, 0.28); text-underline-offset: 3px; transition: text-decoration-color 0.25s; }
.svx-ex a:hover { text-decoration-color: currentColor; }
.svx-ex .ico { margin-left: 3px; vertical-align: 0; opacity: 0.55; }
.svx-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(15, 15, 15, 0.1); }
.svx-foot .btn.sm { min-height: 44px; }
.svx-foot .svx-turn { width: auto; margin: 0; padding: 0; border: 0; gap: 10px; }
/* girata la card, le voci entrano una dopo l'altra */
@keyframes svx-li { from { opacity: 0; transform: translateX(-8px); } }
html.js .svx-card.flipped .svx-list li { animation: svx-li 0.5s var(--ease) backwards; }
html.js .svx-card.flipped .svx-list li:nth-child(1) { animation-delay: 0.42s; }
html.js .svx-card.flipped .svx-list li:nth-child(2) { animation-delay: 0.48s; }
html.js .svx-card.flipped .svx-list li:nth-child(3) { animation-delay: 0.54s; }
html.js .svx-card.flipped .svx-list li:nth-child(4) { animation-delay: 0.6s; }
html.js .svx-card.flipped .svx-list li:nth-child(5) { animation-delay: 0.66s; }

/* acceso (mouse sopra o, sul touch, card nello schermo): il solido si solleva e prende colore, i segni anche */
.svx-card.lit .svx-art .sol { transform: translateY(-10px); }
.svx-card.lit .svx-art .sh { opacity: 0.3; transform: scale(1); }
.svx-card.lit .svx-art .g { stroke: rgba(var(--c), 0.36); }
.svx-card.lit .svx-art .ln2 { stroke: var(--cl); }
.svx-card.lit .svx-art.r .sol .f { fill: #FF0000; }
.svx-card.lit .svx-art.g .sol .f { fill: #00FF00; }
.svx-card.lit .svx-art.b .sol .f { fill: #0000FF; }
.svx-card.lit .svx-art.k .sol .f { fill: #0F0F0F; }
.svx-card.lit .svx-art.k .sol .f.cap { fill: #3A3A37; }
.svx-card.lit .svx-art.k .sol .e.rim { stroke: rgba(245, 244, 240, 0.8); }

/* ── Larghezze ── */
@media (max-width: 1279px) {
  .svx-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 641px) {
  .svx-front h3 { min-height: 2.1em; }   /* titoli di una o due righe: i testi partono alla stessa quota */
}
@media (max-width: 640px) {
  .svx-cards { grid-template-columns: minmax(0, 1fr); }
}

/* ── Senza JS, stampa, riduci movimento ── */
html:not(.js) .svx-card { cursor: auto; }
html:not(.js) .svx-in { display: flex; flex-direction: column; gap: 12px; transform: none; }
html:not(.js) .svx-back { transform: none; }
html:not(.js) .svx-turn { display: none; }
@media print {
  .svx-in { display: block; transform: none !important; }
  .svx-face { visibility: visible !important; transform: none !important; break-inside: avoid; margin-bottom: 12px; }
  .svx-turn { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .svx-in, .svx-card.lit .svx-in, .svx-card.turning .svx-in { transform: none !important; transition: none !important; }
  .svx-back { transform: none; }
  html.js .svx-front, html.js .svx-back { transition: none; }
  .svx-face::before, .svx-face::after, .svx-turn .ti, .svx-art .sol, .svx-art .sh, .svx-art .f, .svx-art .g, .svx-art .ln2 { transition: none !important; }
  .svx-card.lit .svx-front .svx-turn .ti { transform: none; }
  html.js .svx-card.flipped .svx-list li { animation: none; }
}
