/* ============================================================
   Žij svůj pohyb — galerie.css
   Fotogalerie s alby. Navazuje na base.css (paleta „Teplá broskev").
   Komponenty: hero, přepínač pohledů, alba se „stohem papírů" a
   organickým blob tvarem obálky, masonry mřížka fotek, lightbox.
   ============================================================ */

.hide { display: none !important; }

/* ---------- HERO ---------- */
.gal-hero {
  position: relative; z-index: 2; overflow: hidden;
  text-align: center; padding: 116px 24px 44px;
}
.gal-hero .blob { position: absolute; border-radius: 50%; filter: blur(70px); pointer-events: none; z-index: 0; }
.gal-hero-inner { position: relative; z-index: 2; }
.gal-hero .kicker { font-size: 24px; }
.gal-hero h1 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(52px, 9vw, 104px); line-height: 0.98; letter-spacing: -0.02em;
  margin: 8px 0 20px;
}
.gal-hero h1 em { font-family: var(--font-script); font-style: italic; color: var(--terra); }
.gal-hero p { font-size: 17px; color: var(--ink-soft); max-width: 520px; margin: 0 auto; line-height: 1.6; }
.gal-stats { display: flex; justify-content: center; gap: 36px; margin-top: 30px; }
.gal-stats .stat .n { font-family: var(--font-display); font-size: 34px; color: var(--terra-deep); line-height: 1; }
.gal-stats .stat .l { font-size: 12.5px; color: var(--ink-soft); margin-top: 5px; }

/* ---------- View toggle ---------- */
.gal-views { position: relative; z-index: 2; display: flex; justify-content: center; gap: 8px; padding: 6px 24px 36px; }
.view-btn {
  font-family: var(--font-sans); font-size: 14px; font-weight: 600; cursor: pointer;
  padding: 13px 26px; border-radius: 999px; border: 1.5px solid var(--rule);
  background: rgba(255,255,255,0.6); color: var(--ink-soft); transition: all .2s;
}
.view-btn:hover { border-color: var(--terra); color: var(--terra-deep); }
.view-btn.active { background: var(--ink); color: var(--cream); border-color: var(--ink); }

/* ---------- Stav: spinner / chyba ---------- */
.gal-state { position: relative; z-index: 2; min-height: 120px; display: flex; justify-content: center; padding: 0 24px 40px; }
.gal-spinner { display: flex; flex-direction: column; align-items: center; gap: 16px; color: var(--ink-soft); }
.gal-spinner .ring {
  width: 46px; height: 46px; border-radius: 50%;
  border: 3px solid var(--peach); border-top-color: var(--terra-deep);
  animation: gal-spin .8s linear infinite;
}
.gal-spinner .txt { font-family: var(--font-script); font-style: italic; font-size: 17px; color: var(--terra-deep); }
@keyframes gal-spin { to { transform: rotate(360deg); } }
.gal-error {
  font-family: var(--font-display); font-size: 22px; color: var(--terra-deep);
  text-align: center; padding: 20px 24px; line-height: 1.4;
}

/* ============================================================
   Alba (složky se „stohem papírů")
   ============================================================ */
.gal-albums {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 34px 26px;
  padding: 10px 48px 80px; max-width: 1320px; margin: 0 auto;
}
.album { cursor: pointer; position: relative; opacity: 0; transform: translateY(28px); transition: opacity .7s ease, transform .7s ease; }
.album.in { opacity: 1; transform: translateY(0); }

/* stoh papírů pod obálkou */
.album .stack { position: relative; aspect-ratio: 4/3; }
.album .stack .layer {
  position: absolute; inset: 0; border-radius: 46% 54% 50% 50% / 52% 47% 53% 48%; background: #fff;
  box-shadow: 0 6px 20px rgba(58,42,32,0.10); transition: transform .35s ease;
}
.album .stack .l1 { transform: rotate(-3deg) translateY(6px); background: var(--cream-deep); }
.album .stack .l2 { transform: rotate(2.2deg) translateY(3px); background: var(--peach); }
.album:hover .stack .l1 { transform: rotate(-5deg) translateY(8px); }
.album:hover .stack .l2 { transform: rotate(4deg) translateY(4px); }

/* obálka — organický blob, na hover do kruhu */
.album .cover {
  position: absolute; inset: 0; border-radius: 46% 54% 50% 50% / 52% 47% 53% 48%;
  overflow: hidden; box-shadow: 0 14px 36px rgba(58,42,32,0.16); transition: border-radius .45s ease;
}
.album:nth-child(2n) .cover, .album:nth-child(2n) .stack .layer { border-radius: 54% 46% 48% 52% / 47% 54% 46% 53%; }
.album:nth-child(3n) .cover, .album:nth-child(3n) .stack .layer { border-radius: 50% 50% 55% 45% / 56% 48% 52% 44%; }
.album:hover .cover { border-radius: 50%; }
.album .cover img { width: 100%; height: 100%; object-fit: cover; object-position: center 22%; transition: transform .5s ease; filter: saturate(0.92); }
.album:hover .cover img { transform: scale(1.05); }
.album .cover .shade { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 50%, rgba(35,21,16,0.55) 100%); }

/* pilulky na obálce */
.album .cover .cnt {
  position: absolute; top: 22px; right: 30px; padding: 7px 14px; border-radius: 999px;
  background: rgba(255,255,255,0.88); color: var(--terra-deep); font-size: 12.5px; font-weight: 700;
}
.album .cover .date {
  position: absolute; top: 22px; left: 30px; padding: 7px 14px; border-radius: 999px;
  background: rgba(35,21,16,0.55); color: var(--cream); font-family: var(--font-script); font-style: italic; font-size: 14px;
}
.album .cover .open {
  position: absolute; bottom: 26px; right: 34px; width: 42px; height: 42px; border-radius: 50%;
  background: var(--terra-deep); color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 17px; opacity: 0; transform: translateX(8px); transition: opacity .3s, transform .3s;
}
.album:hover .cover .open { opacity: 1; transform: translateX(0); }

.album .meta { padding: 18px 6px 0; }
.album .meta .t { font-family: var(--font-display); font-size: 27px; line-height: 1.05; transition: color .25s; }
.album:hover .meta .t { color: var(--terra-deep); }
.album .meta .d { font-family: var(--font-script); font-style: italic; font-size: 16px; color: var(--terra-deep); margin-top: 3px; }

/* ============================================================
   Detail alba
   ============================================================ */
.gal-section { position: relative; z-index: 2; }
.album-head {
  max-width: 1320px; margin: 0 auto; padding: 0 48px 26px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
.album-head .back {
  display: inline-flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 600;
  font-family: var(--font-sans); color: var(--ink); text-decoration: none; padding: 11px 22px; border-radius: 999px;
  border: 1.5px solid var(--rule); background: rgba(255,255,255,0.7); cursor: pointer; transition: all .2s;
}
.album-head .back:hover { border-color: var(--terra); color: var(--terra-deep); }
.album-head h2 { font-family: var(--font-display); font-weight: 400; font-size: 46px; letter-spacing: -0.015em; margin: 12px 0 2px; }
.album-head .sub { font-family: var(--font-script); font-style: italic; font-size: 19px; color: var(--terra-deep); }
.album-head .n { font-size: 13.5px; color: var(--ink-soft); padding-bottom: 8px; }

/* ============================================================
   Masonry mřížka fotek (CSS columns 4/3/2/1)
   ============================================================ */
.gal-grid { columns: 4; column-gap: 18px; padding: 0 48px 80px; max-width: 1500px; margin: 0 auto; }
.tile {
  break-inside: avoid; margin: 0 0 20px; border-radius: 58px 26px 58px 26px; overflow: hidden;
  position: relative; cursor: pointer; background: var(--cream-deep);
  opacity: 0; transform: translateY(28px);
  transition: opacity .7s ease, transform .7s ease, border-radius .4s ease;
}
.tile:nth-child(2n) { border-radius: 26px 58px 26px 58px; }
.tile:nth-child(5n) { border-radius: 58px 58px 26px 58px; }
.tile:hover { border-radius: 34px; }
.tile.in { opacity: 1; transform: translateY(0); }
.tile img { width: 100%; display: block; transition: transform .5s ease; }
.tile:hover img { transform: scale(1.05); }
.tile .veil {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 24px 28px; background: linear-gradient(180deg, transparent 55%, rgba(35,21,16,0.65) 100%);
  opacity: 0; transition: opacity .3s ease; color: var(--cream);
}
.tile:hover .veil { opacity: 1; }
.veil .t { font-family: var(--font-display); font-size: 22px; line-height: 1.15; }
.veil .c { font-family: var(--font-script); font-style: italic; font-size: 15px; color: var(--peach); margin-top: 2px; }

/* ============================================================
   Lightbox
   ============================================================ */
.lb { position: fixed; inset: 0; z-index: 300; background: rgba(35,21,16,0.92); display: none; align-items: center; justify-content: center; padding: 40px; }
.lb.open { display: flex; }
.lb img { max-width: min(1100px, 88vw); max-height: 82vh; border-radius: 40px 22px 40px 22px; box-shadow: 0 40px 120px rgba(0,0,0,0.5); }
.lb .cap { position: absolute; bottom: 34px; left: 0; right: 0; text-align: center; color: var(--cream); padding: 0 16px; }
.lb .cap .t { font-family: var(--font-display); font-size: 24px; }
.lb .cap .c { font-family: var(--font-script); font-style: italic; font-size: 16px; color: var(--peach); }
.lb .num { position: absolute; top: 34px; left: 0; right: 0; text-align: center; color: var(--cream); font-family: var(--font-script); font-style: italic; font-size: 16px; opacity: 0.7; }
.lb .x { position: absolute; top: 26px; right: 32px; width: 48px; height: 48px; border-radius: 50%; border: none; background: rgba(251,243,232,0.14); color: var(--cream); font-size: 20px; cursor: pointer; transition: background .2s; }
.lb .x:hover { background: rgba(251,243,232,0.26); }
.lb .arr { position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; border-radius: 50%; border: none; background: rgba(251,243,232,0.14); color: var(--cream); font-size: 20px; cursor: pointer; transition: background .2s; }
.lb .arr:hover { background: rgba(251,243,232,0.26); }
.lb .prev { left: 28px; }
.lb .next { right: 28px; }

/* ============================================================
   Responzivita
   ============================================================ */
@media (max-width: 1100px) { .gal-grid { columns: 3; } }
@media (max-width: 1000px) { .gal-albums { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) {
  .gal-grid { columns: 2; padding: 0 20px 60px; }
  .album-head { padding: 0 20px 22px; }
  .album-head h2 { font-size: 38px; }
}
@media (max-width: 640px) {
  .gal-hero { padding: 96px 20px 36px; }
  .gal-albums { grid-template-columns: 1fr; padding: 10px 20px 60px; }
  .gal-stats { gap: 24px; }
}
@media (max-width: 560px) {
  .gal-grid { columns: 1; }
  .lb { padding: 16px; }
  .lb .arr { width: 44px; height: 44px; }
  .lb .prev { left: 12px; }
  .lb .next { right: 12px; }
  .lb .x { top: 16px; right: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .album, .tile { opacity: 1 !important; transform: none !important; }
  .gal-spinner .ring { animation: none; }
}
