/* =============================================================
   SOCIAL MEDIA AGENCY — 3D layer styles (electric violet)
   WebGL canvas, branded preloader, scroll-flow enhancements.
   Loaded after agency.css; only overrides what the 3D system needs.
   ============================================================= */

/* ---------- WebGL canvas ---------- */
#gmg-webgl {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    display: block;
}

/* ============================================================
   METAVERSE MODE — when WebGL is live, flip the light theme to a
   dark glassy skin by REDEFINING the design tokens, so the 3D
   world shows through every section. When WebGL is off, the
   original light Social-Media theme is untouched (fallback).
   ============================================================ */
html.has-webgl {
    background: #0c0a18;
    /* light tokens -> dark glassy */
    --bg: transparent;
    --bg-soft: rgba(255, 255, 255, 0.04);
    --bg-mute: rgba(255, 255, 255, 0.06);
    --surface: rgba(255, 255, 255, 0.05);
    --border: rgba(255, 255, 255, 0.12);
    --border-strong: rgba(157, 124, 255, 0.40);
    --text: #f4f2fb;
    --text-dim: #b9b4d0;
    --text-faint: #8c879e;
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.05);
}
html.has-webgl body { background: transparent; }

/* Guaranteed content visibility in metaverse mode.
   The IO/GSAP reveal combo proved flaky with Lenis (elements stuck at
   opacity:0), so over the live 3D we force reveals visible. External
   !important beats GSAP's inline styles, so nothing can hide content. */
html.has-webgl [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }

/* let the canvas show through every band */
html.has-webgl main > section,
html.has-webgl .hero,
html.has-webgl .cta-section,
html.has-webgl .agency-footer,
html.has-webgl .band-soft,
html.has-webgl .band-dark { background: transparent !important; }

/* glass cards so content stays readable over the live world */
html.has-webgl .service-card,
html.has-webgl .feature-card,
html.has-webgl .show-card,
html.has-webgl .info-card,
html.has-webgl .portfolio-card,
html.has-webgl .testimonial-card,
html.has-webgl .stat-box,
html.has-webgl .process-step,
html.has-webgl .faq-item,
html.has-webgl .hero-panel,
html.has-webgl .cta-card,
html.has-webgl .contact-form,
html.has-webgl .info-card {
    background: rgba(255, 255, 255, 0.055) !important;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
}
html.has-webgl .service-card:hover,
html.has-webgl .feature-card:hover,
html.has-webgl .portfolio-card:hover {
    background: rgba(124, 92, 255, 0.12) !important;
    border-color: rgba(157, 124, 255, 0.45) !important;
}

/* form fields readable on dark */
html.has-webgl input,
html.has-webgl textarea,
html.has-webgl select {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(255, 255, 255, 0.16) !important;
    color: #f4f2fb !important;
}
html.has-webgl input::placeholder,
html.has-webgl textarea::placeholder { color: #8c879e !important; }

/* glassy nav over the world */
html.has-webgl .agency-nav { background: rgba(12, 10, 24, 0.55); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
html.has-webgl .agency-nav.scrolled { background: rgba(12, 10, 24, 0.78); }

/* ---------- Brand logo image (replaces the text mark) ---------- */
.nav-logo { gap: 0 !important; }
.nav-logo .brand-logo { height: 80px; width: 200px; display: block; object-fit: cover; }
.agency-footer .brand-logo-footer { height: 68px; }
@media (max-width: 600px) { .nav-logo .brand-logo { height: 58px; width:175px; } }
/* The logo art is navy+teal on transparent → invisible on the dark skin.
   Turn it pure WHITE on the dark metaverse (no pill) so it sits cleanly
   on the black/dark background. Light (no-webgl) keeps the original colors. */
html.has-webgl .nav-logo .brand-logo { filter: brightness(0) invert(1); }

/* ---------- Portfolio project images (full image on white, like the live site) ---------- */
.portfolio-cover {
    aspect-ratio: 3 / 3 !important;
    height: auto !important;
    min-height: 0 !important;
    background: #ffffff;          /* white like the live site → contain gaps blend with the screenshots' white bg */
    overflow: hidden;
    position: relative;
}
.portfolio-cover img {
    width: 100%;
    height: 100% !important;
    display: block;
    object-fit: contain;          /* show the WHOLE screenshot, never crop */
    object-position: center;
}
/* 4-column grid like the live site, equal-height cards */
.portfolio-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 20px !important;
    align-items: stretch;
}
@media (max-width: 1180px) { .portfolio-grid { grid-template-columns: repeat(3, 1fr) !important; } }
@media (max-width: 820px)  { .portfolio-grid { grid-template-columns: repeat(2, 1fr) !important; } }
@media (max-width: 540px)  { .portfolio-grid { grid-template-columns: 1fr !important; } }
.portfolio-card { display: flex; flex-direction: column; height: 100%; }
.portfolio-card .portfolio-body { flex: 1 1 auto; }
/* hide the decorative gradient overlay when a real image is present */
.portfolio-cover:has(img)::before { display: none !important; }

/* ---------- Portfolio subcategory filter (niches, like the live site) ---------- */
.portfolio-subfilter {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin: -8px auto 44px;
    max-width: 1040px;
}
.portfolio-subfilter button {
    padding: 12px 22px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-dim, #b9b4d0);
    background: var(--surface, rgba(255,255,255,0.05));
    border: 1px solid var(--border, rgba(255,255,255,0.12));
    transition: all .25s ease;
    cursor: pointer;
}
.portfolio-subfilter button:hover,
.portfolio-subfilter button.active {
    color: #fff;
    background: var(--grad-primary, linear-gradient(120deg, #9d7cff, #7c5cff));
    border-color: transparent;
    transform: translateY(-2px);
}

/* ---------- Branded preloader ---------- */
#gmg-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 50% 45%, rgba(29,132,164,0.18), transparent 60%),
        #0c0a18;
    transition: opacity 0.7s ease, visibility 0.7s ease;
}
#gmg-loader.done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.loader-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 26px;
}
.loader-mark {
    position: relative;
    width: 86px;
    height: 86px;
    display: grid;
    place-items: center;
}
.loader-mark .glyph {
    font-family: 'Sora', sans-serif;
    font-weight: 800;
    font-size: 34px;
    background: linear-gradient(135deg, #7c5cff 0%, #1d84a4 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    z-index: 2;
}
.loader-mark .ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: #7c5cff;
    border-right-color: rgba(124,92,255,0.35);
    animation: loader-spin 0.9s linear infinite;
}
.loader-mark .ring.r2 {
    inset: 10px;
    border-top-color: #ffb020;
    border-right-color: rgba(255,176,32,0.3);
    animation-duration: 1.4s;
    animation-direction: reverse;
}
@keyframes loader-spin { to { transform: rotate(360deg); } }
.loader-text {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: #6c828a;
}
.loader-bar {
    width: 160px;
    height: 2px;
    background: rgba(255,255,255,0.08);
    border-radius: 4px;
    overflow: hidden;
}
.loader-bar span {
    display: block;
    height: 100%;
    width: 40%;
    background: linear-gradient(90deg, #7c5cff, #ffb020);
    border-radius: 4px;
    animation: loader-sweep 1.1s ease-in-out infinite;
}
@keyframes loader-sweep {
    0%   { transform: translateX(-120%); }
    100% { transform: translateX(320%); }
}

/* ---------- Scroll-flow polish ---------- */
/* Lenis recommends this for smooth wheel handoff */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

/* Keep GSAP-driven cards from clipping their 3D rotation */
.services-grid, .portfolio-grid, .team-grid,
.whychoose-grid, .clients-grid, .testimonials-grid {
    perspective: 1200px;
}

/* The float cards read as a foreground glass UI over the live 3D core */
html.has-webgl .hero-scene { animation-duration: 40s; }

/* ---------- Hero scroll cue ---------- */
.scroll-cue {
    position: absolute;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--text-faint, #6c828a);
    z-index: 3;
    animation: cue-bob 2.4s ease-in-out infinite;
}
.scroll-cue:hover { color: var(--accent-1, #7c5cff); }
.scroll-cue-mouse {
    width: 24px;
    height: 38px;
    border: 2px solid currentColor;
    border-radius: 14px;
    display: flex;
    justify-content: center;
    padding-top: 6px;
    opacity: 0.7;
}
.scroll-cue-dot {
    width: 4px;
    height: 8px;
    border-radius: 4px;
    background: currentColor;
    animation: cue-dot 1.6s ease-in-out infinite;
}
.scroll-cue-label {
    font-size: 10px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
}
@keyframes cue-bob {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50%      { transform: translateX(-50%) translateY(8px); }
}
@keyframes cue-dot {
    0%   { transform: translateY(0); opacity: 1; }
    70%  { transform: translateY(12px); opacity: 0; }
    100% { transform: translateY(0); opacity: 0; }
}
@media (max-width: 980px) { .scroll-cue { display: none; } }

/* ---------- Immersive flow: keep content above the 3D world ----------
   We do NOT force 100vh on sections (that created big empty gaps). The
   camera travels by scroll-progress regardless of exact section heights.
   A soft scrim keeps copy readable over the live 3D. */
html.has-webgl main > section {
    position: relative;
    z-index: 1;
}
html.has-webgl main > section > .container {
    position: relative;
    z-index: 1;
}
html.has-webgl main > section > .container::before {
    content: '';
    position: absolute;
    inset: -8% -10%;
    z-index: -1;
    background: radial-gradient(ellipse 75% 65% at 50% 50%, rgba(12,10,24,0.55) 0%, rgba(12,10,24,0.28) 50%, transparent 78%);
    pointer-events: none;
}

/* ---------- Page-transition warp overlay ---------- */
#gmg-warp {
    position: fixed;
    inset: 0;
    z-index: 9000;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    background:
        radial-gradient(circle at 50% 50%, rgba(124,92,255,0.18) 0%, transparent 35%),
        radial-gradient(circle at 50% 50%, rgba(12,10,24,0.0) 0%, rgba(12,10,24,0.92) 70%);
    transition: opacity 0.42s ease, visibility 0.42s ease;
}
#gmg-warp::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 120px; height: 120px;
    margin: -60px 0 0 -60px;
    border-radius: 50%;
    border: 2px solid rgba(124,92,255,0.5);
    border-top-color: #ffb020;
    opacity: 0;
    transition: opacity 0.3s ease;
    animation: loader-spin 0.8s linear infinite;
}
#gmg-warp.on { opacity: 1; visibility: visible; }
#gmg-warp.on::after { opacity: 1; }

/* ---------- 3D nav HUD (zone minimap) ---------- */
#gmg-hud {
    position: fixed;
    right: 26px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 80;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: flex-end;
}
.hud-dot {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    background: none;
    color: var(--text-faint, #6c828a);
}
.hud-dot .hud-label {
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0;
    transform: translateX(8px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    white-space: nowrap;
}
.hud-dot .hud-bullet {
    width: 10px; height: 10px;
    border-radius: 50%;
    border: 1.5px solid currentColor;
    transition: all 0.3s ease;
    flex-shrink: 0;
}
.hud-dot:hover .hud-label { opacity: 1; transform: translateX(0); }
.hud-dot.active {
    color: var(--accent-1, #7c5cff);
}
.hud-dot.active .hud-bullet {
    background: var(--accent-1, #7c5cff);
    box-shadow: 0 0 14px var(--accent-1, #7c5cff);
    transform: scale(1.3);
}
.hud-dot.active .hud-label { opacity: 1; transform: translateX(0); }
@media (max-width: 900px) { #gmg-hud { display: none; } }

/* ---------- Cursor glow (desktop, fine pointer) ---------- */
.gmg-cursor {
    position: fixed;
    top: 0; left: 0;
    width: 26px; height: 26px;
    margin: -13px 0 0 -13px;
    border-radius: 50%;
    border: 1.5px solid rgba(124,92,255,0.7);
    pointer-events: none;
    z-index: 9500;
    transition: width 0.22s ease, height 0.22s ease, margin 0.22s ease, background 0.22s ease, border-color 0.22s ease;
    mix-blend-mode: screen;
    will-change: transform;
}
html.gmg-hot .gmg-cursor {
    width: 54px; height: 54px;
    margin: -27px 0 0 -27px;
    background: rgba(124,92,255,0.12);
    border-color: var(--accent-3, #ffb020);
}
@media (max-width: 900px), (pointer: coarse) { .gmg-cursor { display: none; } }

/* ---------- Reduced motion / no-webgl safety ---------- */
@media (prefers-reduced-motion: reduce) {
    #gmg-loader, #gmg-warp::after { display: none; }
    .loader-mark .ring { animation: none; }
    html.has-webgl main > section { min-height: 0; }
}
html.no-webgl #gmg-webgl { display: none; }
html.no-webgl main > section { min-height: 0; }

/* =============================================================
   RESPONSIVE / MOBILE FIXES
   The .container was sizing to its content (wide marquee/grids)
   instead of the viewport, overflowing on phones. Force it to the
   viewport width and clip any wide decorative tracks.
   ============================================================= */
html, body { overflow-x: hidden; max-width: 100%; }
.container { width: 100%; max-width: var(--container, 1240px); }
.marquee { overflow: hidden; max-width: 100%; }
main > section { max-width: 100vw; }
img, canvas, video { max-width: 100%; }

@media (max-width: 820px) {
    /* never force full-height sections on phones */
    html.has-webgl main > section { min-height: 0 !important; }
    /* tighten section padding so content isn't lost in whitespace */
    .section { padding: 64px 0 !important; }
    /* portfolio + service grids: single column already handled, keep gaps sane */
    .portfolio-subfilter { gap: 8px; }
    .portfolio-subfilter button { padding: 9px 14px; font-size: 13px; }
    /* hero readability on small screens */
    .hero h1 { font-size: clamp(2rem, 8vw, 2.6rem) !important; }
    .hero { padding: 120px 0 60px !important; }
    /* hide desktop-only 3D HUD on phones */
    #gmg-hud { display: none !important; }
}
@media (max-width: 600px) {
    .container { padding-left: 18px; padding-right: 18px; }
    .nav-wrap { padding-left: 14px; padding-right: 14px; }
}
