/* ===========================================================================
   Reset + tipografika asosi
   =========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--s-4));
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-feature-settings: "cv05" 1, "ss01" 1;
}

img,
picture,
svg,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

/* --- Sarlavhalar ---------------------------------------------------------- */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--lh-heading);
  letter-spacing: var(--tracking-tight);
  color: var(--ink-900);
  text-wrap: balance;
}

h1 {
  font-size: clamp(var(--fs-2xl), 4vw, var(--fs-4xl));
  font-weight: 800;
}

h2 {
  font-size: clamp(var(--fs-xl), 3vw, var(--fs-2xl));
}

h3 {
  font-size: var(--fs-lg);
}

h4 {
  font-size: var(--fs-md);
}

p {
  text-wrap: pretty;
}

a {
  color: var(--brand-600);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}

a:hover {
  color: var(--brand-700);
}

strong,
b {
  font-weight: 600;
  color: var(--ink-800);
}

ul,
ol {
  padding-left: var(--s-5);
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--s-8) 0;
}

code,
kbd {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

kbd {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: var(--radius-xs);
  padding: 0.1em 0.4em;
  font-size: var(--fs-xs);
  color: var(--ink-600);
}

/* --- Fokus (klaviatura bilan yurish) -------------------------------------- */

:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

::selection {
  background: var(--brand-100);
  color: var(--brand-900);
}

/* --- Tuzilma -------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--s-5);
}

.container--narrow {
  max-width: var(--container-narrow);
}

.container--wide {
  max-width: var(--container-wide);
}

.page {
  flex: 1;
  padding-block: var(--s-10) var(--s-20);
}

.page--flush {
  padding-block: 0 var(--s-20);
}

.stack > * + * {
  margin-top: var(--s-4);
}

.stack-lg > * + * {
  margin-top: var(--s-8);
}

/* --- Sahifa sarlavhasi ---------------------------------------------------- */

.page-head {
  margin-bottom: var(--s-8);
}

.page-head__eyebrow {
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--brand-600);
  margin-bottom: var(--s-2);
}

.page-head__lead {
  font-size: var(--fs-md);
  color: var(--text-muted);
  max-width: 62ch;
  margin-top: var(--s-3);
}

/* --- Yordamchi sinflar ---------------------------------------------------- */

.muted {
  color: var(--text-muted);
}

.subtle {
  color: var(--text-subtle);
}

.small {
  font-size: var(--fs-sm);
}

.text-center {
  text-align: center;
}

.measure {
  max-width: var(--measure);
}

.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;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--s-4);
  z-index: var(--z-toast);
  background: var(--brand-600);
  color: #fff;
  padding: var(--s-3) var(--s-5);
  border-radius: 0 0 var(--radius) var(--radius);
  font-weight: 600;
}

.skip-link:focus {
  top: 0;
  color: #fff;
}

.grid {
  display: grid;
  gap: var(--s-5);
}

.grid--2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid--3 {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.grid--4 {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.row--between {
  justify-content: space-between;
}

.row--wrap {
  flex-wrap: wrap;
}

.spacer {
  flex: 1;
}

/* --- Harakatni kamaytirish sozlamasi -------------------------------------- */

@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;
  }
}

/* --- Chop etish ----------------------------------------------------------- */

@media print {
  .site-header,
  .site-footer,
  .lesson-sidebar,
  .topic-nav,
  .btn {
    display: none !important;
  }

  body {
    background: #fff;
  }
}
