/* ==========================================================
   Bio_Olymp_Uz — Materiallar
   v3.0  •  immunofluorescence palette, compact header,
            colour-coded material types
   ========================================================== */

:root {
  --m-header-h: 61px;

  /* base */
  --m-ink:        #141B4D;
  --m-ink-deep:   #0E1338;
  --m-violet:     #2E1B63;
  --m-paper:      #EEF2FA;
  --m-card:       #FFFFFF;
  --m-text:       #161B3C;
  --m-muted:      #5F678F;
  --m-faint:      #8C93B4;
  --m-line:       #DDE3F0;
  --m-line-soft:  #E9EDF7;

  /* stain channels — one per material type */
  --m-dapi:       #4361FF;   /* masalalar  */
  --m-dapi-lift:  #8EA0FF;
  --m-safranin:   #E8811B;   /* kitoblar   */
  --m-safranin-lift: #FFB866;
  --m-cherry:     #ED3F7B;   /* videolar   */
  --m-cherry-lift:#FF89B0;
  --m-fitc:       #0FA98B;   /* vositalar  */
  --m-fitc-lift:  #4BDFBC;

  /* active channel — overridden per tab / panel */
  --accent:       var(--m-dapi);
  --accent-lift:  var(--m-dapi-lift);
  --accent-wash:  rgba(67, 97, 255, .10);

  --m-radius:     14px;
  --m-radius-lg:  20px;
  --m-shadow:     0 1px 2px rgba(20, 27, 77, .05),
                  0 10px 26px -18px rgba(20, 27, 77, .45);

  --m-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
            Roboto, "Helvetica Neue", Arial, sans-serif;
  --m-display: "Archivo", "Inter", -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background: var(--m-paper);
  color: var(--m-text);
  font-family: var(--m-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body a { color: inherit; text-decoration: none; }

body > main { flex: 1 0 auto; }

h1, h2, h3 {
  font-family: var(--m-display);
  font-weight: 750;
  letter-spacing: -.022em;
  margin: 0;
}

.m-shell {
  width: min(1200px, calc(100% - 40px));
  margin-inline: auto;
}

/* visible keyboard focus everywhere */
body :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}

/* ==========================================================
   HEADER
   ========================================================== */

.m-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px max(20px, calc((100vw - 1200px) / 2));
  background: rgba(255, 255, 255, .88);
  border-bottom: 1px solid var(--m-line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.m-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
}

.m-brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(145deg, var(--m-dapi), var(--m-fitc) 130%);
  color: #fff;
  font-family: var(--m-display);
  font-size: 1.05rem;
  font-weight: 800;
  box-shadow: 0 6px 16px -8px rgba(67, 97, 255, .9);
}

.m-brand-copy strong {
  display: block;
  font-family: var(--m-display);
  font-size: .98rem;
  font-weight: 750;
  letter-spacing: -.02em;
  line-height: 1.2;
}

.m-brand-copy small {
  display: block;
  color: var(--m-faint);
  font-size: .72rem;
  letter-spacing: .01em;
}

.m-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.m-nav a {
  padding: 8px 13px;
  border-radius: 9px;
  color: var(--m-muted);
  font-size: .85rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background .16s ease, color .16s ease;
}

.m-nav a:hover {
  background: var(--m-line-soft);
  color: var(--m-text);
}

/* ==========================================================
   COMPACT HERO
   ========================================================== */

.m-hero {
  position: relative;
  overflow: hidden;
  padding: 26px 0 28px;
  background:
    radial-gradient(120% 150% at 88% -30%, rgba(15, 169, 139, .38), transparent 60%),
    radial-gradient(90% 130% at 8% 130%, rgba(237, 63, 123, .30), transparent 62%),
    linear-gradient(112deg, var(--m-ink-deep), var(--m-violet) 55%, #20246B);
  color: #fff;
}

/* faint titration-curve grid, purely structural */
.m-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .07) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(90deg, transparent, #000 45%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 45%, transparent);
  pointer-events: none;
}

.m-hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}

.m-hero h1 {
  font-size: clamp(1.8rem, 3.6vw, 2.5rem);
  line-height: 1.05;
  letter-spacing: -.035em;
}

.m-hero p {
  max-width: 46ch;
  margin: 7px 0 0;
  color: rgba(255, 255, 255, .74);
  font-size: .9rem;
  line-height: 1.55;
}

.m-hero-stats {
  display: flex;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.m-hero-stats li {
  min-width: 92px;
  padding: 9px 14px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 12px;
  background: rgba(255, 255, 255, .07);
}

.m-hero-stats b {
  display: block;
  font-family: var(--m-display);
  font-size: 1.32rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.m-hero-stats span {
  display: block;
  margin-top: 1px;
  color: rgba(255, 255, 255, .62);
  font-size: .71rem;
}

/* ==========================================================
   CHANNEL TABS
   ========================================================== */

.m-tabs-bar {
  position: sticky;
  top: var(--m-header-h);
  z-index: 30;
  background: rgba(238, 242, 250, .93);
  border-bottom: 1px solid var(--m-line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.m-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 0;
}

.m-tab {
  --accent: var(--m-dapi);
  --accent-lift: var(--m-dapi-lift);
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  border: 1px solid var(--m-line);
  border-radius: var(--m-radius);
  background: var(--m-card);
  color: var(--m-text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease,
              transform .16s ease, background .16s ease;
}

.m-tab[data-category="books"]  { --accent: var(--m-safranin); --accent-lift: var(--m-safranin-lift); }
.m-tab[data-category="videos"] { --accent: var(--m-cherry);   --accent-lift: var(--m-cherry-lift); }
.m-tab[data-category="tools"]  { --accent: var(--m-fitc);     --accent-lift: var(--m-fitc-lift); }

.m-tab:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--m-line));
}

.m-tab-icon {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 12%, #fff);
  color: var(--accent);
  transition: background .16s ease, color .16s ease;
}

.m-tab-icon svg { width: 18px; height: 18px; display: block; }

.m-tab-copy { min-width: 0; }

.m-tab-copy strong {
  display: block;
  font-size: .88rem;
  font-weight: 650;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m-tab-copy small {
  display: block;
  color: var(--m-faint);
  font-size: .73rem;
  font-variant-numeric: tabular-nums;
}

.m-tab[aria-selected="true"] {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-lift) 165%);
  color: #fff;
  box-shadow: 0 12px 24px -16px color-mix(in srgb, var(--accent) 90%, #000);
}

.m-tab[aria-selected="true"] .m-tab-icon {
  background: rgba(255, 255, 255, .2);
  color: #fff;
}

.m-tab[aria-selected="true"] .m-tab-copy small { color: rgba(255, 255, 255, .75); }

/* ==========================================================
   PANELS
   ========================================================== */

.m-main { padding: 34px 0 80px; }

.m-panel { display: none; }
.m-panel.active { display: block; }

.m-panel[data-channel="problems"] { --accent: var(--m-dapi);     --accent-lift: var(--m-dapi-lift);     --accent-wash: rgba(67, 97, 255, .10); }
.m-panel[data-channel="books"]    { --accent: var(--m-safranin); --accent-lift: var(--m-safranin-lift); --accent-wash: rgba(232, 129, 27, .12); }
.m-panel[data-channel="videos"]   { --accent: var(--m-cherry);   --accent-lift: var(--m-cherry-lift);   --accent-wash: rgba(237, 63, 123, .10); }
.m-panel[data-channel="tools"]    { --accent: var(--m-fitc);     --accent-lift: var(--m-fitc-lift);     --accent-wash: rgba(15, 169, 139, .12); }

.m-panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--m-line);
}

.m-panel-head h2 {
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  line-height: 1.15;
}

.m-panel-head h2::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-wash);
  vertical-align: middle;
}

.m-panel-head p {
  max-width: 48ch;
  margin: 0;
  color: var(--m-muted);
  font-size: .87rem;
}

/* ==========================================================
   STEP 1 — OLYMPIAD PICKER
   ========================================================== */

.m-step + .m-step { margin-top: 30px; }

.m-step-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 13px;
  font-size: .85rem;
  font-weight: 650;
  color: var(--m-text);
}

.m-step-num {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: var(--accent-wash);
  color: var(--accent);
  font-family: var(--m-display);
  font-size: .78rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.m-step-label em {
  margin-left: auto;
  color: var(--m-faint);
  font-size: .78rem;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.hidden { display: none !important; }

.olympiad-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
  gap: 11px;
}

.olympiad-button {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 15px 16px;
  border: 1px solid var(--m-line);
  border-radius: var(--m-radius);
  background: var(--m-card);
  color: var(--m-text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, transform .16s ease,
              box-shadow .16s ease;
}

.olympiad-button::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent);
  opacity: 0;
  transition: opacity .16s ease;
}

.olympiad-button:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--m-line));
  box-shadow: var(--m-shadow);
}

.olympiad-button.active {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--m-line));
  background: linear-gradient(135deg, var(--accent-wash), transparent 70%), #fff;
}

.olympiad-button.active::before { opacity: 1; }

.olympiad-button strong {
  font-family: var(--m-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -.015em;
}

.olympiad-button small {
  color: var(--m-faint);
  font-size: .76rem;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================
   STEP 2 — YEARS
   ========================================================== */

.year-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.year-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border: 1px solid var(--m-line);
  border-radius: 10px;
  background: var(--m-card);
  color: var(--m-text);
  font-family: inherit;
  font-size: .88rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, color .16s ease;
}

.year-button::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.year-button.is-empty { color: var(--m-faint); }
.year-button.is-empty::before { background: var(--m-line); }

.year-button:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--m-line)); }

.year-button.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-lift) 170%);
  color: #fff;
}

.year-button.active::before { background: rgba(255, 255, 255, .85); }

/* ==========================================================
   STEP 3 — FILES
   ========================================================== */

.paper-files {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 10px;
}

.paper-file {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  border: 1px solid var(--m-line);
  border-radius: var(--m-radius);
  background: var(--m-card);
}

.paper-file-icon {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent-wash);
  color: var(--accent);
}

.paper-file-icon svg { width: 18px; height: 18px; }

.paper-file-info { min-width: 0; flex: 1; }

.paper-file-info strong {
  display: block;
  font-size: .89rem;
  font-weight: 620;
}

.paper-file-info small {
  display: block;
  margin-top: 1px;
  color: var(--m-faint);
  font-size: .75rem;
}

.paper-download {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 8px 13px;
  border-radius: 9px;
  background: var(--accent-wash);
  color: color-mix(in srgb, var(--accent) 82%, #000);
  font-size: .78rem;
  font-weight: 650;
  transition: background .16s ease, color .16s ease;
}

.paper-download svg { width: 14px; height: 14px; }

.paper-download:hover {
  background: var(--accent);
  color: #fff;
}

.m-empty {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
  border: 1px dashed var(--m-line);
  border-radius: var(--m-radius);
  background: rgba(255, 255, 255, .5);
}

.m-empty-mark {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--m-line-soft);
  color: var(--m-faint);
}

.m-empty strong {
  display: block;
  font-size: .9rem;
  font-weight: 620;
}

.m-empty small {
  color: var(--m-muted);
  font-size: .8rem;
}

/* ==========================================================
   BOOKS & VIDEOS
   ========================================================== */

.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 13px;
}

.resource-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 20px;
  border: 1px solid var(--m-line);
  border-radius: var(--m-radius-lg);
  background: var(--m-card);
  overflow: hidden;
}

.resource-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-lift));
}

.resource-card h3 {
  margin: 0 0 7px;
  font-size: 1.02rem;
  font-weight: 700;
}

.resource-card p {
  margin: 0;
  color: var(--m-muted);
  font-size: .84rem;
  line-height: 1.6;
}

.resource-card-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: auto;
  padding-top: 18px;
  color: var(--accent);
  font-size: .82rem;
  font-weight: 650;
}

.resource-card-link svg { width: 14px; height: 14px; }
.resource-card-link:hover { text-decoration: underline; }

.resource-card-soon {
  margin-top: auto;
  padding-top: 18px;
  color: var(--m-faint);
  font-size: .8rem;
  font-weight: 600;
}

/* ==========================================================
   ONLINE TOOLS — the loud part of the page
   ========================================================== */

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.tool-card {
  --tool-a: var(--m-fitc);
  --tool-b: #35C8FF;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 16px;
  border: 1px solid var(--m-line);
  border-radius: var(--m-radius-lg);
  background: var(--m-card);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.tool-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--tool-a) 40%, var(--m-line));
  box-shadow: 0 22px 40px -28px color-mix(in srgb, var(--tool-a) 85%, #000);
}

.tool-card-purple { --tool-a: #7B3FE4; --tool-b: #ED3F7B; }

.tool-visual {
  position: relative;
  display: grid;
  place-items: center;
  height: 168px;
  margin-bottom: 15px;
  border-radius: 15px;
  background:
    radial-gradient(90% 120% at 15% 0%, color-mix(in srgb, var(--tool-a) 34%, transparent), transparent 62%),
    radial-gradient(85% 120% at 100% 110%, color-mix(in srgb, var(--tool-b) 32%, transparent), transparent 60%),
    linear-gradient(150deg, #10163F, #1D1550 70%, #101A44);
  overflow: hidden;
}

.tool-visual svg { width: 100%; height: 100%; display: block; }

.tool-badge {
  position: absolute;
  top: 11px;
  left: 12px;
  z-index: 2;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 20px;
  background: rgba(10, 14, 45, .5);
  color: rgba(255, 255, 255, .88);
  font-size: .68rem;
  font-weight: 650;
  letter-spacing: .01em;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.tool-card h3 {
  margin: 0 0 6px;
  font-size: 1.16rem;
  font-weight: 750;
}

.tool-card > p {
  margin: 0;
  color: var(--m-muted);
  font-size: .855rem;
  line-height: 1.6;
}

.tool-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0 16px;
}

.tool-tags span {
  padding: 4px 10px;
  border-radius: 7px;
  background: var(--m-line-soft);
  color: var(--m-muted);
  font-size: .73rem;
  font-weight: 600;
}

.tool-launch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding: 13px 16px;
  border-radius: 12px;
  background: linear-gradient(115deg, var(--tool-a), var(--tool-b));
  color: #fff;
  font-size: .9rem;
  font-weight: 650;
  box-shadow: 0 14px 26px -18px color-mix(in srgb, var(--tool-a) 90%, #000);
  transition: filter .16s ease, transform .16s ease;
}

.tool-launch svg { width: 17px; height: 17px; flex: 0 0 auto; }

.tool-launch:hover { filter: brightness(1.06); transform: translateY(-1px); }

/* placeholder tile */
.tool-card-next {
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  border-style: dashed;
  background: transparent;
  box-shadow: none;
}

.tool-card-next:hover { transform: none; box-shadow: none; border-color: var(--m-line); }

.tool-card-next h3 { font-size: 1.02rem; color: var(--m-text); }
.tool-card-next p { color: var(--m-muted); }

.tool-card-next .m-empty-mark { margin-bottom: 4px; }
.tool-card-next .resource-card-link { margin-top: 14px; padding-top: 0; }

/* ==========================================================
   FOOTER
   ========================================================== */

.m-footer {
  padding: 26px 0;
  background: var(--m-ink-deep);
  color: rgba(255, 255, 255, .6);
  font-size: .8rem;
}

.m-footer .m-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.m-footer strong {
  color: #fff;
  font-family: var(--m-display);
  font-weight: 700;
}

.m-footer a { color: rgba(255, 255, 255, .78); }
.m-footer a:hover { color: #fff; }

/* ==========================================================
   RESPONSIVE
   ========================================================== */

@media (max-width: 960px) {
  .m-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .m-shell { width: calc(100% - 28px); }

  .m-hero { padding: 20px 0 22px; }
  .m-hero-inner { align-items: flex-start; gap: 16px; }
  .m-hero-stats { flex-wrap: wrap; gap: 8px; }
  .m-hero-stats li { min-width: 0; flex: 1 1 calc(50% - 4px); padding: 8px 11px; }
  .m-hero-stats b { font-size: 1.12rem; }

  .m-brand-copy small { display: none; }
  .m-nav a { padding: 7px 10px; font-size: .8rem; }

  .m-tabs { gap: 8px; padding: 10px 0; }
  .m-tab { padding: 9px 11px; gap: 9px; }
  .m-tab-copy small { display: none; }
  .m-tab-copy strong { font-size: .82rem; }

  .m-panel-head { gap: 10px; }
  .olympiad-buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .paper-file { flex-wrap: wrap; }
  .paper-download { width: 100%; justify-content: center; }
}

@media (max-width: 420px) {
  .m-tab-icon { flex-basis: 30px; width: 30px; height: 30px; }
}

/* ==========================================================
   MOTION / PRINT
   ========================================================== */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

@media print {
  .m-header, .m-tabs-bar, .m-hero { display: none; }
  .m-panel { display: block !important; }
}
