/* ============================================================
   CONTENT GRID BUILDER — Output Stylesheet
   ------------------------------------------------------------
   Vše s prefixem cgb_ aby nekolidovalo s tvým webem.
   Nahrej tento soubor do projektu a zalinkuj jednou do <head>:
     <link rel="stylesheet" href="/cesta/content-grid.css">
   Pak stačí kamkoli na stránce vkládat HTML vygenerovaný
   builderem — vše se nastyluje automaticky.
   ============================================================ */

/* ------------------------------------------------------------
   1. TOKENS (nastavitelné proměnné pro celý framework)
   Přepiš si je v :root ve svém CSS, pokud chceš jiné hodnoty.
   ------------------------------------------------------------ */
:root {
  --cgb-max-width: 1200px;
  --cgb-gutter: 20px;
  --cgb-gap: 24px;
  --cgb-gap-sm: 16px;
  --cgb-gap-lg: 32px;

  --cgb-radius-sm: 6px;
  --cgb-radius: 10px;
  --cgb-radius-lg: 14px;

  --cgb-muted: rgba(0, 0, 0, 0.6);
  --cgb-surface: rgba(0, 0, 0, 0.03);
  --cgb-surface-strong: rgba(0, 0, 0, 0.06);
  --cgb-border: rgba(0, 0, 0, 0.1);
  --cgb-border-strong: rgba(0, 0, 0, 0.15);

  --cgb-transition: 0.18s ease;
  --cgb-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.04);
  --cgb-shadow-hover: 0 2px 6px rgba(0, 0, 0, 0.08), 0 8px 24px rgba(0, 0, 0, 0.06);

  --cgb-breakpoint-sm: 640px;
  --cgb-breakpoint-md: 1024px;
}

/* ------------------------------------------------------------
   2. CONTAINER & GRID SYSTEM
   Mobile-first. Na mobilu vždy 1 sloupec.
   ------------------------------------------------------------ */
.cgb_container {
  max-width: var(--cgb-max-width);
  margin: 0 auto;
  padding: 0 var(--cgb-gutter);
  box-sizing: border-box;
}
.cgb_container *, .cgb_container *::before, .cgb_container *::after {
  box-sizing: border-box;
}

.cgb_grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--cgb-gap);
  margin: var(--cgb-gap-lg) 0;
}

.cgb_cell {
  min-width: 0;                 /* důležité — jinak obsah roztahuje sloupec */
  display: flex;
  flex-direction: column;
}
.cgb_cell > *:first-child { margin-top: 0; }
.cgb_cell > *:last-child { margin-bottom: 0; }

/* Tablet (2 sloupce pro 2, 3, 4) */
@media (min-width: 640px) {
  .cgb_grid.cgb_cols-2 { grid-template-columns: repeat(2, 1fr); }
  .cgb_grid.cgb_cols-3 { grid-template-columns: repeat(2, 1fr); }
  .cgb_grid.cgb_cols-4 { grid-template-columns: repeat(2, 1fr); }
  .cgb_grid.cgb_cols-5 { grid-template-columns: repeat(2, 1fr); }
  .cgb_grid.cgb_cols-6 { grid-template-columns: repeat(3, 1fr); }
}

/* Desktop */
@media (min-width: 1024px) {
  .cgb_grid.cgb_cols-2 { grid-template-columns: repeat(2, 1fr); }
  .cgb_grid.cgb_cols-3 { grid-template-columns: repeat(3, 1fr); }
  .cgb_grid.cgb_cols-4 { grid-template-columns: repeat(4, 1fr); }
  .cgb_grid.cgb_cols-5 { grid-template-columns: repeat(5, 1fr); }
  .cgb_grid.cgb_cols-6 { grid-template-columns: repeat(6, 1fr); }
}

/* Asymetrické layouty (pokud je budeš chtít) */
.cgb_grid.cgb_cols-2-1 { grid-template-columns: 1fr; }
.cgb_grid.cgb_cols-1-2 { grid-template-columns: 1fr; }
@media (min-width: 1024px) {
  .cgb_grid.cgb_cols-2-1 { grid-template-columns: 2fr 1fr; }
  .cgb_grid.cgb_cols-1-2 { grid-template-columns: 1fr 2fr; }
}

/* ------------------------------------------------------------
   3. HEADING
   ------------------------------------------------------------ */
.cgb_heading {
  margin: 0 0 0.5em;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.01em;
}
h1.cgb_heading { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2.cgb_heading { font-size: clamp(1.5rem, 3vw, 2rem); }
h3.cgb_heading { font-size: clamp(1.25rem, 2.5vw, 1.5rem); }
h4.cgb_heading { font-size: 1.125rem; }

/* Rich formátování uvnitř nadpisu (B, I, U, link) */
.cgb_heading strong, .cgb_heading b { font-weight: 700; }
.cgb_heading em, .cgb_heading i { font-style: italic; }
.cgb_heading a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  transition: opacity var(--cgb-transition);
}
.cgb_heading a:hover { opacity: 0.7; }

/* ------------------------------------------------------------
   4. TEXT BLOCK
   ------------------------------------------------------------ */
.cgb_text {
  line-height: 1.7;
  font-size: 1rem;
  color: inherit;
}
.cgb_text p { margin: 0 0 1em; }
.cgb_text p:last-child { margin-bottom: 0; }
.cgb_text strong, .cgb_text b { font-weight: 600; }
.cgb_text em, .cgb_text i { font-style: italic; }
.cgb_text u { text-decoration: underline; }
.cgb_text a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: opacity var(--cgb-transition);
}
.cgb_text a:hover { opacity: 0.7; }

/* ------------------------------------------------------------
   5. IMAGE
   ------------------------------------------------------------ */
.cgb_image-figure { margin: 0; }
.cgb_image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--cgb-radius);
  object-fit: cover;
}
.cgb_image-caption {
  font-size: 0.875rem;
  color: var(--cgb-muted);
  margin-top: 8px;
  text-align: center;
  font-style: italic;
}

/* ------------------------------------------------------------
   6. IMAGE WITH TEXT OVERLAY
   ------------------------------------------------------------ */
.cgb_image-text {
  position: relative;
  overflow: hidden;
  border-radius: var(--cgb-radius);
  aspect-ratio: 16 / 10;
  min-height: 240px;
}
.cgb_image-text img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.cgb_image-text:hover img { transform: scale(1.03); }
.cgb_overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px;
  color: #fff;
  background: linear-gradient(to top,
    rgba(0,0,0,0.75) 0%,
    rgba(0,0,0,0.35) 45%,
    rgba(0,0,0,0.05) 75%,
    transparent 100%);
}
.cgb_overlay h3 {
  margin: 0 0 8px;
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  line-height: 1.2;
  color: #fff;
  font-weight: 600;
}
.cgb_overlay p {
  margin: 0;
  font-size: 0.95rem;
  opacity: 0.92;
  line-height: 1.5;
}

/* ------------------------------------------------------------
   7. BUTTON
   ------------------------------------------------------------ */
.cgb_button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--cgb-radius-sm);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  line-height: 1.2;
  cursor: pointer;
  border: 1px solid currentColor;
  transition: all var(--cgb-transition);
  white-space: nowrap;
  user-select: none;
}
.cgb_button:hover { opacity: 0.85; transform: translateY(-1px); }
.cgb_button:active { transform: translateY(0); }
.cgb_button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

/* Plné tlačítko (barva pozadí = currentColor, text kontrastní) */
.cgb_button.cgb_button-solid { background: currentColor; }
.cgb_button.cgb_button-solid > span {
  color: #fff;
  mix-blend-mode: difference;
}

/* Obrysové tlačítko */
.cgb_button.cgb_button-outline { background: transparent; }

/* Ghost varianta (bez borderu) */
.cgb_button.cgb_button-ghost {
  border-color: transparent;
  background: var(--cgb-surface);
}
.cgb_button.cgb_button-ghost:hover { background: var(--cgb-surface-strong); }

/* ------------------------------------------------------------
   8. VIDEO
   ------------------------------------------------------------ */
.cgb_video-wrap {
  position: relative;
  padding-bottom: 56.25%;       /* 16:9 */
  height: 0;
  overflow: hidden;
  border-radius: var(--cgb-radius);
  background: #000;
}
.cgb_video-wrap iframe,
.cgb_video-wrap video {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: 0;
}

/* ------------------------------------------------------------
   9. FEATURES / VÝHODY
   ------------------------------------------------------------ */
.cgb_features {
  display: grid;
  gap: var(--cgb-gap-sm);
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .cgb_features.cgb_features-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .cgb_features.cgb_features-cols-3 { grid-template-columns: repeat(3, 1fr); }
}
.cgb_feature {
  display: flex;
  gap: 14px;
  padding: 16px;
  border-radius: var(--cgb-radius);
  background: var(--cgb-surface);
  transition: background var(--cgb-transition);
}
.cgb_feature:hover { background: var(--cgb-surface-strong); }
.cgb_feature-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cgb-surface-strong);
  border-radius: var(--cgb-radius-sm);
  font-size: 22px;
  line-height: 1;
}
.cgb_feature-body { flex: 1; min-width: 0; }
.cgb_feature-body h4 {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}
.cgb_feature-body p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--cgb-muted);
  line-height: 1.55;
}

/* ------------------------------------------------------------
   10. QUOTE / CITACE
   ------------------------------------------------------------ */
.cgb_quote {
  margin: 0;
  padding: 20px 24px;
  border-left: 3px solid currentColor;
  font-style: italic;
  font-size: 1.15rem;
  line-height: 1.55;
  background: var(--cgb-surface);
  border-radius: 0 var(--cgb-radius) var(--cgb-radius) 0;
}
.cgb_quote-author {
  display: block;
  margin-top: 12px;
  font-style: normal;
  font-size: 0.9rem;
  opacity: 0.7;
  font-weight: 500;
}

/* ------------------------------------------------------------
   11. CTA BOX
   ------------------------------------------------------------ */
.cgb_cta {
  padding: 32px 24px;
  border-radius: var(--cgb-radius-lg);
  background: var(--cgb-surface-strong);
  text-align: center;
}
.cgb_cta h3 {
  margin: 0 0 8px;
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: 600;
}
.cgb_cta p {
  margin: 0 0 20px;
  color: var(--cgb-muted);
  font-size: 1rem;
  line-height: 1.55;
}

/* ------------------------------------------------------------
   12. SLIDER
   ------------------------------------------------------------ */
.cgb_slider {
  position: relative;
  border-radius: var(--cgb-radius);
  overflow: hidden;
}
.cgb_slider-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}
.cgb_slider-track::-webkit-scrollbar { display: none; }
.cgb_slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
}
.cgb_slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cgb_slide-caption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 20px;
  color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
}
.cgb_slide-caption strong {
  display: block;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.cgb_slide-caption div {
  font-size: 0.9rem;
  opacity: 0.9;
}
.cgb_slider-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 14px 0 6px;
}
.cgb_slider-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cgb-border-strong);
  border: 0;
  padding: 0;
  cursor: pointer;
  transition: background var(--cgb-transition), transform var(--cgb-transition);
}
.cgb_slider-dot:hover { transform: scale(1.2); }
.cgb_slider-dot.active {
  background: currentColor;
  transform: scale(1.2);
}

/* Slider šipky (volitelné) */
.cgb_slider-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--cgb-transition);
  z-index: 2;
  color: #000;
}
.cgb_slider-nav:hover { background: #fff; transform: translateY(-50%) scale(1.05); }
.cgb_slider-nav.cgb_slider-prev { left: 12px; }
.cgb_slider-nav.cgb_slider-next { right: 12px; }

/* ------------------------------------------------------------
   13. ACCORDION / FAQ
   ------------------------------------------------------------ */
.cgb_accordion {
  border-radius: var(--cgb-radius);
  overflow: hidden;
  border: 1px solid var(--cgb-border);
}
.cgb_accordion-item {
  border-bottom: 1px solid var(--cgb-border);
}
.cgb_accordion-item:last-child { border-bottom: 0; }
.cgb_accordion-trigger {
  width: 100%;
  padding: 16px 20px;
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.4;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-family: inherit;
  color: inherit;
  transition: background var(--cgb-transition);
}
.cgb_accordion-trigger:hover { background: var(--cgb-surface); }
.cgb_accordion-trigger::after {
  content: "";
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform var(--cgb-transition);
  margin-right: 4px;
  margin-bottom: 4px;
}
.cgb_accordion-item.open .cgb_accordion-trigger::after {
  transform: rotate(-135deg);
  margin-bottom: 0;
  margin-top: 4px;
}
.cgb_accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.2s ease;
  padding: 0 20px;
}
.cgb_accordion-item.open .cgb_accordion-content {
  max-height: 1000px;
  padding: 0 20px 18px;
}
.cgb_accordion-content p {
  margin: 0;
  line-height: 1.6;
  color: var(--cgb-muted);
}

/* ------------------------------------------------------------
   14. TABLE
   ------------------------------------------------------------ */
.cgb_table-wrap {
  overflow-x: auto;
  border-radius: var(--cgb-radius);
  border: 1px solid var(--cgb-border);
  -webkit-overflow-scrolling: touch;
}
.cgb_table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.cgb_table th,
.cgb_table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--cgb-border);
  vertical-align: top;
}
.cgb_table th {
  background: var(--cgb-surface);
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--cgb-muted);
}
.cgb_table tbody tr:last-child td { border-bottom: 0; }
.cgb_table tbody tr:hover { background: var(--cgb-surface); }

/* ------------------------------------------------------------
   15. GALLERY
   ------------------------------------------------------------ */
.cgb_gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
@media (min-width: 640px) {
  .cgb_gallery { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .cgb_gallery.cgb_gallery-cols-4 { grid-template-columns: repeat(4, 1fr); }
}
.cgb_gallery img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--cgb-radius-sm);
  display: block;
  transition: transform var(--cgb-transition), opacity var(--cgb-transition);
  cursor: pointer;
}
.cgb_gallery img:hover {
  transform: scale(1.02);
  opacity: 0.92;
}

/* ------------------------------------------------------------
   16. DIVIDER & SPACER
   ------------------------------------------------------------ */
.cgb_divider {
  border: 0;
  border-top: 1px solid var(--cgb-border);
  margin: var(--cgb-gap-lg) 0;
  height: 0;
}
.cgb_divider.cgb_divider-dashed { border-top-style: dashed; }
.cgb_divider.cgb_divider-thick { border-top-width: 2px; }

.cgb_spacer {
  display: block;
  width: 100%;
  height: 40px;
  pointer-events: none;
}

/* ------------------------------------------------------------
   17. PRINT
   Rozbije mřížku do jednoho sloupce, skryje UI prvky.
   ------------------------------------------------------------ */
@media print {
  .cgb_grid,
  .cgb_features,
  .cgb_gallery {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .cgb_slider-dots,
  .cgb_slider-nav { display: none !important; }
  .cgb_accordion-content {
    max-height: none !important;
    padding: 0 20px 18px !important;
  }
  .cgb_button { border: 1px solid #000 !important; color: #000 !important; }
  .cgb_video-wrap::after {
    content: "[Video]";
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
  }
}

/* ------------------------------------------------------------
   18. PŘÍSTUPNOST (a11y)
   ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .cgb_image-text img,
  .cgb_gallery img,
  .cgb_button,
  .cgb_slider-dot,
  .cgb_feature,
  .cgb_accordion-content,
  .cgb_accordion-trigger::after {
    transition: none !important;
    animation: none !important;
  }
}

.cgb_container :focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
  border-radius: 2px;
}

/* ------------------------------------------------------------
   19. KONEC
   ============================================================ */
