/* ==========================================================================
   SanoatXavfsiz v2 — asosiy qatlam
   Reset, tipografiya, sahifa karkasi, accessibility va utilitlar.
   ========================================================================== */

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

* { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  min-height: 100%;
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: var(--lh-normal);
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 620px at 12% -8%, rgba(245, 165, 36, 0.1), transparent 60%),
    radial-gradient(900px 540px at 100% 0%, rgba(34, 211, 238, 0.08), transparent 62%),
    repeating-linear-gradient(0deg, var(--grid-line) 0 1px, transparent 1px 46px),
    repeating-linear-gradient(90deg, var(--grid-line) 0 1px, transparent 1px 46px);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg, canvas { display: block; max-width: 100%; }

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: var(--brand); text-decoration-color: color-mix(in srgb, var(--brand) 45%, transparent); }
a:hover { text-decoration-color: var(--brand); }
ul, ol { list-style: none; }
table { border-collapse: collapse; width: 100%; }

h1, h2, h3, h4 { line-height: var(--lh-tight); font-weight: 800; letter-spacing: -0.015em; }
strong { font-weight: 700; color: var(--text); }
code, kbd, pre { font-family: var(--font-mono); }

::selection { background: var(--brand-soft); color: var(--text); }

/* --- Scrollbar (WebKit) ------------------------------------------------- */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--steel-400) 55%, transparent);
  border-radius: var(--r-pill);
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--brand) 70%, transparent); background-clip: content-box; }

/* ==========================================================================
   Fokus va accessibility
   ========================================================================== */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: -60px;
  z-index: 2000;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--brand);
  border-radius: var(--r-sm);
  font-weight: 700;
  transition: top var(--t-base) var(--ease-out);
}
.skip-link:focus { top: var(--sp-4); }

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

/* ==========================================================================
   Karkas: header + main + footer
   ========================================================================== */
.shell-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: color-mix(in srgb, var(--bg-soft) 88%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.shell-header::after {
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(90deg,
    var(--brand) 0 18%,
    transparent 18% 22%,
    var(--copper-500) 22% 40%,
    transparent 40% 44%,
    var(--brand) 44% 62%,
    transparent 62% 66%,
    var(--copper-500) 66% 100%);
  opacity: 0.85;
}
.shell-header__row {
  max-width: var(--shell-max);
  margin: 0 auto;
  min-height: var(--header-h);
  padding: var(--sp-3) var(--sp-5);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.brand__mark {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: var(--brand-grad);
  color: var(--brand-ink);
  font-weight: 900;
  font-size: var(--fs-xs);
  letter-spacing: 0.02em;
  box-shadow: var(--glow);
  position: relative;
  flex: 0 0 auto;
}
.brand__mark::after {
  content: "";
  position: absolute; inset: -4px;
  border-radius: calc(var(--r-md) + 4px);
  border: 1px solid var(--brand-border);
  opacity: 0.6;
}
.brand__text { min-width: 0; }
.brand__title {
  font-size: var(--fs-lg);
  font-weight: 900;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.brand__sub {
  font-size: var(--fs-2xs);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 46ch;
}

.shell-header__spacer { flex: 1 1 auto; }
.shell-header__actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }

.shell-main {
  max-width: var(--shell-max);
  width: 100%;
  margin: 0 auto;
  padding: var(--sp-7) var(--sp-5) var(--sp-9);
  flex: 1 1 auto;
}

.app-section { display: none; }
.app-section.is-active { display: block; animation: view-in var(--t-slow) var(--ease-out); }

@keyframes view-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.shell-footer {
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-soft) 70%, transparent);
  padding: var(--sp-6) var(--sp-5);
  color: var(--text-muted);
  font-size: var(--fs-2xs);
}
.shell-footer__row {
  max-width: var(--shell-max);
  margin: 0 auto;
  display: flex;
  gap: var(--sp-5);
  justify-content: space-between;
  flex-wrap: wrap;
}
.shell-footer strong { color: var(--text-soft); }

/* ==========================================================================
   Layout yordamchilari
   ========================================================================== */
.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.stack--sm { gap: var(--sp-2); }
.stack--lg { gap: var(--sp-6); }
.row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-4); }
.auto-grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.page-head { margin-bottom: var(--sp-6); }
.page-head h2 { font-size: var(--fs-2xl); }
.page-head p { color: var(--text-muted); font-size: var(--fs-sm); max-width: 78ch; }

.text-center { text-align: center; }
.muted { color: var(--text-muted); }
.soft { color: var(--text-soft); }
.mono { font-family: var(--font-mono); }
.nowrap { white-space: nowrap; }
.mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.hidden { display: none !important; }
.eyebrow {
  font-size: var(--fs-3xs);
  font-weight: 800;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--brand);
}

/* ==========================================================================
   Harakatni kamaytirish (prefers-reduced-motion) — majburiy hurmat
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media (max-width: 720px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .shell-main { padding: var(--sp-5) var(--sp-4) var(--sp-8); }
  .brand__sub { display: none; }
  .app-section.is-active { animation: none; }
}

/* ==========================================================================
   Chop etish (sertifikat) uchun
   ========================================================================== */
@media print {
  body { background: #fff; color: #000; }
  .shell-header, .shell-footer, .no-print, .app-section:not(.is-active) { display: none !important; }
  .shell-main { padding: 0; max-width: none; }
  .card, .certificate { box-shadow: none !important; border-color: #999 !important; background: #fff !important; }
  .certificate * { color: #000 !important; }
}
