/**
 * Beyond Volatility — Studio Stylesheet
 * Version: 4.0.0 — Studio Rebrand
 *
 * Loaded ONLY on editorial/studio templates:
 * homepage, about, tools, contact, stack, toolkit, privacy, terms.
 *
 * Tool calculator pages do NOT load this file.
 */

/* ==========================================================================
   STUDIO TOKENS — local to this stylesheet
   ========================================================================== */

:root {
    --studio-noise-opacity: 0.04;
    --studio-grid-line:     rgba(255, 255, 255, 0.04);
    --studio-glass-bg:      rgba(255, 255, 255, 0.04);
    --studio-glass-bg-light:rgba(255, 255, 255, 0.6);
    --studio-glass-border:  rgba(255, 255, 255, 0.08);
    --studio-cursor-mix:    difference;
    --studio-marquee-dur:   45s;
}

/* ==========================================================================
   GLOBAL STUDIO TYPOGRAPHY HELPERS
   ========================================================================== */

.studio-editorial,
.studio-editorial * {
    font-family: var(--bv-font-editorial);
}

.studio-italic { font-style: italic; }

.studio-eyebrow {
    font-family: var(--bv-font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.28em;
    color: var(--bv-gold);
    display: inline-flex;
    align-items: center;
    gap: 12px;
    line-height: 1;
}

.studio-eyebrow::before {
    content: '';
    width: 28px;
    height: 1px;
    background: currentColor;
    display: inline-block;
}

.studio-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--bv-gold);
    box-shadow: 0 0 0 4px var(--bv-gold-dim);
    animation: studio-pulse 2.4s ease-in-out infinite;
}

@keyframes studio-pulse {
    0%, 100% { box-shadow: 0 0 0 4px var(--bv-gold-dim); opacity: 1; }
    50%      { box-shadow: 0 0 0 8px transparent; opacity: 0.6; }
}

/* Typewriter caret */
.studio-typewriter-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: var(--bv-gold);
    margin-left: 4px;
    vertical-align: -2px;
    animation: studio-blink 1s steps(1) infinite;
}

@keyframes studio-blink {
    50% { opacity: 0; }
}

/* ==========================================================================
   GLITCH HOVER EFFECT — applied to single editorial words
   ========================================================================== */

.studio-glitch {
    position: relative;
    display: inline-block;
    color: var(--bv-gold);
}

.studio-glitch::before,
.studio-glitch::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.studio-glitch:hover,
.studio-glitch.is-glitching {
    animation: studio-shake 0.2s linear infinite;
}

.studio-glitch:hover::before,
.studio-glitch.is-glitching::before {
    opacity: 0.85;
    color: var(--bv-accent);
    z-index: -1;
    animation: studio-glitch-1 0.32s cubic-bezier(.25,.46,.45,.94) infinite;
}

.studio-glitch:hover::after,
.studio-glitch.is-glitching::after {
    opacity: 0.85;
    color: #fff;
    z-index: -2;
    animation: studio-glitch-2 0.32s cubic-bezier(.25,.46,.45,.94) infinite reverse;
}

@keyframes studio-shake {
    0%, 100% { transform: translate(0); }
    25%      { transform: translate(1px, 1px); }
    50%      { transform: translate(-1px, -1px); }
    75%      { transform: translate(1px, -1px); }
}

@keyframes studio-glitch-1 {
    0%   { clip-path: inset(10% 0 80% 0); transform: translate(-2px, 2px); }
    25%  { clip-path: inset(80% 0 5% 0);  transform: translate(2px, -2px); }
    50%  { clip-path: inset(40% 0 10% 0); transform: translate(2px, 2px); }
    75%  { clip-path: inset(10% 0 60% 0); transform: translate(-2px, -2px); }
    100% { clip-path: inset(20% 0 30% 0); transform: translate(0); }
}

@keyframes studio-glitch-2 {
    0%   { clip-path: inset(20% 0 60% 0); transform: translate(2px, 2px); }
    25%  { clip-path: inset(60% 0 20% 0); transform: translate(-2px, 2px); }
    50%  { clip-path: inset(10% 0 80% 0); transform: translate(2px, -2px); }
    75%  { clip-path: inset(80% 0 10% 0); transform: translate(-2px, 2px); }
    100% { clip-path: inset(10% 0 20% 0); transform: translate(0); }
}

/* ==========================================================================
   MARQUEE — infinite horizontal scroll strip
   ========================================================================== */

.studio-marquee {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    border-top: 1px solid var(--bv-dark-border);
    border-bottom: 1px solid var(--bv-dark-border);
    padding: 1rem 0;
    background: var(--bv-dark-bg);
    color: rgba(255, 255, 255, 0.5);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
            mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.studio-marquee-track {
    display: inline-flex;
    gap: 3rem;
    padding-left: 3rem;
    animation: studio-marquee var(--studio-marquee-dur) linear infinite;
    will-change: transform;
}

.studio-marquee-item {
    font-family: var(--bv-font-editorial);
    font-style: italic;
    font-size: clamp(1.5rem, 4vw, 3rem);
    font-weight: 500;
    letter-spacing: -0.01em;
    display: inline-flex;
    align-items: center;
    gap: 3rem;
}

.studio-marquee-item::after {
    content: '✦';
    color: var(--bv-gold);
    font-size: 0.6em;
    font-style: normal;
}

@keyframes studio-marquee {
    from { transform: translate3d(0, 0, 0); }
    to   { transform: translate3d(-50%, 0, 0); }
}

/* ==========================================================================
   IMAGE CLIP-PATH REVEAL
   ========================================================================== */

.studio-reveal-img {
    overflow: hidden;
    position: relative;
}

.studio-reveal-img > img,
.studio-reveal-img > .studio-img-fill {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.18);
    transform-origin: center;
    clip-path: inset(100% 0 0 0);
    transition: clip-path 1.1s cubic-bezier(0.77, 0, 0.175, 1),
                transform   1.6s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: clip-path, transform;
}

.studio-reveal-img.is-revealed > img,
.studio-reveal-img.is-revealed > .studio-img-fill {
    clip-path: inset(0 0 0 0);
    transform: scale(1);
}

/* ==========================================================================
   GLASS PANEL (studio-scoped, slightly different from tool design system)
   ========================================================================== */

.studio-glass {
    background: var(--studio-glass-bg);
    backdrop-filter: blur(18px) saturate(120%);
    -webkit-backdrop-filter: blur(18px) saturate(120%);
    border: 1px solid var(--studio-glass-border);
    border-radius: var(--bv-radius-xl);
    transition: transform 0.6s var(--bv-ease), border-color 0.4s var(--bv-ease), box-shadow 0.6s var(--bv-ease);
}

.studio-glass-light {
    background: var(--studio-glass-bg-light);
    border-color: var(--bv-light-border);
}

.studio-glass:hover {
    border-color: var(--bv-gold-dim);
    box-shadow: 0 24px 60px -28px rgba(201, 169, 97, 0.35);
}

/* ==========================================================================
   BUTTONS — editorial pill style
   ========================================================================== */

.studio-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 999px;
    font-family: var(--bv-font-display);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.4s var(--bv-ease), background 0.3s var(--bv-ease), color 0.3s var(--bv-ease), border-color 0.3s var(--bv-ease);
    will-change: transform;
}

.studio-btn-primary {
    background: var(--bv-gold);
    color: #1a1606;
    border-color: var(--bv-gold);
}

.studio-btn-primary:hover {
    background: var(--bv-gold-bright);
    border-color: var(--bv-gold-bright);
    transform: translateY(-2px);
}

.studio-btn-ghost {
    background: transparent;
    color: inherit;
    border-color: currentColor;
    opacity: 0.85;
}

.studio-btn-ghost:hover {
    opacity: 1;
    border-color: var(--bv-gold);
    color: var(--bv-gold);
}

.studio-btn-arrow::after {
    content: '→';
    font-size: 0.95rem;
    letter-spacing: 0;
    transition: transform 0.3s var(--bv-ease);
}

.studio-btn:hover .studio-btn-arrow::after,
.studio-btn-arrow:hover::after {
    transform: translateX(4px);
}

/* ==========================================================================
   HUGE BACKGROUND TEXT (used behind hero / showcase slides)
   ========================================================================== */

.studio-bg-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--bv-font-editorial);
    font-style: italic;
    font-size: clamp(8rem, 22vw, 22rem);
    line-height: 0.85;
    color: var(--bv-dark-text);
    opacity: 0.03;
    white-space: nowrap;
    user-select: none;
    pointer-events: none;
    z-index: 0;
    letter-spacing: -0.04em;
}

/* ==========================================================================
   CUSTOM CURSOR — desktop / fine-pointer only
   ========================================================================== */

.studio-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: var(--studio-cursor-mix);
    transform: translate3d(-100px, -100px, 0);
    transition: width 0.3s var(--bv-ease), height 0.3s var(--bv-ease);
    will-change: transform;
}

.studio-cursor.is-expanded {
    width: 56px;
    height: 56px;
}

@media (hover: none), (pointer: coarse) {
    .studio-cursor { display: none !important; }
}

/* ==========================================================================
   STICKY JOURNAL — image swap as user scrolls articles
   ========================================================================== */

.studio-journal {
    position: relative;
}

.studio-journal-stage {
    position: relative;
    overflow: hidden;
    border-radius: var(--bv-radius-xl);
    aspect-ratio: 4 / 5;
}

.studio-journal-img {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transform: scale(1.04);
    transition: opacity 0.7s var(--bv-ease), transform 1.4s var(--bv-ease);
}

.studio-journal-img.is-active {
    opacity: 1;
    transform: scale(1);
}

.studio-journal-img::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0) 30%, rgba(0,0,0,0.5) 100%);
}

/* ==========================================================================
   FADE-UP ON SCROLL (GSAP-driven, has CSS fallback for no-JS)
   ========================================================================== */

.studio-fade-up {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.9s var(--bv-ease), transform 0.9s var(--bv-ease);
}

.studio-fade-up.is-in {
    opacity: 1;
    transform: translateY(0);
}

.studio-stagger > * {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s var(--bv-ease), transform 0.7s var(--bv-ease);
}

.studio-stagger.is-in > * {
    opacity: 1;
    transform: translateY(0);
}

.studio-stagger.is-in > *:nth-child(1) { transition-delay: 0s; }
.studio-stagger.is-in > *:nth-child(2) { transition-delay: 0.08s; }
.studio-stagger.is-in > *:nth-child(3) { transition-delay: 0.16s; }
.studio-stagger.is-in > *:nth-child(4) { transition-delay: 0.24s; }
.studio-stagger.is-in > *:nth-child(5) { transition-delay: 0.32s; }
.studio-stagger.is-in > *:nth-child(6) { transition-delay: 0.40s; }

/* ==========================================================================
   LENIS COMPATIBILITY (smooth scroll engine)
   ========================================================================== */

html.lenis,
html.lenis body {
    height: auto;
}

.lenis.lenis-smooth {
    scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
    overscroll-behavior: contain;
}

.lenis.lenis-stopped {
    overflow: hidden;
}

/* ==========================================================================
   REDUCED MOTION — kill all decorative animations
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .studio-marquee-track,
    .studio-status-dot,
    .studio-typewriter-cursor,
    .studio-glitch,
    .studio-glitch::before,
    .studio-glitch::after {
        animation: none !important;
    }

    .studio-fade-up,
    .studio-stagger > * {
        opacity: 1 !important;
        transform: none !important;
    }

    .studio-reveal-img > img,
    .studio-reveal-img > .studio-img-fill {
        clip-path: inset(0) !important;
        transform: none !important;
    }

    .studio-cursor { display: none !important; }
}
