/* ==========================================================================
   Sudba – styly stránky
   Struktura souboru:
     1. Proměnné a základ        (barvy, písma, reset, tmavý režim)
     2. Hlavička a navigace
     3. Úvodní sekce (hero)
     4. Sekce s pozadím          (Co aplikace řeší, Principy)
     5. Ukázky                   (karusel náhledů)
     6. Lightbox                 (zvětšený obrázek)
     7. Patička
     8. Časová osa vlevo         (osa, odbočky, značky)
   ========================================================================== */

:root {
  --bg: #fff;
  --fg: #2b2f33;
  --muted: #5c646b;
  --accent: #338fe3;
  --accent-text: #1b72c8;
  --eyebrow: #4d7a00;
  --green: #6aa300;
  --rule: #338fe3;
  --band-dark: #000;
  --band-grey: #16191c;
  --on-band: #fff;
  --font-head: Archivo, "Arial Black", Arial, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", Arial, sans-serif;
  --gutter: clamp(1.25rem, 5vw, 2.75rem);
  color-scheme: light dark;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme:dark) {
  :root:not([data-theme="light"]) {
    --bg: #16191c;
    --fg: #eceeef;
    --muted: #a5adb4;
    --accent-text: #6db3f2;
    --eyebrow: #9bd62a
  }
}

:root[data-theme="dark"] {
  --bg: #16191c;
  --fg: #eceeef;
  --muted: #a5adb4;
  --accent-text: #6db3f2;
  --eyebrow: #9bd62a
}

html {
  scroll-padding-top: env(safe-area-inset-top, 0px)
}

@media (prefers-reduced-motion:no-preference) {
  html {
    scroll-behavior: smooth
  }
}

*, *::before, *::after {
  box-sizing: inherit
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 1rem/1.6 var(--font-body)
}

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 800;
  line-height: 1.15;
  margin: 0
}

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

a {
  color: inherit
}

.wrap {
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: var(--gutter)
}

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

/* header */
.site-header .wrap {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem 2rem;
  padding-block: 1.25rem
}

.brand {
  display: flex;
  align-items: center;
  gap: .4rem;
  text-decoration: none;
  font: 900 clamp(4rem, 6vw, 4.5rem)/1 var(--font-head);
  letter-spacing: -.03em
}

.brand__logo {
  width: .75em;
  height: .75em;
  flex: none
}

.site-header::after {
  content: "";
  display: block;
  max-width: calc(1100px - 2*var(--gutter));
  margin-inline: auto;
  border-bottom: 2px solid var(--rule);
  width: calc(100% - 2*var(--gutter))
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1.5rem;
  font-size: 1.15rem
}

.nav a {
  color: var(--accent-text);
  text-decoration: none;
  padding: .25rem 0
}

.nav a:hover {
  text-decoration: underline
}

/* hero */
.hero {
  padding-block: clamp(2.5rem, 7vw, 4.5rem)
}

.eyebrow {
  margin: 0 0 1rem;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--eyebrow)
}

.hero h1 {
  font-size: clamp(2rem, 5.6vw, 3rem);
  max-width: 20ch;
  text-wrap: balance
}

.lead {
  margin: 1.5rem 0 2rem;
  max-width: 46ch;
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  color: var(--muted)
}

.btns {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem
}

.btn {
  display: inline-block;
  padding: .75rem 1.5rem;
  border: 1.5px solid var(--accent);
  border-radius: 4px;
  font-weight: 600;
  font-size: .95rem;
  text-decoration: none;
  color: var(--accent-text);
  background: transparent;
  transition: background-color .15s, color .15s
}

.btn:hover {
  background: var(--accent);
  color: #fff
}

.btn--ghost {
  border-color: #8a9096;
  color: var(--muted)
}

.btn--ghost:hover {
  background: #666;
  border-color: #666
}

/* bands */
.band {
  padding-block: clamp(2.5rem, 7vw, 4.5rem);
  color: var(--on-band)
}

.band--dark {
  background: var(--band-dark)
}

.band--grey {
  background: var(--band-grey)
}

.band h2 {
  font-size: clamp(1.6rem, 4vw, 2.25rem);
  margin-bottom: 2rem
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  counter-reset: s
}

.steps li {
  counter-increment: s
}

.steps li::before {
  content: counter(s, decimal-leading-zero);
  display: block;
  font: 800 2rem/1.2 var(--font-head);
  color: var(--green)
}

.steps h3 {
  font: 600 1.1rem/1.4 var(--font-body);
  margin: .25rem 0 .5rem
}

.steps p {
  margin: 0;
  font-size: .95rem
}

.principles {
  display: grid;
  gap: 1.5rem 3rem;
  grid-template-columns: 1fr
}

.principles h2 {
  margin: 0
}

.principles dl {
  margin: 0;
  display: grid;
  gap: 1.5rem
}

.principles dt {
  font-weight: 600;
  font-size: 1.05rem
}

.principles dd {
  margin: .25rem 0 0
}

@media (min-width:760px) {
  .principles {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    align-items: start
  }
}

/* carousel */
.hint {
  margin: -1.25rem 0 2rem
}

.carousel {
  position: relative;
  container-type: inline-size;   /* umožní použít cqw = šířka karuselu */
  --h: clamp(190px, 28vw, 300px);
  --tile-gap: 1.75rem;           /* mezera mezi dlaždicemi */
  --peek: 2rem                   /* kolik další dlaždice je vidět na mobilu */
}

.track {
  list-style: none;
  margin: -4px;
  padding: 4px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  grid-template-rows: auto auto;   /* 1. řada popisky, 2. řada obrázky */
  column-gap: var(--tile-gap);
  row-gap: .5rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 4px;
  overscroll-behavior-x: contain;
  scrollbar-width: none
}

.track::-webkit-scrollbar {
  display: none
}

.tile {
  /* na mobilu nikdy není širší než viditelná plocha (kvůli čitelnému popisku) */
  width: min(calc(var(--h)*var(--r)), calc(100cqw + var(--gutter) - var(--tile-gap) - var(--peek)));
  display: grid;
  grid-row: span 2;
  grid-template-rows: subgrid;
  scroll-snap-align: start
}

.tile--wide {
  --r: 2.2667
}

.tile--narrow {
  --r: 1.3067
}

.tile figure {
  margin: 0;
  display: grid;
  grid-row: 1 / span 2;
  grid-template-rows: subgrid
}

.tile figcaption {
  align-self: end;               /* popisek těsně nad obrázkem, i když jsou jiné popisky delší */
  padding-right: .5rem;
  font-weight: 800;
  font-size: .95rem;
  line-height: 1.35;
  color: var(--green)
}

.thumb {
  position: relative;
  display: block;
  width: 100%;
  height: var(--h);
  padding: 0;
  border: 1.5px solid #b7bec4;
  border-radius: 16px;
  overflow: hidden;
  background: #2d2d2d;
  cursor: url("../images/cursor-lupa.svg") 15 15, zoom-in
}

.thumb:hover, .thumb:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent)
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left top   /* při oříznutí zůstane vidět levý horní roh */
}

.badge {
  position: absolute;
  top: .75rem;
  right: .75rem;
  padding: .3rem .8rem;
  border-radius: 999px;
  background: rgb(45 45 45/.88);
  color: #fff;
  font-size: .8rem;
  font-weight: 600;
  pointer-events: none;
  transition: background-color .15s
}

.badge::before {
  content: "\2197\00a0"
}

.thumb:hover .badge, .thumb:focus-visible .badge {
  background: var(--accent)
}

.nav-btn {
  position: absolute;
  bottom: calc(var(--h)/2);      /* uprostřed obrázku, bez ohledu na výšku popisků */
  translate: 0 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255/.94);
  color: #2b2f33;
  box-shadow: 0 2px 12px rgb(0 0 0/.55);
  cursor: pointer;
  transition: opacity .2s, background-color .15s, color .15s
}

.nav-btn svg {
  width: 1.5rem;
  height: 1.5rem
}

.nav-btn:hover {
  background: var(--accent);
  color: #fff
}

.nav-btn:disabled {
  opacity: 0;
  pointer-events: none
}

.nav-prev {
  left: .5rem
}

.nav-next {
  right: .5rem
}

@media (max-width:799px) {
  .carousel {
    --tile-gap: 1rem
  }

  .track {
    margin-right: calc(-1*var(--gutter));   /* karusel sahá k pravému okraji displeje */
    padding-right: var(--gutter);
    scroll-snap-type: x mandatory
  }

  .tile {
    scroll-snap-stop: always
  }
}

@media (min-width:800px) {
  .nav-prev {
    left: -1.5rem
  }

  .nav-next {
    right: -1.5rem
  }
}

/* lightbox */
dialog {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 3.5rem 1rem 1.5rem;
  border: 0;
  background: rgb(0 0 0/.92);
  color: #fff
}

dialog::backdrop {
  background: #000
}

dialog[open] {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .75rem
}

dialog p {
  flex: none;
  min-height: 2.8em;             /* stabilní výška, ať obrázek při přechodu neskáče */
  margin: 0;
  max-width: 70ch;
  text-align: center;
  font-size: .95rem;
  font-weight: 800;
  color: var(--green)
}

.lb-btn {
  position: absolute;
  top: calc(.75rem + env(safe-area-inset-top, 0px));
  right: 1rem;
  padding: .5rem 1.1rem;
  border: 1.5px solid #fff;
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font: 600 .9rem var(--font-body);
  cursor: pointer
}

.lb-btn:hover {
  background: var(--accent);
  border-color: var(--accent)
}

/* zvětšené ukázky: karusel všech obrázků */
.lb-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%
}

.lb-track {
  position: absolute;            /* pevná výška podle okna, aby obrázek nepřetekl */
  inset: 0;
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none
}

.lb-track::-webkit-scrollbar {
  display: none
}

.lb-slide {
  flex: 0 0 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-inline: .25rem;
  scroll-snap-align: center;
  scroll-snap-stop: always
}

.lb-slide img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  background: #fff
}

dialog .lb-count {
  position: absolute;
  top: calc(1.1rem + env(safe-area-inset-top, 0px));
  left: 1rem;
  min-height: 0;
  max-width: none;
  text-align: left;
  font-weight: 600;
  color: #fff
}

.lb-nav {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255/.94);
  color: #2b2f33;
  box-shadow: 0 2px 12px rgb(0 0 0/.55);
  cursor: pointer;
  transition: opacity .2s, background-color .15s, color .15s
}

.lb-nav svg {
  width: 1.5rem;
  height: 1.5rem
}

.lb-nav:hover {
  background: var(--accent);
  color: #fff
}

.lb-nav:disabled {
  opacity: 0;
  pointer-events: none
}

.lb-prev {
  left: .25rem
}

.lb-next {
  right: .25rem
}

/* na dotykových zařízeních (i na šířku) se šipky skryjí, přepíná se tažením prstem */
@media (hover: none) and (pointer: coarse) {
  .lb-nav {
    display: none
  }
}

/* footer */
.site-footer {
  padding-block: clamp(2rem, 6vw, 3.5rem);
  background: var(--band-grey);
  color: var(--on-band)
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem
}

.site-footer .brand {
  font-size: 2.25rem
}

.site-footer p {
  margin: .5rem 0 0
}

.site-footer p a {
  color: #fff;
  text-underline-offset: .2em
}

.site-footer p a:hover {
  color: #8fc4f5
}

.site-footer .authors {
  font-size: .9rem;
  color: #b9c0c6;
  margin: 0;
  text-align: right;
  align-self: flex-end
}

/* časová osa */
.page {
  position: relative;
  --rail: 3.5rem;
  --mark: 1.215rem;
  --gap: .6rem;
  --tl-red: #b3001f;
  --tl-blue: #3aa3de;
  --tl-orange: #e8a000;
  --tl-green: #00996b
}

@media (min-width:800px) {
  .page {
    --rail: 5.5rem;
    --mark: 1.71rem;
    --gap: .9rem
  }
}

@media (max-width: 700px) {
  .site-footer .authors { text-align: left; align-self: flex-start; }
}

main .wrap, .site-footer .wrap {
  padding-left: calc(var(--gutter) + var(--rail))
}

.tl {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  mix-blend-mode: difference
}

.tl i {
  position: absolute;
  left: calc(max(0px, (100% - 1100px)/2) + var(--gutter) - 1px);
  top: var(--start, 0px);
  width: 2px
}

.tl-ghost {
  height: var(--end, 100%);
  background: rgb(255 255 255/.16)
}

.tl-ghost::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 -4px;
  width: 10px;
  background: repeating-linear-gradient(to bottom, rgb(255 255 255/.28) 0 1px, transparent 1px 96px)
}

.tl-line {
  height: var(--reach, var(--end, 100%));
  background: #fff;
  transition: height .12s linear
}

.tl i.tl-cap {
  width: 14px;
  height: 2px;
  margin-left: -6px;
  margin-top: -1px;
  background: #fff
}

[data-tl] {
  position: relative
}

.tl-mark {
  position: absolute;
  right: 100%;
  top: 0;
  width: var(--rail);
  height: 1.15em;
  display: flex;
  align-items: center;
  padding-right: var(--gap);
  pointer-events: none;
  color: inherit
}

.brand .tl-mark {
  bottom: 0;
  height: auto
}

.tl-mark::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: currentColor;
  translate: -50% -50%;
  transition: scale .25s ease-out
}

.tl-branch {
  flex: 1;
  height: 2px;
  background: currentColor;
  transform-origin: left;
  transition: transform .4s ease-out
}

.tl-mark svg {
  flex: none;
  width: var(--mark);
  height: var(--mark);
  overflow: visible
}

.tl-mark svg * {
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 0
}

.tl-mark--circle svg {
  color: var(--tl-red)
}

.tl-mark--diamond svg {
  color: var(--tl-blue)
}

.tl-mark--triangle svg {
  color: var(--tl-orange)
}

.tl-mark--pentagon svg {
  color: var(--tl-green)
}

.tl-mark--square svg * {
  fill: none;
  stroke-width: 2
}

.js .tl-mark::before {
  scale: 0
}

.js .tl-branch {
  transform: scaleX(0)
}

.js .tl-mark svg * {
  stroke-dashoffset: 1;
  fill-opacity: 0;
  transition: stroke-dashoffset .55s ease-out .35s, fill-opacity .3s ease-out .8s
}

.js .tl-mark.on::before {
  scale: 1
}

.js .tl-mark.on .tl-branch {
  transform: none
}

.js .tl-mark.on svg * {
  stroke-dashoffset: 0;
  fill-opacity: 1
}

@media (prefers-reduced-motion:reduce) {
  .tl-line, .tl-branch, .tl-mark::before, .tl-mark svg * {
    transition: none !important
  }
}
