/* ===========================================
   Dead Internet Graveyard - Main Styles
   Queer Digital Archaeology Project
   =========================================== */

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --fog-color: #0a0a0f;
    --accent-purple: #9933ff;
    --accent-green: #00ff66;
    --accent-pink: #ff00ff;
    --text-primary: #c0c0c0;
    --text-secondary: #808080;
    --modal-bg: #0d0d1a;
    --border-light: #404060;
    --border-dark: #0a0a15;
    --button-bg: #1a1a2e;
    --button-hover: #252540;
    --border-beveled: 3px outset #404060;
    --border-inset: 2px inset #404060;
    --border-ridge: 3px ridge #404060;
    --glow-purple: 0 0 10px var(--accent-purple);
    --font-pixel: 'VT323', monospace;
}

html, body {
    overflow: hidden;
    background-image: url('../assets/textures/background.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    font-family: 'Georgia', serif;
    color: var(--text-primary);
}

/* ===========================================
   WebGL Canvas
   =========================================== */
.webgl {
    position: fixed;
    inset: 0;
    outline: none;
}

/* ===========================================
   Loading Screen
   =========================================== */
.loading-screen {
    position: fixed;
    inset: 0;
    background: var(--fog-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    transition: opacity 0.5s ease-out;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
}

.loading-content h1 {
    font-size: 2rem;
    margin-bottom: 2rem;
    font-weight: normal;
    letter-spacing: 0.1em;
}

.loading-bar {
    width: 300px;
    height: 4px;
    background: var(--button-bg);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto 1rem;
}

.loading-progress {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-pink));
    transition: width 0.3s ease;
}

.loading-text {
    color: var(--text-secondary);
    font-style: italic;
}

/* ===========================================
   Modal Overlay
   =========================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 100;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow-y: auto;
    padding: 2rem;
}

.modal-overlay.visible {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    opacity: 1;
}

.modal {
    background: url('../assets/textures/bgpurplecotton.jpg') center center / cover no-repeat;
    border: var(--border-beveled);
    box-shadow: 
        inset 2px 2px 0 #505080,
        inset -2px -2px 0 var(--border-dark),
        0 0 30px rgba(153, 51, 255, 0.5),
        0 0 60px rgba(153, 51, 255, 0.2);
    max-width: 900px;
    width: 100%;
    margin: 2rem auto;
    padding: 0;
    position: relative;
    overflow: hidden;
}

.modal::after {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.1) 2px,
        rgba(0, 0, 0, 0.1) 4px
    );
    pointer-events: none;
    z-index: 5;
}

.close-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: #1a1a2e;
    border: 2px outset #505080;
    color: #ff3366;
    font-size: 1rem;
    font-family: 'VT323', monospace;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.1s, color 0.1s;
    z-index: 10;
}

.close-btn:hover {
    background: #ff3366;
    color: #fff;
}

.close-btn:active {
    border-style: inset;
}

/* Modal Header */
.modal-header {
    text-align: center;
    padding: 1.5rem;
    background: transparent;
    border-bottom: var(--border-ridge);
}

.modal-header::before {
    content: "~*~ ";
    color: var(--accent-purple);
    font-family: var(--font-pixel);
}

.modal-header::after {
    content: " ~*~";
    color: var(--accent-purple);
    font-family: var(--font-pixel);
}

.site-name {
    font-family: var(--font-pixel);
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--accent-purple);
    text-shadow: 
        0 0 10px var(--accent-purple),
        0 0 20px var(--accent-purple),
        2px 2px 0 #000;
    animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { text-shadow: 0 0 10px var(--accent-purple), 0 0 20px var(--accent-purple), 2px 2px 0 #000; }
    50% { text-shadow: 0 0 20px var(--accent-purple), 0 0 40px var(--accent-pink), 2px 2px 0 #000; }
}

/* Archive Embed */
.archive-container {
    margin: 1rem;
    height: 450px;
    background: #000;
    border: var(--border-inset);
    border-width: 3px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
    overflow: hidden;
    position: relative;
}

.archive-embed {
    width: 100%;
    height: 100%;
    border: none;
}

.archive-fallback {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #0a0a15;
    color: var(--text-secondary);
    font-family: 'VT323', monospace;
}

.archive-fallback.visible {
    display: flex;
}

.archive-fallback a {
    color: var(--accent-purple);
    margin-top: 1rem;
    font-size: 1.1rem;
}

/* Notes */
.notes-section p {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    font-family: 'VT323', monospace;
    font-size: 1.1rem;
}

#note-input {
    width: 100%;
    height: 100px;
    background: #0a0a15;
    border: 2px inset #404060;
    padding: 0.75rem;
    color: var(--accent-green);
    font-family: 'VT323', monospace;
    font-size: 1.1rem;
    resize: vertical;
    margin-bottom: 0.75rem;
}

#note-input::placeholder {
    color: #404060;
}

#note-input:focus {
    outline: none;
    box-shadow: 0 0 10px var(--accent-purple);
}

.submit-note-btn {
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: linear-gradient(180deg, #9933ff 0%, #6600cc 100%);
    border: 2px outset #bb66ff;
    color: white;
    padding: 0.75rem 2rem;
    cursor: pointer;
    transition: background 0.1s;
}

.submit-note-btn:hover {
    background: linear-gradient(180deg, #aa44ff 0%, #7700dd 100%);
}

.submit-note-btn:active {
    border-style: inset;
}

.notes-list {
    margin-top: 1.5rem;
}

.note-item {
    background: #0a0a15;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border: 2px inset #404060;
    border-left: 3px solid var(--accent-purple);
}

.note-item .note-text {
    margin-bottom: 0.5rem;
}

.note-item .note-date {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ===========================================
   Instructions Overlay
   =========================================== */
.instructions {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--modal-bg);
    padding: 1rem 2rem;
    border-radius: 8px;
    border: 1px solid var(--button-bg);
    text-align: center;
    z-index: 50;
    transition: opacity 0.3s, transform 0.3s;
}

.instructions.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
    pointer-events: none;
}

.instructions p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.instructions button {
    background: var(--button-bg);
    border: 1px solid var(--accent-purple);
    color: var(--text-primary);
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}

.instructions button:hover {
    background: var(--button-hover);
}

/* ===========================================
   Grave Text (CSS2D on gravestones)
   =========================================== */

/* Name on headstone (always visible) */
.grave-name-container {
    font-family: 'VT323', 'Courier New', monospace;
    text-align: center;
    color: #e0e0e0;
    text-shadow: 0 0 10px rgba(157, 78, 221, 0.8), 2px 2px 4px rgba(0,0,0,0.9);
    pointer-events: none;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease;
}

/* Ledger text container (engraved text effect) */
.grave-text-container {
    font-family: 'Georgia', 'Times New Roman', serif;
    text-align: center;
    color: #5a5a5a;
    pointer-events: none;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease, display 0.3s ease;
    max-width: 300px;
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.9),
        1px 1px 2px rgba(0, 0, 0, 0.8),
        0px 0px 1px rgba(0, 0, 0, 0.7),
        -1px -1px 2px rgba(255, 255, 255, 0.1);
}

.grave-name {
    font-size: 1.4rem;
    font-weight: bold;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.grave-info {
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: auto;
}


.grave-epitaph {
    font-style: italic;
    font-size: 1.1rem;
    color: #6a6a6a;
    text-shadow: 
        3px 3px 6px rgba(0, 0, 0, 0.95),
        2px 2px 4px rgba(0, 0, 0, 0.9),
        1px 1px 2px rgba(0, 0, 0, 0.8),
        0px 0px 1px rgba(0, 0, 0, 0.7),
        -1px -1px 1px rgba(255, 255, 255, 0.15);
    letter-spacing: 0.05em;
}

.grave-url {
    font-size: 0.85rem;
    color: #5a5a5a;
    word-break: break-all;
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.9),
        1px 1px 2px rgba(0, 0, 0, 0.8),
        0px 0px 1px rgba(0, 0, 0, 0.7),
        -1px -1px 1px rgba(255, 255, 255, 0.1);
    font-family: 'Courier New', monospace;
}

.grave-lifespan {
    font-size: 0.9rem;
    color: #5a5a5a;
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.9),
        1px 1px 2px rgba(0, 0, 0, 0.8),
        0px 0px 1px rgba(0, 0, 0, 0.7),
        -1px -1px 1px rgba(255, 255, 255, 0.1);
}

.dig-up-btn {
    background: transparent;
    border: 1px solid #6a6a6a;
    color: #8a8a8a;
    padding: 0.5rem 1rem;
    border-radius: 2px;
    cursor: pointer;
    font-family: 'Georgia', serif;
    font-size: 0.9rem;
    font-style: italic;
    transition: all 0.2s;
    pointer-events: auto;
    text-shadow: 
        1px 1px 2px rgba(0, 0, 0, 0.8),
        inset 0 1px 2px rgba(0, 0, 0, 0.3);
    margin-top: 0.5rem;
}

.dig-up-btn:hover {
    border-color: #9a9a9a;
    color: #aaa;
    background: rgba(0, 0, 0, 0.2);
}

/* ===========================================
   Visitor Counter
   =========================================== */
.visitor-counter {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background: var(--modal-bg);
    border: var(--border-beveled);
    padding: 0.5rem;
    font-family: var(--font-pixel);
    text-align: center;
    z-index: 50;
    box-shadow: 
        inset 1px 1px 0 #505080,
        inset -1px -1px 0 var(--border-dark),
        0 0 20px rgba(153, 51, 255, 0.3);
}

.counter-label {
    color: var(--accent-purple);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.counter-display {
    display: flex;
    justify-content: center;
    gap: 2px;
}

.counter-display .digit {
    background: #000;
    color: var(--accent-green);
    padding: 0.25rem 0.4rem;
    border: 1px inset #404060;
    font-size: 1.2rem;
    min-width: 1.5rem;
    text-shadow: 0 0 5px var(--accent-green);
}

.counter-since {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* ===========================================
   Guestbook Section
   =========================================== */
.guestbook-section {
    border-top: var(--border-ridge);
    padding: 1.5rem;
    background: transparent;
}

.guestbook-section::before {
    content: ".:*~*:._.:*~*:._.:*~*:._.:*~*:.";
    display: block;
    text-align: center;
    color: var(--accent-purple);
    font-family: 'VT323', monospace;
    padding: 0.5rem 0 1rem;
    letter-spacing: 0.1em;
}

.guestbook-header {
    text-align: center;
    margin-bottom: 1rem;
}

.guestbook-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.guestbook-header h3 {
    font-family: 'VT323', monospace;
    font-size: 1.5rem;
    color: var(--accent-purple);
    text-shadow: 0 0 10px var(--accent-purple);
    letter-spacing: 0.1em;
}

.guestbook-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#guest-name {
    width: 100%;
    background: #0a0a15;
    border: 2px inset #404060;
    padding: 0.5rem 0.75rem;
    color: var(--accent-pink);
    font-family: 'VT323', monospace;
    font-size: 1.1rem;
}

#guest-name::placeholder {
    color: #404060;
}

#guest-name:focus {
    outline: none;
    box-shadow: 0 0 10px var(--accent-pink);
}

.guestbook-entries {
    margin-top: 1.5rem;
}

.guestbook-entries .note-item {
    background: #0a0a15;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border: 2px inset #404060;
    border-left: 3px solid var(--accent-purple);
}

.guestbook-entries .note-item::before {
    content: ">> ";
    color: var(--accent-green);
    font-family: 'VT323', monospace;
}

.note-author {
    color: var(--accent-pink);
    font-family: 'VT323', monospace;
    font-weight: bold;
    display: block;
    margin-bottom: 0.25rem;
}

.note-text {
    color: var(--text-primary);
    font-family: 'VT323', monospace;
}

.note-date {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-family: 'VT323', monospace;
    margin-top: 0.5rem;
}

/* ===========================================
   Responsive Design
   =========================================== */
@media (max-width: 768px) {
    .modal {
        margin: 1rem;
        padding: 0;
    }

    .archive-container {
        height: 300px;
    }

    .site-name {
        font-size: 1.5rem;
    }

    .loading-content h1 {
        font-size: 1.5rem;
    }

    .loading-bar {
        width: 200px;
    }

    .marquee-container {
        height: 28px;
    }

    .marquee-content {
        font-size: 0.9rem;
    }

    .visitor-counter {
        bottom: 0.5rem;
        right: 0.5rem;
        padding: 0.35rem;
    }

    .counter-display .digit {
        font-size: 1rem;
        padding: 0.2rem 0.3rem;
    }

    .guestbook-section {
        padding: 1rem;
    }
}
