:root {
  color-scheme: light;
  --olive: #3b4018;
  --cream: #dad3a5;
  --paper: #fbfbf6;
  --map: #cfd1c6;
  --ink: #3b4018;
  --ink-soft: #5f6244;
  --line: #d9dacb;
  --serif: 'EB Garamond', 'Cormorant Garamond', Georgia, serif;
  --sans: 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.locked { overflow: hidden; }

h1, h2, p { margin: 0; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 2px solid var(--olive); outline-offset: 3px; }

/* Grafika z pozvánky: jednofarebná maska, farba sa berie z `color` */
.motif {
  display: block;
  background: currentColor;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-size: contain; mask-size: contain;
}
.m-cyprus  { -webkit-mask-image: url(assets/cyprus.png);  mask-image: url(assets/cyprus.png);  aspect-ratio: 974 / 598; }
.m-vetvicka{ -webkit-mask-image: url(assets/vetvicka.png);mask-image: url(assets/vetvicka.png);aspect-ratio: 734 / 270; }
.m-kompas  { -webkit-mask-image: url(assets/kompas.png);  mask-image: url(assets/kompas.png);  aspect-ratio: 438 / 441; }
.m-svet    { -webkit-mask-image: url(assets/svet.png);    mask-image: url(assets/svet.png);    aspect-ratio: 987 / 466; }
.m-more    { -webkit-mask-image: url(assets/more.png);    mask-image: url(assets/more.png);    aspect-ratio: 1408 / 660; }

/* Tlačidlá */
.btn {
  display: inline-block;
  border: 0;
  border-radius: 999px;
  padding: 15px 34px;
  font: 500 16px/1 var(--sans);
  cursor: pointer;
  transition: background-color .2s, color .2s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--olive); color: var(--cream); }
.btn-primary:hover { background: #2f3314; }
.btn-cover { background: transparent; color: var(--cream); border: 1px solid var(--cream); }
.btn-cover:hover { background: var(--cream); color: var(--olive); }
.btn-cover:focus-visible { outline-color: var(--cream); }

.link {
  background: none; border: 0; padding: 0;
  font: 400 14px/1.4 var(--sans);
  color: var(--olive);
  text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer;
}

/* Obálka */
.cover-stage {
  position: fixed; inset: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center;
  transition: background-color .5s .35s;
}
.cover-stage.is-open { background-color: transparent; pointer-events: none; }
.cover {
  position: relative; width: 100%; height: 100%;
  background: var(--olive);
  color: var(--cream);
  display: flex; justify-content: center;
  padding: max(28px, env(safe-area-inset-top)) 24px max(28px, env(safe-area-inset-bottom));
  text-align: center;
  transform-origin: left center;
  transition: transform .95s cubic-bezier(.65, 0, .35, 1), opacity .3s .65s;
  box-shadow: inset -10px 0 24px rgba(0, 0, 0, .18);
}
.cover.is-open {
  transform: perspective(1600px) rotateY(-104deg);
  opacity: 0;
  pointer-events: none;
}
.cover-inner {
  width: 100%; max-width: 460px;
  display: flex; flex-direction: column; justify-content: space-between; align-items: center;
}
.cover-top h1 {
  font-size: clamp(34px, 10.5vw, 54px);
  font-weight: 400;
  letter-spacing: .22em;
  padding-left: .22em;
  line-height: 1.1;
}
.cover-top .sub {
  margin-top: 8px;
  font-size: clamp(14px, 4.2vw, 19px);
  letter-spacing: .16em;
  padding-left: .16em;
  text-transform: uppercase;
}
.cover-mid { display: flex; flex-direction: column; align-items: center; gap: clamp(14px, 3.4dvh, 30px); }
.cover-mid .m-cyprus  { height: clamp(100px, 23dvh, 190px); }
.cover-mid .m-vetvicka{ height: clamp(44px, 9dvh, 78px); }
.cover-bottom { display: flex; flex-direction: column; align-items: center; }
.cover-bottom .names { font-size: clamp(30px, 9.4vw, 44px); line-height: 1.15; }
.cover-bottom hr {
  width: 62%; margin: 12px 0 10px;
  border: 0; border-top: 1px solid rgba(218, 211, 165, .6);
}
.cover-bottom .date { font-size: clamp(17px, 4.8vw, 21px); letter-spacing: .04em; line-height: 1.35; }
.cover-bottom .btn { margin-top: clamp(16px, 3.4dvh, 28px); }

/* Strany pasu */
.page { position: relative; min-height: 100vh; min-height: 100dvh; overflow: hidden; }

/* Zadanie mena */
.page-name {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 36px 24px;
  text-align: center;
}
.worldmap {
  position: absolute; left: 50%; bottom: 24px;
  width: min(135vw, 900px);
  transform: translateX(-50%);
  color: var(--map); opacity: .5;
  pointer-events: none;
}
.name-form { position: relative; width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: center; }
.name-form .m-kompas { height: 96px; color: var(--olive); margin-bottom: 14px; }
.name-form h2 { font-size: 36px; font-weight: 500; line-height: 1.15; }
.lead { margin-top: 8px; color: var(--ink-soft); max-width: 30ch; }
.name-form input {
  width: 100%; margin-top: 30px; padding: 8px 4px;
  background: transparent; border: 0; border-bottom: 1px solid var(--olive); border-radius: 0;
  text-align: center;
  font: 500 27px/1.3 var(--serif);
  color: var(--olive);
}
.name-form input::placeholder { color: #a4a78d; font-weight: 400; }
.name-form input:focus { outline: none; border-bottom-width: 2px; padding-bottom: 7px; }
.field-error { margin-top: 10px; font: 400 14px/1.4 var(--sans); color: #8a2f1a; }
.name-form .btn { margin-top: 28px; }

/* Odpočet */
.count { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; margin-top: 30px; }
.count div { display: flex; flex-direction: column; align-items: center; padding-top: 12px; border-top: 1px solid var(--olive); }
.count b { font: 500 44px/1 var(--serif); font-variant-numeric: tabular-nums; }
.count span { margin-top: 8px; font: 400 13px/1.2 var(--sans); color: var(--ink-soft); }

/* Galéria */
.page-gallery { padding-bottom: 130px; overflow: visible; }
.hero { padding: max(16px, env(safe-area-inset-top)) 20px 0; text-align: center; }
.who {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  max-width: 1000px; margin: 0 auto;
  font: 400 14px/1.4 var(--sans); color: var(--ink-soft);
  text-align: left;
}
.who strong { font-weight: 500; color: var(--ink); }
.hero h1 {
  margin-top: 34px;
  font-size: clamp(42px, 12.5vw, 64px); font-weight: 500; line-height: 1.05;
}
.when { margin-top: 8px; font-size: 19px; letter-spacing: .04em; color: var(--ink-soft); }
.sea {
  width: 100%; max-width: 720px; margin: 6px auto 0;
  -webkit-mask-image: radial-gradient(ellipse 62% 78% at 50% 42%, #000 58%, transparent 100%);
  mask-image: radial-gradient(ellipse 62% 78% at 50% 42%, #000 58%, transparent 100%);
}
.sea .motif { width: 100%; color: #b9bcab; }

.intro { padding: 0 16px; text-align: center; }
.intro > p { max-width: 34ch; margin: 0 auto; }

.chips {
  display: flex; gap: 8px; margin: 22px -16px 0; padding: 2px 16px 6px;
  overflow-x: auto; scrollbar-width: none; justify-content: flex-start;
}
.chips::-webkit-scrollbar { display: none; }
.chips::before, .chips::after { content: ''; margin: auto; }
.chip {
  flex: none;
  border: 1px solid var(--olive); border-radius: 999px; background: transparent;
  padding: 8px 15px;
  font: 500 14px/1 var(--sans); color: var(--olive);
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.chip span { font-weight: 400; opacity: .7; margin-left: 4px; }
.chip[aria-pressed="true"] { background: var(--olive); color: var(--cream); }

.grid {
  list-style: none; margin: 22px auto 0; padding: 0 12px;
  max-width: 1000px;
  columns: 2; column-gap: 10px;
}
.grid li { break-inside: avoid; margin: 0 0 16px; }
.tile {
  display: block; width: 100%; padding: 0; border: 0; background: none;
  text-align: left; cursor: pointer;
}
.thumb {
  position: relative; display: block; width: 100%;
  border-radius: 3px; overflow: hidden;
  background-color: var(--map);
}
.thumb img, .thumb video { display: block; width: 100%; height: auto; }
.by { display: block; margin-top: 6px; padding: 0 2px; font: 500 17px/1.2 var(--serif); color: var(--ink); }
.play {
  position: absolute; left: 8px; bottom: 8px;
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px 5px 8px; border-radius: 999px;
  background: rgba(59, 64, 24, .82); color: var(--cream);
  font: 500 12px/1 var(--sans);
}
.play::before {
  content: ''; width: 0; height: 0;
  border-left: 8px solid var(--cream); border-top: 5px solid transparent; border-bottom: 5px solid transparent;
}

/* Tlačidlo na pridanie fotiek */
.fab {
  position: fixed; z-index: 10; left: 50%; transform: translateX(-50%);
  bottom: max(18px, env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 10px;
  border: 0; border-radius: 999px;
  padding: 17px 28px;
  background: var(--olive); color: var(--cream);
  font: 500 16px/1 var(--sans); white-space: nowrap;
  box-shadow: 0 10px 28px rgba(59, 64, 24, .35), 0 2px 6px rgba(59, 64, 24, .25);
  cursor: pointer;
  transition: background-color .2s, transform .1s;
}
.fab:hover { background: #2f3314; }
.fab:active { transform: translateX(-50%) scale(.98); }
.fab:focus-visible { outline-color: var(--cream); outline-offset: -5px; }
.plus { position: relative; width: 14px; height: 14px; }
.plus::before, .plus::after { content: ''; position: absolute; background: var(--cream); }
.plus::before { left: 6px; top: 0; width: 2px; height: 14px; }
.plus::after  { left: 0; top: 6px; width: 14px; height: 2px; }

.empty { margin: 40px 24px 0; text-align: center; color: var(--ink-soft); }

/* Zoznam nahrávaných súborov nad tlačidlom */
.uploads {
  position: fixed; z-index: 11; left: 50%; transform: translateX(-50%);
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 76px);
  width: min(460px, calc(100% - 24px)); max-height: 42dvh; overflow: auto;
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 32px rgba(59, 64, 24, .22);
}
.uploads-head {
  position: sticky; top: 0; display: flex; justify-content: space-between; align-items: baseline;
  padding: 12px 16px 8px; background: var(--paper);
  font: 500 15px/1.3 var(--sans);
}
.uploads-list { list-style: none; margin: 0; padding: 0 12px 8px; }
.up {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 8px 4px; border-top: 1px solid var(--line);
}
.up-thumb { width: 44px; height: 44px; border-radius: 4px; background: var(--map) center / cover no-repeat; }
.up-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 14px/1.3 var(--sans); }
.up-status { display: block; font: 400 13px/1.3 var(--sans); color: var(--ink-soft); }
.up.is-error .up-status { color: #8a2f1a; }
.up-bar { display: block; height: 3px; margin-top: 6px; overflow: hidden; border-radius: 2px; background: var(--line); }
.up-bar i { display: block; width: 0; height: 100%; background: var(--olive); transition: width .25s; }
.up.is-done .up-bar, .up.is-error .up-bar { display: none; }

.toast {
  position: fixed; z-index: 40; left: 50%; top: max(16px, env(safe-area-inset-top));
  transform: translate(-50%, -8px);
  padding: 11px 18px; border-radius: 999px;
  background: var(--cream); color: var(--olive);
  font: 500 14px/1.2 var(--sans); white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Prehliadač fotiek */
html:has(dialog[open]) { overflow: hidden; }
dialog#viewer {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: #1f2210; color: var(--cream);
}
dialog#viewer[open] { display: flex; align-items: center; justify-content: center; }
dialog#viewer::backdrop { background: #1f2210; }
.v-stage { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; padding: 64px 0 28px; }
.v-stage img, .v-stage video { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.v-bar {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: max(10px, env(safe-area-inset-top)) 14px 10px 20px;
}
.v-meta { display: flex; flex-direction: column; line-height: 1.25; }
.v-meta strong { font: 500 21px/1.2 var(--serif); }
.v-meta span { font: 400 13px/1.4 var(--sans); opacity: .75; }
.v-btn {
  display: grid; place-items: center;
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: rgba(218, 211, 165, .14); color: var(--cream);
  font: 400 30px/1 var(--serif); cursor: pointer;
}
.v-btn:hover { background: rgba(218, 211, 165, .26); }
.v-btn:focus-visible { outline-color: var(--cream); }
.v-nav { position: absolute; top: 50%; margin-top: -22px; padding-bottom: 4px; }
.v-prev { left: 10px; }
.v-next { right: 10px; }

/* Tablet a väčšie */
@media (min-width: 700px) {
  body { font-size: 20px; }

  .cover-inner { max-width: 640px; }
  .cover-top h1 { font-size: min(76px, 7.4dvh); }
  .cover-top .sub { font-size: min(23px, 2.5dvh); margin-top: 12px; }
  .cover-mid .m-cyprus { height: min(300px, 26dvh); }
  .cover-mid .m-vetvicka { height: min(110px, 10dvh); }
  .cover-bottom .names { font-size: min(64px, 6.4dvh); }
  .cover-bottom .date { font-size: min(25px, 2.7dvh); }
  .btn-cover { font-size: 17px; padding: 17px 42px; }

  .name-form { max-width: 460px; }
  .name-form .m-kompas { height: 128px; }
  .name-form h2 { font-size: 46px; }
  .name-form input { font-size: 34px; }
  .count b { font-size: 60px; }
  .count span { font-size: 15px; }
  .worldmap { width: min(110vw, 1100px); bottom: 40px; }

  .hero { padding-top: 22px; }
  .hero h1 { margin-top: 28px; font-size: 72px; }
  .when { font-size: 21px; }
  .intro > p { max-width: 40ch; }
  .chips { justify-content: center; flex-wrap: wrap; margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }
  .chip { font-size: 15px; padding: 9px 18px; }

  .grid { columns: 3; column-gap: 16px; padding: 0 20px; }
  .grid li { margin-bottom: 20px; }
  .by { font-size: 18px; }
  .fab { padding: 19px 34px; font-size: 17px; }
  .v-nav { width: 52px; height: 52px; margin-top: -26px; }
  .v-prev { left: 24px; }
  .v-next { right: 24px; }
}

/* Širšie obrazovky na šírku: obálka ako pas uprostred, tmavé pozadie okolo */
@media (min-width: 700px) and (min-aspect-ratio: 4/5) {
  .cover-stage { background-color: #2a2e11; }
  .cover-stage.is-open { background-color: transparent; }
  .cover {
    width: auto; height: min(94dvh, 1000px);
    aspect-ratio: 1408 / 2000;
    border-radius: 6px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .45), inset -10px 0 24px rgba(0, 0, 0, .18);
  }
  .cover-inner { max-width: none; }
  .cover { padding: clamp(28px, 5dvh, 56px) 28px; }
}

@media (min-width: 1000px) {
  .grid { columns: 4; max-width: 1100px; column-gap: 18px; }
  .who { max-width: 1100px; }
  .hero h1 { margin-top: 14px; font-size: 64px; }
  .sea { max-width: 540px; margin-top: 0; }
  .intro > p { max-width: 46ch; }
  .chips { margin-top: 16px; }
  .grid { margin-top: 18px; }
}
@media (min-width: 1500px) {
  .grid { columns: 5; max-width: 1400px; }
  .who { max-width: 1400px; }
}

@media (hover: hover) {
  .thumb { transition: transform .25s, box-shadow .25s; }
  .tile:hover .thumb { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(59, 64, 24, .18); }
}

@media (prefers-reduced-motion: reduce) {
  .cover { transition: opacity .2s; }
  .cover.is-open { transform: none; opacity: 0; }
  .btn, .fab, .chip, .toast { transition: none; }
}
