/* Reusable pieces: buttons, cards, lists, forms, navigation aids. */

/* ---- Buttons ------------------------------------------------------------------- */
/* No flex gap here: a button's label may contain inline elements (a <span lang>
 * for an abbreviation), and a gap would space every text node apart. Icons
 * carry their own margin instead. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-block-size: var(--target-comfortable);
  padding: 0.55em 1.35em;
  border: 2px solid var(--accent);
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition:
    background-color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out),
    translate var(--duration-fast) var(--ease-out);
}

.button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--on-accent);
  translate: 0 -1px;
}

.button:active {
  translate: 0 1px;
}

.button--ghost {
  background: transparent;
  color: var(--link);
}

.button--ghost:hover {
  background: var(--bg-tint);
  color: var(--accent-strong);
}

.button--inverse {
  background: var(--text-inverse);
  border-color: var(--text-inverse);
  color: var(--bg-inverse);
}

.button--inverse:hover {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
  color: var(--bg-inverse);
}

.button--small {
  min-block-size: var(--target-min);
  padding: 0.3em 0.9em;
  font-size: var(--text--1);
}

/* ---- Cards ----------------------------------------------------------------------- */
.card {
  --flow-space: var(--space-xs);
  position: relative;
  display: flex;
  flex-direction: column;
  padding: var(--space-m);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--duration-base) var(--ease-out), border-color var(--duration-base) var(--ease-out);
}

.card::before {
  content: "";
  position: absolute;
  inset-inline: var(--space-m);
  inset-block-start: 0;
  block-size: 4px;
  border-radius: 0 0 var(--radius-pill) var(--radius-pill);
  background: linear-gradient(90deg, var(--accent), color-mix(in oklch, var(--accent) 40%, var(--amber)));
  transition: inset-inline var(--duration-base) var(--ease-out), block-size var(--duration-base) var(--ease-out);
}

/* Hover: deeper shadow, accent border and a wider gradient bar; the lift is
 * movement, so it is gated by the reduced-motion preference. */
@media (hover: hover) {
  .card:hover {
    box-shadow: var(--shadow-lg);
    border-color: color-mix(in oklch, var(--accent) 55%, var(--border));
  }

  .card:hover::before {
    inset-inline: var(--space-xs);
    block-size: 6px;
  }
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .card {
    transition:
      box-shadow var(--duration-base) var(--ease-out),
      border-color var(--duration-base) var(--ease-out),
      translate var(--duration-base) var(--ease-out);
  }

  .card:hover {
    translate: 0 -4px;
  }
}

.card__title {
  font-size: var(--text-1);
}

.card__title a {
  color: var(--text);
  text-decoration-color: transparent;
}

.card__title a:hover {
  color: var(--accent-strong);
  text-decoration-color: currentColor;
}

/* Whole-card click target: the title stays the only link (one Tab stop, the
 * title as its name) and its hit area is stretched over the card. The focus
 * ring moves to the card so a wrapped title gets one rectangle, not one per
 * line. Secondary links are raised above the overlay. */
@supports selector(:has(a)) {
  .card__title a::after,
  .post-card__title a::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
  }

  .card:has(.card__title a:focus-visible),
  .post-card:has(.post-card__title a:focus-visible) {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
    box-shadow: 0 0 0 3px var(--focus-halo);
  }

  .card__title a:focus-visible,
  .post-card__title a:focus-visible {
    outline: none;
    box-shadow: none;
  }

  .card .more-link,
  .card__list a,
  .post-card .more-link {
    position: relative;
    z-index: 1;
  }
}

.card__meta {
  font-size: var(--text--1);
  color: var(--text-muted);
}

.card__list {
  --flow-space: var(--space-2xs);
  display: grid;
  gap: var(--space-3xs);
  font-size: var(--text--1);
}

.card__list li {
  display: flex;
  align-items: flex-start;
  gap: 0.7em;
}

/* The dot is a flex item centred on the first line of text, so it stays
 * aligned whatever the font size or line height. */
.card__list li::before {
  content: "";
  flex: none;
  inline-size: 0.6em;
  block-size: 0.6em;
  margin-block-start: calc((var(--leading-body) * 1em - 0.6em) / 2);
  border-radius: 50%;
  background: var(--accent);
}

.card__more {
  margin-block-start: auto;
  padding-block-start: var(--space-xs);
}

.more-link {
  font-weight: 650;
  text-decoration: none;
}

.more-link::after {
  content: "\2192" / "";
  display: inline-block;
  margin-inline-start: 0.35em;
  transition: translate var(--duration-fast) var(--ease-out);
}

.more-link:hover {
  text-decoration: underline;
}

.more-link:hover::after {
  translate: 0.25em 0;
}

/* Cards rise in as they scroll into view (scroll-driven animation, gated).
 * Only movement is animated, never opacity: if the timeline is inactive
 * (a page that does not scroll) the resting state is still fully readable. */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .card,
    .post-card {
      animation: rise-in linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 30%;
    }
  }

  @keyframes rise-in {
    from {
      translate: 0 1.25rem;
      scale: 0.985;
    }
  }
}

/* ---- Blog list ------------------------------------------------------------------------- */
.post-list {
  --flow-space: var(--space-l);
}

.post-card {
  position: relative;
  padding-inline-start: var(--space-m);
  border-inline-start: 4px solid var(--accent-soft);
  transition: border-color var(--duration-base) var(--ease-out);
}

.post-card:hover {
  border-color: var(--accent);
}

.post-card__title {
  font-size: var(--text-2);
}

.post-card__title a {
  color: var(--text);
  text-decoration-color: transparent;
}

.post-card__title a:hover {
  color: var(--accent-strong);
  text-decoration-color: currentColor;
}

.post-card__meta,
.post-meta {
  font-size: var(--text--1);
  color: var(--text-muted);
}

.post-meta__sep {
  margin-inline: 0.4em;
}

.post-figure img {
  inline-size: 100%;
  box-shadow: var(--shadow-md);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
}

.tag {
  display: inline-flex;
  align-items: center;
  min-block-size: var(--target-comfortable);
  padding-inline: 0.9em;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--bg-tint);
  color: var(--accent-strong);
  font-size: var(--text--1);
  font-weight: 600;
  text-decoration: none;
  transition: background-color var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out);
}

a.tag:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.tag[aria-current] {
  background: var(--accent);
  color: var(--on-accent);
}

.feed-link::before {
  content: "";
  display: inline-block;
  inline-size: 1em;
  block-size: 1em;
  margin-inline-end: 0.4em;
  vertical-align: -0.15em;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='5' cy='19' r='2.5'/%3E%3Cpath d='M3 10a11 11 0 0 1 11 11h-3a8 8 0 0 0-8-8zm0-7a18 18 0 0 1 18 18h-3A15 15 0 0 0 3 6z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---- Pagination ------------------------------------------------------------------------- */
.pagination__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
}

.pagination__list a {
  display: inline-flex;
  align-items: center;
  min-block-size: var(--target-comfortable);
  padding-inline: var(--space-xs);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  text-decoration: none;
  font-weight: 600;
}

.pagination__list a[aria-current] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

/* The filled background that marks the current tag and page disappears in
 * forced colours; a thick border and an underline survive there. */
@media (forced-colors: active) {
  .tag[aria-current],
  .pagination__list a[aria-current] {
    border-width: 3px;
    text-decoration: underline;
    text-decoration-thickness: 0.15em;
    text-underline-offset: 0.2em;
  }
}

/* ---- Language switcher: a segmented group, styled like the appearance toggle ---------------- */
.lang-switcher__list,
.version-switch__list {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-raised);
}

.lang-switcher__link,
.version-switch__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* 44 px including the group's 1 px border, like the rest of the header row. */
  min-inline-size: calc(var(--target-comfortable) - 2px);
  min-block-size: calc(var(--target-comfortable) - 2px);
  padding: 0 0.75em;
  border-radius: var(--radius-pill);
  font-size: var(--text--1);
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}

.lang-switcher__link:hover,
.version-switch__link:hover {
  color: var(--accent-strong);
}

.lang-switcher__link[aria-current],
.version-switch__link[aria-current] {
  background: var(--accent-soft);
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.lang-switcher__link:focus-visible,
.version-switch__link:focus-visible {
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--focus-halo);
}

/* The version switch (standard text / easy-to-read text) is the same segmented
 * control, in the page header of the pages that exist in both versions; the
 * easy option carries the easy-to-read mark. */
.version-switch__link {
  gap: 0.5em;
  padding-inline: 1em;
}

.version-switch__mark {
  block-size: 1.5em;
  inline-size: auto;
  flex: none;
}

/* Full names by default; the short code is hidden from everyone. */
.lang-switcher__short {
  display: none;
}

/* First stage of the header's collapse: when the tools row is narrower than
 * 40em of its font, the pills show SK / EN / CZ and the full name becomes
 * screen-reader-only text after the code, so the accessible name still
 * contains the visible label (WCAG 2.5.3) and still says the language. */
@container tools (width < 40em) {
  .lang-switcher__short {
    display: inline;
  }

  .lang-switcher__name {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

/* ---- Sitemap and link lists ----------------------------------------------------------------------------- */
.sitemap-list,
.link-list {
  display: grid;
  gap: var(--space-2xs);
}

.sitemap-list ul {
  margin-block-start: var(--space-2xs);
  padding-inline-start: var(--space-m);
  display: grid;
  gap: var(--space-2xs);
  border-inline-start: 2px solid var(--border);
}

.sitemap-list a,
.link-list a {
  display: inline-flex;
  align-items: center;
  min-block-size: var(--target-min);
}

.sitemap-list__date {
  color: var(--text-muted);
  font-size: var(--text--1);
  margin-inline-start: 0.4em;
}

/* ---- Back to top ------------------------------------------------------------------------------------------- */
.back-to-top {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  min-block-size: var(--target-comfortable);
  font-weight: 650;
}

/* The arrow is decorative: the empty alternative text keeps it silent for assistive technology. */
.back-to-top::before {
  content: "\2191" / "";
}

/* ---- Search page ------------------------------------------------------------------------------ */
.search-page__form {
  --flow-space: var(--space-2xs);
  display: grid;
  gap: var(--space-2xs);
  max-inline-size: var(--measure);
}

.search-page__row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
}

.search-page__row input {
  flex: 1 1 14rem;
}

.search-page__search .search-status {
  margin-block-start: var(--space-s);
  font-weight: 650;
  color: var(--text);
}

.search-page__search .search-results {
  margin-block-start: var(--space-s);
  max-inline-size: var(--measure-wide);
}

/* ---- Pattern library ------------------------------------------------------------------------- */
.pattern-meta {
  display: grid;
  gap: var(--space-xs) var(--space-l);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  margin: var(--space-m) 0 0;
  font-size: var(--text--1);
}

.pattern-meta__item dt {
  color: var(--text-muted);
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.85em;
}

.pattern-meta__item dd {
  margin: var(--space-3xs) 0 0;
}

.pattern-criteria {
  display: grid;
  gap: var(--space-3xs);
}

.pattern-criteria__id {
  display: inline-block;
  min-inline-size: 3.2em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent-strong);
}

/* Under the list: a component must meet every criterion; these are the ones
 * most often broken with it (the list is a selection, not a certificate). */
.pattern-criteria__note {
  margin: var(--space-2xs) 0 0;
  font-size: var(--text--1);
  color: var(--text-muted);
}

.pattern-demo__stage {
  padding: var(--space-l);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  background:
    radial-gradient(40rem 20rem at 100% 0%, color-mix(in oklch, var(--bg-tint) 70%, transparent), transparent 70%),
    var(--bg-raised);
  box-shadow: var(--shadow-sm);
}

.demo-stack {
  display: grid;
  gap: var(--space-m);
}

.demo-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-m);
  padding: var(--space-xs) var(--space-s);
  border-radius: var(--radius-m);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
}

.demo-controls legend {
  font-weight: 650;
  font-size: var(--text--1);
  padding-inline: var(--space-3xs);
}

.demo-controls label {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  min-block-size: var(--target-comfortable);
  font-weight: 500;
}

.demo-sentence {
  font-size: var(--text-1);
  max-inline-size: var(--measure);
}

/* Code blocks span the full layout width, like the demo stages above them. */
.code-block {
  position: relative;
}

.code-block__copy {
  position: absolute;
  inset-block-start: var(--space-2xs);
  inset-inline-end: var(--space-2xs);
}

.code-block pre {
  padding-block-start: var(--space-l);
}

.pattern-prose h2 {
  margin-block-start: var(--space-xl);
}

.pattern-prose table td:first-child,
.pattern-prose table th:first-child {
  white-space: nowrap;
}

/* ---- EAA check ------------------------------------------------------------------------------- */
.eaa-check {
  max-inline-size: var(--measure);
  padding: var(--space-l);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  background: var(--bg-raised);
  box-shadow: var(--shadow-sm);
}

.eaa-node__title {
  font-size: var(--text-2);
  max-inline-size: 30ch;
}

.eaa-node__title--applies {
  color: var(--success);
}

.eaa-node__title--not {
  color: var(--text);
}

.eaa-node__description {
  max-inline-size: var(--measure);
  color: var(--text-muted);
}

.eaa-node__description ol {
  margin-block-start: var(--space-2xs);
}

.eaa-node__answers {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}


.button--yes::before {
  content: "\2713" / "";
  margin-inline-end: 0.5em;
  font-weight: 800;
}

.button--no {
  background: var(--bg-inverse);
  border-color: var(--bg-inverse);
  color: var(--text-inverse);
}

.button--no:hover {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.button--no::before {
  content: "\2715" / "";
  margin-inline-end: 0.5em;
  font-weight: 800;
}

.eaa-node__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.eaa-progress {
  display: grid;
  gap: var(--space-2xs);
  max-inline-size: 24rem;
}

/* The track has a visible outline (3:1, WCAG 1.4.11) so the full length of the
 * questionnaire can be judged, not only the filled part. */
.eaa-progress__bar {
  inline-size: 100%;
  block-size: 0.9rem;
  border: 2px solid var(--text-muted);
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: var(--bg-raised);
  accent-color: var(--accent);
}

.eaa-progress__bar::-webkit-progress-bar {
  background: var(--bg-raised);
  border-radius: var(--radius-pill);
}

.eaa-progress__bar::-webkit-progress-value {
  background: var(--accent);
  border-radius: var(--radius-pill);
  transition: inline-size var(--duration-base) var(--ease-out);
}

.eaa-progress__bar::-moz-progress-bar {
  background: var(--accent);
  border-radius: var(--radius-pill);
}

@media (prefers-reduced-motion: no-preference) {
  .eaa-check[data-enhanced] .eaa-node {
    animation: eaa-in var(--duration-base) var(--ease-out);
  }

  @keyframes eaa-in {
    from {
      translate: 0.75rem 0;
    }
  }
}

/* Controls that only make sense once the consent component has upgraded. */
html:not([data-js]) [data-consent-open],
html:not([data-js]) [data-consent-reset] {
  display: none;
}

/* ---- Local navigation ("On this page") ---------------------------------------------------- */
.toc {
  margin-block-end: var(--space-l);
  padding: var(--space-s) var(--space-m);
  border-inline-start: 4px solid var(--accent);
  border-radius: var(--radius-s);
  background: var(--bg-sunken);
  max-inline-size: var(--measure);
}

.toc__title {
  margin: 0 0 var(--space-2xs);
  font-size: var(--text--1);
  font-weight: 650;
  font-stretch: var(--width-condensed);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.toc__list {
  margin: 0;
  padding-inline-start: 1.4em;
  font-size: var(--text--1);
}

.toc__list li + li {
  margin-block-start: 0.2em;
}

.toc__list a {
  display: inline-block;
  padding-block: 0.15em;
}

/* ---- Blog list: tight rhythm inside a card, room between cards ----------------------------- */
.post-card__inner {
  --flow-space: var(--space-2xs);
}

/* ---- Service pages: section lists and price lists ------------------------------------------ */
/* Overview lists whose items open with a heading: the marker scales with the heading and the
 * items get section-sized spacing instead of the usual list rhythm. */
.prose li:has(> :is(h2, h3):first-child) {
  margin-block-start: var(--space-l);
}

.prose li:has(> h2:first-child)::marker {
  font-size: var(--text-2);
}

.prose li:has(> h3:first-child)::marker {
  font-size: var(--text-1);
}

.prose li:has(> :is(h2, h3):first-child) > * + * {
  margin-block-start: var(--space-xs);
}

/* Name/price pairs as a definition list: tight inside a pair, breathing room between pairs. */
.price-list {
  margin: 0;
}

.price-list dt {
  font-weight: 450;
}

.price-list dd {
  margin: 0.15em 0 0;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.price-list dd + dt {
  margin-block-start: var(--space-xs);
}

/* Label/value facts (duration, form, price): label and value on one line. */
.price-list--inline {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: var(--space-s);
  row-gap: 0.35em;
}

.price-list--inline dt {
  font-weight: 650;
}

.price-list--inline dd {
  margin: 0;
  font-weight: 450;
}

.price-list--inline dd + dt {
  margin-block-start: 0;
}

/* Contact block after the prose: a heading-sized gap above it, tight rhythm inside. */
.cta {
  --flow-space: var(--space-l);
}

.cta > * {
  --flow-space: var(--space-xs);
}
