/* ================================= */
/* BRAINSTORMERS. Shared Styles     */
/* ================================= */

:root {
    /* Light mode defaults mapping to Brand Kit */
    --ink: #111111;
    --near: #1E1E1E;
    --paper: #FFFFFF;
    --mist: #F2F2F2;
    --mist-2: #E8E8E8;
    --grey: #838282;
    --faint: #B6B5B5;
    --line: rgba(17,17,17,0.10);
    --line-2: rgba(17,17,17,0.16);
    --line-soft: rgba(17,17,17,0.06);
    --accent: #8b3dff;
}

html.dark {
    /* Dark mode mapping to Brand Kit */
    --ink: #F4F4F4;
    --near: #000000;
    --paper: #151515;
    --mist: #1F1F1F;
    --mist-2: #2A2A2A;
    --grey: #9A9A9A;
    --faint: #5E5E5E;
    --line: rgba(255,255,255,0.13);
    --line-2: rgba(255,255,255,0.20);
    --line-soft: rgba(255,255,255,0.07);
}

html.glass-mode {
    /* Glass display mode mapping */
    --ink: #f0f0f5;
    --near: rgba(8, 5, 20, 0.4);
    --paper: rgba(255, 255, 255, 0.03);
    --mist: transparent;
    --mist-2: rgba(255, 255, 255, 0.02);
    --grey: rgba(255, 255, 255, 0.4);
    --faint: rgba(255, 255, 255, 0.25);
    --line: rgba(255, 255, 255, 0.06);
    --line-2: rgba(255, 255, 255, 0.08);
    --line-soft: rgba(255, 255, 255, 0.04);
    --accent: var(--ink);
}

/* --- Echo Text Effect --- */
.echo-stack {
    position: relative;
    display: inline-block;
    line-height: 0.9;
}
.echo-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    white-space: nowrap;
}
.echo-1 { --eo: -0.04em; color: #bfbfbf; text-shadow: 0 0 40px rgba(0, 0, 0, 0.1); }
.echo-2 { --eo: -0.08em; color: #c9c9c9; }
.echo-3 { --eo: -0.12em; color: #d1d1d1; }
.echo-4 { --eo: -0.16em; color: #d9d9d9; }
.echo-layer { transform: translate(var(--eo), var(--eo)); }
.dark .echo-1 { color: #333333; text-shadow: 0 0 40px rgba(255, 255, 255, 0.1); }
.dark .echo-2 { color: #2a2a2a; }
.dark .echo-3 { color: #222222; }
.dark .echo-4 { color: #1a1a1a; }
.echo-wrap .echo-layer { white-space: normal; }

/* Day/night colour crossfade. The main word flips first (in sync with the page), then each
   echo layer crossfades in turn so the change ripples backward into the depth like a real echo. */
.echo-stack,
.echo-stack > span,
.echo-layer { transition: color 0.55s cubic-bezier(0.65, 0, 0.35, 1), text-shadow 0.55s cubic-bezier(0.65, 0, 0.35, 1); }
.echo-stack > span:not(.echo-layer) { transition-delay: 0s; }
.echo-1 { transition-delay: 0.07s; }
.echo-2 { transition-delay: 0.14s; }
.echo-3 { transition-delay: 0.21s; }
.echo-4 { transition-delay: 0.28s; }

/* One-shot ripple: as the wave passes each layer, it lifts and settles. The class is added on
   theme toggle by nav.js and removed when the wave finishes, so it only plays on day<->night. */
@keyframes echoWave {
    0%   { transform: translate(var(--eo), var(--eo)); opacity: 1; }
    45%  { transform: translate(var(--eo), calc(var(--eo) - 0.05em)); opacity: 0.45; }
    100% { transform: translate(var(--eo), var(--eo)); opacity: 1; }
}
@keyframes echoWaveMain {
    0%   { transform: translateY(0); opacity: 1; }
    45%  { transform: translateY(-0.035em); opacity: 0.8; }
    100% { transform: translateY(0); opacity: 1; }
}
html.echo-rippling .echo-stack > span:not(.echo-layer) { animation: echoWaveMain 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0s both; }
html.echo-rippling .echo-1 { animation: echoWave 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.07s both; }
html.echo-rippling .echo-2 { animation: echoWave 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.14s both; }
html.echo-rippling .echo-3 { animation: echoWave 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.21s both; }
html.echo-rippling .echo-4 { animation: echoWave 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.28s both; }
@media (prefers-reduced-motion: reduce) {
    html.echo-rippling .echo-layer,
    html.echo-rippling .echo-stack > span:not(.echo-layer) { animation: none; }
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f2f2f2; }
::-webkit-scrollbar-thumb { background: #111111; border-radius: 4px; }
.dark ::-webkit-scrollbar-track { background: #111111; }
.dark ::-webkit-scrollbar-thumb { background: #f2f2f2; }

/* --- Contact Form Input Animations --- */
.input-group input:focus ~ label,
.input-group input:not(:placeholder-shown) ~ label,
.input-group textarea:focus ~ label,
.input-group textarea:not(:placeholder-shown) ~ label {
    transform: translateY(-2.25rem) scale(0.8);
    color: #121212;
}
.dark .input-group input:focus ~ label,
.dark .input-group input:not(:placeholder-shown) ~ label,
.dark .input-group textarea:focus ~ label,
.dark .input-group textarea:not(:placeholder-shown) ~ label {
    color: #f2f2f2;
}
.input-border {
    transform-origin: left;
    transition: transform 0.6s cubic-bezier(0.6, 0.01, -0.05, 0.9);
}
.input-group input:focus ~ .input-border,
.input-group textarea:focus ~ .input-border {
    transform: scaleX(1);
}

/* --- Service / Budget Radio Chips --- */
.service-radio:checked + div {
    background-color: #121212;
    color: #ffffff;
    border-color: #121212;
}
.dark .service-radio:checked + div {
    background-color: #f2f2f2;
    color: #111111;
    border-color: #f2f2f2;
}

/* --- Magnetic Button --- */
.magnetic-btn:hover .btn-fill {
    transform: scale(1.05);
}
.magnetic-btn .btn-fill {
    transition: transform 0.4s cubic-bezier(0.6, 0.01, -0.05, 0.9);
}

/* --- Prime Action Buttons (Contact) --- */
.btn-prime {
    color: #8b3dff !important;
    border: 1px solid #8b3dff !important;
    background-color: transparent !important;
    transition: all 0.4s cubic-bezier(0.77, 0, 0.175, 1) !important;
}

.btn-prime * {
    color: #8b3dff !important;
    transition: color 0.3s ease-in-out;
}

.btn-prime:hover {
    background-color: #8b3dff !important;
    color: #ffffff !important;
}

.btn-prime:hover * {
    color: #ffffff !important;
}

/* --- Expertise Icon Accents --- */
.group:hover .material-icons {
    color: #8b3dff !important;
    transition: color 0.3s ease;
}

.text-brand-color {
    color: #8b3dff !important;
}

/* --- Boids Canvas --- */
#boids-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}
#boids-container canvas {
    display: block;
}

/* --- Mobile Menu --- */
.mobile-menu {
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.77, 0, 0.175, 1);
}
.mobile-menu.open {
    transform: translateX(0);
}

/* --- Hero Float Animation --- */
.hero-float {
    animation: heroFloat 8s ease-in-out infinite;
}
@keyframes heroFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
/* Larger amplitude for the oversized hero title (11vw) so the same gentle
   levitation actually reads at that scale, like the smaller shadowed titles. */
.hero-float-xl {
    animation: heroFloat 8s ease-in-out infinite;
}
@media (min-width: 768px) {
    .hero-float-xl { animation-name: heroFloatXl; }
}
@keyframes heroFloatXl {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-16px); }
}

/* Hero service icon (sits beside the shadowed echo title). Mirrors the echo
   layers' soft shadow and day/night/glass behaviour so the icon feels shadowed
   and themed exactly like the title. Colour comes from text-black dark:text-white. */
.hero-icon {
    text-shadow: 0 0 40px rgba(0, 0, 0, 0.1);
    transition: color 0.55s cubic-bezier(0.65, 0, 0.35, 1), text-shadow 0.55s cubic-bezier(0.65, 0, 0.35, 1);
}
.dark .hero-icon {
    text-shadow: 0 0 40px rgba(255, 255, 255, 0.1);
}
html.glass-mode .hero-icon {
    color: #fff !important;
    text-shadow: 0 0 28px rgba(255, 255, 255, 0.55);
}

/* --- Page Fade In --- */
.page-content {
    animation: fadeIn 0.6s cubic-bezier(0.77, 0, 0.175, 1) forwards;
}
@keyframes fadeIn {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* --- Toast Notifications --- */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 2rem;
    border-radius: 0.5rem;
    z-index: 9999;
    font-family: "Satoshi", sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    transform: translateY(calc(100% + 3rem));
    transition: transform 0.4s cubic-bezier(0.77, 0, 0.175, 1);
}
.toast.show {
    transform: translateY(0);
}
.toast.success {
    background-color: #111;
    color: #f2f2f2;
}
.toast.error {
    background-color: #dc2626;
    color: #fff;
}

/* --- No Scrollbar Utility --- */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* --- Header Toggles --- */
.toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
    border: 1px solid rgba(0,0,0,0.1);
    background: transparent;
    cursor: pointer;
    transition: all 0.3s;
}
.toggle-btn:hover {
    border-color: rgba(0,0,0,0.3);
}
.dark .toggle-btn {
    border-color: rgba(255,255,255,0.1);
}
.dark .toggle-btn:hover {
    border-color: rgba(255,255,255,0.3);
}

/* --- Expert Glass Toggle Switch --- */
#glass-toggle {
    position: relative;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
    background: rgba(139, 61, 255, 0.05);
    border: 1px solid rgba(139, 61, 255, 0.1);
    color: #8b3dff;
    transition: all 0.5s cubic-bezier(0.77, 0, 0.175, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#glass-toggle::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #8b3dff, #6c5ce7);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -1;
}

#glass-toggle:hover {
    transform: scale(1.05);
    border-color: #8b3dff;
    box-shadow: 0 0 20px rgba(139, 61, 255, 0.2);
}

#glass-toggle.active {
    color: #fff;
    border-color: transparent;
    box-shadow: 0 0 30px rgba(139, 61, 255, 0.4);
}

#glass-toggle.active::before {
    opacity: 1;
}

#glass-toggle .material-icons {
    font-size: 1.1rem;
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#glass-toggle:hover .material-icons {
    transform: rotate(45deg);
}

/* --- Placeholder Page --- */
.placeholder-section {
    min-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

/* ================================= */
/* MOBILE RESPONSIVE OVERRIDES       */
/* ================================= */

@media (max-width: 768px) {
    /* --- Hero Text --- */
    .echo-stack {
        line-height: 0.85;
    }
    .echo-layer {
        white-space: normal;
    }

    /* --- Header Controls --- */
    .toggle-btn {
        width: 2rem;
        height: 2rem;
    }
    .toggle-btn .material-icons {
        font-size: 1rem;
    }
    #glass-toggle {
        width: 2rem;
        height: 2rem;
    }
    #glass-toggle .material-icons {
        font-size: 0.9rem;
    }

    /* --- Portfolio Grid --- */
    .aspect-video {
        aspect-ratio: 16/9;
    }

    /* --- Expertise Cards --- */
    .min-h-\[400px\] {
        min-height: 280px;
    }

    /* --- CTA Buttons --- */
    .btn-prime.inline-flex {
        font-size: 0.875rem;
        padding: 0.875rem 1.5rem;
    }

    /* --- Footer --- */
    footer .grid {
        gap: 2rem;
    }
    footer h2 {
        font-size: 1.5rem;
    }

    /* --- Contact Page LET'S TALK --- */
    .placeholder-section {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    /* --- Footer Big Text --- */
    footer h2[class*="text-[14vw]"] {
        font-size: 12vw;
    }
}

/* --- VERTICAL PHONE RESOLUTION OPTIMIZATIONS --- */
@media (max-width: 768px) and (orientation: portrait) {
    /* Texts: Shrink large display text to fit narrow screens */
    h1.text-4xl, h1.text-5xl, h1.text-6xl {
        font-size: 2.75rem !important;
        line-height: 1.1 !important;
    }
    .text-6xl, .text-7xl, .text-8xl, .text-9xl {
        font-size: 3rem !important;
        line-height: 1.1 !important;
    }

    /* Panels/Covers: Reduce heavy padding */
    .p-12, .px-12, .py-12, .p-10, .px-10, .py-10, .p-8, .px-8, .py-8 {
        padding: 1.25rem !important;
    }
    
    .px-6 {
        padding-left: 1.25rem !important;
        padding-right: 1.25rem !important;
    }
    
    /* Optimize vertical spacing (covers) */
    .pt-24, .pb-24, .py-24, .pt-32, .pb-32 {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }

    /* Reduce gaps in grids and flex layouts */
    .gap-12, .gap-16, .gap-8 {
        gap: 1.5rem !important;
    }

    /* Adjust Expertise/Service cards so they aren't overly tall */
    .min-h-\[400px\] {
        min-height: 250px !important;
    }
}

/* Force black footer background as per user request */
footer {
    background-color: #1e1e1e !important;
}
footer .text-black, footer .dark\:text-\[\#f6f6f6\] {
    color: #f6f6f6 !important;
}
footer .bg-background-light, footer .dark\:bg-\[\#1e1e1e\] {
    background-color: #1e1e1e !important;
}
