/* ==========================================================================
   New design (Carrot, Oct 2026): side menu (screen 23)
   Values from the delivered prototype (06_Prototype_Source_Code/app.css, final
   mobile rules) and the Figma Spec page. Classes are prefixed "s2-" so they
   never clash with the current site. Loaded only for Preview users.
   ========================================================================== */

/* Fixed, screen-sized box that clips the hidden menu, so it never makes the page wider on phones */
.s2-drawer-clip {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 2000;
}
.s2-drawer-clip > * {
    pointer-events: auto;
}

.s2-drawer-overlay {
    position: absolute;
    inset: 0;
    background: var(--s2-overlay);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s var(--s2-ease-out);
}
.s2-drawer-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.s2-drawer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 86%;
    /* 86% of every phone like the design (the prototype capped it at 360px, which made it narrower on big phones); cap only for tablets */
    max-width: 440px;
    height: 100%;
    min-height: 100dvh;
    /* No safe-area padding: the app already keeps the page below the status bar (Flutter SafeArea),
       and newer Android WebViews still report the status bar here, which added a gap above the logo */
    padding: 20px 24px 24px;
    background: #fff;
    z-index: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: -15px 0 50px rgba(0, 34, 64, 0.2);
    font-family: var(--s2-font);
    color: var(--s2-indigo-dark);
    transform: translateX(105%);
    visibility: hidden;
    transition: transform 0.45s var(--s2-ease-out), visibility 0.45s;
}
.s2-drawer.is-open {
    transform: translateX(0);
    visibility: visible;
}
.s2-drawer * {
    box-sizing: border-box;
    border-radius: 0;
}

/* Woven logo mark watermark at the bottom */
.s2-drawer::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    aspect-ratio: 475.08 / 282.58;
    background: url('../img/Logo_Mark.svg') no-repeat left bottom / 100% 100%;
    opacity: 0.08;
    pointer-events: none;
}

.s2-drawer-header {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--s2-border);
}
.s2-drawer-header img {
    display: block;
    height: 20px;
    width: auto;
}

.s2-drawer-close {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    background: var(--s2-indigo);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.s2-drawer-close svg {
    width: 14px;
    height: 14px;
}
/* The close button spins in when the menu opens */
.s2-drawer.is-open .s2-drawer-close {
    animation: s2CloseIn 0.62s var(--s2-ease-spring) 0.04s both;
}
.s2-drawer.is-open .s2-drawer-close svg {
    animation: s2CloseIconIn 0.62s var(--s2-ease-spring) 0.04s both;
}
@keyframes s2CloseIn {
    0% { transform: rotate(-360deg) scale(0.4); opacity: 0; }
    40% { opacity: 1; }
    100% { transform: rotate(0) scale(1); opacity: 1; }
}
@keyframes s2CloseIconIn {
    0% { transform: rotate(-225deg); }
    100% { transform: rotate(0); }
}

.s2-drawer-links {
    position: relative;
    z-index: 1;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 16px 0 0;
    padding: 0;
}

/* Items slide in one after another */
.s2-drawer-item {
    border-bottom: 1px solid var(--s2-border-soft);
    opacity: 0;
    transform: translateX(32px);
    transition: opacity 0.4s var(--s2-ease-out), transform 0.4s var(--s2-ease-out);
}
.s2-drawer.is-open .s2-drawer-item { opacity: 1; transform: translateX(0); }
.s2-drawer.is-open .s2-drawer-item:nth-child(1) { transition-delay: 0.07s; }
.s2-drawer.is-open .s2-drawer-item:nth-child(2) { transition-delay: 0.13s; }
.s2-drawer.is-open .s2-drawer-item:nth-child(3) { transition-delay: 0.19s; }
.s2-drawer.is-open .s2-drawer-item:nth-child(4) { transition-delay: 0.25s; }
.s2-drawer.is-open .s2-drawer-item:nth-child(5) { transition-delay: 0.31s; }
.s2-drawer.is-open .s2-drawer-item:nth-child(6) { transition-delay: 0.37s; }
.s2-drawer.is-open .s2-drawer-item:nth-child(7) { transition-delay: 0.43s; }
.s2-drawer.is-open .s2-drawer-item:nth-child(8) { transition-delay: 0.49s; }

.s2-drawer-link {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 4px;
    margin: 0;
    border: 0;
    background: none;
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1px;
    line-height: normal;
    color: var(--s2-indigo);
    text-decoration: none;
    text-align: left;
    cursor: pointer;
    transition: color 0.2s ease;
}
.s2-drawer-link:active {
    color: var(--s2-blue);
}
.s2-drawer-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: transform 0.45s var(--s2-ease-spring), color 0.2s ease;
}
/* Open submenu: title turns sand and the plus turns into an x */
.s2-drawer-link.is-open {
    color: var(--s2-sand-dark);
}
.s2-drawer-link.is-open svg {
    transform: rotate(45deg);
}

/* Submenus open with a height reveal, a sand guide line and a cascade */
.s2-drawer-sub {
    position: relative;
    list-style: none;
    margin: 0;
    padding: 0 0 0 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.5s var(--s2-ease-out),
                padding 0.5s var(--s2-ease-out),
                opacity 0.3s ease;
}
.s2-drawer-sub.is-open {
    max-height: 420px;
    padding-top: 6px;
    padding-bottom: 14px;
    opacity: 1;
}
.s2-drawer-sub::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 8px;
    bottom: 16px;
    width: 1.5px;
    background: var(--s2-sand-dark);
    transform: scaleY(0);
    transform-origin: top center;
    transition: transform 0.55s var(--s2-ease-out);
}
.s2-drawer-sub.is-open::before {
    transform: scaleY(1);
    transition-delay: 0.08s;
}
.s2-drawer-sub li {
    opacity: 0;
    transform: translateX(-14px);
    transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.s2-drawer-sub.is-open li { opacity: 1; transform: translateX(0); }
.s2-drawer-sub.is-open li:nth-child(1) { transition-delay: 0.06s; }
.s2-drawer-sub.is-open li:nth-child(2) { transition-delay: 0.10s; }
.s2-drawer-sub.is-open li:nth-child(3) { transition-delay: 0.14s; }
.s2-drawer-sub.is-open li:nth-child(4) { transition-delay: 0.18s; }
.s2-drawer-sub.is-open li:nth-child(5) { transition-delay: 0.22s; }
.s2-drawer-sub.is-open li:nth-child(6) { transition-delay: 0.26s; }
.s2-drawer-sub.is-open li:nth-child(7) { transition-delay: 0.30s; }
.s2-drawer-sub.is-open li:nth-child(8) { transition-delay: 0.34s; }
.s2-drawer-sub.is-open li:nth-child(n+9) { transition-delay: 0.38s; }

.s2-drawer-sub a {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.5px;
    color: var(--s2-text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}
.s2-drawer-sub a:active {
    color: var(--s2-indigo);
    font-weight: 700;
}
.s2-drawer-sub a.s2-view-all {
    display: inline-block;
    margin-top: 4px;
    font-weight: 700;
    color: var(--s2-indigo);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.s2-drawer-footer {
    position: relative;
    z-index: 1;
    padding-top: 16px;
    font-size: 11px;
    line-height: 1.4;
    color: var(--s2-text-light);
}
.s2-drawer-footer p {
    margin: 0;
}

body.s2-menu-open {
    overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
    .s2-drawer, .s2-drawer-overlay, .s2-drawer-item, .s2-drawer-sub, .s2-drawer-sub li, .s2-drawer-sub::before {
        transition: none;
    }
    .s2-drawer.is-open .s2-drawer-close,
    .s2-drawer.is-open .s2-drawer-close svg {
        animation: none;
    }
}
