/* Fotokniha – zamčená listovací kniha */

@font-face {
  font-family: "Cormorant Garamond";
  src: url("fonts/cormorant-garamond.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Parisienne";
  src: url("fonts/parisienne.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --noc: #070f24;
  --noc-2: #0c1d45;
  --noc-3: #163170;
  --zlata: #a1774c;
  --zlata-svetla: #dcc097;
  --text: #f4eee4;
  --text-2: rgba(244, 238, 228, 0.72);
  --linka: rgba(220, 192, 151, 0.26);
  --linka-silna: rgba(220, 192, 151, 0.5);
  --chyba: #f2ab93;
  --pismo: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --pismo-nadpis: "Parisienne", "Snell Roundhand", "Apple Chancery", cursive;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }
html { height: 100%; }
body {
  min-height: 100%;
  background-color: var(--noc);
  background-image:
    radial-gradient(110% 80% at 50% -10%, rgba(40, 80, 170, 0.55) 0%, rgba(22, 49, 112, 0.35) 38%, rgba(7, 15, 36, 0) 72%),
    linear-gradient(180deg, var(--noc-2) 0%, var(--noc) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--pismo);
  font-size: 18px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body.kniha-otevrena { overflow: hidden; overscroll-behavior: none; }

button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--zlata-svetla); outline-offset: 3px; }
.vh {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------ zámek */

.zamek {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

.karta {
  position: relative;
  width: min(100%, 400px);
  padding: 44px 32px 26px;
  text-align: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--linka);
  border-radius: 22px;
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.karta::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(220, 192, 151, 0.1);
  border-radius: 16px;
  pointer-events: none;
}

.zamek-ikona {
  display: inline-grid;
  place-items: center;
  width: 58px;
  height: 58px;
  color: var(--zlata-svetla);
  border: 1px solid var(--linka);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, rgba(220, 192, 151, 0.14), rgba(220, 192, 151, 0) 70%);
}
.zamek-ikona svg { width: 28px; height: 28px; }

.nadpis {
  margin: 12px 0 2px;
  font-family: var(--pismo-nadpis);
  font-weight: 400;
  font-size: 58px;
  line-height: 1.15;
  color: var(--zlata-svetla);
  letter-spacing: 0.01em;
}
.popis {
  margin: 0 0 26px;
  color: var(--text-2);
  font-size: 19px;
  line-height: 1.45;
}

.skryte {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.pole { position: relative; }
.pole input {
  display: block;
  width: 100%;
  margin: 0;
  padding: 13px 52px 13px 18px;
  font: inherit;
  font-size: 20px;
  font-weight: 500;
  color: var(--text);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--linka);
  border-radius: 13px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}
.pole input::placeholder { color: rgba(244, 238, 228, 0.42); font-weight: 400; }
.pole input:focus {
  border-color: var(--linka-silna);
  background: rgba(0, 0, 0, 0.32);
  box-shadow: 0 0 0 4px rgba(220, 192, 151, 0.12);
}
.oko {
  position: absolute;
  right: 5px;
  top: 50%;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  transform: translateY(-50%);
  color: rgba(244, 238, 228, 0.6);
  background: none;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}
.oko:hover { color: var(--zlata-svetla); }
.oko svg { width: 21px; height: 21px; }
.oko .oko-zavrene { display: none; }
.oko[aria-pressed="true"] .oko-otevrene { display: none; }
.oko[aria-pressed="true"] .oko-zavrene { display: block; }

.tlacitko {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 14px;
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  text-decoration: none;
  color: #1d1408;
  background: linear-gradient(180deg, #e6cca4 0%, #c29864 100%);
  border: 0;
  border-radius: 13px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  cursor: pointer;
  transition: filter 0.2s, transform 0.1s;
}
.tlacitko:hover { filter: brightness(1.06); }
.tlacitko:active { transform: translateY(1px); }
.tlacitko:disabled { cursor: progress; filter: saturate(0.7) brightness(0.92); }
.tocka {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(29, 20, 8, 0.25);
  border-top-color: #1d1408;
  border-radius: 50%;
  animation: tocit 0.8s linear infinite;
}
.pracuje .tocka { display: inline-block; }

.stav {
  min-height: 1.5em;
  margin: 14px 0 0;
  font-size: 17px;
  line-height: 1.4;
  color: var(--text-2);
}
.stav[data-typ="chyba"] { color: var(--chyba); }

.karta.zatres { animation: zatres 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97); }

@keyframes zatres {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}
@keyframes tocit { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ prohlížeč knihy */

.prohlizec {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
.prohlizec.pripravuje { visibility: hidden; }

/* Celá stránka se v knize gestem nepřibližuje (kniha má vlastní lupu). Kdyby přesto byla
   přiblížená, přes knihu se položí průhledný štít, na kterém gesto dvěma prsty zmenší zpět. */
.prohlizec { touch-action: none; }
.prohlizec.priblizeno { touch-action: auto; }
.stit-priblizeni {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 40;
  touch-action: auto;
}
.prohlizec.priblizeno .stit-priblizeni { display: block; }

.scena {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  margin: clamp(10px, 3.2vh, 40px) clamp(8px, 3vw, 56px) clamp(8px, 1.6vh, 18px);
}

#kniha {
  position: absolute;
  inset: 0;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
#kniha .stf__wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

.stin-knihy {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  border-radius: 2px;
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.55),
    0 8px 22px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  transition: transform 0.45s ease, width 0.45s ease, height 0.45s ease;
}

.strana {
  background: #fff;
  overflow: hidden;
}
.strana img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}
.strana.nacteno img { opacity: 1; }

/* čekání na stranu */
.strana::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border: 2px solid rgba(161, 119, 76, 0.2);
  border-top-color: var(--zlata);
  border-radius: 50%;
  animation: tocit 0.9s linear infinite;
}
.strana.nacteno::before { display: none; }
.strana.chyba::before {
  content: "Stranu se nepodařilo načíst";
  width: auto;
  height: auto;
  margin: 0;
  transform: translate(-50%, -50%);
  border: 0;
  animation: none;
  font-size: 15px;
  color: #8a6a48;
  white-space: nowrap;
}

/* jemný stín ve hřbetu knihy */
.strana::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.na-sirku .strana.--left::after,
.prohlizec:not(.na-sirku) .strana[data-hrbet="vpravo"]::after {
  background: linear-gradient(to left, rgba(0, 0, 0, 0.13), rgba(0, 0, 0, 0.04) 1.4%, rgba(0, 0, 0, 0) 4.5%);
}
.na-sirku .strana.--right::after,
.prohlizec:not(.na-sirku) .strana[data-hrbet="vlevo"]::after {
  background: linear-gradient(to right, rgba(0, 0, 0, 0.13), rgba(0, 0, 0, 0.04) 1.4%, rgba(0, 0, 0, 0) 4.5%);
}

/* Jedna strana (mobil na výšku): u hřbetu je v tiskových podkladech 3 mm přesah fotky
   z protější strany. Ve dvoustraně navazuje, samostatně by rušil – skryje se (3/382 šířky). */
.prohlizec:not(.na-sirku) .strana[data-hrbet="vlevo"] img { transform-origin: 100% 50%; transform: scale(1.0079); }
.prohlizec:not(.na-sirku) .strana[data-hrbet="vpravo"] img { transform-origin: 0 50%; transform: scale(1.0079); }

/* ovládací lišta */
.lista {
  position: relative;
  z-index: 20;
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  width: min(calc(100% - 20px), 720px);
  margin: 0 auto max(10px, env(safe-area-inset-bottom));
  padding: 5px 8px;
  background: rgba(5, 12, 30, 0.7);
  border: 1px solid rgba(220, 192, 151, 0.16);
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.ikona-tl {
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  color: var(--zlata-svetla);
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.15s, opacity 0.15s;
}
.ikona-tl:hover { background: rgba(220, 192, 151, 0.12); }
.ikona-tl:active { background: rgba(220, 192, 151, 0.2); }
.ikona-tl:disabled { opacity: 0.28; cursor: default; background: transparent; }
.ikona-tl svg { width: 22px; height: 22px; }
.ikona-tl .fs-vypnout { display: none; }
.ikona-tl.zapnuto .fs-zapnout { display: none; }
.ikona-tl.zapnuto .fs-vypnout { display: block; }

.posuvnik {
  --podil: 0%;
  flex: 1 1 auto;
  min-width: 60px;
  height: 30px;
  margin: 0 8px;
  padding: 0;
  cursor: pointer;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}
.posuvnik:focus-visible { outline: none; }
.posuvnik::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--zlata-svetla) var(--podil), rgba(220, 192, 151, 0.22) var(--podil));
}
.posuvnik::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6.5px;
  border: 2px solid var(--zlata);
  border-radius: 50%;
  background: #f3e2c4;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
  transition: box-shadow 0.15s;
}
.posuvnik:focus-visible::-webkit-slider-thumb,
.posuvnik:active::-webkit-slider-thumb { box-shadow: 0 0 0 5px rgba(220, 192, 151, 0.3); }
.posuvnik::-moz-range-track { height: 3px; border-radius: 3px; background: rgba(220, 192, 151, 0.22); }
.posuvnik::-moz-range-progress { height: 3px; border-radius: 3px; background: var(--zlata-svetla); }
.posuvnik::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: 2px solid var(--zlata);
  border-radius: 50%;
  background: #f3e2c4;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
}
.posuvnik:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 5px rgba(220, 192, 151, 0.3); }

.tip-otoceni {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0 24px;
  line-height: 1.35;
  font-size: 16px;
  font-style: italic;
  color: var(--text-2);
  text-align: center;
  pointer-events: none;
}
.tip-otoceni svg { flex: none; width: 22px; height: 22px; color: var(--zlata-svetla); }

.cislo {
  flex: none;
  min-width: 82px;
  padding: 0 4px;
  text-align: center;
  font-size: 18px;
  font-weight: 500;
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--text);
  white-space: nowrap;
}

.oddelovac {
  flex: none;
  width: 1px;
  height: 24px;
  margin: 0 4px;
  background: rgba(220, 192, 151, 0.2);
}

@media (max-width: 560px) {
  .lista {
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 0;
    border-radius: 24px;
    padding: 4px 6px 5px;
  }
  .posuvnik { order: -1; flex-basis: 100%; margin: 4px 10px 0; }
  .cislo { min-width: 72px; font-size: 17px; }
  .ikona-tl { width: 44px; height: 44px; }
}

/* ------------------------------------------------------------ lupa */

.lupa {
  position: fixed;
  inset: 0;
  z-index: 100;
  overflow: hidden;
  background: rgba(4, 9, 22, 0.95);
  touch-action: none;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}
.lupa.tahne { cursor: grabbing; }
.lupa-platno {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  overflow: hidden;
  transform-origin: 0 0;
  background: #fff;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  will-change: transform;
}
.lupa-platno img {
  display: block;
  height: 100%;
  width: auto;
  pointer-events: none;
  -webkit-user-drag: none;
}
.lupa-ovladani {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  display: flex;
  gap: 6px;
  padding: 4px;
  background: rgba(5, 12, 30, 0.75);
  border: 1px solid rgba(220, 192, 151, 0.16);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.lupa-napoveda {
  position: absolute;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  margin: 0;
  padding: 6px 14px;
  transform: translateX(-50%);
  font-size: 15px;
  color: var(--text-2);
  background: rgba(5, 12, 30, 0.7);
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.6s;
}
.lupa-napoveda.skryt { opacity: 0; }

@media (max-width: 560px) {
  .lupa-napoveda { font-size: 13px; white-space: normal; width: calc(100% - 40px); text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .stin-knihy, .strana img { transition: none; }
  .karta.zatres { animation: none; }
}

/* stránka 404 */
.odkaz { margin-top: 6px; }
