/* MEGA CUBE — megacube.cz */

:root {
  --blue: #1B2A5E;
  --orange: #F47B20;
  --orange-dark: #D9660D;
  --bg-light: #F5F7FA;
  --text: #2B2F36;
  --radius: 10px;
  --shadow: 0 4px 18px rgba(27, 42, 94, 0.14);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: #FFFFFF;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

h2 {
  color: var(--blue);
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  font-weight: 700;
  line-height: 1.25;
}

h2 .accent { color: var(--orange); }

a { color: var(--blue); }

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

/* Tlačítka */
.btn {
  display: inline-block;
  padding: 14px 32px;
  border: 0;
  border-radius: 8px;
  font-size: 1.05rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.btn-primary {
  background: var(--orange);
  color: #FFFFFF;
}

.btn-primary:hover { background: var(--orange-dark); }

.btn-secondary {
  background: var(--blue);
  color: #FFFFFF;
}

.btn-secondary:hover { background: #142147; }

/* ===== HERO ===== */
.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  background:
    linear-gradient(180deg, rgba(27, 42, 94, 0.72) 0%, rgba(27, 42, 94, 0.55) 45%, rgba(27, 42, 94, 0.78) 100%),
    url("../img/Megacube_background.jpg") center / cover no-repeat;
}

.hero-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 20px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.eyebrow {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 1.25rem;
}

.hero-logo {
  width: 100%;
  max-width: 320px;
  height: auto;
  margin-bottom: 2rem;
}

.hero h1 {
  color: #FFFFFF;
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  font-weight: 800;
  line-height: 1.3;
  max-width: 34ch;
  margin: 0 auto 2.25rem;
}

/* ===== KATALOG ===== */
.catalog {
  background: var(--bg-light);
  padding: 72px 0 80px;
}

.catalog h2 {
  text-align: center;
  margin-bottom: 2.5rem;
}

.viewer {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
}

.stage {
  display: flex;
  justify-content: center;
  min-height: 40vh;
  perspective: 1800px;
}

.stage img {
  max-height: 85vh;
  width: auto;
  max-width: 100%;
  border-radius: 10px;
  box-shadow: var(--shadow);
  background: #FFFFFF;
  transform-style: preserve-3d;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.stage img.is-out-left {
  opacity: 0;
  transform: rotateY(-18deg) translateX(-22px) scale(0.97);
  transform-origin: right center;
}

.stage img.is-out-right {
  opacity: 0;
  transform: rotateY(18deg) translateX(22px) scale(0.97);
  transform-origin: left center;
}

/* Návrat na začátek katalogu (z poslední strany) — odlišná animace od běžného listování */
.stage img.is-wrap-out {
  opacity: 0;
  transform: scale(0.82) rotateY(0deg);
  transition: opacity 0.26s ease, transform 0.26s ease;
}

.stage img.is-wrap-in {
  opacity: 0;
  transform: scale(1.1);
  transition: opacity 0.26s ease, transform 0.26s ease;
}

.viewer.is-restarting .stage img {
  box-shadow: var(--shadow), 0 0 0 4px rgba(244, 123, 32, 0.55);
}

/* Šipky */
.arrow {
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: #FFFFFF;
  color: var(--blue);
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.arrow:hover:not(:disabled) {
  background: var(--orange);
  color: #FFFFFF;
}

.arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

/* Lišta pod stránkou */
.viewer-bar {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  margin-top: 14px;
}

.counter {
  color: var(--blue);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 1.05rem;
}

.fs-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid rgba(27, 42, 94, 0.25);
  border-radius: 8px;
  background: #FFFFFF;
  color: var(--blue);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.fs-btn:hover {
  border-color: var(--orange);
  color: var(--orange);
}

/* Miniatury */
.thumbs {
  display: flex;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 10px;
  margin-top: 24px;
  overflow-x: auto;
  padding: 6px 2px 10px;
  scrollbar-width: thin;
}

.thumb {
  flex: 0 0 auto;
  width: 72px;
  padding: 0;
  border: 3px solid transparent;
  border-radius: 6px;
  background: none;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.thumb img {
  border-radius: 5px;
  box-shadow: 0 1px 6px rgba(27, 42, 94, 0.18);
}

.thumb:hover { border-color: rgba(244, 123, 32, 0.45); }

.thumb.is-active { border-color: var(--orange); }

/* Fullscreen — nativní API i fallback */
.viewer:fullscreen {
  background: var(--blue);
  padding: 24px;
  grid-template-rows: 1fr auto;
}

.viewer.fs-fallback {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--blue);
  padding: 24px;
  grid-template-rows: 1fr auto;
  margin: 0;
}

.viewer:fullscreen .stage img,
.viewer.fs-fallback .stage img {
  max-height: calc(100vh - 110px);
}

.viewer:fullscreen .counter,
.viewer.fs-fallback .counter { color: #FFFFFF; }

body.fs-lock { overflow: hidden; }

/* ===== KONSTRUKCE / BEFORE-AFTER ===== */
.before-after {
  background: #FFFFFF;
  padding: 72px 0 80px;
}

.before-after h2 {
  text-align: center;
  margin-bottom: 2.5rem;
}

.ba-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 2528 / 1684;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--bg-light);
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
  --pos: 50%;
}

.ba-frame:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
}

.ba-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.ba-img-before {
  clip-path: inset(0 calc(100% - var(--pos)) 0 0);
}

.ba-label {
  position: absolute;
  top: 16px;
  padding: 6px 14px;
  border-radius: 6px;
  background: rgba(27, 42, 94, 0.75);
  color: #FFFFFF;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  pointer-events: none;
}

.ba-label-before { left: 16px; }
.ba-label-after { right: 16px; }

.ba-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  width: 0;
  transform: translateX(-50%);
  pointer-events: none;
}

.ba-handle-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  background: #FFFFFF;
  transform: translateX(-50%);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.35);
}

.ba-handle-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: var(--shadow);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== KONTAKT ===== */
.contact {
  background: #FFFFFF;
  padding: 72px 0;
  text-align: center;
}

.contact h2 {
  max-width: 24ch;
  margin: 0 auto 2rem;
}

.contact-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px 40px;
  margin-bottom: 2rem;
}

.contact-links a {
  color: var(--blue);
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
}

.contact-links a:hover { color: var(--orange); }

.contact-note { color: var(--text); }

.contact-note a {
  color: var(--orange);
  font-weight: 600;
}

/* ===== PATIČKA ===== */
.footer {
  background: var(--blue);
  color: rgba(255, 255, 255, 0.85);
  padding: 24px 0;
  text-align: center;
  font-size: 0.95rem;
}

.footer a {
  color: #FFFFFF;
  font-weight: 600;
}

.footer-note {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 6px;
}

/* ===== RESPONZIVITA ===== */
@media (max-width: 720px) {
  .viewer {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 46px;
    height: 46px;
    background: rgba(255, 255, 255, 0.92);
  }

  .arrow-prev { left: 6px; }
  .arrow-next { right: 6px; }

  .stage img { max-height: 75vh; }

  .thumb { width: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
