:root { --container-max: 1200px;
  --bg: #ffffff;
  --text: #111418;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #f5f7fb;
  --radius: 16px;
}
* { box-sizing: border-box; }
body { margin:0; font-family: system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; color:var(--text); background:var(--bg); }
.header { border-bottom:1px solid var(--border); background:#fff; }
.container { max-width:1200px; margin:0 auto; padding:0px 0px; }
.topbar { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.brand { display:flex; align-items:center; gap:12px; }
.brand img { width:57px; height:auto; object-fit:contain; } /* +10% */
.brand-title { font-weight:700; font-size:14px; line-height:1.1; color:#000000; } /* -10%, black */
.spacer { flex:1; }
.actions { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.call { display:flex; align-items:center; gap:8px; text-decoration:none; padding:8px 10px; border:1px solid var(--border); border-radius:999px; color:var(--text); font-weight:500; }
.call:hover { background:var(--accent); }
.social { display:flex; align-items:center; gap:10px; }
.icon-btn { width:36px; height:36px; border-radius:999px; display:grid; place-items:center; border:1px solid var(--border); background:#fff; text-decoration:none; }
.icon-btn:hover { background:var(--accent); }
.icon { width:18px; height:18px; display:block; }

nav { border-top:1px solid var(--border); }
.menu { display:flex; gap: 6px; overflow:auto; padding: 4px 0; }
.menu a { white-space:nowrap; text-decoration:none; color:var(--text); padding: 4px 8px; border-radius: 6px; }
.menu a:hover, .menu a.active { background:var(--accent); }

main { padding:24px 16px 48px; }
section { max-width: 1200px; margin: 0 auto 0px; padding: 16px; border:1px solid var(--border); border-radius: var(--radius); background:#fff; overflow: visible; height: auto; }
section h1, section h2 { margin:0 0 12px; font-size:20px; }
section p { margin: 0 0 16px; color: var(--text); font-size: 15px; line-height: 1.7; text-align: justify; }

/* Carousel */
.carousel { position: relative; overflow: hidden; border:1px solid var(--border); border-radius: var(--radius); background:#fff; max-width: 600px; margin: 0 auto 20px;}
.carousel-track { display:flex; gap:0; width:100%; transition: transform 0.5s ease; }
.carousel-slide { min-width:100%; aspect-ratio: 1 / 1; display:grid; place-items:center; background:#f8fafc; }
.carousel-slide img { width:100%; height:100%; object-fit:cover; display:block; }
.carousel-dots { position:absolute; bottom:8px; left:50%; transform:translateX(-50%); display:flex; gap:6px; }
.carousel-dot { width:4px; height:2px; border-radius:999px; background:#cbd5e1; }
.carousel-dot.active { background:#111418; }
.carousel-arrow {
  position:absolute; top:50%; transform:translateY(-50%);
  width:16px; height:16px; border-radius:999px; background:rgba(255,255,255,0.85);
  border:1px solid var(--border); display:grid; place-items:center; cursor:pointer; user-select:none;
}
.carousel-arrow:hover { background:#fff; }
.carousel-arrow svg { width:9px; height:4px; }
.carousel-arrow.prev { left:8px; }
.carousel-arrow.next { right:8px; }

/* Enroll */
.enroll-wrap { margin-top: 12px; }
.btn-enroll, .btn-primary { display:inline-flex; align-items:center; justify-content:center; padding:10px 14px; border-radius:10px; border:1px solid var(--border); background:#111418; color:#fff; cursor:pointer; font-weight:600; text-decoration:none; }
.btn-enroll:hover, .btn-primary:hover { filter:brightness(0.95); }
.btn-enroll:active, .btn-primary:active { transform: translateY(1px); }

/* Modal */
.modal { position:fixed; inset:0; display:none; }
.modal.show { display:block; }
.modal-backdrop { position:absolute; inset:0; background:rgba(0,0,0,0.45); }
.modal-card { position:absolute; left:50%; top:50%; transform:translate(-50%, -50%); width:min(560px, 92vw); background:#fff; border-radius:16px; border:1px solid var(--border); padding:18px; }
.modal-close { position:absolute; top:8px; right:10px; background:#fff; border:1px solid var(--border); border-radius:999px; width:28px; height:28px; cursor:pointer; }
.modal h3 { margin:0 0 12px; font-size:18px; }
.field { display:grid; gap:6px; margin-bottom:12px; }
.field input, .field select, .field textarea { padding:10px 12px; border:1px solid var(--border); border-radius:10px; font-size:14px; }

footer { border-top:1px solid var(--border); background:#fff; }
.footer-grid { display:grid; gap:8px; padding:16px; }
.copyright { font-weight:700; }
.addr { color:var(--muted); font-size:14px; }

@media (max-width: 720px) {
  .brand img { width:46px; }
  .icon { width:14px; height:14px; }
  .icon-btn { width:30px; height:30px; }
  .call { padding:6px 8px; font-size:14px; }
  .brand-title { font-size:13px; }
}


.btn-secondary {
  display:inline-flex; align-items:center; justify-content:center;
  padding:10px 14px; border-radius:10px; border:1px solid var(--border);
  background:#fff; color:#111418; cursor:pointer; font-weight:600; text-decoration:none;
}
.btn-secondary:hover { background:#f8fafc; }
.btn-secondary:active { transform: translateY(1px); }


/* === Mobile menu: compact two-row layout === */
@media (max-width: 720px) {
  .menu { 
    display: flex; 
    flex-wrap: wrap;              /* перенос на следующую строку */
    gap: 6px;                 /* вертикальный и горизонтальный зазоры */
    overflow: visible;            /* отключаем горизонтальный скролл */
    justify-content: center;      /* выравнивание по центру */
  }
  .menu a { 
    flex: 1 1 calc(50% - 8px);    /* два столбца */
    text-align: center;
    font-size: 13px;              /* меньше шрифт */
    padding: 4px 8px;             /* компактные отступы */
    border-radius: 6px;
  }
  .container { padding-left: 12px; padding-right: 12px; }
}


/* === Global H1 color override === */
h1 {
  color: #555555; /* серый */
}


/* === Compact mobile menu === */
@media (max-width: 720px) {
  .menu {
    gap: 4px 4px;
    padding: 2px 0;
  }
  .menu a {
    font-size: 12px;
    padding: 3px 6px;
    border-radius: 5px;
  }
}


/* === Mobile menu ultra-compact === */
@media (max-width: 720px) {
  .menu {
    display:flex;
    flex-wrap: wrap;          /* переносим на две строки и больше */
    gap: 4px 4px;             /* минимальные промежутки */
    padding: 2px 0;           /* минимальный вертикальный отступ */
    overflow: visible;        /* убираем горизонтальный скролл */
    justify-content: center;  /* центрируем */
  }
  .menu a {
    flex: 1 1 calc(50% - 4px);/* два столбца */
    font-size: 12px;          /* максимально компактный текст */
    padding: 4px 6px;         /* минимальные внутренние отступы */
    border-radius: 6px;       /* аккуратные углы */
    text-align: center;
  }
}


/* === Compact spacing between intro text and first course block === */
.intro + .btn-readmore {
  margin-bottom: 4px !important; /* small gap under the button */
}
.intro + .btn-readmore + .courses-grid {
  margin-top: 2px !important; /* reduce gap before courses grid */
}
.courses-grid {
  margin-top: 2px !important; /* ensure compact spacing overall */
}



/* === Standardized styles patch (DesignSchool.uz) moved to common.css === */
:root { --container-max: 1200px;
  --text: #111418;
  --muted: #475569;
  --border: #e2e8f0;
}
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji";
  font-size: 16px;
  line-height: 1.5;
}
/* Headings */
h1 {
  font-size: 1.6em;
  text-align: center;
  margin: 12px 0;
  font-weight: 600;
}
h2 {
  font-size: 1.25em;
  line-height: 1.3;
  margin: 8px 0 6px;
  font-weight: 600;
  color: var(--text);
}
/* Paragraphs */
p { margin: 4px 0; line-height: 1.45; }
/* Course text blocks become compact and consistent */
.course-text { margin-top: 4px; margin-bottom: 6px; }
.course-text p { margin: 4px 0; }
/* Grid spacing (where used) */
.courses-grid { margin-top: 4px !important; gap: 16px; }
@media (max-width: 640px){
  .courses-grid { gap: 8px; }
  h1 { font-size: 1.35em; margin: 10px 0; }
  h2 { font-size: 1.05em; margin: 6px 0; }
  p { font-size: 15px; }
}
/* Carousel arrows & dots: unified, 2x smaller look */
.carousel-arrow, .ad-prev, .ad-next, .news-prev, .news-next {
  width: 16px; height: 16px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.carousel-dots, .ad-dots, .news-dots { display:flex; gap:4px; justify-content:center; }
.carousel-dots button, .ad-dots button, .news-dots button {
  width: 4px; height: 4px; border-radius: 50%; border: none; background:#cbd5e1;
}
.carousel-dots button.active, .ad-dots button.active, .news-dots button.active { background:#111418; }
/* Banners (ad/news) same width behavior */
.ad-banner-wrap, .news-banner-wrap { display:flex; justify-content:center; margin:12px 0 16px; width:100%; }
.ad-carousel,
.news-carousel {
  position: relative;
  display: block;
  width: 100%;
  max-width: 1200px;   /* ширина как у колонки */
  margin: 0 auto;      /* центрируем */
  height: auto;        /* адаптивная высота */
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-sizing: border-box;
}
.ad-track, .news-track { display:flex; width:100%; height:100%; transition:transform .4s ease; }
.ad-slide, .news-slide { flex:0 0 100%; height:100%; display:block; }
.ad-slide img, .news-slide img {
  width: 100%;
  height: auto;
  object-fit: cover;
  object-position: center;
  display: block;
}
@media (max-width: 640px) {
  /* баннеры уже адаптивные, отдельные правила не требуются */
}

}
/* Minor utilities */
.container { padding-left: 12px; padding-right: 12px; }



/* === Unified site width (match header/container) === */
.container, .section-block, .card, .courses-grid, .reader, .book-list,
.ad-carousel, .news-carousel, .ad-banner-wrap, .news-banner-wrap,
main > section, main > div, footer, .footer, .hero, .toc, .page,
.banner, .reklama-banner, .news-banner {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

/* cancel full-viewport hacks if any appeared earlier */
.news-carousel, .ad-carousel, .reklama-banner, .news-banner {
  margin-left: auto !important;
  margin-right: auto !important;
  max-width: var(--container-max) !important;
  width: 100% !important;
}


.ad-carousel, .news-carousel { height: auto; overflow: hidden; border-radius: var(--radius, 12px); }
.ad-slide img, .news-slide img, .ad-carousel img, .news-carousel img {
  width: 100%; height: auto; object-fit: cover; object-position: center; display: block;
}


/* === Unified vertical margins for all blocks (desktop + mobile) === */
section,
.section-block,
.card,
.courses-grid,
.ad-carousel,
.news-carousel,
.book-list,
.reader,
footer,
header,
main > section,
main > div {
  margin-top: 2px !important;
  margin-bottom: 2px !important;
}


/* unified override */

.ad-carousel {
  position: relative;
  display: block;
  width: 100%;
  max-width: 1200px;   /* unified with header column */
  margin: 0 auto;
  height: auto;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-sizing: border-box;
}

/* ===== Mobile ultra-compact title & pagination patch (high priority) ===== */
@media (max-width: 720px){
  /* reduce space between menu and page title */
  main { padding-top: 1px !important; }

  /* page title spacing */
  h1 {
    margin-top: 1px !important;
    margin-bottom: 1px !important;
    padding-top: 1px !important;
    padding-bottom: 1px !important;
    line-height: 1.15 !important;
  }

  /* ultra-compact pagination */
  .pagination, .pager, .page-nav { gap: 2px !important; }
  .pagination .page-link,
  .pager a, .pager span,
  .page-nav .btn, .btn-page,
  .page-number {
    min-width: 18px !important;
    height: 18px !important;
    padding: 0 1px !important;
    font-size: 10px !important;
    line-height: 1 !important;
    border-radius: 4px !important;
  }
}

/* === Mobile menu ultra-compact v2 === */
@media (max-width: 720px){
  .menu{
    gap: 2px !important;
    padding: 1px 0 !important;
  }
  .menu a{
    font-size: 11px !important;
    line-height: 1.1 !important;
    padding: 2px 4px !important;
    border-radius: 4px !important;
  }
}

/* Reader TOC: убираем нумерацию и маркеры */
.toc-root {
  list-style: none;   /* убирает цифры и точки */
  margin: 0;
  padding: 0;
}
.toc-root li {
  margin: 4px 0;      /* аккуратные отступы */
}
