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

html {
  --line: 12.5pt;
  background: #000;
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  container-type: inline-size;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: calc(3 * var(--line)) 1.5rem;
  background: #000;
  color: #fff;
  font-family: "IBM Plex Sans";
  font-size: 10pt;
  line-height: var(--line);
}

/* Všechny rozměry vychází z --line, takže poměr náhledů a textu je vždy stejný.
   Když se sloupce nevejdou, --line se zmenší podle šířky stránky. */
main {
  --columns: 4;
  --line: min(12.5pt, 100cqw / (var(--columns) * 12.96 - 0.96));
  --thumb: calc(12 * var(--line));
  --gap: calc(0.96 * var(--line));
  --text: calc(0.8 * var(--line));
  width: 100%;
  max-width: calc(var(--columns) * var(--thumb) + (var(--columns) - 1) * var(--gap));
  font-size: var(--text);
  line-height: var(--line);
  text-rendering: geometricPrecision;
}

/* Okraje stránky jsou stejné jako mezera mezi náhledy */
@media (max-width: 767.98px) {
  body {
    padding-inline: 0;
  }

  main {
    --columns: 2;
    --line: min(12.5pt, 100cqw / (var(--columns) * 12.96 + 0.96));
  }
}

a {
  display: block;
  color: inherit;
  overflow-wrap: anywhere;
}

html[lang="cs"] [lang="en"],
html[lang="en"] [lang="cs"] {
  display: none;
}

a:focus-visible,
.languages button:focus-visible,
.thumb:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

ul {
  list-style: none;
}

.logo {
  display: block;
  height: calc(2 * var(--line));
  width: auto;
}

h1 {
  font-family: "IBM Plex Mono";
  font-size: calc((var(--line) + 0.698 * var(--text)) / 0.698);
  font-weight: 200;
  line-height: calc(2 * var(--line));
  /* Optické zarovnání: svislý tah "K" lícuje s levou hranou vlajek */
  margin-left: -0.094em;
}

h1 span {
  display: block;
}

.languages {
  display: flex;
  gap: 1ch;
}

.languages button {
  position: relative;
  height: var(--line);
  aspect-ratio: 3 / 2;
  border: 1px solid #fff;
  background: none;
  cursor: pointer;
}

/* Větší plocha pro klepnutí na mobilu, vlajka zůstává malá */
.languages button::after {
  content: "";
  position: absolute;
  inset: -0.5rem calc(-0.5ch - 1px);
}

.languages img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portrait {
  display: block;
  width: var(--thumb);
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

.about,
.projects {
  display: grid;
  grid-template-columns: repeat(var(--columns), var(--thumb));
  gap: var(--line) var(--gap);
}

.thumb {
  display: block;
  position: relative;
  width: var(--thumb);
  aspect-ratio: 3 / 2;
  overflow: hidden;
  cursor: pointer;
}

.thumb > img,
.thumb > video {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.thumb > .is-active {
  display: block;
}

.arrow {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3ch;
  border: 0;
  background: rgb(0 0 0 / 0.33);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  opacity: 0;
  -webkit-user-select: none;
  user-select: none;
}

.arrow-previous {
  left: 0;
}

.arrow-next {
  right: 0;
}

.thumb:hover .arrow,
.project .thumb:focus-visible .arrow,
.arrow:focus-visible {
  opacity: 1;
}

.arrow:hover {
  background: rgb(0 0 0 / 0.66);
}

.arrow:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -2px;
}

@media (any-hover: none) {
  .arrow {
    opacity: 1;
    touch-action: manipulation;
  }
}

.lightbox {
  width: min(90vw, 127.5vh, 40 * 1.5 * var(--line));
  width: min(90vw, 127.5svh, 40 * 1.5 * var(--line));
  max-width: none;
  max-height: none;
  margin: auto;
  border: 0;
  background: #000;
  color: inherit;
  overflow: hidden;
}

.lightbox::backdrop {
  background: rgb(0 0 0 / 0.85);
}

.lightbox .thumb {
  width: 100%;
  outline: 0;
  cursor: default;
  touch-action: pan-y pinch-zoom;
}
