/* Главный блок в стиле apple.com */
.sq-hero-section {
    --sq-slide-w: min(1250px, 84vw);
    --sq-edge: calc((100% - var(--sq-slide-w)) / 2);
    --sq-gap: 12px;
    margin: 0 0 40px;
    overflow: hidden;
}

/* Общие правила для обеих лент */
.sq-hero, .sq-cards { position: relative; }
.sq-hero-track, .sq-cards-track {
    display: flex;
    gap: var(--sq-gap);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.sq-hero-track::-webkit-scrollbar, .sq-cards-track::-webkit-scrollbar { display: none; }
.sq-hero-slide, .sq-card {
    position: relative;
    flex: 0 0 auto;
    overflow: hidden;
    display: block;
    color: #fff !important;
    text-decoration: none !important;
    background: #1d1d1f;
}
.sq-hero-slide img, .sq-card img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .8s cubic-bezier(.2, .7, .2, 1);
}
.sq-hero-slide:hover img, .sq-card:hover img { transform: scale(1.03); }
.sq-hero-slide::after, .sq-card::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* Большая карусель (двигается через transform, без полосы прокрутки) */
.sq-hero .sq-hero-track {
    overflow: visible;
    scroll-snap-type: none;
    scroll-behavior: auto;
    transition: transform .9s cubic-bezier(.45, .05, .25, 1);
    will-change: transform;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}
.sq-hero:not(.ready) .sq-hero-track { padding-left: var(--sq-edge); }
.sq-hero-slide {
    width: var(--sq-slide-w);
    height: clamp(340px, 40vw, 580px);
    transition: opacity .6s;
}
.sq-hero-slide img { pointer-events: none; }
.sq-hero-slide::after {
    background: linear-gradient(to top, rgba(0, 0, 0, .78) 0%, rgba(0, 0, 0, .35) 32%, rgba(0, 0, 0, 0) 60%);
}
.sq-hero-slide:not(.active) { opacity: .85; }
.sq-hero-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 0 70px 52px;
}
.sq-hero-text { min-width: 0; }
.sq-hero-title {
    margin: 0;
    color: #fff;
    font-size: clamp(18px, 1.7vw, 24px);
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: -.01em;
    text-shadow: 0 1px 12px rgba(0, 0, 0, .35);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.sq-hero-date {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: rgba(255, 255, 255, .75);
}

/* Белая «таблетка», как кнопки на apple.com */
.sq-pill {
    flex: 0 0 auto;
    display: inline-block;
    padding: 11px 21px;
    border-radius: 980px;
    background: #fff;
    color: #1d1d1f;
    font-size: 17px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    transition: background .2s;
}
.sq-hero-slide:hover .sq-pill, .sq-card:hover .sq-pill { background: #e8e8ed; }
.sq-pill-sm { padding: 8px 16px; font-size: 14px; }

/* Точки и пауза под каруселью */
.sq-hero-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    margin-top: 18px;
}
.sq-dots {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 980px;
    background: rgba(210, 210, 215, .64);
    backdrop-filter: blur(10px);
}
.sq-dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 980px;
    background: rgba(0, 0, 0, .42);
    cursor: pointer;
    transition: width .35s ease, background .35s ease;
}
.sq-dot.active { width: 46px; background: rgba(0, 0, 0, .8); }
.sq-play {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: rgba(210, 210, 215, .64);
    color: rgba(0, 0, 0, .8);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.sq-play .i-play { display: none; }
.sq-play.paused .i-play { display: block; }
.sq-play.paused .i-pause { display: none; }

/* Стрелки по бокам */
.sq-arrow {
    position: absolute;
    top: 50%;
    z-index: 5;
    width: 48px;
    height: 48px;
    margin-top: -24px;
    border: 0;
    border-radius: 50%;
    background: rgba(210, 210, 215, .75);
    backdrop-filter: blur(10px);
    color: #1d1d1f;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity .25s, background .2s;
}
.sq-hero .sq-arrow { top: calc(clamp(340px, 40vw, 580px) / 2); }
.sq-hero:hover .sq-arrow, .sq-cards:hover .sq-arrow { opacity: 1; }
.sq-arrow:hover { background: rgba(225, 225, 230, .95); }
.sq-arrow:disabled { opacity: 0 !important; pointer-events: none; }
.sq-arrow-prev { left: calc(var(--sq-edge) + 16px); }
.sq-arrow-next { right: calc(var(--sq-edge) + 16px); }

/* Лента карточек */
.sq-cards { margin-top: 22px; }
.sq-cards-track {
    padding: 0 var(--sq-edge);
    scroll-padding: 0 var(--sq-edge);
}
.sq-card {
    width: clamp(280px, 30vw, 470px);
    height: clamp(220px, 17vw, 265px);
    scroll-snap-align: start;
}
.sq-card::after {
    background: linear-gradient(to top, rgba(0, 0, 0, .8) 0%, rgba(0, 0, 0, .2) 45%, rgba(0, 0, 0, 0) 65%),
                linear-gradient(to bottom, rgba(0, 0, 0, .35) 0%, rgba(0, 0, 0, 0) 25%);
}
.sq-card-category {
    position: absolute;
    top: 20px;
    right: 22px;
    z-index: 2;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -.01em;
}
.sq-card-bottom {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 20px;
    z-index: 2;
    display: flex;
    align-items: flex-end;
    gap: 16px;
}
.sq-card-title {
    flex: 1;
    margin: 0;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.sq-hero-slide .media-icon, .sq-card .media-icon { z-index: 2; }

/* Тёмная тема сайта */
.dark-mode .sq-dots, .dark-mode .sq-play { background: rgba(66, 66, 69, .72); }
.dark-mode .sq-dot { background: rgba(255, 255, 255, .45); }
.dark-mode .sq-dot.active { background: rgba(255, 255, 255, .9); }
.dark-mode .sq-play { color: #fff; }

/* Сайттың кіруі: карусель жайлап үлкейіп, карточкалар мен тізім төменнен көтеріледі.
   Кіріспе көрсетілсе, --sq-enter-delay арқылы одан кейін басталады.
   backwards: анимация біткен соң элементте із қалмайды (әйтпесе ашылмалы мәзірлер астында қалады) */
.sq-hero { animation: sqHeroIn 1.1s cubic-bezier(.2, .8, .2, 1) backwards; animation-delay: var(--sq-enter-delay, 0s); }
.sq-hero-controls { animation: sqRise .8s cubic-bezier(.2, .8, .2, 1) backwards; animation-delay: calc(var(--sq-enter-delay, 0s) + .35s); }
.sq-cards { animation: sqRise .9s cubic-bezier(.2, .8, .2, 1) backwards; animation-delay: calc(var(--sq-enter-delay, 0s) + .2s); }
.sq-heads { animation: sqRise .9s cubic-bezier(.2, .8, .2, 1) backwards; animation-delay: calc(var(--sq-enter-delay, 0s) + .35s); }
@keyframes sqHeroIn { from { opacity: 0; transform: scale(.96); } }
@keyframes sqRise { from { opacity: 0; transform: translateY(28px); } }
@media (prefers-reduced-motion: reduce) {
    .sq-hero, .sq-hero-controls, .sq-cards, .sq-heads { animation: none; }
}

/* Жаңалықтар легі: суретсіз тақырыптар, беттерге бөлінген */
.sq-heads { --c: 3; --r: 4; margin: 40px var(--sq-edge) 0; }
.sq-heads-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 12px; border-bottom: 2px solid #1d1d1f; }
.sq-heads-title { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.02em; color: inherit; }
.sq-heads-nav { display: flex; align-items: center; gap: 10px; }
.sq-heads-nav button {
    width: 36px; height: 36px; border: 0; border-radius: 50%; padding: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(210, 210, 215, .64); color: #1d1d1f; cursor: pointer; transition: background .2s;
}
.sq-heads-nav button:hover { background: rgba(210, 210, 215, .95); }
.sq-heads-count { min-width: 44px; text-align: center; font-size: 14px; font-variant-numeric: tabular-nums; color: #6e6e73; }
.sq-heads-viewport { overflow: hidden; }
.sq-heads-track { display: flex; transition: transform .7s cubic-bezier(.45, .05, .25, 1); will-change: transform; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.sq-heads-list, .sq-heads-page {
    display: grid; grid-template-columns: repeat(var(--c), minmax(0, 1fr)); grid-template-rows: repeat(var(--r), auto);
    grid-auto-flow: column; column-gap: 36px; margin: 0; padding: 0; list-style: none;
}
.sq-heads-list { grid-template-rows: none; grid-auto-flow: row; }
.sq-heads-page { flex: 0 0 100%; align-content: start; }
.sq-head-item { border-bottom: 1px solid #e5e5ea; }
.sq-head-link { display: block; padding: 15px 0 16px; color: inherit !important; text-decoration: none !important; }
.sq-head-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: #86868b; text-transform: uppercase; letter-spacing: .03em; }
.sq-head-meta i { flex: 0 0 7px; height: 7px; border-radius: 50%; }
.sq-head-title {
    display: -webkit-box; margin-top: 6px; font-size: 17px; font-weight: 600; line-height: 1.35; letter-spacing: -.01em;
    -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; transition: color .15s;
}
.sq-head-link:hover .sq-head-title { color: #0071e3; }
.sq-heads-dots { display: flex; justify-content: center; gap: 8px; margin-top: 18px; }
.sq-heads-dots button { width: 7px; height: 7px; padding: 0; border: 0; border-radius: 980px; background: rgba(0, 0, 0, .25); cursor: pointer; transition: width .35s ease, background .35s ease; }
.sq-heads-dots button.active { width: 28px; background: rgba(0, 0, 0, .75); }

.dark-mode .sq-heads-head { border-bottom-color: #f5f5f7; }
.dark-mode .sq-heads-nav button { background: rgba(66, 66, 69, .72); color: #f5f5f7; }
.dark-mode .sq-heads-nav button:hover { background: rgba(86, 86, 90, .9); }
.dark-mode .sq-heads-count { color: #a1a1a6; }
.dark-mode .sq-head-item { border-bottom-color: #2c2c2e; }
.dark-mode .sq-head-link:hover .sq-head-title { color: #2997ff; }
.dark-mode .sq-heads-dots button { background: rgba(255, 255, 255, .3); }
.dark-mode .sq-heads-dots button.active { background: rgba(255, 255, 255, .85); }

@media (max-width: 1199px) {
    .sq-heads { --c: 2; --r: 4; }
}

.sq-hero-cat, .sq-hero-read { display: none; }

/* Телефоны: сверху одна высокая новость, снизу ряд узких карточек (как apple.com) */
@media (max-width: 767px) {
    .sq-hero-section { --sq-slide-w: 72vw; --sq-card-w: 48vw; --sq-gap: 12px; margin-bottom: 28px; }
    .sq-hero-slide { height: calc(72vw * 1.58); max-height: 72vh; }
    .sq-hero-slide::after { background: linear-gradient(to top, rgba(0, 0, 0, .82) 0%, rgba(0, 0, 0, .45) 35%, rgba(0, 0, 0, 0) 62%); }
    .sq-hero-slide:not(.active) { opacity: 1; }
    .sq-hero-caption { flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 0 16px 22px; }
    .sq-hero-pill, .sq-hero-date { display: none; }
    .sq-hero-cat { display: block; font-size: 15px; font-weight: 700; margin-bottom: 2px; }
    .sq-hero-title { font-size: 16px; font-weight: 400; line-height: 1.3; -webkit-line-clamp: 3; }
    .sq-hero-read { display: inline-block; }
    .sq-pill { padding: 9px 22px; font-size: 15px; }
    .sq-hero-controls { margin-top: 14px; }
    .sq-arrow { display: none; }

    .sq-cards { margin-top: 14px; }
    .sq-cards-track { padding: 0 calc((100% - var(--sq-card-w)) / 2); scroll-padding: 0 calc((100% - var(--sq-card-w)) / 2); }
    .sq-card { width: var(--sq-card-w); height: calc(var(--sq-card-w) * 1.32); scroll-snap-align: center; }
    .sq-card::after { background: linear-gradient(to top, rgba(0, 0, 0, .85) 0%, rgba(0, 0, 0, .3) 45%, rgba(0, 0, 0, 0) 65%), linear-gradient(to bottom, rgba(0, 0, 0, .45) 0%, rgba(0, 0, 0, 0) 28%); }
    .sq-card-category { left: 10px; right: 10px; top: 14px; text-align: center; font-size: 15px; }
    .sq-card-bottom { left: 10px; right: 10px; bottom: 14px; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
    .sq-card-title { font-size: 13px; -webkit-line-clamp: 3; }
    .sq-pill-sm { padding: 6px 14px; font-size: 13px; }

    .sq-heads { --c: 1; --r: 5; margin: 30px 16px 0; }
    .sq-heads-title { font-size: 22px; }
    .sq-head-link { padding: 13px 0 14px; }
    .sq-head-title { font-size: 16px; }
}
