/* Button FX - Glow, Noise, and Interaction */

.btn-fx {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    /* Ensure content stays on top */
    z-index: 1;
}

/* Hover Effect: Stronger Red Glow & Noise */
.btn-fx:hover {
    box-shadow: 0 0 40px rgba(230, 12, 12, 0.8), inset 0 0 20px rgba(230, 12, 12, 0.4);
    transform: scale(1.05);
    background-color: #ff0000;
    /* Brighter red on hover */
}

/* Noise overlay on hover */
.btn-fx::after {
    content: '';
    position: absolute;
    inset: -50%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.6' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0;
    mix-blend-mode: overlay;
    pointer-events: none;
    transition: opacity 0.3s ease;
    animation: btn-noise 0.2s steps(4) infinite;
    z-index: 0;
}

.btn-fx:hover::after {
    opacity: 0.3;
}

@keyframes btn-noise {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(-10%, -10%);
    }
}

/* Click Animation: Fill & Rotate */

/* Fill Container */
.btn-fill {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    background: #FAFFFF;
    /* Off-White */
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 1;
    /* Above background/noise, below text */
}

/* Text Content Wrapper (to stay above fill) */
.btn-content {
    position: relative;
    z-index: 2;
    display: inline-block;
    transition: color 0.3s;
}

/* The Letter R */
.letter-r {
    display: inline-block;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

/* Active Clicking State */
.btn-fx.clicking .btn-fill {
    transform: translate(-50%, -50%) scale(50);
}

.btn-fx.clicking .btn-content {
    color: #222427;
    /* Turn text dark so it's visible on white */
}

.btn-fx.clicking .letter-r {
    color: #000000 !important;
    transform: rotate(15deg) scale(1.3);
    text-shadow: none;
}

.btn-fx.clicking {
    transform: scale(0.98);
    box-shadow: none !important;
    /* Remove glow immediately */
    background-color: var(--color-primary) !important;
    /* Reset to original red or keep it, but remove the bright #ff0000 hover state. Actually, let's make it the base color so the white fill contrasts well against the button bounds if visible. */
}

/* Deep Noise State for Button (Post-Close) */
.btn-fx.post-closed {
    background-color: #000 !important;
    /* Deep black base */
    box-shadow: inset 0 0 20px #000;
    transform: scale(1) !important;
    cursor: default;
    overflow: hidden;
}

.btn-fx.post-closed .btn-fill {
    transform: scale(0) !important;
    /* Hide the white fill immediately */
    transition: transform 0.2s;
}

/* Heavy Noise Overlay */
.btn-fx.post-closed::after {
    content: '';
    position: absolute;
    inset: -50%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.8 !important;
    /* High opacity */
    mix-blend-mode: normal !important;
    filter: contrast(200%) brightness(150%);
    /* Make noise harsh */
    animation: btn-noise 0.1s steps(4) infinite;
    /* Fast chaotic noise */
    z-index: 5;
}

/* Obscure Text */
.btn-fx.post-closed .btn-content,
.btn-fx.post-closed .letter-r {
    color: rgba(255, 255, 255, 0.15) !important;
    /* Barely visible */
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.1);
    transition: color 0.5s ease;
    z-index: 6;
}

.btn-fx.post-closed:hover {
    box-shadow: none;
    transform: none;
    background-color: #000;
}

/* --- Interactive Button (Unified Mobile + Desktop) --- */
/* 
   Animation: starts transparent with red border.
   On hover: red circle EXPANDS from center outward (ripple fill).
   Works on touch (active) and mouse (hover).
*/

.interactive-btn {
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
    border: 1.5px solid #E60C0C;
    background: transparent;
    padding: 0.85rem 1.5rem;
    flex-shrink: 0;
    font-weight: 900;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    text-align: center;
    cursor: pointer;
    isolation: isolate;
    transition: box-shadow 0.3s ease;
    white-space: nowrap;
}

.interactive-btn:hover,
.interactive-btn:active {
    box-shadow: 0 0 20px rgba(230, 12, 12, 0.4);
}

/* The fill circle — starts collapsed at center, expands on hover */
.btn-red-fill {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1rem;
    height: 1rem;
    background: #E60C0C;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 0;
    pointer-events: none;
}

.interactive-btn:hover .btn-red-fill,
.interactive-btn:active .btn-red-fill {
    transform: translate(-50%, -50%) scale(30);
}

.interactive-btn .btn-content {
    position: relative;
    z-index: 1;
    color: white;
    transition: color 0.3s;
}

/* Tilted R letter animation — all screen sizes */
.interactive-btn .letter-r {
    display: inline-block;
    transform: rotate(-12deg);
    transform-origin: center center;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.3s;
    color: #E60C0C;
}

.interactive-btn:hover .letter-r,
.interactive-btn:active .letter-r {
    color: white;
    transform: rotate(0deg);
}