/* ROBOCZA, NIEOPUBLIKOWANA — nowa odsłona OdkryjSudety.pl.
   Zdjęcia i filmy miejsc (DESIGN.md: The Puzzle Rule): galeria „puzzle” wizytówki, „Zobacz więcej”,
   rząd filmów, mikrogaleria punktu na trasie i warstwa z galerią miejsca (nowa-galeria.js). */

/* ---------- Puzzle: rzędy o wspólnej wysokości, zdjęcia we własnych proporcjach ----------
   Kafel rośnie proporcjonalnie do --r (szerokość/wysokość) od zera, więc w wierszu wszystkie kafle mają
   tę samą wysokość. Wiersze łamią znaczniki z serwera (_galeria.php), każdy aktywny tylko w swoim progu;
   luka --g zostawia ostatni rząd węższym, gdy na całą szerokość byłby za wysoki. */
.n-galeria-pas { margin: var(--n-6) 0 0; }
.n-galeria-pas .n-sekcja-tytul { margin-bottom: var(--n-3); }
.n-puzzle { --luz: 6px; display: flex; flex-wrap: wrap; align-items: flex-start; column-gap: var(--luz); }
.n-puzzle-el { position: relative; flex: var(--r) 1 0; min-width: 0; aspect-ratio: var(--r); margin: 0 0 var(--luz); }
.n-puzzle-el--wiecej { display: none; }
#zdjecia:target .n-puzzle-el--wiecej, .n-galeria-pas.is-otwarta .n-puzzle-el--wiecej { display: block; }
.n-puzzle-x, .n-puzzle-luka { display: none; height: 0; }
@media (max-width: 699.98px) {
  .n-puzzle { --luz: 4px; }
  .n-puzzle-x--m { display: block; flex: 0 0 100%; }
  .n-puzzle-luka--m { display: block; flex: var(--g) 1 0; }
}
@media (min-width: 700px) and (max-width: 999.98px) {
  .n-puzzle-x--t { display: block; flex: 0 0 100%; }
  .n-puzzle-luka--t { display: block; flex: var(--g) 1 0; }
}
@media (min-width: 1000px) {
  .n-puzzle-x--d { display: block; flex: 0 0 100%; }
  .n-puzzle-luka--d { display: block; flex: var(--g) 1 0; }
}
.n-puzzle-przycisk {
  display: block; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 4px; overflow: hidden;
  background: var(--n-ekran-ciemny); cursor: zoom-in;
}
/* width/height z atrybutów img dają proporcje przed wczytaniem; kafel i tak wypełnia się całym zdjęciem. */
.n-puzzle-przycisk img { display: block; width: 100%; height: 100%; object-fit: cover; }
.n-puzzle-przycisk:focus-visible { outline: 3px solid var(--n-fokus); outline-offset: 2px; }
.n-puzzle-el:focus-within { z-index: 1; }
.n-puzzle-el .foto-znak { position: absolute; top: 6px; left: 6px; margin: 0; pointer-events: none; }
/* Podpis bez linków: po wskazaniu albo fokusie, skokowo (Refresh Rule); pełny z linkami w powiększeniu i w spisie. */
.n-puzzle-podpis {
  position: absolute; left: 4px; right: 4px; bottom: 4px; visibility: hidden; pointer-events: none;
  padding: 4px 8px; border-radius: 4px; background: rgb(21 26 24 / 0.82); color: var(--n-ekran-jasny);
  font: 500 12.5px/1.3 var(--n-font-tekst); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.n-puzzle-el:focus-within .n-puzzle-podpis { visibility: visible; }
@media (hover: hover) { .n-puzzle-el:hover .n-puzzle-podpis { visibility: visible; } }

/* ---------- „Zobacz więcej” (zdjęcia i filmy): wyraźny przycisk pod siatką ---------- */
.n-wiecej-pas { display: flex; justify-content: center; margin: var(--n-3) 0 0; }
.n-wiecej {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 52px; padding: 0 22px 0 26px;
  border: var(--n-linia) solid var(--n-tusz); border-radius: var(--n-r); background: var(--n-ekran-jasny); color: var(--n-tusz);
  font: 600 18px/1.1 var(--n-font-dane); font-stretch: 92%; text-decoration: none; cursor: pointer;
}
.n-wiecej:hover { background: var(--n-tusz); color: var(--n-ekran-jasny); }
.n-wiecej:focus-visible { outline: 3px solid var(--n-fokus); outline-offset: 2px; }
.n-wiecej-ile {
  display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 28px; padding: 0 9px;
  border-radius: 14px; background: var(--n-tusz); color: var(--n-ekran-jasny); font: 600 15px/1 var(--n-font-dane); font-variant-numeric: tabular-nums;
}
.n-wiecej:hover .n-wiecej-ile { background: var(--n-ekran-jasny); color: var(--n-tusz); }
#zdjecia:target .n-wiecej-pas, .n-galeria-pas.is-otwarta .n-wiecej-pas,
#filmy:target .n-wiecej-pas, .n-filmy-pas.is-otwarta .n-wiecej-pas { display: none; }
@media (max-width: 699.98px) { .n-wiecej { width: 100%; } }

/* Nota i spis autorów i licencji pod galerią (pełne podpisy z linkami; numer = kolejność zdjęcia). */
.n-galeria-stopka { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: var(--n-4); margin: var(--n-2) 0 0; }
.n-galeria-nota { margin: 0; font-size: 14px; color: var(--n-tusz-2); }
.n-galeria-autorzy { flex: 1 1 100%; font-size: 13.5px; color: var(--n-tusz-2); }
.n-galeria-autorzy:not([open]) { flex: 0 1 auto; }
.n-galeria-autorzy summary { cursor: pointer; display: inline-flex; align-items: center; min-height: 44px; font: 600 15px var(--n-font-dane); color: var(--n-tusz); text-decoration: underline; text-underline-offset: 3px; }
.n-galeria-autorzy ol { margin: 0 0 var(--n-2); padding-left: 2.2em; columns: 2 320px; column-gap: var(--n-6); }
.n-galeria-autorzy li { break-inside: avoid; padding: 2px 0; }
.n-galeria-autorzy .foto-znak { font-size: 10.5px; padding: 3px 5px; }

/* ---------- Filmy: jeden rząd miniatur 16:9 (telefon 2, tablet 4, komputer 5), reszta pod „Zobacz więcej” ----------
   Hooki main.js zostają: .video[data-video-id], role="button", tabindex, .video-title. */
.n-filmy-pas { margin: var(--n-6) 0 0; }
.n-filmy-pas .n-sekcja-tytul { margin-bottom: var(--n-3); }
.n-filmy { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--n-4) var(--n-3); }
.n-filmy > li:nth-child(n+3) { display: none; }
.n-filmy-pas .n-wiecej-pas, .n-wiecej-ile--t, .n-wiecej-ile--d { display: none; }
.n-filmy-pas--m .n-wiecej-pas { display: flex; }
@media (min-width: 700px) {
  .n-filmy { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .n-filmy > li:nth-child(-n+4) { display: block; }
  .n-filmy-pas .n-wiecej-pas, .n-wiecej-ile--m { display: none; }
  .n-filmy-pas--t .n-wiecej-pas { display: flex; }
  .n-wiecej-ile--t { display: inline-flex; }
}
@media (min-width: 1000px) {
  .n-filmy { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--n-4); }
  .n-filmy > li:nth-child(5) { display: block; }
  .n-filmy-pas--t .n-wiecej-pas, .n-wiecej-ile--t { display: none; }
  .n-filmy-pas--d .n-wiecej-pas { display: flex; }
  .n-wiecej-ile--d { display: inline-flex; }
}
#filmy:target .n-filmy > li, .n-filmy-pas.is-otwarta .n-filmy > li { display: block; }
#filmy:target .n-wiecej-pas, .n-filmy-pas.is-otwarta .n-wiecej-pas { display: none; }
.n-film { display: grid; gap: 8px; cursor: pointer; border-radius: var(--n-r); }
.n-film:focus-visible { outline: 3px solid var(--n-fokus); outline-offset: 3px; }
.n-film-kadr { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; border: var(--n-linia-2) solid var(--n-tusz); border-radius: var(--n-r); background: var(--n-ekran-ciemny); }
.n-film-miniatura { width: 100%; height: 100%; object-fit: cover; }
.n-film-play {
  position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; transform: translate(-50%, -50%);
  display: flex; align-items: center; justify-content: center; border-radius: 50%;
  background: var(--n-ekran-jasny); color: var(--n-tusz); border: var(--n-linia) solid var(--n-tusz);
}
.n-film-play svg { margin-left: 3px; width: 22px; height: 22px; }
.n-film:hover .n-film-play, .n-film:focus-visible .n-film-play { background: var(--n-tusz); color: var(--n-ekran-jasny); }
.n-film-czas { position: absolute; right: 6px; bottom: 6px; padding: 2px 6px; border-radius: 4px; background: var(--n-tusz); color: var(--n-ekran-jasny); font: 600 12.5px/1.3 var(--n-font-dane); font-variant-numeric: tabular-nums; }
.n-film-tekst { display: grid; gap: 2px; padding: 0 2px; }
.n-film .video-title { font: 560 16px/1.3 var(--n-font-dane); font-stretch: 96%; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.n-film:hover .video-title { text-decoration: underline; }
.n-film-meta { font-size: 14px; color: var(--n-tusz-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 699.98px) {
  .n-film-play { width: 40px; height: 40px; }
  .n-film-play svg { width: 18px; height: 18px; }
  .n-film .video-title { font-size: 15px; }
  .n-film-meta { font-size: 13.5px; }
}

/* ---------- Mikrogaleria punktu na trasie: duża miniatura i dwie małe, „+N” na ostatniej ---------- */
.n-mikro { display: grid; gap: 4px; width: 248px; height: 116px; grid-template-columns: 156px minmax(0, 1fr); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.n-mikro--1 { width: 156px; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.n-mikro--2 .n-mikro-el--2 { grid-row: 1 / -1; }
.n-mikro-el--1 { grid-row: 1 / -1; }
.n-mikro-el { position: relative; display: block; min-height: 0; border-radius: 4px; overflow: hidden; background: var(--n-ekran-ciemny); cursor: zoom-in; }
.n-mikro-el img { display: block; width: 100%; height: 100%; object-fit: cover; }
.n-mikro-el:hover img { filter: brightness(0.92); }
.n-mikro-el:focus-visible { outline: 3px solid var(--n-fokus); outline-offset: 2px; }
.n-mikro-wiecej {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgb(21 26 24 / 0.6); color: var(--n-ekran-jasny); font: 600 18px/1 var(--n-font-dane); font-variant-numeric: tabular-nums;
}

/* ---------- Warstwa z galerią miejsca (nowa-galeria.js): zasłona z tuszu, zdjęcie w całości ---------- */
.n-warstwa {
  position: fixed; inset: 0; z-index: 1200; display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  background: rgb(14 18 15 / 0.97); color: var(--n-ekran-jasny); --n-fokus: var(--n-zolc);
}
.n-warstwa[hidden] { display: none; }
.n-warstwa-gora { display: flex; align-items: center; gap: var(--n-4); padding: 12px clamp(12px, 3vw, 28px); }
.n-warstwa-naglowek { flex: 1; min-width: 0; }
.n-warstwa-tytul { margin: 0; font: 600 21px/1.2 var(--n-font-dane); font-stretch: 92%; color: #fff; }
.n-warstwa-opis { margin: 2px 0 0; font-size: 14.5px; color: #cfd8d1; }
.n-warstwa-licznik { margin: 0; font: 600 16px var(--n-font-dane); font-variant-numeric: tabular-nums; color: #cfd8d1; white-space: nowrap; }
.n-warstwa button { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; flex: none; padding: 0; border-radius: 50%; border: 2px solid var(--n-ekran-jasny); background: rgb(14 18 15 / 0.55); color: var(--n-ekran-jasny); cursor: pointer; }
.n-warstwa button:hover { background: var(--n-ekran-jasny); color: var(--n-tusz); }
.n-warstwa button:focus-visible, .n-warstwa a:focus-visible { outline: 3px solid var(--n-zolc); outline-offset: 2px; }
.n-warstwa button .ikx { width: 22px; height: 22px; }
.n-warstwa-scena { position: relative; display: grid; place-items: center; min-height: 0; padding: 0 76px; touch-action: pan-y pinch-zoom; }
.n-warstwa-figura { margin: 0; display: grid; justify-items: center; gap: 10px; max-width: 100%; max-height: 100%; min-height: 0; grid-template-rows: minmax(0, 1fr) auto; height: 100%; }
.n-warstwa-obraz { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; align-self: center; border-radius: 6px; background: rgb(255 255 255 / 0.04); }
.n-warstwa-podpis { max-width: min(760px, 100%); padding: 6px 10px; border-radius: var(--n-r); background: var(--n-ekran-jasny); color: var(--n-tusz); font-size: 13.5px; line-height: 1.4; text-align: center; }
.n-warstwa-podpis:empty { display: none; }
.n-warstwa-podpis .foto-znak { font-size: 10.5px; padding: 3px 5px; vertical-align: 1px; }
.n-warstwa-poprz, .n-warstwa-nast { position: absolute; top: 50%; translate: 0 -50%; }
.n-warstwa .n-warstwa-poprz { left: clamp(10px, 2vw, 24px); }
.n-warstwa .n-warstwa-nast { right: clamp(10px, 2vw, 24px); }
.n-warstwa-dol { display: flex; align-items: center; justify-content: center; gap: var(--n-4); flex-wrap: wrap; padding: 12px clamp(12px, 3vw, 28px) 16px; }
.n-warstwa-miniatury { display: flex; gap: 6px; max-width: 100%; overflow-x: auto; padding: 3px; scrollbar-width: thin; }
.n-warstwa .n-warstwa-mini { width: 56px; height: 56px; border-radius: 4px; border: 2px solid transparent; background: none; overflow: hidden; opacity: 0.62; }
.n-warstwa .n-warstwa-mini:hover { background: none; opacity: 1; }
.n-warstwa .n-warstwa-mini[aria-current="true"] { opacity: 1; border-color: var(--n-zolc); }
.n-warstwa-mini img { width: 100%; height: 100%; object-fit: cover; }
.n-warstwa-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 2px solid var(--n-ekran-jasny); border-radius: var(--n-r); color: var(--n-ekran-jasny); font: 600 16px var(--n-font-dane); text-decoration: none; white-space: nowrap; }
.n-warstwa-link:hover { background: var(--n-ekran-jasny); color: var(--n-tusz); }
.n-warstwa-link .ikx { width: 18px; height: 18px; }
.n-warstwa--jedno .n-warstwa-poprz, .n-warstwa--jedno .n-warstwa-nast, .n-warstwa--jedno .n-warstwa-miniatury, .n-warstwa--jedno .n-warstwa-licznik { display: none; }
@media (max-width: 699.98px) {
  .n-warstwa-gora { padding: 8px 10px 8px 14px; gap: var(--n-3); }
  .n-warstwa-tytul { font-size: 18px; }
  .n-warstwa-opis { font-size: 13.5px; }
  .n-warstwa-scena { padding: 0 6px; }
  .n-warstwa .n-warstwa-poprz, .n-warstwa .n-warstwa-nast { top: auto; bottom: 46px; translate: none; width: 44px; height: 44px; }
  .n-warstwa .n-warstwa-poprz { left: 10px; }
  .n-warstwa .n-warstwa-nast { right: 10px; }
  .n-warstwa .n-warstwa-mini { width: 48px; height: 48px; }
  .n-warstwa-dol { padding: 8px 10px 12px; gap: var(--n-2); }
}
