/* Společné plynulé animace pro všechny stránky (načítá se přes _nav.html).
   Vypnutí: odebrat 2 řádky v _nav.html (site-fx.css a site-fx.js). Barvy z webu. */

/* 1. Plynulý přechod mezi stránkami (Chrome/Edge; jinde se nic nemění) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: th-vt-out .22s ease both; }
::view-transition-new(root) { animation: th-vt-in .32s cubic-bezier(.2,.7,.2,1) both; }
@keyframes th-vt-out { to { opacity: 0; } }
@keyframes th-vt-in { from { opacity: 0; transform: translateY(10px); } }

/* 2. Obsah při scrollu jemně najede (jen to, co při načtení ještě nebylo vidět) */
.th-reveal-pending { opacity: 0; transform: translateY(18px); }
.th-reveal-in {
  animation: th-reveal .6s cubic-bezier(.2,.7,.2,1) both;
  animation-delay: var(--th-d, 0ms);
}
@keyframes th-reveal { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* 3. Proužek nahoře při načítání / čekání na server */
#th-loadbar {
  position: fixed; top: 0; left: 0; height: 3px; width: 100%; z-index: 100000; pointer-events: none;
  background: linear-gradient(90deg, #4f7cff, #7c3aed, #06b6d4);
  box-shadow: 0 0 10px rgba(124,58,237,.6);
  transform-origin: 0 50%; transform: scaleX(0); opacity: 0;
  transition: transform .4s ease, opacity .3s ease;
}
#th-loadbar.is-on { opacity: 1; }
#th-loadbar.is-done { transform: scaleX(1) !important; opacity: 0; transition: transform .2s ease, opacity .35s ease .15s; }

/* 4. Fotky: místo prázdna jemný lesk, pak plynulé objevení */
img.th-img-ready { animation: th-img-in .5s ease both; }
@keyframes th-img-in { from { opacity: .3; filter: blur(6px); } to { opacity: 1; filter: none; } }
.th-shimmer {
  background: linear-gradient(100deg, rgba(148,163,184,.07) 30%, rgba(148,163,184,.16) 50%, rgba(148,163,184,.07) 70%) 0 0 / 300% 100% !important;
  animation: th-shimmer 1.3s linear infinite;
}
@keyframes th-shimmer { to { background-position: -300% 0; } }

/* 5. Drobnosti: tlačítka se při stisku lehce zmáčknou (vlastnost scale nekoliduje s transform) */
button, .btn-primary, .btn-secondary, a[class*="rounded"][class*="font-bold"], a[class*="btn"] {
  transition-property: scale, background-color, border-color, color, box-shadow, opacity, transform, filter;
}
button:active:not(:disabled), .btn-primary:active, .btn-secondary:active,
a[class*="rounded"][class*="font-bold"]:active, a[class*="btn"]:active { scale: .97; }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  .th-reveal-pending { opacity: 1; transform: none; }
  .th-reveal-in, img.th-img-ready, .th-shimmer { animation: none; }
  button:active, .btn-primary:active, .btn-secondary:active, a:active { scale: none; }
}

/* ── Mobil: pole s datem/časem nesmí přetéct ze sloupce (iOS/Chrome jim dávají pevnou min. šířku) ── */
input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"] {
  min-width: 0; max-width: 100%; box-sizing: border-box;
}
*:has(> input[type="date"]), *:has(> input[type="time"]), *:has(> input[type="datetime-local"]) { min-width: 0; }
@media (max-width: 768px) {
  /* iOS přibližuje stránku při psaní do pole s písmem pod 16 px */
  input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"] { font-size: 16px !important; }
  input[type="date"]::-webkit-date-and-time-value { text-align: left; }
}

/* ── Mobil: spodní lišta čitelná a stejně široké položky (popisky byly 8,5 px) ── */
@media (max-width: 768px) {
  #mob-nav .mni { flex: 1 1 0; min-width: 0; min-height: 46px; padding: 5px 2px !important; font-size: 10.5px !important; letter-spacing: 0 !important; }
  #mob-nav .mni .ni { font-size: 20px !important; }
}

/* ── Mobil: malé dotykové cíle aspoň ~40 px ── */
@media (max-width: 768px) {
  .footer-links a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 6px; }
  button[onclick^="editName"], button[onclick^="editUsername"] { min-width: 36px; min-height: 36px; display: inline-flex; align-items: center; justify-content: center; }
  #bio-edit-btn:not(.hidden), #bio-text:not(.hidden) { min-height: 32px; display: inline-flex; align-items: center; }
  .step-btn { width: 40px !important; height: 40px !important; }
}
