/* ============================================================
   X-Out Preservation Site — Style Sheet
   ============================================================ */

/* --- Design Tokens --- */
:root {
    --bg:         #0C0A09;
    --bg-card:    #1a1614;
    --bg-surface: #231f1d;
    --text:       #faf7f6;
    --text-muted: #a09490;
    --accent:     #E8603C;
    --accent-dim: #c44e30;
    --border:     #2e2825;
    --radius:     12px;
    --radius-sm:  8px;
    --font-display: 'Fraunces', Georgia, serif;
    --font-body:    'Instrument Sans', system-ui, -apple-system, sans-serif;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #f0825e;
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.15;
}

h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.125rem; }

/* --- Layout --- */
.container {
    width: min(1200px, 100% - 3rem);
    margin-inline: auto;
}

section {
    padding: 4rem 0;
}

section + section {
    border-top: 1px solid var(--border);
}

/* --- Hero --- */
.hero {
    text-align: center;
    padding: 6rem 0 4rem;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -40%;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(232, 96, 60, 0.12) 0%, transparent 70%);
    pointer-events: none;
}

.hero h1 {
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
    position: relative;
}

.hero h1 .accent {
    color: var(--accent);
}

.hero .tagline {
    font-size: clamp(1rem, 2.2vw, 1.35rem);
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 0.75rem;
}

.hero .credit {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-style: italic;
    opacity: 0.8;
}

.badge {
    display: inline-block;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.35rem 1rem;
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1.5rem;
}

/* --- Section Headers --- */
.section-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.section-header h2 {
    margin-bottom: 0.5rem;
}

.section-header p {
    color: var(--text-muted);
    max-width: 500px;
    margin: 0 auto;
}

/* --- Screenshot Gallery --- */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

.gallery-item {
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-card);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    cursor: pointer;
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(232, 96, 60, 0.12);
}

.gallery-item img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.gallery-item figcaption {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* --- Level Browser --- */
.level-browser {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.level-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.25rem;
}

.level-controls label {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
}

.level-controls select {
    flex: 1;
    min-width: 200px;
    max-width: 400px;
    padding: 0.55rem 0.75rem;
    background: var(--bg-surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a09490' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

.level-controls select:hover,
.level-controls select:focus {
    border-color: var(--accent);
    outline: none;
}

.canvas-wrapper {
    background: #000;
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    position: relative;
}

.canvas-wrapper canvas {
    display: block;
    max-width: 100%;
    height: auto;
    image-rendering: pixelated;
}

.canvas-placeholder {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 2rem;
    text-align: center;
}

/* --- Level Metadata --- */
.level-meta {
    margin-top: 1.25rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.level-meta .meta-item {
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
}

.meta-item .meta-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.meta-item .meta-value {
    font-size: 0.95rem;
    font-weight: 500;
}

.meta-item .meta-value.empty {
    color: var(--text-muted);
    font-style: italic;
}

/* --- About --- */
.about-content {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.about-content p {
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.7;
}

.about-content p:last-child {
    margin-bottom: 0;
}

/* --- Footer --- */
footer {
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

footer a {
    font-weight: 600;
}

footer .footer-sep {
    display: inline-block;
    margin: 0 0.5rem;
    opacity: 0.4;
}

/* --- Lightbox --- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(12, 10, 9, 0.92);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    cursor: zoom-out;
}

.lightbox.active {
    opacity: 1;
    pointer-events: all;
}

.lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

/* --- Responsive --- */
@media (max-width: 640px) {
    .hero {
        padding: 4rem 0 3rem;
    }

    section {
        padding: 3rem 0;
    }

    .gallery {
        grid-template-columns: 1fr 1fr;
    }

    .level-browser {
        padding: 1rem;
    }

    .level-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .level-controls select {
        max-width: none;
    }

    .level-meta {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 400px) {
    .gallery {
        grid-template-columns: 1fr;
    }

    .level-meta {
        grid-template-columns: 1fr;
    }
}
