/*Rotating Text Header */
.header-container {
    text-align: center;
    width: 100%;
    margin-top: 20px;
    margin-bottom: 3rem;
}

.title-rotate {
    font-family: 'Instrument Serif', serif;
    font-weight: 400;
    line-height: 1.3;
    font-size: 3rem;
    /* Matches existing headers */
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.static-text {
    color: #A855F7;
    /* accentBright */
    display: inline-block;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.static-text:hover {
    text-shadow: 0 0 12px rgba(168, 85, 247, 0.4);
    transform: scale(1.02);
}

.dynamic-container {
    position: relative;
    display: inline-block;
    min-height: 1.2em;
    vertical-align: bottom;
    /* Align with text baseline */
    border-radius: 12px;
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.03) 0%,
        rgba(168, 85, 247, 0.08) 30%,
        rgba(255, 255, 255, 0.05) 70%,
        rgba(99, 102, 241, 0.06) 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    padding: 0 12px;
    margin: 0 6px;

    /* Enhanced subtle effects */
    backdrop-filter: blur(10px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        0 4px 16px rgba(0, 0, 0, 0.1),
        0 0 20px rgba(168, 85, 247, 0.05);
}

.dynamic-container:hover {
    border-color: rgba(168, 85, 247, 0.3);
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.08) 0%,
        rgba(168, 85, 247, 0.12) 30%,
        rgba(255, 255, 255, 0.1) 70%,
        rgba(99, 102, 241, 0.1) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 8px 32px rgba(168, 85, 247, 0.2),
        0 4px 16px rgba(0, 0, 0, 0.2),
        0 0 30px rgba(99, 102, 241, 0.1);
    transform: translateY(-1px);
}

/* Subtle animated border effect */
.dynamic-container::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg,
        rgba(168, 85, 247, 0.2),
        rgba(99, 102, 241, 0.2),
        rgba(168, 85, 247, 0.2));
    border-radius: 14px;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -1;
}

.dynamic-container:hover::after {
    opacity: 1;
    animation: rotateGlow 4s linear infinite;
}

@keyframes rotateGlow {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.dynamic-container::before {
    content: attr(data-text);
    visibility: hidden;
    height: 0;
    display: block;
    font-weight: 400;
    white-space: nowrap;
}

.dynamic-word {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    white-space: nowrap;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    color: white;
    font-weight: 500;
    width: 100%;
    text-align: center;
    letter-spacing: 0.25px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Mobile-specific styles for text wrapping */
@media (max-width: 768px) {
    .dynamic-word {
        white-space: normal;
        word-break: break-word;
        line-height: 1.2;
        transform: translate(-50%, -50%) translateY(-0.1em); /* Slight adjustment for centered multiline text */
        font-size: 0.7em; /* Inherit from parent instead of fixed 18px */
    }
}

.dynamic-word.active {
    opacity: 1;
    transform: translate(-50%, -50%);
    text-shadow:
        0 1px 2px rgba(0, 0, 0, 0.1),
        0 0 16px rgba(168, 85, 247, 0.4),
        0 0 32px rgba(99, 102, 241, 0.2);
}


.dynamic-word.fade-out {
    opacity: 0;
    transform: translate(-50%, -3px) scale(0.98);
}

.dynamic-word.fade-in {
    opacity: 0;
    transform: translate(-50%, 3px) scale(1.02);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .title-rotate {
        font-size: 1.6rem;
    }

    .dynamic-container {
        min-width: 80px;
        max-width: calc(100vw - 40px); /* Prevent overflow beyond viewport */
        word-wrap: break-word;
        white-space: normal; /* Allow text wrapping */
        padding: 0 0px;
        margin: 0 4px;
    }

    .dynamic-word {
        white-space: normal; /* Allow wrapping in animated text */
        word-break: break-word; /* Break long words if needed */
        text-align: center;
        line-height: 1.2;
        font-size: 0.85em; /* Slightly smaller for mobile */
    }

    .header-container {
        padding: 0 0px;
        box-sizing: border-box;
    }
}

/* Extra small screens */
@media (max-width: 400px) {
    .title-rotate {
        font-size: 1.4rem;
    }

    .dynamic-word {
        font-size: 0.8em;
    }
}