/* ============================================================
   layout.css — шапка, подвал, прелоадер, кнопка «наверх».
   ============================================================ */

/* ---- прелоадер: клубника наливается цветом ---------------- */
.preloader {
    position: fixed;
    inset: 0;
    z-index: var(--z-preloader);
    display: grid;
    place-items: center;
    gap: var(--s-5);
    grid-auto-flow: row;
    align-content: center;
    background: var(--ink);
    transition: opacity var(--t-mid) ease, visibility var(--t-mid) ease;
}

.preloader.is-done {
    opacity: 0;
    visibility: hidden;
}

.berry {
    width: 84px;
    height: auto;
    overflow: visible;
}

/* контур ягоды — виден до того, как её зальёт */
.berry__outline {
    fill: none;
    stroke: rgba(255, 255, 255, .16);
    stroke-width: 2.5;
}

/* прямоугольник заливки едет снизу вверх внутри обрезки по форме ягоды */
.berry__fill {
    animation: berry-fill 1.9s var(--ease) infinite;
    animation-fill-mode: forwards;
}

@keyframes berry-fill {
    0% {
        transform: translateY(96px);
    }
    55%, 72% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(0);
        opacity: 0;
    }
}

.berry__leaves {
    fill: rgba(255, 255, 255, .3);
}

.berry__stem {
    fill: rgba(255, 255, 255, .3);
}

.berry__seeds {
    fill: rgba(255, 255, 255, .55);
}

/* лёгкое покачивание, чтобы ягода не выглядела приклеенной */
.berry__body {
    animation: berry-sway 2.6s ease-in-out infinite;
    transform-origin: 36px 92px;
}

@keyframes berry-sway {
    0%, 100% {
        transform: rotate(-2.5deg);
    }
    50% {
        transform: rotate(2.5deg);
    }
}

.preloader__label {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .35);
    animation: label-pulse 1.9s ease-in-out infinite;
}

@keyframes label-pulse {
    0%, 100% {
        opacity: .35;
    }
    50% {
        opacity: .8;
    }
}

/* ---- шапка ------------------------------------------------ */
.site-header {
    position: fixed;
    inset: 0 0 auto;
    z-index: var(--z-nav);
    transition: background var(--t-mid), box-shadow var(--t-mid);
}

.site-header.is-stuck {
    background: rgba(16, 18, 24, .82);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .08);
}

/* Прозрачная шапка — только на страницах с тёмным героем (body.has-hero).
   На всех остальных она сразу тёмная, а контент отступает вниз. */
body:not(.has-hero) .site-header {
    background: var(--ink);
}

body:not(.has-hero) #main {
    padding-top: 124px;
}

@media (max-width: 980px) {
    body:not(.has-hero) #main {
        padding-top: 72px;
    }
}

.site-header__in {
    display: flex;
    align-items: center;
    gap: var(--s-6);
    height: 80px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: none;
}

.brand img {
    height: 30px;
    width: auto;
}

.brand__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--magenta);
    box-shadow: 0 0 14px 2px var(--magenta);
    flex: none;
}

.site-nav {
    display: flex;
    gap: var(--s-1);
    margin-left: auto;
    align-items: center;
}

.site-nav__link {
    display: block;
    padding: 10px 18px;
    border-radius: var(--r-pill);
    color: rgba(255, 255, 255, .72);
    font-size: var(--fs-sm);
    font-weight: 600;
    transition: color var(--t-fast), background var(--t-fast);
}

.site-nav__link:hover {
    color: var(--white);
    background: rgba(255, 255, 255, .09);
}

.site-nav__link.is-active {
    color: var(--white);
    background: var(--magenta);
}

/* выпадающий каталог */
.has-drop {
    position: relative;
}

.drop {
    position: absolute;
    left: 0;
    top: calc(100% + 10px);
    min-width: 230px;
    background: var(--ink);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: var(--r-md);
    padding: var(--s-2);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity var(--t-fast), transform var(--t-fast), visibility var(--t-fast);
}

.has-drop:hover .drop,
.has-drop:focus-within .drop {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.drop a {
    display: block;
    padding: 11px 16px;
    border-radius: var(--r-sm);
    color: rgba(255, 255, 255, .75);
    font-size: var(--fs-sm);
    font-weight: 600;
}

.drop a:hover {
    background: rgba(255, 255, 255, .09);
    color: var(--white);
}

/* верхняя строка с телефонами */
.topbar {
    border-bottom: 1px solid rgba(255, 255, 255, .09);
    font-size: var(--fs-xs);
}

.topbar__in {
    display: flex;
    align-items: center;
    gap: var(--s-5);
    height: 44px;
    color: rgba(255, 255, 255, .6);
}

.topbar a:hover {
    color: var(--white);
}

.topbar .socials {
    margin-left: auto;
}

.socials {
    display: flex;
    gap: var(--s-2);
}

.socials a {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, .08);
    color: rgba(255, 255, 255, .8);
    transition: background var(--t-fast), color var(--t-fast);
}

.socials a:hover {
    background: var(--magenta);
    color: var(--white);
}

.socials svg {
    width: 16px;
    height: 16px;
}

/* бургер и мобильное меню */
.burger {
    display: none;
    margin-left: auto;
    width: 46px;
    height: 46px;
    flex: none;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, .25);
    background: transparent;
    padding: 0;
}

.burger span {
    display: block;
    width: 18px;
    height: 1.5px;
    background: var(--white);
    margin: 4px auto;
    transition: transform var(--t-mid) var(--ease), opacity var(--t-fast);
}

.burger.is-open span:nth-child(1) {
    transform: translateY(5.5px) rotate(45deg);
}

.burger.is-open span:nth-child(2) {
    opacity: 0;
}

.burger.is-open span:nth-child(3) {
    transform: translateY(-5.5px) rotate(-45deg);
}

.mobile-menu {
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-nav) - 1);
    background: var(--ink);
    padding: 110px var(--shell-pad) var(--s-7);
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-12px);
    transition: opacity var(--t-mid) var(--ease), transform var(--t-mid) var(--ease), visibility var(--t-mid);
}

.mobile-menu.is-open {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.mobile-menu a {
    padding: 14px 4px;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    color: rgba(255, 255, 255, .8);
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.mobile-menu a:hover, .mobile-menu a.is-active {
    color: var(--magenta);
}

.mobile-menu .sub {
    padding-left: var(--s-5);
    font-size: 17px;
    font-family: var(--font-body);
}

/* ---- подвал ----------------------------------------------- */
.site-footer {
    background: var(--ink);
    color: rgba(255, 255, 255, .62);
    padding: var(--section-y-sm) 0 var(--s-7);
    font-size: var(--fs-sm);
}

.site-footer__grid {
    display: grid;
    grid-template-columns: 1.3fr 1.2fr .8fr 1.4fr;
    gap: var(--s-7);
}

.site-footer h5 {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--white);
    font-weight: 500;
    margin: 0 0 var(--s-4);
}

.site-footer a {
    transition: color var(--t-fast);
}

.site-footer a:hover {
    color: var(--magenta);
}

.site-footer ul {
    line-height: 2.1;
}

.site-footer .accent-link {
    color: rgba(255, 255, 255, .85);
}

.site-footer .day-off {
    color: var(--danger);
}

.site-footer .hours span {
    color: var(--white);
    margin-left: 8px;
}

/* форма в подвале — тёмная */
.site-footer .form-wrap {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
}

/* высота поля задаётся здесь, а не атрибутом rows у виджета Django */
.site-footer .form-wrap textarea {
    height: 140px;
    min-height: 0;
}

.site-footer .form-button .btn {
    width: 100%;
}

.site-footer input[type="text"], .site-footer input[type="email"], .site-footer textarea {
    background: rgba(255, 255, 255, .06);
    border-color: rgba(255, 255, 255, .14);
    color: var(--white);
}

.site-footer input::placeholder, .site-footer textarea::placeholder {
    color: rgba(255, 255, 255, .4);
}

.site-footer input:focus, .site-footer textarea:focus {
    border-color: var(--magenta);
    box-shadow: 0 0 0 4px rgba(255, 0, 120, .16);
}


.site-footer__bottom {
    margin-top: var(--s-7);
    padding-top: var(--s-5);
    border-top: 1px solid rgba(255, 255, 255, .09);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--s-4);
    font-size: var(--fs-xs);
    color: rgba(255, 255, 255, .4);
}

/* ---- кнопка «наверх» -------------------------------------- */
.to-top {
    position: fixed;
    left: 22px;
    bottom: 22px;
    z-index: 90;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 0;
    background: var(--magenta);
    color: var(--white);
    display: grid;
    place-items: center;
    box-shadow: var(--shadow-magenta);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity var(--t-mid), transform var(--t-mid), visibility var(--t-mid);
}

.to-top.is-on {
    opacity: 1;
    visibility: visible;
    transform: none;
}

/* ---- адаптив ---------------------------------------------- */
@media (max-width: 1100px) {
    .site-footer__grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 980px) {
    .site-nav, .topbar {
        display: none;
    }

    .burger {
        display: block;
    }

    .site-header__in {
        height: 72px;
    }
}

@media (max-width: 640px) {
    .site-footer__grid {
        grid-template-columns: 1fr;
        gap: var(--s-6);
    }

    .site-footer__bottom {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ---- строка поиска в шапке -------------------------------- */

.nav-search {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: var(--r-pill);
    padding: 3px 4px 3px 16px;
    transition: border-color var(--t-fast), background var(--t-fast);
}

.nav-search:focus-within {
    border-color: var(--magenta);
    background: rgba(255, 255, 255, .12);
}

.nav-search input {
    width: 150px;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--white);
    font-size: var(--fs-xs);
    padding: 8px 0;
    transition: width var(--t-mid) var(--ease);
    appearance: none;
    -webkit-appearance: none;
}

.nav-search input::placeholder {
    color: rgba(255, 255, 255, .4);
}

.nav-search input:focus {
    outline: none;
    width: 190px;
    background: transparent;
}

.nav-search input {
    transition: width var(--t-mid) var(--ease);
}

.nav-search button {
    width: 34px;
    height: 34px;
    flex: none;
    border: 0;
    border-radius: 50%;
    background: var(--magenta);
    color: var(--white);
    display: grid;
    place-items: center;
}

.nav-search button:hover {
    background: var(--magenta-dark);
}

/* ---- поиск в мобильном меню ---- */

.nav-search--mobile {
    width: 100%;
    margin-bottom: var(--s-4);
    box-sizing: border-box;
}

.nav-search--mobile input {
    flex: 1;
    min-width: 0;
    width: auto;
    font-size: var(--fs-sm);
}

.nav-search--mobile input:focus {
    width: auto;
}

.nav-search--mobile button {
    flex: 0 0 34px;
    margin-left: auto;
}

@media (max-width: 1180px) {
    .nav-search input {
        width: 110px;
    }
}

@media (max-width: 980px) {
    .site-header__in .nav-search {
        display: none;
    }
}

.nav-search input:-webkit-autofill,
.nav-search input:-webkit-autofill:hover,
.nav-search input:-webkit-autofill:focus,
.nav-search input:-webkit-autofill:active {
    -webkit-text-fill-color: var(--white) !important;
    caret-color: var(--white) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    transition: background-color 999999s ease-in-out 0s;
}

.nav-search input::selection {
    background: var(--magenta);
    color: var(--white);
}