/* ============================================================
   layout.css
   Page skeleton — navbar, sections, grids, footer.
   Component-level styling lives in components.css.
   ============================================================ */

/* === Navbar === */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    z-index: 100;
    /* Translucent + blur for the glassy effect over the grid */
    background-color: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid transparent;
    /* Animate border (scroll), transform (hide/show), opacity (fade). */
    transition: border-color var(--transition),
                transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.4s ease;
    will-change: transform;
}

/* Border appears once user scrolls — added by JS */
.navbar.is-scrolled {
    border-bottom-color: var(--border);
}

/* Hide on scroll-down, reveal on scroll-up — toggled by nav.js */
.navbar.is-hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.navbar__inner {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

.navbar__logo {
    font-weight: 700;
    color: var(--accent);
    font-size: 1.125rem;
    letter-spacing: -0.01em;
    /* Become a flex container so the <img> aligns vertically with the
       baseline of the rest of the navbar contents. */
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

/* When a logo image is uploaded the anchor switches to image mode —
   strip the text styling so the image isn't tinted/spaced like text. */
.navbar__logo--image {
    color: inherit;
}

.navbar__logo-img {
    height: 40px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
    display: block;
}

.navbar__links {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    list-style: none;
}

.navbar__link {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.navbar__link:hover,
.navbar__link.active {
    color: var(--text-primary);
}

/* === Mobile burger button (hidden on desktop) === */
.navbar__burger {
    display: none;
    width: 40px;
    height: 40px;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    align-items: center;
}

.navbar__burger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    transition: transform var(--transition-fast), opacity var(--transition-fast);
}

/* When mobile menu open, animate burger → X */
.navbar__burger.is-open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.navbar__burger.is-open span:nth-child(2) {
    opacity: 0;
}
.navbar__burger.is-open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* === Sections === */
.section {
    padding: var(--space-xl) 0;
    position: relative;
}

.section--hero {
    padding-top: calc(var(--nav-height) + var(--space-lg));
    min-height: 100vh;
    display: flex;
    align-items: center;
    text-align: center;
}

/* Common section header (kicker + title + subtitle) */
.section-header {
    text-align: center;
    margin-bottom: var(--space-lg);
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}

.section-header__kicker {
    display: inline-block;
    color: var(--accent);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: var(--space-sm);
}

.section-header__title {
    margin-bottom: var(--space-sm);
}

.section-header__subtitle {
    color: var(--text-secondary);
    font-size: 1.0625rem;
}

/* === Hero layout === */
.hero__avatar-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-md);
}

.hero__avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    box-shadow: var(--shadow-glow);
    background: var(--bg-card);
    object-fit: cover;
}

.hero__title {
    margin-bottom: var(--space-md);
}

.hero__subtitle {
    max-width: 720px;
    margin: 0 auto var(--space-md);
    font-size: 1.0625rem;
    color: var(--text-secondary);
}

.hero__ctas {
    display: flex;
    justify-content: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-bottom: var(--space-lg);
}

.hero__stack {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-sm);
    color: var(--text-muted);
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* === About layout (photo + content side-by-side) === */
.about__grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: var(--space-lg);
    align-items: start;
}

.about__photo {
    aspect-ratio: 1 / 1.1;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 1px solid var(--border);
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-glow);
}

.about__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.about__photo-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-md);
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85), transparent);
}

.about__photo-caption strong {
    display: block;
    color: var(--text-primary);
    font-size: 1.125rem;
}

.about__photo-caption span {
    color: var(--accent);
    font-size: 0.875rem;
}

.about__tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-top: var(--space-md);
}

/* === Stats grid (used in About + Results) === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--space-sm);
    margin-top: var(--space-lg);
}

.stats-grid--lg {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
}

/* === Services grid === */
.services-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

/* === Products list (stacked, full-width cards) === */
.products-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

/* === Stack/Industries grid === */
.stack-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

/* === CTA banner section === */
.cta-banner {
    text-align: center;
    padding: var(--space-xl) var(--space-md);
}

.cta-banner__title {
    margin-bottom: var(--space-md);
}

.cta-banner__subtitle {
    max-width: 640px;
    margin: 0 auto var(--space-lg);
}

.cta-banner__buttons {
    display: flex;
    justify-content: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

/* === Contact section === */
.contact__form-wrap {
    max-width: 760px;
    margin: 0 auto;
}

/* === Footer === */
.footer {
    background-color: var(--bg-elevated);
    border-top: 1px solid var(--border);
    padding: var(--space-md) 0;
    margin-top: var(--space-lg);
}

.footer__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.footer__copy,
.footer__tagline {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.footer__socials {
    display: flex;
    gap: var(--space-sm);
}

.footer__socials a {
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.footer__socials a:hover {
    color: var(--accent);
}

/* ============================================================
   SITE CHROME — preloader, spotlight, back-to-top
   Markup is injected by inc/site-chrome.php via wp_body_open
   and wp_footer hooks.
   ============================================================ */

/* === Preloader === */
.mb-preloader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background-color: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    /* Same grid texture as the page so the transition is seamless. */
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    background-size: 40px 40px;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

/* Once JS adds .is-loaded the overlay fades + lifts out of the way. */
.mb-preloader.is-loaded {
    opacity: 0;
    visibility: hidden;
}

.mb-preloader__brand {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--accent);
    /* Soft pulsing glow */
    text-shadow: 0 0 32px rgba(45, 212, 168, 0.4);
    animation: mb-preloader-pulse 1.6s ease-in-out infinite;
}

.mb-preloader__bar {
    width: 200px;
    height: 2px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-pill);
    overflow: hidden;
    position: relative;
}

.mb-preloader__bar span {
    /* Travels left-to-right as a moving 60px-wide pill — the classic
       indeterminate-progress look but tighter and on-brand. */
    position: absolute;
    inset: 0;
    width: 60px;
    background-color: var(--accent);
    border-radius: var(--radius-pill);
    box-shadow: 0 0 16px rgba(45, 212, 168, 0.6);
    animation: mb-preloader-slide 1.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes mb-preloader-pulse {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50%      { opacity: 1;   transform: scale(1.04); }
}

@keyframes mb-preloader-slide {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(calc(200px + 100%)); }
}

/* === Spotlight surface — radial gradient that follows the cursor ===
   --mx / --my are updated by JS on mousemove. The whole layer is
   pointer-events:none so it never blocks clicks. */
.mb-spotlight {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 50;          /* above page bg, below navbar (z-100) */
    background: radial-gradient(
        circle 480px at var(--mx, 50%) var(--my, 50%),
        rgba(45, 212, 168, 0.08),
        transparent 60%
    );
    /* Soft easing so the spotlight slightly trails the cursor — feels
       smoother than instant hard tracking. */
    transition: background 0.18s ease-out;
    /* Composite on the page below — gradient lights up dark surfaces. */
    mix-blend-mode: screen;
    opacity: 0;
}

/* Hidden until JS confirms a fine pointer is in use. Avoids the
   weird flash on touch-only devices. */
.mb-spotlight.is-active {
    opacity: 1;
}

/* === Sticky WhatsApp button ===
   Anchored to the bottom-right corner so it's the first thing in
   reach. The pulse ring radiates outward to keep the eye drawn. */
.mb-whatsapp {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    width: 56px;
    height: 56px;
    z-index: 95;
    border-radius: 50%;
    background-color: #25d366;          /* WhatsApp brand green */
    color: #ffffff;
    display: grid;
    place-items: center;
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.45);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.25s ease;
}

.mb-whatsapp:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 32px rgba(37, 211, 102, 0.7);
}

.mb-whatsapp:active {
    transform: scale(0.96);
}

.mb-whatsapp svg {
    width: 28px;
    height: 28px;
    /* Pop above the pulse ring */
    position: relative;
    z-index: 2;
}

/* Pulsing halo — radiates outward to grab attention.
   Two animations layered would be ideal but one is enough at this size. */
.mb-whatsapp__pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background-color: #25d366;
    opacity: 0.6;
    z-index: 1;
    animation: mb-whatsapp-pulse 2s ease-out infinite;
}

@keyframes mb-whatsapp-pulse {
    0%   { transform: scale(1);    opacity: 0.5; }
    70%  { transform: scale(1.6);  opacity: 0;   }
    100% { transform: scale(1.6);  opacity: 0;   }
}

/* === Back-to-top === */
.mb-back-to-top {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    width: 48px;
    height: 48px;
    z-index: 90;
    border-radius: 50%;
    background-color: var(--accent);
    color: var(--bg-primary);
    box-shadow: 0 8px 24px rgba(45, 212, 168, 0.4);
    display: grid;
    place-items: center;
    /* Hidden by default — translateY for a subtle slide-in,
       opacity for a fade. Both reverse via .is-visible. */
    opacity: 0;
    transform: translateY(16px) scale(0.85);
    pointer-events: none;
    transition: opacity 0.35s ease,
                transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
                background-color 0.2s ease,
                box-shadow 0.2s ease,
                bottom 0.3s ease;
}

/* When the WhatsApp sticky is on the page, lift the back-to-top above
   it (instead of overlapping). Body class set in inc/site-chrome.php. */
.mb-has-whatsapp .mb-back-to-top {
    bottom: 5.5rem;       /* 1.5rem (whatsapp bottom) + 56px (whatsapp height) + ~1rem gap */
}

.mb-back-to-top.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.mb-back-to-top:hover {
    background-color: var(--accent-hover);
    box-shadow: 0 8px 32px rgba(45, 212, 168, 0.6);
    transform: translateY(-3px) scale(1);
}

.mb-back-to-top:active {
    transform: translateY(0) scale(0.95);
}

.mb-back-to-top svg {
    width: 22px;
    height: 22px;
}

/* Magnetic helper — JS toggles a transform offset via CSS variable
   on hover. Keep transition fast so the button feels responsive. */
.btn[data-magnetic] {
    transform: translate(var(--mx-off, 0), var(--my-off, 0));
    transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1),
                background-color var(--transition-fast),
                color var(--transition-fast),
                border-color var(--transition-fast);
}
