/* Main Styles - Haunted Vinyl Diary */

:root {
    --primary-bg: #0a0a0a;
    --secondary-bg: #1a1a1a;
    --text-color: #e0e0e0;
    --scary-color: #8b0000;
    --accent-color: #4a0e0e;
    --font-scary: 'Kirang Haerang', 'Creepster', 'Nosifer', cursive, serif;
    --font-main: 'Georgia', serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--primary-bg);
    color: var(--text-color);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    position: relative;
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><circle cx="16" cy="16" r="8" fill="%23ff0000" opacity="0.6"/><circle cx="16" cy="16" r="4" fill="%23darkred"/></svg>'), auto;
}

/* State Container Management */
.state-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    transition: opacity 0.5s ease-in-out;
    pointer-events: auto;
}

.state-container.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none !important;
}

/* Background Media */
#background-media {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none !important;
}

.background-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
    pointer-events: none !important;
}

/* Accessibility - Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus Indicators for Keyboard Navigation */
button:focus,
.nav-button:focus,
.close-button:focus,
.message-button:focus {
    outline: 3px solid var(--scary-color);
    outline-offset: 4px;
    box-shadow: 0 0 0 6px rgba(139, 0, 0, 0.3);
}

/* High contrast focus for better visibility */
button:focus-visible,
.nav-button:focus-visible,
.close-button:focus-visible,
.message-button:focus-visible {
    outline: 3px solid var(--scary-color);
    outline-offset: 4px;
    box-shadow: 0 0 0 6px rgba(139, 0, 0, 0.5),
                0 0 20px rgba(139, 0, 0, 0.8);
}

/* Scary Text Styling */
.scary-message,
.scary-text,
.error-message {
    font-family: var(--font-scary);
    color: var(--scary-color);
    text-shadow: 0 0 10px rgba(139, 0, 0, 0.8),
                 0 0 20px rgba(139, 0, 0, 0.6),
                 0 0 30px rgba(139, 0, 0, 0.4);
    letter-spacing: 2px;
}

/* Ensure all scary messages use the font */
#recording-message,
#message-text,
.message-content p {
    font-family: var(--font-scary);
}

/* Main Interface Layout */
#main-container {
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto !important;
}

#main-container:not(.hidden) {
    z-index: 50 !important;
}

.main-content {
    width: 100%;
    height: 100%;
    position: relative;
}

.button-container {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 50;
    pointer-events: none;
}

/* Navigation Buttons */
.nav-button {
    background: none;
    border: none;
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40"><text x="5" y="30" font-size="30" fill="%23ff0000">☠</text></svg>'), pointer;
    transition: transform 0.3s ease, filter 0.3s ease, box-shadow 0.3s ease;
    padding: 0;
    outline: none;
    position: absolute;
    animation: pulse-subtle 3s ease-in-out infinite;
    z-index: 100;
    pointer-events: auto;
}

.nav-button:hover {
    transform: scale(1.2);
    filter: brightness(1.5) drop-shadow(0 0 25px rgba(255, 0, 0, 1)) drop-shadow(0 0 50px rgba(139, 0, 0, 0.8));
    animation: none;
}

.nav-button:active {
    transform: scale(0.95);
    filter: brightness(0.7) drop-shadow(0 0 10px rgba(139, 0, 0, 0.5));
    transition: transform 0.1s ease, filter 0.1s ease;
}

/* Subtle pulse animation to draw attention */
@keyframes pulse-subtle {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.1);
    }
}

.nav-button img {
    display: block;
    max-width: 150px;
    height: auto;
}

/* Fallback text styling when images don't load */
.button-fallback-text {
    font-family: var(--font-scary);
    font-size: 1.5rem;
    color: var(--scary-color);
    text-shadow: 0 0 10px rgba(139, 0, 0, 0.8);
    padding: 1rem 2rem;
    background: rgba(26, 26, 26, 0.8);
    border: 2px solid var(--scary-color);
    border-radius: 10px;
    display: inline-block;
}

/* Specific button sizes */
#start-btn img {
    max-width: 300px;
    pointer-events: none;
}

#log-btn img {
    max-width: 300px;
    pointer-events: none;
}

/* Button Positioning */
#start-btn {
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%);
}

#start-btn:hover {
    transform: translateX(-50%) scale(1.2);
}

#start-btn:active {
    transform: translateX(-50%) scale(0.95);
}

#next-btn {
    bottom: 5%;
    right: 5%;
}

#log-btn {
    top: 5%;
    right: 5%;
}

#seance-btn {
    bottom: 5%;
    left: 5%;
}

#seance-btn img {
    max-width: 200px;
}

/* Close Buttons */
.close-button {
    background: var(--scary-color);
    color: var(--text-color);
    border: 2px solid var(--accent-color);
    font-size: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40"><text x="5" y="30" font-size="30" fill="%23ff0000">☠</text></svg>'), pointer;
    transition: all 0.3s ease;
    font-family: var(--font-main);
}

.close-button:hover {
    background: var(--accent-color);
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 0 20px rgba(139, 0, 0, 0.8);
}

/* Message Overlay */
.message-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message-overlay.hidden {
    display: none;
}

.message-content {
    background: var(--secondary-bg);
    padding: 2rem;
    border: 3px solid var(--scary-color);
    border-radius: 10px;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 0 30px rgba(139, 0, 0, 0.6);
}

.message-content p {
    font-family: var(--font-scary);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--scary-color);
    text-shadow: 0 0 10px rgba(139, 0, 0, 0.8),
                 0 0 20px rgba(139, 0, 0, 0.6);
}

.message-button {
    background: var(--scary-color);
    color: var(--text-color);
    border: 2px solid var(--accent-color);
    padding: 0.75rem 2rem;
    font-size: 1.2rem;
    font-family: var(--font-scary);
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40"><text x="5" y="30" font-size="30" fill="%23ff0000">☠</text></svg>'), pointer;
    transition: all 0.3s ease;
    border-radius: 5px;
}

.message-button:hover {
    background: var(--accent-color);
    box-shadow: 0 0 15px rgba(139, 0, 0, 0.8);
    transform: scale(1.05);
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .scary-message,
    .scary-text {
        font-size: 1.2rem;
    }
    
    .message-content {
        padding: 1.5rem;
        max-width: 90%;
    }
    
    .message-content p {
        font-size: 1.2rem;
    }
    
    .nav-button img {
        max-width: 120px;
    }
    
    #start-btn img {
        max-width: 200px;
    }
    
    #log-btn img {
        max-width: 200px;
    }
    
    #start-btn {
        bottom: 3%;
    }
    
    #next-btn {
        bottom: 3%;
        right: 3%;
    }
    
    #log-btn {
        top: 3%;
        right: 3%;
    }
    
    #seance-btn {
        bottom: 3%;
        left: 3%;
    }
    
    #seance-btn img {
        max-width: 150px;
    }
    
    /* Ensure background video works on mobile */
    .background-video {
        object-fit: cover;
        min-width: 100%;
        min-height: 100%;
    }
}

@media (max-width: 480px) {
    .scary-message,
    .scary-text {
        font-size: 1rem;
    }
    
    .close-button {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
    
    .nav-button img {
        max-width: 100px;
    }
    
    #start-btn img {
        max-width: 150px;
    }
    
    #log-btn img {
        max-width: 150px;
    }
    
    #seance-btn img {
        max-width: 120px;
    }
    
    .message-content {
        padding: 1rem;
        max-width: 95%;
    }
    
    .message-content p {
        font-size: 1rem;
    }
    
    .message-button {
        padding: 0.5rem 1.5rem;
        font-size: 1rem;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    #start-btn {
        bottom: 2%;
    }
    
    #next-btn {
        bottom: 2%;
        right: 2%;
    }
    
    #log-btn {
        top: 2%;
        right: 2%;
    }
    
    .nav-button img {
        max-width: 80px;
    }
}

/* Very small screens */
@media (max-width: 320px) {
    .nav-button img {
        max-width: 60px;
    }
    
    #start-btn img {
        max-width: 90px;
    }
    
    #log-btn img {
        max-width: 90px;
    }
    
    .scary-message,
    .scary-text {
        font-size: 0.9rem;
    }
}

/* Click to Start Overlay */
.click-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.5s ease;
    opacity: 1;
}

.click-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    display: none;
}

.click-content {
    text-align: center;
    padding: 2rem;
}

.click-content h1 {
    font-family: var(--font-scary);
    font-size: 3rem;
    color: #ff0000;
    text-shadow: 0 0 20px rgba(255, 0, 0, 0.9),
                 0 0 40px rgba(255, 0, 0, 0.7),
                 0 0 60px rgba(139, 0, 0, 0.5);
    margin-bottom: 2rem;
    animation: pulse-glow 2s ease-in-out infinite;
    font-weight: bold;
}

.click-instruction {
    font-family: var(--font-main);
    font-size: 1.8rem;
    color: #ffffff;
    animation: fade-pulse 2s ease-in-out infinite;
    font-weight: normal;
}

@keyframes pulse-glow {
    0%, 100% {
        text-shadow: 0 0 20px rgba(255, 0, 0, 0.9),
                     0 0 40px rgba(255, 0, 0, 0.7),
                     0 0 60px rgba(139, 0, 0, 0.5);
    }
    50% {
        text-shadow: 0 0 30px rgba(255, 0, 0, 1),
                     0 0 60px rgba(255, 0, 0, 0.9),
                     0 0 90px rgba(139, 0, 0, 0.7);
    }
}

@keyframes fade-pulse {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .click-content h1 {
        font-size: 2rem;
    }
    
    .click-instruction {
        font-size: 1.2rem;
    }
}
