/* ============================================================
   ГЛАВНАЯ: «погружение» — пляж → толща океана → дно
   Подключается только на главной (body.page-home)
   ============================================================ */
.page-home {
    /* Дно (срезы глубины --d1…--d5 и волны между ними — общие, style.css) */
    --floor-top: #041a31;
    --floor-bot: #0b2a3a;

    --sea-text: #e6f6fa;
    --sea-link: #aeefff;


    /* Цвет песка на дне — им же закрашивается всё ниже подвала */
    background-color: #4a675f;
}

/* ------------------------------------------------------------
   ШАПКА: песчаный пляж
   ------------------------------------------------------------ */
.page-home .header-overlay {
    padding-bottom: 120px;
}

/* на главной под логотипом нет заголовка — отступы больше */
.page-home .site-logo {
    padding: 3rem 1rem 2.5rem;
}

/* Ракушки на песке */
.beach-decor {
    position: absolute;
    inset: 0;
    z-index: 3; /* над .header-overlay — иначе фигурки не ловят наведение и клик */
    pointer-events: none;
}

/* Фигурки по бокам логотипа: каждая — посередине между краем экрана и логотипом (он 900px по центру).
   (50% − 450px) — ширина поля между краем и логотипом; отступ = (поле − ширина фигурки) / 2. */
.beach-figure {
    --w: 122px;
    position: absolute;
    bottom: 165px;
    display: block;
    width: var(--w);
    pointer-events: auto;
}

/* Неподвижная «яма»: всё, что ниже кромки холмика, скрыто (иначе просвечивало бы сквозь его
   растворяющийся низ). Вверх и в стороны область открыта — фигурке есть куда выпрыгнуть. */
.beach-figure-clip {
    display: block;
    clip-path: inset(-150% -60% 24% -60%);
}

.beach-figure img {
    display: block;
    width: 100%;
    height: auto;
    transform: rotate(var(--tilt, 0deg));
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); /* с «отскоком» */
}

/* при наведении фигурка выскакивает из песка целиком */
.beach-figure:hover img,
.beach-figure:focus-visible img {
    transform: translateY(-48%) rotate(calc(var(--tilt, 0deg) * -1));
}

.beach-figure:focus-visible {
    outline: none;
}

.beach-figure:focus-visible .beach-figure-clip {
    filter: drop-shadow(0 0 3px #fff) drop-shadow(0 0 2px var(--ocean-700, #0f6f93));
}

/* Холмик песка спереди: закрывает низ фигурки, будто она наполовину закопана.
   Та же текстура, что у пляжа; низ холмика растворяется в песке, верх — со светлой кромкой. */
.beach-figure::after {
    content: "";
    position: absolute;
    left: -30%;
    right: -30%;
    bottom: -10px;
    height: 48%;
    border-radius: 50% 50% 0 0 / 100% 100% 0 0;
    /* основа — тот же цвет пляжа на этой высоте, что и вокруг (#efd5a1 под текстурой) */
    background:
        url('../sand-texture.png') 0 0 / 200px 200px,
        #efd5a1;
    /* светлая кромка по вершине холмика и лёгкая тень у фигурки */
    box-shadow: inset 0 2px 1px rgba(255, 249, 228, 0.7), inset 0 7px 6px -5px rgba(140, 95, 40, 0.22);
    /* низ и бока растворяются в песке — видна только вершина холмика */
    -webkit-mask-image:
        linear-gradient(180deg, #000 50%, transparent 100%),
        linear-gradient(90deg, transparent 0%, #000 12%, #000 88%, transparent 100%);
    -webkit-mask-composite: source-in;
    mask-image:
        linear-gradient(180deg, #000 50%, transparent 100%),
        linear-gradient(90deg, transparent 0%, #000 12%, #000 88%, transparent 100%);
    mask-composite: intersect;
}

/* кит из логотипа «Море детям» (static/whale.svg, без надписи) — слева, «плывёт» в песке */
.beach-figure--whale {
    --w: 122px;
    left: calc((50% - 450px - var(--w)) / 2);
}

.beach-figure--whale {
    --tilt: -5deg;
}

/* матрёшка (static/matryoshka.svg — с сайта конвенции) — справа, чуть наклонена */
.beach-figure--matryoshka {
    --w: 43px;
    right: calc((50% - 450px - var(--w)) / 2);
}

.beach-figure--matryoshka {
    --tilt: 8deg;
}

/* ------------------------------------------------------------
   ТОЛЩА ОКЕАНА: каждый блок — срез глубже предыдущего (только цвет, без узора)
   ------------------------------------------------------------ */
.page-home main {
    position: relative;
    overflow: hidden;
    color: var(--sea-text);
}

/* Волны над подвалом главной (над дном) — как между блоками, style.css */
.page-home .site-footer::before,
.page-home .site-footer::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    pointer-events: none;
}

.page-home .site-footer::before {
    top: -39px;
    height: 40px;
    z-index: 1;
    background: var(--top);
    -webkit-mask: var(--slice-wave) 0 0 / 600px 40px repeat-x;
    mask: var(--slice-wave) 0 0 / 600px 40px repeat-x;
    animation: sea-drift 22s linear infinite;
    animation-delay: var(--wave-delay, 0s);
}

.page-home .site-footer::after {
    top: -51px;
    height: 52px;
    z-index: 0;
    background: var(--top);
    opacity: 0.45;
    -webkit-mask: var(--slice-wave-back) 0 0 / 900px 52px repeat-x;
    mask: var(--slice-wave-back) 0 0 / 900px 52px repeat-x;
    animation: sea-drift-back 34s linear infinite, sea-bob 6s ease-in-out infinite alternate;
    animation-delay: var(--wave-delay, 0s), 0s;
}

/* Типографика на воде */
.page-home main h2,
.page-home main h5 {
    color: #fff;
}

.page-home main .lead {
    color: rgba(230, 246, 250, 0.88);
}

.page-home main a.text-decoration-none {
    color: var(--sea-link);
}

.page-home main a.text-decoration-none:hover {
    color: #fff;
}

.page-home main .text-muted {
    color: rgba(230, 246, 250, 0.7) !important;
}

.page-home main .btn-outline-primary {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.7);
}

.page-home main .btn-outline-primary:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: #fff;
    color: #fff;
}

/* Карточки курсов (как на странице «Программы») — светлые, с тенью под водой */
.page-home .course-card {
    box-shadow: 0 8px 24px rgba(0, 30, 50, 0.25);
}

.page-home main .course-card h3 {
    color: inherit;
}

/* Заголовок блока и кнопки «Больше курсов» / «Подробнее о …» */
.sea-head {
    margin-bottom: 1.75rem;
}

.sea-head.text-center .lead {
    max-width: 760px;
    margin: 0 auto;
}

.sea-more {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.75rem 1.25rem;
    margin-top: 2rem;
}

.sea-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1.6rem;
    border-radius: 999px;
    background: #fff;
    color: var(--ocean-800, #0b5675);
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 8px 22px rgba(0, 25, 45, 0.3);
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.sea-btn:hover {
    transform: translateY(-2px);
    background: #f2fbfd;
    color: var(--ocean-900, #0b3e52);
    box-shadow: 0 12px 28px rgba(0, 25, 45, 0.38);
}

.sea-btn .bi {
    transition: transform 0.2s;
}

.sea-btn:hover .bi {
    transform: translateX(4px);
}

.sea-btn--big {
    padding: 0.95rem 2.4rem;
    font-size: 1.15rem;
}

.sea-more-note {
    color: rgba(230, 246, 250, 0.8);
    font-size: 0.92rem;
}

/* Карусели представителей и партнёров (static/js/sea-carousel.js) */
.sea-carousel {
    position: relative;
    padding: 0 3rem;
}

.sea-carousel-track {
    display: flex;
    gap: 1rem;
    /* запас со всех сторон — иначе прокручиваемая лента обрезает тени карточек ровным краем;
       отрицательные отступы возвращают карточки на место */
    margin: -0.5rem -2rem -1.5rem;
    padding: 1rem 2rem 2.5rem;
    scroll-padding-inline: 2rem;
    /* края ленты растворяются: соседние карточки и тени уходят в воду без резкой границы */
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 2rem, #000 calc(100% - 2rem), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 2rem, #000 calc(100% - 2rem), transparent 100%);
    list-style: none;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

.sea-carousel-track::-webkit-scrollbar {
    display: none;
}

.sea-carousel-item {
    display: flex;
    flex: 0 0 calc((100% - 3rem) / 4);
    flex-direction: column;
    scroll-snap-align: start;
}

.sea-carousel-item > * {
    flex: 1 1 auto;
    min-width: 0;
}

/* ширина ячейки — по расчёту выше, а не по содержимому: длинная строка «направление + формат»
   у карточки курса переносится, а не растягивает ячейку */
.sea-carousel-item {
    min-width: 0;
}

.sea-carousel-item .course-card-top {
    flex-wrap: wrap;
}

@media (max-width: 1199.98px) {
    .sea-carousel-item { flex-basis: calc((100% - 2rem) / 3); }
}

/* Карусель курсов: карточки курса содержательнее — по 3 в ряд (на планшете по 2), чтобы не вытягивались */
.sea-carousel--wide .sea-carousel-item {
    flex-basis: calc((100% - 2rem) / 3);
}

@media (max-width: 1199.98px) {
    .sea-carousel--wide .sea-carousel-item { flex-basis: calc((100% - 1rem) / 2); }
}

@media (max-width: 767.98px) {
    .sea-carousel { padding: 0; }
    .sea-carousel--wide .sea-carousel-item { flex-basis: 82%; }
    .sea-carousel-item { flex-basis: 82%; }
    .sea-carousel .sea-carousel-btn { display: none; } /* на телефоне листают свайпом */
}

.sea-carousel-btn {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: var(--ocean-800, #0b5675);
    font-size: 1.1rem;
    box-shadow: 0 6px 18px rgba(0, 25, 45, 0.35);
    transform: translateY(-50%);
    transition: opacity 0.2s, transform 0.2s;
}

.sea-carousel-btn:hover:not(:disabled) {
    transform: translateY(-50%) scale(1.08);
}

.sea-carousel-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.sea-carousel-btn--prev { left: 0; }
.sea-carousel-btn--next { right: 0; }

/* все карточки помещаются — листать нечего */
.sea-carousel.is-static { padding: 0; }
.sea-carousel.is-static .sea-carousel-btn { display: none; }
.sea-carousel.is-static .sea-carousel-track { justify-content: center; }

.sea-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.1rem 1.15rem 1.15rem;
    border-radius: 22px;
    background: #fff;
    color: var(--text, #2a3540);
    box-shadow: 0 8px 24px rgba(0, 30, 50, 0.25);
}

.sea-card-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 110px;
    margin-bottom: 0.9rem;
    border-radius: 16px;
    background: var(--ocean-50, #f2f8fb);
    color: var(--ocean-500, #1f8fa6);
    font-size: 2.2rem;
}

.sea-card-logo img {
    max-width: 80%;
    max-height: 86px;
    object-fit: contain;
}

.page-home main .sea-card-title {
    margin: 0.2rem 0 0.4rem;
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--ink, #1b2a33);
}

.sea-card-meta {
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
    color: var(--muted, #55636e);
}

.sea-card-meta .bi {
    color: var(--ocean-700, #0f6f93);
}

.sea-card-desc {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0.3rem 0 0;
    font-size: 0.86rem;
    line-height: 1.5;
    color: var(--muted, #55636e);
}

.sea-card-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: auto;
    padding-top: 0.8rem;
}

.sea-card-links .course-chip {
    margin: 0;
    font-weight: 600;
    color: var(--ocean-700, #0f6f93);
    text-decoration: none;
}

.sea-card-links .course-chip:hover {
    border-color: var(--ocean-500, #1f8fa6);
    background: var(--ocean-50, #f2f8fb);
}

/* На глубине (членство, представители, партнёры) белое слишком контрастно —
   карточки и кнопки становятся «подводным стеклом»: полупрозрачные, со светлой бирюзовой кромкой */
.page-home .depth-3 .sea-btn,
.page-home .depth-4 .sea-btn,
.page-home .depth-5 .sea-btn,
.page-home .depth-3 .sea-carousel-btn,
.page-home .depth-4 .sea-carousel-btn,
.page-home .depth-5 .sea-carousel-btn {
    border: 1px solid rgba(174, 239, 255, 0.55);
    background: rgba(174, 239, 255, 0.12);
    color: var(--sea-text);
    box-shadow: 0 8px 22px rgba(0, 10, 25, 0.35);
}

.page-home .depth-3 .sea-btn:hover,
.page-home .depth-4 .sea-btn:hover,
.page-home .depth-5 .sea-btn:hover,
.page-home .depth-3 .sea-carousel-btn:hover,
.page-home .depth-4 .sea-carousel-btn:hover,
.page-home .depth-5 .sea-carousel-btn:hover {
    border-color: var(--sea-link);
    background: rgba(174, 239, 255, 0.24);
    color: #fff;
}

.page-home .depth-3 .sea-card,
.page-home .depth-4 .sea-card,
.page-home .depth-5 .sea-card {
    border: 1px solid rgba(174, 239, 255, 0.22);
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.04));
    color: var(--sea-text);
    box-shadow: 0 10px 28px rgba(0, 10, 25, 0.4);
    /* без backdrop-filter: внутри прокручиваемой ленты размытие даёт светлую полосу по её краю */
}

/* логотипы рисовались под светлый фон — под ними мягкая светло-голубая подложка */
.page-home .depth-4 .sea-card-logo,
.page-home .depth-5 .sea-card-logo {
    background: rgba(232, 246, 250, 0.92);
}

.page-home .depth-3 .sea-card-title,
.page-home .depth-4 .sea-card-title,
.page-home .depth-5 .sea-card-title {
    color: #fff;
}

.page-home .depth-4 .sea-card .course-card-dir {
    color: var(--sea-link);
}

.page-home .depth-3 .sea-card-meta,
.page-home .depth-3 .sea-card-desc,
.page-home .depth-4 .sea-card-meta,
.page-home .depth-5 .sea-card-meta,
.page-home .depth-5 .sea-card-desc {
    color: rgba(230, 246, 250, 0.75);
}

.page-home .depth-3 .sea-card-meta .bi,
.page-home .depth-4 .sea-card-meta .bi,
.page-home .depth-5 .sea-card-meta .bi {
    color: var(--sea-link);
}

.page-home .depth-4 .sea-card-links .course-chip,
.page-home .depth-5 .sea-card-links .course-chip {
    border-color: rgba(174, 239, 255, 0.45);
    background: transparent;
    color: var(--sea-link);
}

.page-home .depth-4 .sea-card-links .course-chip:hover,
.page-home .depth-5 .sea-card-links .course-chip:hover {
    border-color: var(--sea-link);
    background: rgba(174, 239, 255, 0.14);
    color: #fff;
}

/* Карточка специалиста (блок «Членство»): фото, имя, должность, город */
.sea-card--person {
    align-items: center;
    text-align: center;
}

.sea-card-photo {
    width: 104px;
    height: 104px;
    margin: 0.25rem 0 0.9rem;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 0 4px rgba(174, 239, 255, 0.25);
}

.sea-card-photo--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(174, 239, 255, 0.14);
    color: var(--sea-link);
    font-size: 2.6rem;
}

.sea-card--person .sea-card-desc {
    margin: 0 0 0.5rem;
}

.sea-card--person .sea-card-meta {
    margin-top: auto;
}

/* Пузырьки воздуха */
.bubbles {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.bubbles span {
    position: absolute;
    bottom: -20px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.45);
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.05) 60%);
    animation: bubble-rise linear infinite;
    opacity: 0;
}

.bubbles span:nth-child(1)  { left: 4%;  animation-duration: 22s; animation-delay: 0s; }
.bubbles span:nth-child(2)  { left: 12%; width: 6px;  height: 6px;  animation-duration: 18s; animation-delay: 5s; }
.bubbles span:nth-child(3)  { left: 23%; width: 14px; height: 14px; animation-duration: 28s; animation-delay: 9s; }
.bubbles span:nth-child(4)  { left: 37%; width: 7px;  height: 7px;  animation-duration: 20s; animation-delay: 2s; }
.bubbles span:nth-child(5)  { left: 51%; animation-duration: 25s; animation-delay: 12s; }
.bubbles span:nth-child(6)  { left: 63%; width: 5px;  height: 5px;  animation-duration: 16s; animation-delay: 7s; }
.bubbles span:nth-child(7)  { left: 74%; width: 12px; height: 12px; animation-duration: 24s; animation-delay: 3s; }
.bubbles span:nth-child(8)  { left: 83%; width: 6px;  height: 6px;  animation-duration: 19s; animation-delay: 10s; }
.bubbles span:nth-child(9)  { left: 91%; animation-duration: 27s; animation-delay: 6s; }
.bubbles span:nth-child(10) { left: 97%; width: 8px;  height: 8px;  animation-duration: 21s; animation-delay: 14s; }

@keyframes bubble-rise {
    0%   { transform: translate(0, 0); opacity: 0; }
    8%   { opacity: 1; }
    50%  { transform: translate(14px, -1600px); }
    90%  { opacity: 0.8; }
    100% { transform: translate(-6px, -3200px); opacity: 0; }
}

/* ------------------------------------------------------------
   ПОДВАЛ: дно океана
   ------------------------------------------------------------ */
.page-home .site-footer {
    position: relative;
    background: linear-gradient(180deg, var(--floor-top) 0%, var(--floor-bot) 100%);
    padding-bottom: 150px; /* место под дно */
}

.page-home .site-footer {
    --top: var(--floor-top);
    --wave-delay: -8s;
}

.page-home .footer-body,
.page-home .footer-bottom-icon {
    position: relative;
    z-index: 2;
}

.page-home .footer-bottom-icon {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 18px;
    padding: 0;
    opacity: 0.5;
}

.seabed {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 200px;
    z-index: 1;
    pointer-events: none;
}

.seabed-dunes {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.seabed-rock {
    position: absolute;
    width: 120px;
}

.seabed-rock--l { left: 6%;  bottom: 28px; }
.seabed-rock--r { right: 9%; bottom: 40px; width: 90px; }

.seabed-star {
    position: absolute;
    width: 26px;
    right: 24%;
    bottom: 18px;
    transform: rotate(20deg);
    opacity: 0.85;
}

.kelp {
    position: absolute;
    width: 36px;
    height: 150px;
    transform-origin: 50% 100%;
    animation: kelp-sway 6s ease-in-out infinite alternate;
}

.kelp--1 { left: 13%; bottom: 30px; }
.kelp--2 { left: 16%; bottom: 24px; height: 110px; animation-duration: 7.5s; }
.kelp--3 { right: 16%; bottom: 44px; height: 120px; animation-duration: 5.5s; }
.kelp--4 { right: 13%; bottom: 36px; height: 160px; animation-duration: 8s; }

@keyframes kelp-sway {
    from { transform: rotate(-5deg); }
    to   { transform: rotate(5deg); }
}

/* ------------------------------------------------------------
   Адаптив и доступность
   ------------------------------------------------------------ */
/* уже 1240px между краем экрана и логотипом не помещается кит с отступами */
@media (max-width: 1239px) {
    .beach-decor { display: none; }
}

@media (max-width: 767px) {
    .page-home .header-overlay { padding-bottom: 90px; }
    .seabed-rock--l, .kelp--2, .kelp--3 { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .kelp,
    .bubbles span {
        animation: none;
    }
    .bubbles { display: none; }
    .beach-figure img { transition: none; }
    .page-home .site-footer::before,
    .page-home .site-footer::after { animation: none; }
}
