/* Shared mobile drawer — keep in sync with index + portfolio-nav.css */

@keyframes drawerSheen {
    0%, 100% { transform: translateX(-120%) skewX(-12deg); opacity: 0; }
    40% { opacity: 0.55; }
    55% { transform: translateX(140%) skewX(-12deg); opacity: 0; }
}
@keyframes drawerPulseBar {
    0%, 100% { opacity: 0.55; transform: scaleX(0.72); }
    50% { opacity: 1; transform: scaleX(1); }
}
@keyframes drawerCornerGlow {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
}
@keyframes drawerLivePulse {
    50% { opacity: 0.35; }
}

.nav-toggle-bar:nth-child(2) {
    animation: drawerPulseBar 2.4s ease-in-out infinite;
    transform-origin: right center;
}
.nav-toggle.open .nav-toggle-bar:nth-child(2) { animation: none; }

.mobile-drawer-backdrop {
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    z-index: 9990; opacity: 0; visibility: hidden; transition: opacity 0.45s ease, visibility 0.45s;
}
.mobile-drawer-backdrop.open { opacity: 1; visibility: visible; }
.mobile-drawer {
    position: fixed; inset: 0; z-index: 9995; pointer-events: none;
    display: flex; justify-content: center; align-items: flex-start;
    padding: 0 10px 20px; box-sizing: border-box;
}
.mobile-drawer.open { pointer-events: auto; }
.mobile-drawer-panel {
    position: relative;
    width: 100%; max-width: 520px;
    margin-top: calc(env(safe-area-inset-top, 0px) + var(--mobile-menu-nav-offset, 64px));
    max-height: min(88dvh, calc(100dvh - env(safe-area-inset-top, 0px) - var(--mobile-menu-nav-offset, 64px) - env(safe-area-inset-bottom, 0px) - 20px));
    background:
        radial-gradient(ellipse 85% 55% at 100% 0%, rgba(230,32,32,0.22) 0%, transparent 52%),
        radial-gradient(ellipse 70% 45% at 0% 100%, rgba(230,32,32,0.12) 0%, transparent 48%),
        linear-gradient(180deg, rgba(18,18,18,0.98) 0%, rgba(6,6,6,0.98) 100%);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 0 0 24px 24px;
    box-shadow:
        0 36px 90px rgba(0, 0, 0, 0.7),
        0 0 0 1px rgba(230, 32, 32, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    overflow: hidden; display: flex; flex-direction: column;
    transform: translateY(calc(-100% - 32px)) scale(0.985); opacity: 0;
    transition: transform 0.55s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}
.mobile-drawer-panel::before {
    content: '';
    position: absolute; left: 0; right: 0; bottom: 0; height: 2px; z-index: 4;
    background: linear-gradient(90deg, var(--brand-red, #e62020) 0%, rgba(230,32,32,0.35) 42%, transparent 78%);
    pointer-events: none;
}
.mobile-drawer.open .mobile-drawer-panel { transform: translateY(0) scale(1); opacity: 1; }
[data-theme="light"] .mobile-drawer-backdrop { background: rgba(10, 10, 10, 0.4); }
[data-theme="light"] .mobile-drawer-panel {
    background:
        radial-gradient(ellipse 85% 55% at 100% 0%, rgba(230,32,32,0.14) 0%, transparent 52%),
        radial-gradient(ellipse 70% 45% at 0% 100%, rgba(230,32,32,0.08) 0%, transparent 48%),
        linear-gradient(180deg, #ffffff 0%, #f4f4f4 100%);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow:
        0 28px 70px rgba(0, 0, 0, 0.14),
        0 0 0 1px rgba(230, 32, 32, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
}
.mobile-drawer-art {
    position: absolute; inset: 12px; z-index: 1; pointer-events: none;
}
.mobile-drawer-art span {
    position: absolute; width: 14px; height: 14px;
    animation: drawerCornerGlow 2.8s ease-in-out infinite;
}
.mobile-drawer-art .mda-tl {
    top: 0; left: 0;
    border-top: 2px solid var(--brand-red, #e62020);
    border-left: 2px solid var(--brand-red, #e62020);
}
.mobile-drawer-art .mda-tr {
    top: 0; right: 0;
    border-top: 2px solid rgba(255,255,255,0.55);
    border-right: 2px solid rgba(255,255,255,0.55);
    animation-delay: 0.4s;
}
.mobile-drawer-art .mda-bl {
    bottom: 0; left: 0;
    border-bottom: 2px solid rgba(255,255,255,0.35);
    border-left: 2px solid rgba(255,255,255,0.35);
    animation-delay: 0.8s;
}
.mobile-drawer-art .mda-br {
    bottom: 0; right: 0;
    border-bottom: 2px solid var(--brand-red, #e62020);
    border-right: 2px solid var(--brand-red, #e62020);
    animation-delay: 1.2s;
}
[data-theme="light"] .mobile-drawer-art .mda-tr,
[data-theme="light"] .mobile-drawer-art .mda-bl {
    border-color: rgba(10,10,10,0.35);
}
.mobile-drawer-handle {
    width: 44px; height: 4px; border-radius: 999px;
    background: linear-gradient(90deg, rgba(230,32,32,0.25), rgba(255,255,255,0.35), rgba(230,32,32,0.25));
    margin: 12px auto 4px; flex-shrink: 0; position: relative; z-index: 2;
}
[data-theme="light"] .mobile-drawer-handle {
    background: linear-gradient(90deg, rgba(230,32,32,0.3), rgba(0,0,0,0.18), rgba(230,32,32,0.3));
}
.mobile-drawer-panel-inner {
    overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
    padding: 8px 18px 24px; position: relative; z-index: 2;
}
.mobile-drawer-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 12px; margin-bottom: 18px; padding-bottom: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
[data-theme="light"] .mobile-drawer-head { border-bottom-color: rgba(0,0,0,0.08); }
.mobile-drawer-close {
    flex-shrink: 0; width: 42px; height: 42px; border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.04);
    color: var(--text-color, #fff); font-size: 1.4rem; line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.25s, border-color 0.25s, color 0.25s, transform 0.25s;
}
.mobile-drawer-close:hover, .mobile-drawer-close:active {
    border-color: var(--brand-red, #e62020); color: #fff;
    background: var(--brand-red, #e62020); transform: rotate(90deg);
}
[data-theme="light"] .mobile-drawer-close {
    border-color: rgba(0, 0, 0, 0.1);
    background: rgba(0, 0, 0, 0.03);
    color: #0a0a0a;
}
.mobile-drawer-label {
    font-family: var(--font-mono, 'Space Mono', monospace); font-size: 0.55rem;
    color: var(--brand-red, #e62020); letter-spacing: 3px; text-transform: uppercase;
    font-weight: 700; display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
    opacity: 0; transform: translateY(-6px);
    transition: opacity 0.4s 0.12s, transform 0.4s 0.12s;
}
.mobile-drawer.open .mobile-drawer-label { opacity: 1; transform: translateY(0); }
.mobile-drawer-label::before {
    content: ''; width: 6px; height: 6px; background: var(--brand-red, #e62020);
    border-radius: 50%; animation: drawerLivePulse 1.4s infinite;
    box-shadow: 0 0 10px var(--brand-red, #e62020);
}
.mobile-drawer-title {
    font-family: var(--font-head, 'Inter', sans-serif);
    font-size: clamp(2rem, 9vw, 2.45rem); font-weight: 900;
    color: var(--text-color, #fff); letter-spacing: -0.05em; line-height: 0.9; margin: 0;
    opacity: 0; transform: translateY(10px);
    transition: opacity 0.45s 0.18s, transform 0.45s 0.18s;
}
.mobile-drawer-title span { color: var(--brand-red, #e62020); }
.mobile-drawer.open .mobile-drawer-title { opacity: 1; transform: translateY(0); }
.mobile-drawer-sub {
    margin: 8px 0 0; font-family: var(--font-mono, 'Space Mono', monospace);
    font-size: 0.52rem; letter-spacing: 2px; text-transform: uppercase; color: var(--text-muted, #777);
    opacity: 0; transform: translateY(6px);
    transition: opacity 0.4s 0.24s, transform 0.4s 0.24s;
}
.mobile-drawer.open .mobile-drawer-sub { opacity: 1; transform: translateY(0); }
.mobile-nav-list {
    display: grid; grid-template-columns: 1fr; gap: 8px;
    list-style: none; padding: 0; margin: 0;
}
.mobile-nav-list li {
    opacity: 0; transform: translateY(14px);
    transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1), transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
.mobile-drawer.open .mobile-nav-list li { opacity: 1; transform: translateY(0); }
.mobile-drawer.open .mobile-nav-list li:nth-child(1) { transition-delay: 0.2s; }
.mobile-drawer.open .mobile-nav-list li:nth-child(2) { transition-delay: 0.24s; }
.mobile-drawer.open .mobile-nav-list li:nth-child(3) { transition-delay: 0.28s; }
.mobile-drawer.open .mobile-nav-list li:nth-child(4) { transition-delay: 0.32s; }
.mobile-drawer.open .mobile-nav-list li:nth-child(5) { transition-delay: 0.36s; }
.mobile-drawer.open .mobile-nav-list li:nth-child(6) { transition-delay: 0.4s; }
.mobile-drawer.open .mobile-nav-list li:nth-child(7) { transition-delay: 0.44s; }
.mobile-drawer.open .mobile-nav-list li:nth-child(8) { transition-delay: 0.48s; }
.mobile-nav-link {
    display: flex; flex-direction: row; align-items: center; justify-content: space-between;
    gap: 12px; font-family: var(--font-head, 'Inter', sans-serif);
    font-size: 1.05rem; font-weight: 800; color: var(--text-color, #fff); text-transform: uppercase;
    letter-spacing: -0.03em; text-decoration: none; padding: 15px 16px 15px 18px;
    border-radius: 14px;
    background:
        linear-gradient(110deg, rgba(230,32,32,0.08) 0%, transparent 42%),
        rgba(255,255,255,0.035);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: border-color 0.28s, background 0.28s, transform 0.28s, box-shadow 0.28s;
    min-height: 3.4rem; box-sizing: border-box; position: relative; overflow: hidden;
}
.mobile-nav-link::before {
    content: '';
    position: absolute; left: 0; top: 18%; bottom: 18%; width: 3px;
    border-radius: 0 2px 2px 0; background: var(--brand-red, #e62020);
    transform: scaleY(0); transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.mobile-nav-link::after {
    content: '↗';
    font-family: var(--font-mono, 'Space Mono', monospace); font-size: 0.72rem; font-weight: 700;
    color: var(--brand-red, #e62020); opacity: 0; transform: translate(-4px, 4px);
    transition: opacity 0.28s, transform 0.28s;
}
[data-theme="light"] .mobile-nav-link {
    color: #0a0a0a;
    background:
        linear-gradient(110deg, rgba(230,32,32,0.07) 0%, transparent 42%),
        rgba(255,255,255,0.9);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 8px 18px rgba(0,0,0,0.04);
}
.mobile-nav-link:hover, .mobile-nav-link:active {
    border-color: rgba(230, 32, 32, 0.55);
    background:
        linear-gradient(110deg, rgba(230,32,32,0.18) 0%, transparent 50%),
        rgba(230,32,32,0.1);
    transform: translateX(3px);
    box-shadow: 0 12px 28px rgba(230,32,32,0.12);
}
.mobile-nav-link:hover::before, .mobile-nav-link:active::before { transform: scaleY(1); }
.mobile-nav-link:hover::after, .mobile-nav-link:active::after {
    opacity: 1; transform: translate(0, 0);
}
.mobile-nav-num {
    font-family: var(--font-mono, 'Space Mono', monospace); font-size: 0.58rem;
    color: var(--brand-red, #e62020); letter-spacing: 2px; font-weight: 700; opacity: 0.75;
    min-width: 2.2rem;
}
.mobile-nav-link:hover .mobile-nav-num, .mobile-nav-link:active .mobile-nav-num { opacity: 1; }
.mobile-drawer-footer {
    margin-top: 18px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex; flex-direction: column; gap: 14px;
    opacity: 0; transition: opacity 0.45s 0.52s;
}
[data-theme="light"] .mobile-drawer-footer { border-top-color: rgba(0, 0, 0, 0.08); }
.mobile-drawer.open .mobile-drawer-footer { opacity: 1; }
.mobile-drawer-cta {
    position: relative; overflow: hidden;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: var(--brand-red, #e62020); color: #fff;
    font-family: var(--font-mono, 'Space Mono', monospace); font-size: 0.72rem; font-weight: 700;
    letter-spacing: 2px; text-transform: uppercase; padding: 17px 20px; border-radius: 14px;
    text-decoration: none; box-shadow: 0 14px 32px rgba(230,32,32,0.35);
}
.mobile-drawer-cta::after {
    content: '';
    position: absolute; top: 0; left: 0; width: 45%; height: 100%;
    background: linear-gradient(105deg, transparent, rgba(255,255,255,0.28), transparent);
    animation: drawerSheen 3.8s ease-in-out infinite; pointer-events: none;
}
.mobile-drawer-cta span { position: relative; z-index: 1; }
.mobile-drawer-cta:active {
    transform: scale(0.985); background: #c41818;
    box-shadow: 0 8px 20px rgba(230,32,32,0.3);
}
.mobile-drawer-meta {
    display: flex; justify-content: space-between; align-items: center;
    font-family: var(--font-mono, 'Space Mono', monospace); font-size: 0.52rem;
    color: var(--text-muted, #777); letter-spacing: 2px; text-transform: uppercase; padding: 0 2px;
}
.mobile-drawer-meta-dot {
    display: inline-block; width: 5px; height: 5px; background: var(--brand-red, #e62020);
    border-radius: 50%; margin-right: 7px; animation: drawerLivePulse 1.4s infinite;
    box-shadow: 0 0 8px var(--brand-red, #e62020);
}
body.drawer-open { overflow: hidden; }

@media (max-width: 380px) {
    .mobile-nav-link { font-size: 0.95rem; padding: 14px 14px 14px 16px; }
}
@media (prefers-reduced-motion: reduce) {
    .nav-toggle-bar:nth-child(2),
    .mobile-drawer-art span,
    .mobile-drawer-cta::after { animation: none !important; }
}
