/* Vytvoř GIF z obrázků: vzhled stránky. Vlastní, bez cizích písem a obrázků. */

:root {
  --mat: #263f86;
  --mat-line: rgba(255, 255, 255, 0.07);
  --mat-line-strong: rgba(255, 255, 255, 0.15);
  --film: #16213f;
  --ink: #10233a;
  --muted: #4b5d6b;
  --paper: #ffffff;
  --wash: #f2f4f8;
  --line: #d5dbe5;
  --cut: #ffd43b;
  --cut-hover: #ffdd66;
  --error: #b42318;
  --focus: #1a5fd6;
  --check-a: #e4e9ee;
  --check-b: #ffffff;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--wash);
}

[hidden] { display: none !important; }

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

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

kbd {
  font: inherit;
  font-size: 0.9em;
  padding: 0 0.4em;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--paper);
}

code {
  font-family: ui-monospace, Consolas, 'Courier New', monospace;
  font-size: 0.92em;
  padding: 0 0.3em;
  border-radius: 4px;
  background: var(--paper);
}

/* ---------- záhlaví */

.mat {
  color: #fff;
  background-color: var(--mat);
  background-image:
    linear-gradient(var(--mat-line-strong) 1px, transparent 1px),
    linear-gradient(90deg, var(--mat-line-strong) 1px, transparent 1px),
    linear-gradient(var(--mat-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--mat-line) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  background-position: -1px -1px;
}
.mat :focus-visible { outline-color: var(--cut); }

.mat-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 24px 72px;
}

.home {
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}
.home:hover { text-decoration: underline; text-underline-offset: 4px; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 56px;
  align-items: center;
  margin-top: 44px;
}

h1 {
  margin: 0 0 22px;
  max-width: 11ch;
  font-size: clamp(2.5rem, 1.3rem + 4vw, 4.4rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.lead {
  margin: 0;
  max-width: 34ch;
  font-size: 1.25rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.93);
}

/* ---------- filmový pás pro výběr obrázků */

.sheet {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 360px;
  padding: 64px 32px;
  text-align: center;
  color: var(--ink);
  border-radius: 18px;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 20px 44px rgba(6, 14, 40, 0.42);
}
.sheet::before,
.sheet::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 34px;
  background-color: var(--film);
  background-image: radial-gradient(closest-side, var(--paper) 86%, transparent 100%);
  background-size: 30px 16px;
  background-repeat: repeat-x;
  background-position: 12px center;
}
.sheet::before { top: 0; }
.sheet::after { bottom: 0; }

.sheet :focus-visible { outline-color: var(--focus); }
.sheet.is-dragging { outline: 5px solid var(--cut); outline-offset: 6px; }

.sheet-body {
  max-width: 430px;
  padding: 14px 20px 6px;
}

.hint { margin: 16px 0 4px; }
.formats { margin: 0 0 12px; font-size: 0.9375rem; color: var(--muted); }

/* ---------- tlačítka */

.btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  font-size: 1.0625rem;
  line-height: 1.2;
  text-decoration: none;
  border: 0;
  border-radius: 999px;
  padding: 14px 28px;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.08s ease;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  color: var(--ink);
  background: var(--cut);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.16);
}
.btn-primary:hover { background: var(--cut-hover); }

.btn-big { font-size: 1.25rem; padding: 17px 36px; }

.btn-secondary {
  color: var(--ink);
  background: transparent;
  border: 2px solid var(--ink);
  padding: 12px 24px;
}
.btn-secondary:hover { background: rgba(16, 35, 58, 0.06); }

.btn-link {
  font: inherit;
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--mat);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.btn-link:hover { color: var(--ink); }

.btn:disabled, .btn-link:disabled, .icon-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}
.icon-btn:hover:not(:disabled) { border-color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- pracovní plocha */

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 48px 24px 8px;
}

.alert {
  margin: 0 0 32px;
  padding: 14px 18px;
  border: 2px solid var(--error);
  border-radius: 12px;
  background: #fff4f2;
  color: #7a1a11;
}
.alert p { margin: 0; }
.alert p + p { margin-top: 6px; }

.workspace { margin-bottom: 48px; }

.ws-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 24px;
}
.ws-head h2, .settings h2, .result h2 { margin: 0; font-size: 1.75rem; letter-spacing: -0.015em; }
.ws-note { flex: 1 1 300px; margin: 0; color: var(--muted); }

.ws-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 22px;
  margin: 18px 0 22px;
}

.frames {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.frame {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  overflow: hidden;
}
.frame.is-dragged { opacity: 0.45; }
.frame.drop-before::before,
.frame.drop-after::before {
  content: '';
  position: absolute;
  top: 8px;
  bottom: 8px;
  width: 5px;
  border-radius: 3px;
  background: var(--cut);
  box-shadow: 0 0 0 1px var(--ink);
  z-index: 2;
}
.frame.drop-before::before { left: 2px; }
.frame.drop-after::before { right: 2px; }
.frame.is-error { border-color: var(--error); }

.thumb {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  background-color: var(--check-b);
  background-image: repeating-conic-gradient(var(--check-a) 0 25%, var(--check-b) 0 50%);
  background-size: 16px 16px;
  cursor: grab;
}
.thumb img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  -webkit-user-drag: none;
  user-select: none;
}
.badge {
  position: absolute;
  top: 8px;
  left: 8px;
  min-width: 30px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 700;
  text-align: center;
  color: #fff;
  background: rgba(16, 35, 58, 0.82);
}
.thumb .badge { pointer-events: none; }

.frame-body { padding: 12px 14px 14px; }
.frame-name { margin: 0; font-weight: 600; font-size: 0.9375rem; overflow-wrap: anywhere; }
.frame-meta { margin: 2px 0 0; font-size: 0.875rem; color: var(--muted); }
.frame.is-error .frame-meta { color: var(--error); font-weight: 500; }

.frame-delay {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 0.9375rem;
}

input.num {
  width: 5.5em;
  padding: 6px 8px;
  border: 1px solid #aab6c4;
  border-radius: 8px;
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  background: var(--paper);
  text-align: right;
}

.frame-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.frame-actions .btn-remove { margin-left: auto; }

/* ---------- nastavení */

.settings {
  margin-top: 36px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
}

.set-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 22px 32px;
  margin-top: 18px;
}

.field-label { display: block; margin-bottom: 8px; font-weight: 600; }
.inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.field-note { margin: 6px 0 0; font-size: 0.9375rem; color: var(--muted); }

.choice { margin: 0; padding: 0; border: 0; min-width: 0; }
.choice legend { margin-bottom: 8px; padding: 0; font-weight: 600; }
.choice label { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; cursor: pointer; }
.choice input[type="radio"] { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--mat); }
.bg-color {
  width: 36px;
  height: 28px;
  padding: 0 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  cursor: pointer;
}

.more { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 14px; }
.more summary { font-weight: 600; cursor: pointer; color: var(--mat); width: max-content; }
.more summary:hover { color: var(--ink); }

.make {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 28px;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.summary { flex: 1 1 320px; margin: 0; }

.progress {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-top: 18px;
}
.progress progress {
  flex: 1 1 260px;
  height: 14px;
  accent-color: var(--mat);
}
.progress-text { min-width: 12ch; }

/* ---------- výsledek */

.result {
  margin-bottom: 56px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
}

.result-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(250px, 2fr);
  gap: 28px;
  align-items: start;
  margin-top: 18px;
}

.preview {
  display: grid;
  place-items: center;
  min-height: 160px;
  padding: 12px;
  border-radius: 10px;
  background-color: var(--check-b);
  background-image: repeating-conic-gradient(var(--check-a) 0 25%, var(--check-b) 0 50%);
  background-size: 20px 20px;
}
.preview img {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  image-rendering: auto;
}

.result-meta { margin: 0 0 14px; }
.result-old { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; background: #fff8db; }
.result-side .btn { margin-bottom: 4px; }

/* ---------- jak to funguje */

.info {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 36px;
  padding: 8px 0 32px;
}
.info h2 { margin: 0 0 8px; font-size: 1.125rem; letter-spacing: -0.005em; }
.info p { margin: 0 0 8px; max-width: 40ch; color: var(--muted); }

.foot {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 24px 44px;
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
  color: var(--muted);
}
.foot p { max-width: 80ch; margin: 0 0 6px; }
.foot a { color: inherit; text-underline-offset: 3px; }

@media (max-width: 880px) {
  .mat-inner { padding-bottom: 44px; }
  .hero { grid-template-columns: 1fr; gap: 28px; margin-top: 26px; }
  h1 { max-width: none; }
  .sheet { min-height: 300px; padding: 56px 18px; }
  .info { grid-template-columns: 1fr; gap: 22px; }
  .result-grid { grid-template-columns: 1fr; gap: 18px; }
  .settings, .result { padding: 18px 16px; }
}

@media (max-width: 520px) {
  .frames { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .frame-body { padding: 10px 10px 12px; }
  .frame-actions { flex-wrap: wrap; }
  .icon-btn { width: 38px; height: 38px; }
  .make .btn-big { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
}
