/* Primul ecran „Mozaicul viu” (prim-ecran-mozaic-viu.html), 16 nov 2026: plăci pe un rost închis; în stânga un roi de tessere mici care
   se adună pe rând în fotografiile comunei, în mijloc stema cu numele (îngustă, ca la Mozaic), în dreapta scena unde tesserele
   se adună singure în hartă, stemă și BREBU; fără butoane. Scrisă de mână; se încarcă doar pe pagina ei. Fără clasa pe-js pe <html> (fără script sau cu „fără mișcare”) scena arată harta ca mozaic SVG și nimic nu se mișcă. */
.xv { --mh: clamp(310px, calc(100vh - 340px), 660px); --mg: 6px; --sh: clamp(110px, min(calc(var(--mh) * .4), 17vw), 260px);
  --rost: color-mix(in srgb, var(--ac-i) 52%, #06080c); --scena: color-mix(in srgb, var(--ac-i) 70%, #020306);
  position: relative; height: var(--mh); padding: var(--mg); display: grid; gap: var(--mg); overflow: clip;
  /* stânga (roiul fotografiilor) și dreapta (scena) au aceeași lățime, ca numele să stea chiar pe centrul ecranului; mijlocul e mai îngust */
  grid-template-columns: minmax(0, 1fr) minmax(0, .72fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); background: var(--rost); }
.xv ~ .scurt { padding-top: 14px; }
.xv-t { position: relative; min-width: 0; min-height: 0; margin: 0; border-radius: 8px; overflow: hidden; }
.xv-rs { grid-area: 1 / 1 / 2 / 2; }
html.pe-js .xv-rs { cursor: pointer; }   /* 24 nov, noaptea: clicul sau atingerea aduce fotografia următoare (pe-mozviu.js) */
.xv-id { grid-area: 1 / 2 / 2 / 3; }
.xv-sc { grid-area: 1 / 3 / 2 / 4; }

/* placa numelui, în mijloc, ca la Mozaic: stema mare deasupra, numele dedesubt; culoarea site-ului, cu un desen de tessere abia văzut */
.xv-id { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(14px, calc(var(--mh) * .05), 30px);
  padding: 16px 22px; background: var(--ac); color: #fff; text-align: center; }
.xv-id::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background: linear-gradient(90deg, rgb(0 0 0 / .14) 1px, transparent 1px) 0 0 / 15px 15px, linear-gradient(rgb(0 0 0 / .14) 1px, transparent 1px) 0 0 / 15px 15px; }
.xv-st { position: relative; flex: none; }
.xv .st3 { --h: var(--sh); margin: 0; }
.xv .st3-g { opacity: .35; }
.xv-nume { position: relative; min-width: 0; }
.xv-nume h1 { margin: 0; font: 700 clamp(22px, 2.5vw, 36px)/1.26 var(--titlu); letter-spacing: .02em; color: #fff; text-wrap: balance; }
.xv-jud { margin: 10px 0 0; font-size: 17px; font-weight: 500; letter-spacing: .01em; color: #fff; }
.xv-sate { margin: 14px auto 0; padding-top: 12px; max-width: 34ch; border-top: 1px solid rgb(255 255 255 / .4); font-size: 15px; line-height: 1.5; color: #fff; text-wrap: balance; }
@media (prefers-reduced-motion: no-preference) {
  .xv .st3-c { animation: none; }
  .xv .st3-b { animation: xv-leagana 9s ease-in-out 2.6s infinite; }
}
@keyframes xv-leagana { 25% { transform: perspective(calc(var(--h) * 2.7)) rotateY(10deg) rotateX(3deg); } 75% { transform: perspective(calc(var(--h) * 2.7)) rotateY(-10deg) rotateX(-1deg); } }

/* stânga: fără script, prima fotografie, lată, pe fondul închis; cu script, roiul o desenează (imaginea rămâne doar pentru
   culorile de la intrare) */
.xv-rs > img { position: absolute; z-index: 1; left: 1.5%; top: 50%; width: 97%; height: auto; max-height: 94%; aspect-ratio: 1.9; object-fit: cover; translate: 0 -50%; border-radius: 4px; }
html.pe-js .xv-rs > img { visibility: hidden; }

/* scenele (dreapta și stânga): fondul închis pe care se adună tesserele */
.xv-sc, .xv-rs { background: var(--scena); }
.xv-sc::before, .xv-rs::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 60% 70% at 50% 50%, color-mix(in srgb, var(--ac) 34%, transparent), transparent 78%); }
/* pardoseala scenei: o grilă de tessere abia văzută */
.xv-sc::after, .xv-rs::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .55;
  background: linear-gradient(90deg, rgb(255 255 255 / .05) 1px, transparent 1px) 0 0 / 22px 22px, linear-gradient(rgb(255 255 255 / .05) 1px, transparent 1px) 0 0 / 22px 22px; }

/* fără script: harta ca mozaic SVG, cu numele satelor și creditul */
.xv-fb { position: absolute; inset: 4% 4% 4%; display: flex; align-items: center; justify-content: center; }
html.pe-js .xv-fb { display: none; }
.xv-fb-h { position: relative; height: 100%; max-width: 100%; }
.xv-fb-h svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.xv-fb-h ul { list-style: none; margin: 0; padding: 0; }
.xv-m-hot { fill: color-mix(in srgb, var(--ac) 18%, #fff); }
.xv-m-rau { fill: color-mix(in srgb, var(--ac) 45%, #fff); }
.xv-m-drum { fill: #f2d6a2; }
/* satele: un punct alb pe locul satului și numele scris cu alb lângă el, fără fundal (umbra îl ține citeț peste hartă) */
.xv-fs, .xv-sat { position: absolute; z-index: 5; margin-top: -11px; padding: 0 0 0 12px; background: none; color: #fff;
  font-size: 17px; font-weight: 700; line-height: 22px; white-space: nowrap; pointer-events: none;
  text-shadow: 0 1px 2px rgb(0 0 0 / .9), 0 0 10px rgb(0 0 0 / .75), 0 0 3px rgb(0 0 0 / .8); }
.xv-fs::before, .xv-sat::before { content: ""; position: absolute; left: -3px; top: 8px; width: 6px; height: 6px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 2px rgb(0 0 0 / .5), 0 1px 3px rgb(0 0 0 / .5); }
.xv-fs-st, .xv-sat-st { translate: calc(-100% + 3px) 0; padding: 0 12px 0 0; }
.xv-fs-st::before, .xv-sat-st::before { left: auto; right: 0; }

/* deasupra plăcilor: canvasul cu tesserele, fotografia care se limpezește și numele satelor */
.xv-cv { display: none; position: absolute; z-index: 4; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }
html.pe-js .xv-cv { display: block; }
.xv-poza { display: none; position: absolute; z-index: 5; left: 0; top: 0; margin: 0; border-radius: 8px; overflow: hidden; background: #24262c; opacity: 0; transition: opacity .9s cubic-bezier(.4, 0, .2, 1); pointer-events: none; }
.xv-poza-st { border-radius: 4px; }
html.pe-js .xv-poza { display: block; }
.xv-poza img { display: block; width: 100%; height: 100%; object-fit: cover; }
.xv.xv-limpede-st .xv-poza-st { opacity: 1; }
.xv.xv-iese-st .xv-poza-st { opacity: 0; transition-duration: .35s; }

.xv-sate-et { display: none; list-style: none; margin: 0; padding: 0; }
html.pe-js .xv-sate-et { display: block; }
.xv-sat { left: 0; top: 0; opacity: 0; transition: opacity .6s ease; }
.xv.xv-ad .xv-sat { opacity: 1; }

/* 19 nov, seara: harta limpede, în straturi, care se înclină în 3D după ce tesserele s-au adunat (pe-mozviu.js pune clasele și locul ei).
   Fazele: .xv-3d-da = harta limpede se aprinde peste tessere (plată, exact pe locul lor); .xv-3d-inclin = se înclină, satele și pădurea ies în
   relief; fără .xv-3d-inclin se întoarce plată, apoi fără .xv-3d-da se stinge și tesserele se sparg spre desenul următor. */
.xv-3d { display: none; position: absolute; z-index: 5; left: 0; top: 0; pointer-events: none; perspective: 1200px; opacity: 0; transition: opacity .4s ease; }
html.pe-js .xv-3d { display: block; }
.xv.xv-3d-da .xv-3d { opacity: 1; }
.xv-3d-in { position: absolute; inset: 0; transform-style: preserve-3d; transform-origin: 50% 50%;
  transition: transform .8s cubic-bezier(.33, .1, .2, 1); }
.xv.xv-3d-inclin .xv-3d-in { transform: rotateX(40deg) rotateZ(-10deg) scale(1.08); }
.xv-3d-l { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; transform: translateZ(var(--z)); backface-visibility: hidden; }
.xv-3d-gros { filter: blur(var(--b, 0px)) brightness(var(--l, .42)) saturate(.85); }
.xv-3d-pd.xv-3d-gros { filter: brightness(.55); }
.xv-3d-st.xv-3d-gros { filter: blur(var(--b, 0px)) brightness(var(--l, .5)) saturate(1.1); }
.xv-3d-sus { filter: drop-shadow(0 0 1.5px rgb(0 0 0 / .35)); }
/* pinii satelor (19 nov, noaptea): punctul cu numele stă ridicat deasupra satului (translateZ), întors spre om; tija e o linie în
   planul numelui, din punct până jos în sat (înălțimea ridicării × sin(înclinare)). O tijă 3D adevărată, perpendiculară pe planșă,
   taie planul numelui și Chrome îl desenează pe jumătate, de aceea e desenată așa. Plată, harta nu arată pinul: se ridică odată cu înclinarea. */
/* 20 nov (Tudor): fără tijă; un punct mic culcat chiar pe fața satului, iar numele lângă el, întors spre om și adus puțin spre el
   (translateZ la urmă), ca să stea în fața plăcilor: o etichetă care le atinge Chrome o desenează tăiată */
.xv-3d-pin { position: absolute; width: 0; height: 0; transform-style: preserve-3d; }
.xv-3d-pct { position: absolute; left: -3px; top: -3px; width: 6px; height: 6px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1.5px rgb(0 0 0 / .5);
  opacity: 0; transform: translateZ(18.6px); transition: opacity .4s ease; }
.xv.xv-3d-inclin .xv-3d-pct { opacity: 1; }
.xv-3d-cap { position: absolute; width: 0; height: 0; opacity: 0; transform: translateZ(18px); transition: transform 1.1s cubic-bezier(.33, .1, .2, 1), opacity .4s ease; }
.xv.xv-3d-inclin .xv-3d-cap { opacity: 1; transform: translateZ(19px) rotateZ(10deg) rotateX(-40deg) translateZ(24px); }
.xv-3d-cap > span { position: absolute; left: 0; top: -12px; padding-left: 8px; color: #fff; font-size: 17px; font-weight: 700; line-height: 24px; white-space: nowrap;
  text-shadow: 0 1px 2px rgb(0 0 0 / .9), 0 0 10px rgb(0 0 0 / .75), 0 0 3px rgb(0 0 0 / .8); }
.xv-3d-pin-st .xv-3d-cap > span { left: auto; right: 0; padding: 0 8px 0 0; }
/* cu 3D, numele plate de pe tessere nu se mai arată deloc: satele apar doar pe pini (fără script sau fără 3D rămân) */
.xv.xv-h3 .xv-sat { opacity: 0; transition-duration: .3s; }
@media (max-width: 760px) {
  .xv-3d-cap > span { font-size: 15px; }
  .xv.xv-3d-inclin .xv-3d-in { transform: rotateX(38deg) rotateZ(-8deg) scale(1.04); }
  .xv.xv-3d-inclin .xv-3d-cap { transform: translateZ(19px) rotateZ(8deg) rotateX(-38deg) translateZ(24px); }
}

/* colțul machetei: butonul care pornește din nou intrarea */
#pe-reia { padding: 6px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--ac-i); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--ac) 46%, #fff); }
#pe-reia:hover { background: var(--f); }
html:not(.pe-js) #pe-reia { display: none; }

/* ---------------------------------------------------------------- intrarea (doar cu pe-js): tesserele pleacă de pe plăci, iar plăcile
   apar în urma lor, de la stânga la dreapta (întârzierea fiecăreia e --d, pusă din Python) */
html.pe-js .xv-t { animation: xv-apare .62s cubic-bezier(.2, .7, .2, 1) var(--d, .5s) backwards; }
html.pe-js .xv-nume { animation: xv-urca .7s cubic-bezier(.16, 1, .3, 1) calc(var(--d, .5s) + .22s) backwards; }
@keyframes xv-apare { from { opacity: 0; transform: scale(.97); filter: blur(6px); } }
@keyframes xv-urca { from { opacity: 0; translate: 0 14px; } }

/* 20 nov: totemul de la intrarea în comună, al patrulea desen al roiului (pe-mozviu.js pune locul și clasa .xv-tot-da). După adunare,
   imaginea adevărată se aprinde peste tessere și se ridică puțin spre om; stă ușor aplecată, se leagănă abia văzut, se întoarce după cursor
   (--ry, --rx), o lumină trece peste steagul lucios (doar pe forma totemului: masca e chiar imaginea), iar dedesubt are umbra pe scenă. */
.xv-totem, .xv-stema, .xv-brebu { display: none; position: absolute; z-index: 5; left: 0; top: 0; margin: 0; pointer-events: none; perspective: 1100px;
  opacity: 0; transition: opacity .7s cubic-bezier(.4, 0, .2, 1); }
html.pe-js .xv-totem, html.pe-js .xv-stema, html.pe-js .xv-brebu { display: block; }
.xv.xv-tot-da .xv-totem, .xv.xv-stm-da .xv-stema, .xv.xv-brb-da .xv-brebu { opacity: 1; }
.xv-totem::before { content: ""; position: absolute; left: 4%; right: 4%; bottom: -3.5%; height: 9%; border-radius: 50%;
  background: radial-gradient(closest-side, rgb(0 0 0 / .55), transparent); filter: blur(4px); transform: scaleX(.86); transition: transform 1.1s ease; }
.xv.xv-tot-da .xv-totem::before { transform: scaleX(1); }
.xv-totem-in { position: absolute; inset: 0; transform-origin: 50% 88%;
  transform: rotateX(var(--rx, 3deg)) rotateY(var(--ry, -7deg)) translateZ(0) scale(.96);
  transition: transform 1.1s cubic-bezier(.22, .9, .3, 1); }
.xv.xv-tot-da .xv-totem .xv-totem-in, .xv.xv-stm-da .xv-stema .xv-totem-in, .xv.xv-brb-da .xv-brebu .xv-totem-in { transform: rotateX(var(--rx, 3deg)) rotateY(var(--ry, -7deg)) translateZ(26px) scale(1); }
/* 22 nov: stema nu stă pe pământ ca totemul: fără umbra de dedesubt, se întoarce în jurul mijlocului, privită aproape din față */
.xv-stema .xv-totem-in, .xv-brebu .xv-totem-in { transform-origin: 50% 50%; transform: rotateX(var(--rx, 2deg)) rotateY(var(--ry, -5deg)) translateZ(0) scale(.96); }
.xv.xv-stm-da .xv-stema .xv-totem-in, .xv.xv-brb-da .xv-brebu .xv-totem-in { transform: rotateX(var(--rx, 2deg)) rotateY(var(--ry, -5deg)) translateZ(26px) scale(1); }
.xv-totem img, .xv-stema img, .xv-brebu img { display: block; width: 100%; height: 100%; filter: drop-shadow(0 10px 14px rgb(0 0 0 / .45)) saturate(1.05); }
.xv-totem-luc { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: soft-light; opacity: 0;
  -webkit-mask: var(--masca) center / 100% 100% no-repeat; mask: var(--masca) center / 100% 100% no-repeat;
  background: linear-gradient(112deg, transparent 38%, rgb(255 255 255 / .95) 48%, rgb(255 255 255 / .2) 53%, transparent 60%) 0 0 / 300% 100% no-repeat; }
.xv.xv-tot-da .xv-totem .xv-totem-luc, .xv.xv-stm-da .xv-stema .xv-totem-luc, .xv.xv-brb-da .xv-brebu .xv-totem-luc { animation: xv-tot-luc 2.4s cubic-bezier(.45, 0, .3, 1) .4s infinite; }
.xv.xv-tot-da .xv-totem, .xv.xv-stm-da .xv-stema, .xv.xv-brb-da .xv-brebu { animation: xv-tot-leagan 6s ease-in-out .9s infinite alternate; }
/* oprit: aceeași greutate ca regulile de mai sus (patru clase), scrisă după ele */
.xv.xv-oprit .xv-totem, .xv.xv-oprit .xv-stema, .xv.xv-oprit .xv-brebu, .xv.xv-oprit .xv-totem .xv-totem-luc, .xv.xv-oprit .xv-stema .xv-totem-luc, .xv.xv-oprit .xv-brebu .xv-totem-luc { animation: none; }
@keyframes xv-tot-luc { 0% { opacity: 1; background-position: 100% 0; } 55%, 100% { opacity: 1; background-position: 0 0; } }
@keyframes xv-tot-leagan { from { translate: 0 0; } to { translate: 0 -5px; } }

/* ---------------------------------------------------------------- ferestre scunde: plăcile sunt joase, deci mai strânse */
@media (min-width: 901px) and (max-height: 790px) {
  .xv-id { gap: 12px; padding: 12px 18px; }
  .xv-sate { margin-top: 8px; padding-top: 7px; }
  .xv-jud { margin-top: 6px; }
}
@media (min-width: 901px) and (max-height: 740px) {
  .xv-sate { display: none; }
}

/* ---------------------------------------------------------------- lățimi mai mici */
@media (max-width: 1100px) {
  .xv { --sh: clamp(96px, min(calc(var(--mh) * .36), 17vw), 180px); grid-template-columns: minmax(0, 1fr) minmax(0, .9fr) minmax(0, 1fr); }
  .xv-id { gap: 14px; padding: 12px 14px; }
  .xv-nume h1 { font-size: clamp(20px, 2.6vw, 27px); }
  .xv-jud { margin-top: 6px; font-size: 15px; }
  .xv-sate { font-size: 14px; }
  .xv-fs, .xv-sat { font-size: 15px; }
}
/* telefon și tabletă îngustă: numele sus, scena pe toată lățimea, fotografiile dedesubt */
@media (max-width: 900px) {
  .xv { --sh: 96px; height: auto; grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  /* 30 nov (Tudor): pe telefon, ordinea e scena (harta, stema, BREBU) sus, numele cu stema la mijloc, fotografiile jos; stema și numele pe mijlocul plăcii */
  .xv-id { grid-area: 2 / 1; flex-direction: row; justify-content: center; gap: 16px; padding: 14px 16px; text-align: center; }
  .xv-nume { flex: 0 1 auto; max-width: 200px; }
  .xv-nume h1 { font-size: 22px; }
  .xv-sate { display: none; }
  /* 29 nov (telefon): scena și fotografiile mai scunde, ca primul ecran să arate și banda de anunțuri și scurtăturile */
  .xv-sc { grid-area: 1 / 1; height: 330px; height: clamp(190px, 30svh, 330px); }
  .xv-rs { grid-area: 3 / 1; height: 270px; height: clamp(150px, 22svh, 270px); }
}
