/* Kviziq – the static pages (tools/site-pages.mjs; each page loads base.css, then this file): plain
   HTML without JS, and the printed answer sheets. The old-engine :focus block is repeated at the end
   so it comes last here too, as it does in app.css. */

/* Every wordmark: its height is set where it's used, the width follows from the viewBox. */
.wordmark {
  display: block;
  width: auto;
  height: 1em;
  overflow: visible;
}

.wordmark__kviz {
  stroke: var(--text);
}

.wordmark__marks {
  stroke: var(--accent);
}

.wordmark__top {
  stop-color: var(--accent);
}

/* Darker toward the bottom, so IQ keeps its contrast on the sand ground (the gradient ends below it). */
.wordmark__bottom {
  stop-color: var(--accent-ink);
}

/* ---------------------------------------------------------------- Static pages */

/* The pages tools/site.mjs generates (kvizy/, kategorie/, jak-hrat/, o-projektu/, ochrana-soukromi/):
   plain HTML without JS, cream sheets on the ground. Stacks use grid gaps, not flex gaps, which
   Chromium 76 (2021 smart TVs) lacks. */
.page {
  max-width: 96rem;
  margin: 0 auto;
  padding: max(var(--gutter), env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right))
    max(var(--gutter), env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
  display: grid;
  gap: 1.6rem;
  font-size: 1.6rem;
  line-height: 1.5;
}

@supports not (width: min(1px, 2px)) {
  .page {
    padding: var(--gutter);
  }
}

.page__main {
  display: grid;
  gap: 2rem;
}

.page__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

/* The wordmark (wordmarkSvg() in icons.js) links home; its rays overhang into the page's padding. */
.page__brand {
  display: block;
  width: max-content;
  margin-right: 2rem;
  font-size: 3.2rem;
}

@media (pointer: coarse) {
  .page__brand {
    display: flex;
    align-items: center;
    min-height: 44px;
  }
}

/* The page links and "Hrát" (TASK-journey §12): the app's top bar has the same links. */
.page__nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.page__play {
  min-height: 0;
  margin-left: 2.4rem;
  padding: 0.5em 1.6em;
  font-size: 1.5rem;
  text-decoration: none;
}

.page__menu {
  margin: 0;
  padding: 0;
  list-style: none;
}

.page__menu li {
  display: inline-block;
  margin-right: 1.8rem;
}

.page__menu li:last-child {
  margin-right: 0;
}

.page__menu [aria-current] {
  color: var(--text);
}

.page__crumbs ol {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 1.4rem;
}

.page__crumbs li {
  display: inline;
}

.page__crumbs li + li::before {
  content: '›';
  margin: 0 0.6em;
}

.page__body,
.page__box {
  display: grid;
  gap: 1rem;
  padding: 2.4rem 2.8rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 0.15rem solid var(--line);
  box-shadow: var(--raise);
}

/* The short how-to beside a quiz: recessed, so the quiz itself stays the main sheet. */
.page__box {
  background: var(--surface-2);
  box-shadow: none;
}

.page__body > *,
.page__box > * {
  min-width: 0;
  margin: 0;
}

.page__title {
  font-family: var(--font-display);
  font-size: 3.6rem;
  line-height: 1.1;
}

.page__body h2,
.page__box h2,
.page__heading {
  font-family: var(--font-display);
  font-size: 2.2rem;
  line-height: 1.2;
}

.page__body h2 {
  margin-top: 1.2rem;
}

.page__lead {
  font-size: 1.9rem;
  color: var(--muted);
}

.page__body ul,
.page__steps {
  padding-left: 1.4em;
}

.page__body li + li,
.page__steps li + li {
  margin-top: 0.4rem;
}

.page__body code {
  font-size: 0.85em;
  color: var(--muted);
}

.page__note,
.page__footer {
  color: var(--muted);
  font-size: 1.3rem;
}

/* One row like the home footer (links left, copyright right), wrapping on narrow screens. Margins,
   not flex gap, which Chromium 76 lacks. */
.page__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  padding-top: var(--footer-pad);
  border-top: 0.15rem solid var(--line);
}

.page__footer > * {
  margin: 0.3rem 0;
}

.page__footer .page__menu {
  margin-right: 2rem;
}

.page__link,
.page__kicker-link {
  color: var(--accent-ink);
  font-weight: 700;
  text-underline-offset: 0.2em;
}

.page__kicker-link {
  text-decoration: none;
}

@media (hover: hover) {
  .page__link:hover,
  .page__kicker-link:hover {
    color: var(--text);
    text-decoration: underline;
  }

  .page__brand .wordmark {
    transition: transform 0.15s ease;
  }

  .page__brand:hover .wordmark {
    transform: rotate(-2deg) scale(1.04);
  }
}

.page__facts {
  font-weight: 700;
}

.page__cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: 0.8rem 0;
}

.page__cta > * {
  margin: 0.4rem 1.6rem 0.4rem 0;
}

.page__cta .btn {
  text-decoration: none;
}

.page__rounds,
.page__options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(28rem, 1fr));
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 28rem), 1fr));
  gap: 0.8rem;
  padding: 0;
  list-style: none;
}

.page__body .page__rounds li,
.page__body .page__options li {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 0.1rem solid var(--line);
  font-weight: 700;
}

.page__round-num,
.page__option-letter {
  flex: none;
  width: 2.8rem;
  height: 2.8rem;
  margin-right: 1rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 2.8rem;
  text-align: center;
}

.page__option-letter {
  background: var(--surface);
  border: 0.1rem solid var(--line);
  color: var(--text);
  line-height: 2.6rem;
}

.page__round-icon {
  margin-right: 0.8rem;
}

.page__sample {
  display: grid;
  gap: 1rem;
  margin: 0;
}

.page__question {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
}

.page__section,
.page__intro {
  display: grid;
  gap: 1.2rem;
}

.page__intro > *,
.page__section > * {
  margin: 0;
}

.page__count {
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 1.4rem;
}

.page__tags {
  margin: 0;
  padding: 0;
  list-style: none;
}

.page__tags li {
  display: inline-block;
  margin: 0 0.6rem 0.6rem 0;
}

.page__tag {
  display: inline-block;
  padding: 0.3em 0.9em;
  border-radius: 999px;
  background: var(--surface);
  border: 0.1rem solid var(--line);
  color: var(--text);
  font-size: 1.4rem;
  font-weight: 700;
  text-decoration: none;
}

.page__cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(28rem, 1fr));
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 28rem), 1fr));
  gap: 1.2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.page__card {
  display: grid;
  align-content: start;
  gap: 0.6rem;
  height: 100%;
  padding: 1.6rem 1.8rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 0.15rem solid var(--line);
  box-shadow: var(--raise);
  color: var(--text);
  text-decoration: none;
}

@media (hover: hover) {
  .page__tag:hover,
  .page__card:hover {
    border-color: var(--accent-line);
  }
}

/* The category strip, as on the app's cards (js/patterns.js): full bleed across the card's top. */
.page__card-strip {
  position: relative;
  display: flex;
  align-items: center;
  height: 3.6rem;
  margin: -1.6rem -1.8rem 0.4rem;
  padding: 0 1.2rem;
  overflow: hidden;
  border-bottom: 0.15rem solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface-2);
}

.page__card-strip .pattern {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.45;
}

.page__card-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border: 0.15rem solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  font-size: 1.4rem;
  line-height: 1;
}

.page__heading-icon {
  font-size: 0.9em;
}

/* The how-to page's ways to play and steps, with the app's illustrations. */
.page__ways {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr));
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: 1.2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.page__body .page__ways {
  padding-left: 0;
}

.page__body .page__way {
  margin: 0;
}

.page__way {
  display: grid;
  grid-template-columns: 5.6rem minmax(0, 1fr);
  align-items: center;
  gap: 1.2rem;
  padding: 1.2rem 1.4rem;
  border: 0.15rem solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 1.5rem;
  line-height: 1.4;
}

.page__way .illo {
  width: 5.6rem;
  height: 4.2rem;
}

.page__way strong {
  display: block;
}

.page__card-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
}

.page__card-text {
  color: var(--muted);
  font-size: 1.4rem;
}

.page__card-facts {
  color: var(--accent-ink);
  font-size: 1.3rem;
  font-weight: 700;
}

.page__faq {
  margin: 0;
}

.page__faq dt {
  margin-top: 1.4rem;
  font-weight: 800;
}

.page__faq dt:first-child {
  margin-top: 0;
}

.page__faq dd {
  margin: 0.3rem 0 0;
}

.page__keys {
  border-collapse: collapse;
}

.page__keys th,
.page__keys td {
  padding: 0.4rem 2.4rem 0.4rem 0;
  border-bottom: 0.1rem solid var(--line);
  text-align: left;
}

.page__keys kbd {
  padding: 0.1em 0.5em;
  border-radius: 0.4rem;
  background: var(--surface-2);
  border: 0.1rem solid var(--line);
  font-family: inherit;
  font-weight: 700;
}

/* Printable answer sheets (/kvizy/<id>/listek/, /listek/; TASK-platform §4): rounds in two
   columns on screen, two rounds per A4 page in print, with only the sheet itself on paper. */
.sheet__rounds {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(30rem, 1fr));
  gap: 1.6rem 2.4rem;
}

.sheet__round {
  display: grid;
  gap: 0.6rem;
  padding: 1.2rem 1.4rem;
  border: 0.15rem solid var(--line);
  border-radius: 0.8rem;
  break-inside: avoid;
}

.sheet__title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  font-size: 1.7rem;
}

.sheet__joker {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 1.3rem;
  font-weight: 700;
}

.sheet__joker .sheet__box {
  margin-right: 0.4em;
}

.sheet__rows {
  display: grid;
  gap: 0.2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sheet__row {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr) auto;
  align-items: end;
  gap: 0.8rem;
  min-height: 3rem;
  margin: 0;
}

/* A row without a number (the tiebreaker) is only the line. */
.sheet__tiebreak .sheet__row {
  grid-template-columns: minmax(0, 1fr);
}

.sheet__num {
  color: var(--muted);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sheet__line {
  display: block;
  height: 2.2rem;
  border-bottom: 0.12rem solid var(--text);
}

/* A list question (TASK-competition §7): one line per item, stacked in the answer column. */
.sheet__line ~ .sheet__line {
  grid-column: 2;
}

/* Boxes to tick (A–D) without a line: they fill the row from the left. */
.sheet__row > .sheet__boxes:nth-child(2) {
  grid-column: 2 / 4;
}

.sheet__boxes {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 2.4rem;
  justify-content: start;
  gap: 1rem;
}

.sheet__box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border: 0.12rem solid var(--text);
  border-radius: 0.3rem;
  color: var(--muted);
  font-size: 1.2rem;
  font-weight: 700;
}

.sheet__box--wide {
  width: 6rem;
  margin-left: 0.6rem;
}

.sheet__sum,
.sheet__total {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-family: var(--font-body);
  font-size: 1.4rem;
  font-weight: 700;
}

.sheet__team {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: end;
  gap: 1rem;
  font-size: 1.8rem;
  font-weight: 800;
}

/* The logo and the address in the printed sheet's corner (the page header doesn't print). */
.sheet__brand {
  display: none;
}

.sheet__play {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.sheet__play .btn {
  margin-right: 1.6rem;
}

@page {
  size: A4;
  margin: 12mm;
}

@media print {
  body {
    background: #fff;
    color: #000;
  }

  .page__header,
  .page__crumbs,
  .page__footer,
  .sheet__hint,
  .sheet__play {
    display: none;
  }

  /* Blocks, not grids: page breaks inside a grid are unreliable. Sizes in mm, so two rounds and
     the title fit one A4 page whatever the screen's root size. */
  .page,
  .page__main,
  .page__body,
  .sheet__rounds {
    display: block;
  }

  .page {
    padding: 0;
  }

  .page__body {
    padding: 0;
    border: 0;
    box-shadow: none;
    background: #fff;
  }

  .page__title {
    margin-bottom: 4mm;
    font-size: 18pt;
  }

  .sheet {
    position: relative;
  }

  /* The corner's logo stays clear of the title and the team line. */
  .sheet .page__title,
  .sheet__team {
    padding-right: 45mm;
  }

  .sheet__brand {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    position: absolute;
    top: 0;
    right: 0;
    margin: 0;
    padding-top: var(--wordmark-overhang);
    font-size: 8mm;
    line-height: 1;
  }

  .sheet__brand span {
    margin-top: 2mm;
    font-size: 9pt;
    font-weight: 700;
  }

  .sheet__team {
    margin-bottom: 5mm;
    font-size: 12pt;
  }

  .sheet__round {
    margin-bottom: 5mm;
    padding: 3mm 4mm;
  }

  .sheet__title {
    margin-bottom: 1mm;
    font-size: 12pt;
  }

  .sheet__row {
    min-height: 8mm;
  }

  .sheet__line {
    height: 6mm;
  }

  /* Two rounds per page; the last page also holds the tiebreaker and the total. */
  .sheet__rounds > .sheet__round:nth-child(2n):not(:last-child) {
    break-after: page;
  }
}

@media (max-aspect-ratio: 4/3) {

  html {
    font-size: 1.3vw;
    font-size: max(12px, min(1.3vw, 1.3vh));
  }
}

@media (pointer: coarse) {
  .btn,
  .ctrl,
  .switch,
  .add__tab {
    min-height: 44px;
  }
}

@media (max-width: 600px), (max-height: 500px) {

  /* The 12 px floor would make the UI too big for a phone; scale with the short side instead. */
  html {
    font-size: clamp(10px, 2.75vmin, 12px);
  }

  :root {
    --gutter: 1.6rem;
  }

  .btn--xl {
    font-size: 1.9rem;
  }
}

@media (max-width: 600px) {

  .page {
    font-size: 1.5rem;
  }

  .page__body,
  .page__box {
    padding: 1.6rem 1.6rem;
  }

  .page__title {
    font-size: 3rem;
  }

  /* The wordmark and "Hrát" on one row, the page links under them. */
  .page__header {
    display: grid;
    grid-template-columns: auto auto;
    grid-template-areas:
      "brand play"
      "nav nav";
    align-items: center;
    justify-content: space-between;
  }

  .page__nav {
    display: contents;
  }

  .page__header .page__brand {
    grid-area: brand;
  }

  .page__header nav {
    grid-area: nav;
  }

  .page__play {
    grid-area: play;
    margin-left: 0;
  }

  /* Room for the smile above the menu. */
  .page__brand {
    margin-bottom: 0.6rem;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .btn {
    min-height: max(44px, 2.8em);
  }

  .btn--xl,
  .intro .actions .btn--primary {
    font-size: 1.8rem;
  }
}

/* !important: beats every component's own animation and transition. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------------------------------------------------------------- Older engines (TV browsers)

   Smart TVs keep the browser engine they shipped with (Samsung 2021: Chromium 76, 2022: Chromium 85).
   Current browsers never read this block; desktop and phones look exactly as above.
   The color-mix() fallbacks sit right after the rules they patch, to keep the cascade order. */

/* Without :focus-visible (Chromium 86) the rules using it are dropped and the browser's own ring
   shows on every focus, including the quiet one setScreen() gives the main button. */
@supports not selector(:focus-visible) {
  :focus {
    outline: 0.3rem solid var(--focus);
    outline-offset: 0.25rem;
  }

  [data-quiet-focus]:focus,
  .screen:focus {
    outline: none;
  }
}
