html, body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background-color: #1e1e1e;
    color: #87ceeb;
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 800px;
    margin: 20px auto;
    background: #2a2a2a;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    border: 1px solid #3d3d3d;
    box-sizing: border-box;
    width: 92%;
}

h1, h2 {
    color: #add8e6;
}

section {
    margin-bottom: 30px;
    padding: 20px;
    border: 1px solid #3d3d3d;
    border-radius: 6px;
    background: #222222;
    box-sizing: border-box;
    width: 100%;
}

section:hover {
    border-color: #5577aa;
    box-shadow: 0 4px 20px rgba(119, 170, 255, 0.08);
    transform: translateY(-2px);
    transition: all 0.2s ease;
}

footer {
    text-align: center;
    margin: 40px 0 20px 0;
    font-size: 0.9em;
    color: #77aaff;
    padding: 0 15px;
}

.pi-link {
    color: #87ceeb;
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s ease-in-out;
}

.pi-link:hover {
    color: #ffffff;
}

/* --- Modal Popup Styles (Zero-Border, Clean Picture Framing) --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.85);
    justify-content: center;
    align-items: flex-start;
    backdrop-filter: blur(3px);
    padding: 10px 20px;
    box-sizing: border-box;
    overflow-y: auto;
}

.modal-content {
    position: relative;
    background: #2a2a2a;
    padding: 20px 20px 15px 20px;
    border-radius: 8px;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    max-width: 600px;
    width: 100%;
    text-align: center;
    color: #add8e6;
    box-sizing: border-box;
    margin-top: 10px;
}

.razzy-wrapper {
    position: relative;
    display: inline-block;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    font-weight: bold;
}

.razzy-wrapper:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.green-spinner {
    position: absolute;
    top: -3px;
    left: 31px;
    width: 32px;
    height: 32px;
    border: 1.5px solid rgba(0, 255, 128, 0.12);
    border-top: 1.5px solid #00ff80;
    border-radius: 50%;
    opacity: 0;
}

.spin-active {
    animation: greenSpinAndFade 3s ease-in-out forwards;
}

@keyframes greenSpinAndFade {
    0% { transform: rotate(0deg); opacity: 1; }
    85% { opacity: 1; }
    100% { transform: rotate(1080deg); opacity: 0; }
}

/* Photo Wrapper with absolute overflow clipping to eliminate top/bottom white lines */
.photo-wrapper {
    position: relative;
    display: inline-block;
    margin-top: 10px;
    max-width: 100%;
    border-radius: 6px;
    overflow: hidden;
    background: #000000;
    line-height: 0;
}

.modal-content img {
    max-width: 100%;
    max-height: 58vh;
    width: auto;
    height: auto;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    display: block;
    margin: 0 auto;
}

/* Watermark positioned higher up (~20% shift up) with smooth backup timing */
.watermark-fade {
    position: absolute;
    bottom: 35px;
    left: 50%;
    transform: translateX(-50%);
    font-family: monospace;
    font-size: 18px;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
    opacity: 0;
    animation: fadeInWatermark 2.0s ease-in-out 4s forwards;
}

@keyframes fadeInWatermark {
    0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
    100% { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Square-proportioned Telemetry Box positioned higher up with slow fade-in/out */
.razzy-stats-overlay {
    position: absolute;
    bottom: 75px;
    right: 20px;
    width: 175px;
    height: 65px;
    background: rgba(30, 35, 40, 0.92);
    border: 1px solid rgba(0, 200, 100, 0.45);
    border-radius: 6px;
    padding: 10px 12px;
    text-align: left;
    font-family: monospace;
    font-size: 11px;
    color: #00cc66;
    box-shadow: 0 4px 15px rgba(0,0,0,0.7);
    opacity: 0;
    transition: opacity 2.0s ease-in-out; /* Slower, smoother transition */
    z-index: 10;
    pointer-events: none;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.razzy-stats-overlay.visible { opacity: 1; }

.stats-label {
    display: block;
    font-size: 9px;
    letter-spacing: 1px;
    color: #00994d;
    margin-bottom: 4px;
}

.stats-row {
    opacity: 0;
    transition: opacity 2.0s ease-in-out;
    line-height: 1.4;
}

.stats-row.text-visible { opacity: 1; }

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: rgba(51, 51, 51, 0.85);
    color: #87ceeb;
    border: none;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease-in-out;
}

.modal-close:hover {
    background: #444;
    color: #ffffff;
}

.credits-trigger-container { margin-top: 10px; }
.credits-btn {
    background: transparent;
    border: none;
    color: #87ceeb;
    font-size: 0.9em;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
    transition: color 0.2s ease-in-out;
}
.credits-btn:hover { color: #ffffff; }
.credits-card { text-align: left; }
.credits-title {
    margin-top: 0;
    font-size: 1.4rem;
    color: #ffffff;
    border-bottom: 1px solid #444;
    padding-bottom: 10px;
    text-align: center;
}
.credits-intro {
    font-size: 0.95rem;
    line-height: 1.4;
    color: #cccccc;
    margin-bottom: 20px;
    text-align: center;
}
.credits-list { list-style: none; padding: 0; margin: 0; }
.credit-item {
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px dashed #3a3a3a;
}
.credit-item:last-child { border-bottom: none; }
.tech-name { display: block; font-size: 1.1rem; font-weight: 600; margin-bottom: 3px; }
.tech-name a { color: #4da6ff; text-decoration: none; }
.tech-name a:hover { text-decoration: underline; }
.tech-desc { font-size: 0.9rem; line-height: 1.4; color: #aaaaaa; }
.tech-desc a { color: #88c4ff; text-decoration: none; }
.tech-desc a:hover { text-decoration: underline; }

/* --- Site Masthead Layout & Styling --- */
.site-masthead {
    position: relative;
    width: 100%;
    height: 60vh;
    min-height: 350px;
    background-image: url('assets/images/masthead-bg.jpg');
    background-size: cover;
    background-position: center bottom;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    padding: 2rem;
    box-sizing: border-box;
}

.masthead-brand a {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    font-size: clamp(1.5rem, 3.5vw, 3rem);
    font-weight: 800;
    text-decoration: none;
    color: #00cc66;
    filter: drop-shadow(0px 3px 2px rgba(0, 0, 0, 0.8)) drop-shadow(0px 1px 1px rgba(0, 0, 0, 0.9));
}

.menu-toggle {
    display: none;
    background: rgba(18, 48, 78, 0.90);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 6px;
    font-size: 1.2rem;
    padding: 6px 12px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 100;
    opacity: 1;
    visibility: visible;
    transition: opacity 1.25s ease-in-out, transform 1.25s ease-in-out, visibility 1.25s ease;
}

.menu-toggle.inactive {
    opacity: 0;
    visibility: hidden;
}

.menu-toggle:hover {
    background: rgba(25, 65, 105, 0.95);
}

.masthead-nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
}

.masthead-nav a {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: #111111;
    text-decoration: none;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.7);
    transition: color 0.2s ease;
}

.masthead-nav a:hover {
    color: #c2410c;
}

/* Mobile Styling */
@media (max-width: 768px) {
    .site-masthead {
        height: auto;
        min-height: 350px;
        padding: 1.25rem;
        justify-content: flex-start;
    }

    .menu-toggle {
        display: inline-block;
        margin-top: auto;
        margin-bottom: 0px; 
    }

    .masthead-nav {
        display: block;
        width: 100%;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        background: #111c24;
        border: none;
        border-radius: 0 0 6px 6px;
        box-sizing: border-box;
        margin: 0;
        box-shadow: none;
        
        padding: 0 1rem;
        max-height: 0px;
        overflow: hidden;
        z-index: 50;

        transition: opacity 2.5s cubic-bezier(0.25, 1, 0.5, 1),
                    transform 2.5s cubic-bezier(0.25, 1, 0.5, 1),
                    visibility 2.5s ease,
                    max-height 2.5s cubic-bezier(0.25, 1, 0.5, 1),
                    padding 2.5s cubic-bezier(0.25, 1, 0.5, 1);
    }

    .masthead-nav.active {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        max-height: 220px;
        padding: 0.8rem 1rem;
    }

    .masthead-nav ul {
        flex-direction: column;
        gap: 0.5rem;
    }

    .masthead-nav a {
        color: #87ceeb;
        font-weight: 700;
        text-shadow: none;
        display: block;
        padding: 4px 0;
        font-size: 1.05rem;
        transition: color 0.2s ease, transform 0.2s ease;
    }

    .masthead-nav a:hover {
        color: #ffffff;
        transform: translateX(4px);
    }
}
