/* Víťa & Mája – lidový design: modrá jako Májina sukně, červená výšivka, plátno */

:root {
  --linen: #f6efe0;
  --paper: #fffaf1;
  --ink: #2b2420;
  --ink-soft: #5d5249;
  --kroj: #2253a8;
  --kroj-deep: #1d2a4d;
  --red: #b8312f;
  --red-deep: #8f2321;
  --green: #4b7a3e;
  --gold: #d8a443;
  --line: #e4d6bb;
  --radius: 18px;
  --shadow: 0 1px 0 #fff inset, 0 20px 40px -24px rgba(29, 42, 77, .45);
  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --sans: 'Alegreya Sans', 'Avenir Next', system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--linen);
  /* jemná textura plátna */
  background-image:
    repeating-linear-gradient(0deg, rgba(120, 90, 50, .035) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(120, 90, 50, .03) 0 1px, transparent 1px 3px);
  -webkit-font-smoothing: antialiased;
}
img, video { display: block; max-width: 100%; }
h1, h2 { font-family: var(--serif); font-weight: 700; line-height: 1.05; margin: 0; letter-spacing: -.01em; }
em { font-style: italic; }

/* ---------- ornament (barvy přes custom properties – fungují i uvnitř <use>) */
.petal-out { fill: var(--po, var(--red)); }
.petal-in  { fill: var(--pi, var(--kroj)); }
.dot       { fill: var(--pd, var(--gold)); }
.t-red  { --po: var(--red);  --pi: var(--kroj); --pd: var(--gold); }
.t-blue { --po: var(--kroj); --pi: var(--red);  --pd: var(--paper); }
.h-red  { fill: var(--red); }
#leaf path { fill: var(--green); }
#leaf .vein { fill: none; stroke: var(--linen); stroke-width: 1.2; stroke-linecap: round; opacity: .7; }
.stems path { stroke: var(--green); stroke-width: 2.6; stroke-linecap: round; }
.dots circle { fill: var(--gold); }

/* ---------- vyšívaný pruh (křížkový steh) */
.stitch {
  height: 22px;
  background-color: var(--kroj-deep);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='22' viewBox='0 0 44 22'%3E%3Cg fill='%23b8312f'%3E%3Cpath d='M11 3l8 8-8 8-8-8z'/%3E%3Cpath d='M33 3l8 8-8 8-8-8z' fill='%23f6efe0'/%3E%3C/g%3E%3Cg fill='%23d8a443'%3E%3Ccircle cx='11' cy='11' r='2'/%3E%3Ccircle cx='33' cy='11' r='2'/%3E%3Ccircle cx='22' cy='4' r='1.3'/%3E%3Ccircle cx='22' cy='18' r='1.3'/%3E%3Ccircle cx='0' cy='4' r='1.3'/%3E%3Ccircle cx='0' cy='18' r='1.3'/%3E%3Ccircle cx='44' cy='4' r='1.3'/%3E%3Ccircle cx='44' cy='18' r='1.3'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-position: center;
  box-shadow: 0 3px 0 var(--red) inset, 0 -3px 0 var(--red) inset;
}

/* ---------- tlačítka */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  font: 700 1.05rem/1 var(--sans);
  letter-spacing: .02em;
  border-radius: 999px;
  padding: .95em 1.7em;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s ease, background-color .15s ease, box-shadow .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px) scale(.98); }
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 8px 20px -10px var(--red-deep); }
.btn-primary:hover { background: var(--red-deep); }
.btn-ghost { background: transparent; color: var(--kroj-deep); border-color: var(--kroj-deep); }
.btn-ghost:hover { background: var(--kroj-deep); color: var(--paper); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

/* ---------- hero */
.hero {
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(28px, 6vw, 72px) 20px clamp(24px, 5vw, 56px);
  display: grid;
  gap: clamp(24px, 5vw, 64px);
  align-items: center;
}
.hero-text { text-align: center; }
.eyebrow {
  margin: 0 0 .4rem;
  font: 700 .82rem/1 var(--sans);
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--red);
}
.ornament { width: min(320px, 78vw); height: auto; margin: 0 auto -.2rem; display: block; }
.hero h1 {
  font-size: clamp(3.2rem, 12vw, 6.4rem);
  color: var(--kroj-deep);
  font-weight: 700;
  font-variation-settings: 'SOFT' 100, 'WONK' 1;
}
.hero h1 em {
  font-weight: 500;
  color: var(--red);
  font-size: .72em;
  vertical-align: .08em;
  padding: 0 .06em;
}
.date {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.2rem, 3.5vw, 1.5rem);
  color: var(--ink-soft);
  margin: .7rem 0 1.1rem;
  display: flex; align-items: center; justify-content: center; gap: .8rem;
}
.date::before, .date::after {
  content: ''; width: 44px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold));
}
.date::after { transform: scaleX(-1); }
.lede { margin: 0 auto 1.6rem; max-width: 28em; color: var(--ink-soft); font-size: 1.12rem; }

.hero-photo { margin: 0; justify-self: center; width: min(400px, 82vw); }
.arch {
  position: relative;
  border-radius: 999px 999px 22px 22px;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  border: 6px solid var(--paper);
  box-shadow: 0 0 0 2px var(--kroj), 0 0 0 9px var(--paper), 0 0 0 11px var(--red), 0 30px 60px -30px rgba(29, 42, 77, .6);
}
.arch img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 42%; }

@media (min-width: 860px) {
  .hero { grid-template-columns: 1.1fr .9fr; }
  .hero-photo { width: 100%; max-width: 420px; }
}

/* ---------- karta s uploadem */
main { padding: 0 16px; }
.upload-card {
  position: relative;
  max-width: 720px;
  margin: 0 auto clamp(48px, 8vw, 96px);
  padding: clamp(28px, 5vw, 52px) clamp(20px, 5vw, 56px);
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  text-align: center;
  scroll-margin-top: 16px;
}
.upload-card::before {
  /* vnitřní „prošívání" */
  content: '';
  position: absolute; inset: 10px;
  border: 2px dashed rgba(34, 83, 168, .28);
  border-radius: calc(var(--radius) - 8px);
  pointer-events: none;
}
.card-corner {
  position: absolute; width: 34px; height: 34px;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 34 34'%3E%3Cpath d='M17 4l4 9 9 4-9 4-4 9-4-9-9-4 9-4z' fill='%23b8312f'/%3E%3Ccircle cx='17' cy='17' r='3' fill='%23d8a443'/%3E%3C/svg%3E");
}
.card-corner.tl { top: -14px; left: -14px; }
.card-corner.tr { top: -14px; right: -14px; }
.card-corner.bl { bottom: -14px; left: -14px; }
.card-corner.br { bottom: -14px; right: -14px; }

.upload-card h2 { font-size: clamp(1.8rem, 5.5vw, 2.5rem); color: var(--kroj-deep); }
.sub { color: var(--ink-soft); margin: .7rem auto 1.6rem; max-width: 32em; }

.upload-form { display: grid; gap: 18px; text-align: left; }
.field span { display: block; font-weight: 700; margin-bottom: 6px; color: var(--kroj-deep); }
.field small { font-weight: 400; color: var(--ink-soft); }
.field input {
  width: 100%;
  font: 500 1.08rem var(--sans);
  padding: .8em 1em;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
  transition: border-color .15s;
}
.field input:focus { outline: none; border-color: var(--kroj); }

.drop {
  position: relative;
  display: grid; justify-items: center; gap: 4px;
  padding: 30px 20px 26px;
  border-radius: 16px;
  background: var(--kroj);
  background-image: radial-gradient(circle at 20% 0%, rgba(255,255,255,.16), transparent 60%);
  color: #fff;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 14px 30px -16px var(--kroj-deep), 0 0 0 4px var(--paper), 0 0 0 6px var(--kroj);
  margin: 6px;
  transition: transform .15s ease, background-color .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.drop:hover { background-color: #1c4793; }
.drop:active { transform: scale(.99); }
.drop.is-over { background-color: var(--red); box-shadow: 0 0 0 4px var(--paper), 0 0 0 6px var(--red); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop:focus-within { outline: 3px solid var(--gold); outline-offset: 6px; }
.drop-icon { width: 46px; height: 46px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linejoin: round; }
.drop-icon .fill { fill: var(--gold); stroke: none; }
.drop-title { font: 700 clamp(1.35rem, 4.5vw, 1.6rem)/1.15 var(--serif); margin-top: 6px; }
.drop-hint { font-size: .95rem; opacity: .85; }

/* ---------- průběh */
.progress { margin-top: 26px; text-align: left; }
.progress-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; color: var(--kroj-deep); }
.bar { height: 12px; border-radius: 99px; background: var(--linen); overflow: hidden; margin: 10px 0 8px; box-shadow: inset 0 1px 2px rgba(0,0,0,.08); }
.bar-fill {
  height: 100%; width: 0;
  background: repeating-linear-gradient(45deg, var(--red) 0 10px, var(--red-deep) 10px 20px);
  background-size: 28px 28px;
  animation: stripes 1s linear infinite;
  border-radius: inherit;
  transition: width .3s ease;
}
@keyframes stripes { to { background-position: 28px 0; } }
.progress-note { font-size: .9rem; color: var(--ink-soft); margin: 0 0 12px; }
.queue {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px;
}
.queue li {
  position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden;
  background: var(--linen) center / cover no-repeat;
  border: 2px solid var(--line);
}
.queue li::after {
  content: ''; position: absolute; left: 0; bottom: 0; height: 4px; width: var(--p, 0%);
  background: var(--kroj); transition: width .2s;
}
.queue li.is-video::before {
  content: '▶'; position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--kroj-deep); font-size: 1.1rem;
}
.queue li.ok { border-color: var(--green); }
.queue li.ok::after { width: 100%; background: var(--green); }
.queue li.err { border-color: var(--red); }
.queue li.err::after { width: 100%; background: var(--red); }
.queue li .badge {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff;
}
.queue li.ok .badge { background: var(--green); }
.queue li.err .badge { background: var(--red); }

/* ---------- hotovo */
.done { margin-top: 24px; }
.done-heart { width: 54px; height: 54px; fill: var(--red); margin: 0 auto 6px; display: block; animation: beat 1.4s ease-in-out infinite; }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.14); } 30% { transform: scale(1); } 45% { transform: scale(1.08); } }
.done-title { font: italic 600 1.9rem/1.1 var(--serif); color: var(--red); margin: 0 0 4px; }
.done p { margin: 0 0 16px; }
.retry { margin-top: 12px; }

/* ---------- galerie */
.gallery-wrap { max-width: 1200px; margin: 0 auto; }
.gallery-head { text-align: center; margin-bottom: 26px; }
.mini-orn { width: 140px; height: auto; display: block; margin: 0 auto 4px; }
.gallery-head h2 { font-size: clamp(1.9rem, 6vw, 2.8rem); color: var(--kroj-deep); }
.gallery-count { margin: .4rem 0 0; color: var(--ink-soft); font-style: italic; font-family: var(--serif); }
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
@media (min-width: 700px) { .gallery { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; } }
.tile {
  position: relative; display: block; width: 100%;
  aspect-ratio: 1; padding: 0; border: 0; cursor: zoom-in;
  border-radius: 12px; overflow: hidden;
  background: var(--line);
  box-shadow: 0 0 0 4px var(--paper), 0 10px 24px -14px rgba(29, 42, 77, .5);
  margin: 4px;
  transition: transform .2s ease, box-shadow .2s ease;
  animation: pop .4s ease both;
}
.tile:hover { transform: translateY(-2px) rotate(-.4deg); box-shadow: 0 0 0 4px var(--paper), 0 0 0 6px var(--gold), 0 16px 30px -16px rgba(29, 42, 77, .6); }
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; }
.tile .play {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
}
.tile .play::before {
  content: ''; width: 46px; height: 46px; border-radius: 50%;
  background: rgba(29, 42, 77, .75) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 6l9 6-9 6z' fill='%23fff'/%3E%3C/svg%3E") center / 24px no-repeat;
  box-shadow: 0 0 0 3px rgba(255,255,255,.7);
}
.tile .who {
  position: absolute; left: 6px; bottom: 6px; max-width: calc(100% - 12px);
  font-size: .78rem; font-weight: 700; color: #fff;
  background: rgba(29, 42, 77, .72); padding: 2px 8px; border-radius: 99px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: capitalize;
}
.tile .noprev {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 10px;
  font-size: .85rem; color: var(--kroj-deep); text-align: center; background: var(--linen);
}
@keyframes pop { from { opacity: 0; transform: scale(.96); } }
.gallery-empty { text-align: center; color: var(--ink-soft); font-style: italic; padding: 30px 0; }
.gallery-more { text-align: center; margin: 28px 0 0; }

/* ---------- patička */
.foot { text-align: center; padding: 64px 20px 36px; color: var(--ink-soft); }
.foot p { margin: 0; font-family: var(--serif); font-size: 1.2rem; }
.foot em { color: var(--red); }

/* ---------- lightbox */
.lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: rgba(20, 24, 40, .96);
  color: #fff;
  overscroll-behavior: contain;
}
.lightbox::backdrop { background: rgba(20, 24, 40, .9); }
.lb-stage { position: absolute; inset: 0 0 64px; display: grid; place-items: center; padding: 16px; touch-action: pan-y pinch-zoom; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.lb-bar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 64px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 16px calc(env(safe-area-inset-bottom) * .5);
}
.lb-caption { font-size: .95rem; opacity: .85; text-transform: capitalize; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-btn { color: #fff; font-weight: 700; text-decoration: none; padding: .55em 1.1em; border-radius: 99px; border: 2px solid rgba(255,255,255,.6); flex: none; }
.lb-btn:hover { background: #fff; color: var(--kroj-deep); }
.lb-nav, .lb-close {
  position: absolute; border: 0; background: rgba(255,255,255,.12); color: #fff;
  width: 48px; height: 48px; border-radius: 50%; font-size: 2rem; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
}
.lb-nav:hover, .lb-close:hover { background: rgba(255,255,255,.25); }
.lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 12px; top: 50%; transform: translateY(-50%); }
.lb-close { top: calc(12px + env(safe-area-inset-top)); right: 12px; }
@media (hover: none) { .lb-nav { display: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
