:root {
  --paper: #f4efe2;
  --paper-deep: #e8dfcc;
  --ink: #14283d;
  --muted: #5c6873;
  --coral: #b93428;
  --yellow: #f4c84a;
  --green: #3f7045;
  --blue: #4d9ac0;
  --cream: #fffaf0;
  --white: #fffdf8;
  --line: rgba(20, 40, 61, 0.17);
  --display: "Bricolage Grotesque", "Arial Narrow", sans-serif;
  --body: "Source Sans 3", Arial, sans-serif;
  --shadow: 0 18px 42px rgba(47, 48, 43, 0.12), 0 3px 8px rgba(47, 48, 43, 0.08);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

::selection { color: var(--cream); background: var(--coral); }

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

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-underline-offset: 0.2em; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  color: var(--white);
  background: var(--ink);
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  width: min(100% - 2rem, 84rem);
  min-height: 5.2rem;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--display);
  font-size: 0.9rem;
  line-height: 1.02;
  text-decoration: none;
}

.brand strong { color: var(--coral); font-weight: 800; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  color: var(--cream);
  background: var(--ink);
  font-family: Georgia, serif;
  font-size: 1.8rem;
  font-weight: 700;
}

nav { display: none; }

.hero {
  width: min(100% - 2rem, 84rem);
  margin: 0 auto;
  padding: 4rem 0 5rem;
  display: grid;
  gap: 3rem;
}

.hero-copy { max-width: 44rem; }

.hero h1 {
  max-width: 9ch;
  margin: 0;
  font-family: var(--display);
  font-size: clamp(3.35rem, 15vw, 6rem);
  line-height: 0.88;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.hero h1 span { color: var(--coral); }

.hero-copy > p {
  max-width: 39rem;
  margin: 1.75rem 0 0;
  color: #435363;
  font-size: clamp(1.08rem, 3vw, 1.3rem);
  line-height: 1.5;
}

.hero-actions {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.button {
  min-height: 3.1rem;
  padding: 0.75rem 1.15rem;
  border: 0;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 180ms cubic-bezier(.2,.9,.2,1), box-shadow 180ms ease, background 180ms ease;
}

.button:hover { transform: translateY(-2px); }
.button:active { transform: translateY(1px); }

.button-primary {
  color: var(--cream);
  background: var(--coral);
  box-shadow: 0 8px 18px rgba(160, 51, 36, 0.2);
}

.button-primary:hover { background: #982a22; }

.button-secondary {
  color: var(--ink);
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--ink);
}

.button-secondary:hover { background: rgba(20, 40, 61, 0.06); }

.button-ink {
  color: var(--cream);
  background: var(--ink);
  box-shadow: 0 8px 18px rgba(20, 40, 61, 0.2);
}

.hero-demo {
  position: relative;
  min-height: 31rem;
  padding: 2rem 1.25rem;
  overflow: hidden;
  border-radius: 16px;
  color: var(--ink);
  background: var(--yellow);
  box-shadow: var(--shadow);
  isolation: isolate;
}

.hero-demo::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 18rem;
  height: 18rem;
  right: -5rem;
  top: -4rem;
  border-radius: 50%;
  background: var(--cream);
  opacity: 0.66;
}

.route-line {
  position: absolute;
  left: 2.35rem;
  top: 5.8rem;
  bottom: 8rem;
  border-left: 2px dashed rgba(20, 40, 61, 0.45);
}

.demo-phrase {
  position: relative;
  z-index: 2;
  margin-left: 2.8rem;
  padding: 0.8rem 0;
  font-family: var(--display);
  line-height: 1.1;
}

.demo-phrase::before {
  content: "";
  position: absolute;
  left: -3.25rem;
  top: 1.25rem;
  width: 0.75rem;
  height: 0.75rem;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
}

.demo-label {
  display: block;
  margin-bottom: 0.45rem;
  font-family: var(--body);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.demo-wrong s { font-size: clamp(1.7rem, 8vw, 2.65rem); text-decoration-color: var(--coral); text-decoration-thickness: 0.15em; }
.demo-right { margin-top: 4.5rem; }
.demo-right strong { font-size: clamp(2.1rem, 10vw, 3.6rem); letter-spacing: -0.035em; }

.correction-pin {
  position: absolute;
  z-index: 3;
  top: 8.2rem;
  right: 1.3rem;
  padding: 0.45rem 0.8rem;
  color: var(--cream);
  background: var(--coral);
  border-radius: 8px;
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 800;
  transform: rotate(-5deg);
  box-shadow: 0 8px 14px rgba(97, 45, 32, 0.17);
}

.hero-art {
  position: absolute;
  right: -1.2rem;
  bottom: -2rem;
  width: 14rem;
  aspect-ratio: 1;
  filter: drop-shadow(0 10px 10px rgba(20, 40, 61, 0.14));
}

.art {
  background-image: url("assets/language-atlas-sprites.png");
  background-repeat: no-repeat;
  background-size: 400% 300%;
}

.art-1 { background-position: 0 0; }
.art-2 { background-position: 33.333% 0; }
.art-3 { background-position: 66.667% 0; }
.art-4 { background-position: 100% 0; }
.art-5 {
  background-image: url("assets/speech-bubble.png");
  background-position: center;
  background-size: contain;
}
.art-6 { background-position: 33.333% 50%; }
.art-7 { background-position: 66.667% 50%; }
.art-8 { background-position: 100% 50%; }
.art-9 { background-position: 0 100%; }
.art-10 { background-position: 33.333% 100%; }
.art-11 {
  background-image: url("assets/repeat-cards.png");
  background-position: center;
  background-size: contain;
}
.art-12 { background-position: 100% 100%; }

.atlas {
  padding: 4.5rem max(1rem, calc((100vw - 84rem) / 2));
  background: var(--cream);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
}

.section-heading h2,
.quiz-section h2,
.sources-section h2 {
  max-width: 16ch;
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.3rem, 8vw, 4.5rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.section-heading p,
.sources-title-wrap p {
  max-width: 42rem;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 1.1rem;
}

.result-count {
  display: none;
  flex: 0 0 auto;
  padding: 0.3rem 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.finder { margin: 2.25rem 0 2.75rem; }

.search-box {
  min-height: 3.7rem;
  padding: 0.4rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  border-radius: 14px;
  color: var(--muted);
  background: var(--white);
  box-shadow: inset 0 0 0 1px var(--line), 0 6px 16px rgba(35, 42, 47, 0.06);
}

.search-box:focus-within { box-shadow: inset 0 0 0 2px var(--blue), 0 6px 16px rgba(35, 42, 47, 0.06); }

.search-box svg {
  width: 1.35rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.search-box input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 1rem;
}

.search-box input::placeholder { color: #747f89; opacity: 1; }

kbd {
  display: none;
  min-width: 1.9rem;
  padding: 0.12rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--paper);
  font: 600 0.8rem var(--body);
  text-align: center;
}

.category-list {
  margin-top: 0.9rem;
  padding: 0.15rem 0 0.5rem;
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--paper-deep) transparent;
}

.category-chip {
  flex: 0 0 auto;
  min-height: 2.5rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: transparent;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
}

.category-chip:hover { background: var(--paper); }

.category-chip[aria-pressed="true"] {
  color: var(--cream);
  border-color: var(--ink);
  background: var(--ink);
}

.cards-grid {
  display: grid;
  gap: 1rem;
}

.language-card {
  --category-color: var(--coral);
  min-width: 0;
  padding: 1.1rem;
  border-radius: 16px;
  background: var(--white);
  box-shadow: 0 10px 26px rgba(54, 50, 39, 0.08);
  animation: card-enter 520ms cubic-bezier(.2,.85,.2,1) both;
  animation-delay: var(--card-delay);
}

.language-card[data-category="cislovky"] { --category-color: var(--blue); }
.language-card[data-category="tvary"] { --category-color: var(--green); }
.language-card[data-category="pravopis"] { --category-color: #b57a1d; }
.language-card[data-category="narecie"] { --category-color: #745f96; }

@keyframes card-enter {
  from { opacity: 0.01; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.category-badge {
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  color: var(--white);
  background: var(--category-color);
  font-size: 0.76rem;
  font-weight: 700;
}

.card-number {
  color: #73808a;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.card-art {
  width: min(68%, 13rem);
  aspect-ratio: 1;
  margin: 0.8rem auto 0.5rem;
  filter: drop-shadow(0 8px 8px rgba(20, 40, 61, 0.1));
  transition: transform 300ms cubic-bezier(.2,.85,.2,1);
}

.language-card:hover .card-art { transform: translateY(-4px) rotate(1deg); }

.card-comparison {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 1.15rem minmax(0, 1fr);
  align-items: center;
  gap: 0.45rem;
}

.card-comparison > svg {
  width: 1.15rem;
  fill: none;
  stroke: var(--coral);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.form { min-width: 0; }

.form span {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.form s,
.form strong {
  display: block;
  overflow-wrap: anywhere;
  font-family: var(--display);
  font-size: clamp(1rem, 4.5vw, 1.24rem);
  line-height: 1.12;
}

.form s {
  color: #7c4540;
  text-decoration-color: var(--coral);
  text-decoration-thickness: 0.12em;
}

.form strong { color: var(--green); }

.card-explanation {
  margin: 1.15rem 0 0;
  color: #475664;
  font-size: 0.96rem;
  line-height: 1.5;
}

.source-link {
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
}

.source-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.source-link svg {
  width: 1rem;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  transition: transform 160ms ease;
}

.source-link:hover { color: var(--coral); }
.source-link:hover svg { transform: translate(2px, -2px); }

.empty-state {
  padding: 3rem 1rem;
  text-align: center;
}

.empty-compass {
  width: 10rem;
  aspect-ratio: 1;
  margin: auto;
}

.empty-state h3 { margin: 0.75rem 0 0; font: 800 1.5rem/1.1 var(--display); }
.empty-state p { margin: 0.5rem 0 1rem; color: var(--muted); }

.text-button {
  padding: 0.3rem;
  border: 0;
  color: var(--coral);
  background: transparent;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.quiz-section {
  padding: 5rem 1rem;
  color: var(--cream);
  background: var(--green);
}

.quiz-section > * {
  width: min(100%, 84rem);
  margin-inline: auto;
}

.quiz-intro {
  display: grid;
  gap: 1.5rem;
  align-items: center;
}

.quiz-intro h2 { max-width: 13ch; }
.quiz-intro p { max-width: 42rem; margin: 1rem 0 0; color: #edf1df; font-size: 1.1rem; }
.quiz-intro .button { justify-self: start; }

.quiz-stamp {
  width: 6rem;
  aspect-ratio: 1;
  display: grid;
  place-content: center;
  padding: 0.6rem;
  border: 2px solid currentColor;
  border-radius: 50%;
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 800;
  line-height: 0.75;
  text-align: center;
  transform: rotate(-7deg);
}

.quiz-stamp span { font-family: var(--body); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }

.quiz-panel,
.quiz-result {
  max-width: 52rem;
  margin-inline: auto;
}

.quiz-topline {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 0.4rem;
  margin-top: 0.75rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
}

.progress-track span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--yellow);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 420ms cubic-bezier(.2,.85,.2,1);
}

.quiz-prompt { margin: 2.25rem 0 0.35rem; color: #edf1df; }

.quiz-panel h3 {
  margin: 0;
  font: 800 clamp(2rem, 9vw, 4rem)/1 var(--display);
  letter-spacing: -0.03em;
}

.quiz-options {
  margin-top: 1.75rem;
  display: grid;
  gap: 0.7rem;
}

.quiz-option {
  min-height: 4.5rem;
  padding: 1rem 1.2rem;
  border: 2px solid rgba(255, 255, 255, 0.48);
  border-radius: 14px;
  color: var(--cream);
  background: rgba(20, 40, 61, 0.12);
  font-family: var(--display);
  font-size: clamp(1.2rem, 5vw, 1.7rem);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.quiz-option:hover:not(:disabled) { transform: translateX(4px); background: rgba(20, 40, 61, 0.22); border-color: var(--white); }
.quiz-option:disabled { cursor: default; opacity: 0.64; }
.quiz-option.is-correct { border-color: var(--yellow); color: var(--ink); background: var(--yellow); opacity: 1; }
.quiz-option.is-wrong { border-color: #ffd5cc; background: #a34338; opacity: 1; }

.quiz-feedback {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 12px;
  color: var(--ink);
  background: var(--cream);
}

.quiz-feedback strong,
.quiz-feedback span { display: block; }
.quiz-feedback strong { font-family: var(--display); font-size: 1.1rem; }
.quiz-feedback span { margin-top: 0.25rem; }
.quiz-next { margin-top: 1rem; }

.quiz-result { text-align: center; }
.result-art { width: 11rem; aspect-ratio: 1; margin: -2rem auto 0; }
.result-kicker { margin: 0; color: #edf1df; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.quiz-result h3 { margin: 0.5rem 0 0; font: 800 clamp(2.2rem, 9vw, 4.5rem)/1 var(--display); letter-spacing: -0.035em; }
.quiz-result > p:not(.result-kicker) { max-width: 36rem; margin: 1rem auto 1.5rem; color: #edf1df; font-size: 1.1rem; }

.sources-section {
  padding: 5rem max(1rem, calc((100vw - 84rem) / 2));
  display: grid;
  gap: 2.5rem;
}

.source-links {
  border-top: 1px solid var(--line);
}

.source-links a {
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 0.15rem;
  text-decoration: none;
  transition: color 160ms ease, transform 160ms ease;
}

.source-links a:hover { color: var(--coral); transform: translateX(0.5rem); }
.source-links span { color: var(--muted); font-size: 0.85rem; }
.source-links strong { font-family: var(--display); font-size: 1.15rem; }

footer {
  padding: 1.5rem max(1rem, calc((100vw - 84rem) / 2));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--cream);
  background: var(--ink);
}

.brand-footer strong { color: var(--yellow); }
.brand-footer .brand-mark { color: var(--ink); background: var(--yellow); }
footer p { margin: 0; color: var(--cream); }
footer > a:last-child { font-weight: 700; }

[hidden] { display: none !important; }

@media (min-width: 42rem) {
  .site-header { width: min(100% - 3rem, 84rem); }
  nav { display: flex; align-items: center; gap: 1.4rem; }
  nav a { font-size: 0.92rem; font-weight: 700; text-decoration: none; }
  nav a:hover { color: var(--coral); }
  .hero { width: min(100% - 3rem, 84rem); padding-top: 5rem; }
  .hero-demo { padding: 2.5rem; }
  .result-count { display: inline; }
  kbd { display: inline-block; }
  .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; }
  .language-card:first-child { grid-column: span 2; display: grid; grid-template-columns: minmax(12rem, .75fr) 1.25fr; column-gap: 2rem; align-items: center; }
  .language-card:first-child .card-topline { grid-column: 1 / -1; }
  .language-card:first-child .card-art { grid-row: 2 / span 3; width: 100%; max-width: 18rem; }
  .language-card:first-child .card-comparison,
  .language-card:first-child .card-explanation,
  .language-card:first-child .source-link { grid-column: 2; }
  .language-card:first-child .form s,
  .language-card:first-child .form strong { font-size: 1.5rem; }
  .language-card:last-child { grid-column: span 2; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(12rem, .85fr); column-gap: 2rem; align-items: center; }
  .language-card:last-child .card-topline { grid-column: 1 / -1; }
  .language-card:last-child .card-art { grid-column: 2; grid-row: 2 / span 3; width: 100%; max-width: 17rem; }
  .language-card:last-child .card-comparison,
  .language-card:last-child .card-explanation,
  .language-card:last-child .source-link { grid-column: 1; }
  .quiz-intro { grid-template-columns: auto minmax(0, 1fr) auto; gap: 2rem; }
  .quiz-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sources-section { grid-template-columns: minmax(0, 1.1fr) minmax(20rem, .9fr); align-items: end; }
}

@media (min-width: 64rem) {
  .hero { min-height: calc(100vh - 5.2rem); grid-template-columns: minmax(0, 1.02fr) minmax(28rem, .98fr); align-items: center; padding: 4rem 0 5rem; }
  .hero h1 { font-size: clamp(5rem, 7.2vw, 6rem); }
  .hero-demo { min-height: 35rem; }
  .hero-art { width: 18rem; }
  .correction-pin { right: 2.5rem; }
  .finder { display: grid; grid-template-columns: minmax(20rem, .9fr) minmax(0, 1.1fr); gap: 1rem; align-items: start; }
  .category-list { margin-top: 0.35rem; justify-content: flex-end; }
  .cards-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.35rem; }
  .language-card:first-child { grid-column: span 2; }
  .language-card:last-child { grid-column: 1 / -1; }
  .language-card:nth-child(6n + 5) { transform: translateY(1.8rem); }
  .language-card:nth-child(6n + 5):hover .card-art { transform: translateY(-4px) rotate(1deg); }
  .quiz-section { padding-block: 6.5rem; }
  .sources-section { padding-block: 6.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
