/* style.css */

/* Variables */
:root {
    --primary-color: #f5f5f8;
    --secondary-color: #b3b3b5;
    --highlight-color: #CBE2FE;
    --divider-color: #ccc;
    --box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}


/* ==========================================================================
   1. Core Reset & Layout
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--primary-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 1rem;
    position: relative;
    overflow-x: hidden;

    /* Dynamic Smooth Pastel Rainbow 
       Using an 8-stop system transitioning over 40 seconds 
    */
    background: linear-gradient(135deg, var(--color-1), var(--color-2));
    animation: rainbowShift 40s ease-in-out infinite alternate;
}

/* Skip to content link for keyboard navigation navigation */
.skip-link {
    position: absolute;
    top: -42px;
    left: 0;
    background: var(--highlight-color);
    color: #000;
    padding: 8px 12px;
    z-index: 100;
    transition: top 0.2s;
    font-weight: bold;
    text-decoration: none;
}

.skip-link:focus {
    top: 0;
}

/* Main Container */
main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex-grow: 1;
    max-width: 900px;
    width: 100%;
    padding: 2rem 0;
}

/* ==========================================================================
   2. Shared Components & Navigation
   ========================================================================== */
header {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    padding: 0 1rem;
    text-align: left;
}

.back-link {
    color: var(--highlight-color);
    text-decoration: none;
    font-weight: 500;
    display: inline-block;
}

.back-link:hover, .back-link:focus {
    text-decoration: underline;
    outline: none;
}

h1 {
    font-weight: 800;
    outline: none;
    font-size: clamp(2.5rem, 8vw, 4rem);
    margin-bottom: 1.5rem;
}

h2 {
    font-size: clamp(1.5rem, 5vw, 2rem);
    margin-bottom: 1rem;
    font-weight: 700;
}

.app-title {
    font-weight: 800;
    letter-spacing: -0.02em;
    outline: none;
    font-size: clamp(2rem, 6vw, 3rem);
    margin-bottom: 1.5rem;
}

button, a.button {
    display: inline-block;
    background-color: var(--highlight-color);
    color: #000000;
    text-decoration: none;
    padding: 0.8rem 2rem;
    font-weight: 700;
    border-radius: 8px;
    font-size: 1.1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

/* Hover & focus states */

h1:focus, .app-title:focus,
button:hover, a.button:hover,
button:focus, a.button:focus {
    outline: 2px dashed var(--highlight-color);
    outline-offset: 8px;
}

p {
    color: var(--secondary-color);
    font-size: 1.1rem;
    margin-bottom: 2.5rem;
    max-width: 400px;
}


/* Logo Sizing Profiles */
.logo-container {
    margin-bottom: 1.5rem;
    max-width: 100%;
}

.studio-logo {
    max-width: 260px;
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
}

.app-logo {
    display: block;
    margin: 0 auto 1.5rem auto;
    max-width: 180px;
    width: 100%;
    height: auto;
    border-radius: 24px;
    box-shadow: var(--box-shadow);
}

.tagline {
    font-size: clamp(1.1rem, 3.5vw, 1.4rem);
    color: var(--secondary-color);
    max-width: 600px;
    font-weight: 400;
    margin-bottom: 5rem;
}

/* ==========================================================================
   3. Index Grid Layout Modules
   ========================================================================== */
.game-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    width: 100%;
    max-width: 700px;
    margin-bottom: 2rem;
}

@media (max-width: 600px) {
    .game-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

.game-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    border-radius: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.game-card-link:hover,
.game-card-link:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--highlight-color);
}

.game-card {
    background-color: #333344;
    border: 1px solid #2d2d2d;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    aspect-ratio: 1 / 1;
    box-shadow: var(--box-shadow);
}

.game-image-wrapper {
    flex-grow: 1;
    position: relative;
    background-color: #2a2a2a;
    overflow: hidden;
}

.game-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.game-info {
    padding: 1rem;
    background-color: #1a1a1a;
    border-top: 1px solid #2d2d2d;
    text-align: center;
}

.game-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.game-status {
    font-size: 0.85rem;
    color: var(--highlight-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ==========================================================================
   4. App Template-Specific Content Structures
   ========================================================================== */
.app-container {
    max-width: 700px;
    width: 100%;
    text-align: center;
}

.app-description {
    font-size: 1.15rem;
    color: var(--primary-color);
    text-align: left;
    margin-bottom: 3rem;
}

.divider {
    border: 0;
    height: 2px;
    background-color: var(--divider-color);
    margin-bottom: 3rem;
    width: 100%;
}

.privacy-section {
    text-align: left;
    width: 100%;
}

.privacy-section h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--highlight-color);
}

.privacy-content {
    color: var(--secondary-color);
    font-size: 1rem;
}

.privacy-content p {
    margin-bottom: 1rem;
}

.privacy-content h3 {
    font-size: 1.2rem;
    margin: 1.5rem 0 0.5rem 0;
    color: var(--primary-color);
}

.privacy-content ul {
    margin-left: 1.25rem;
    margin-bottom: 1rem;
}

.privacy-content li {
    margin-bottom: 0.25rem;
}

/* ==========================================================================
   5. Footer
   ========================================================================== */
footer {
    text-align: center;
    width: 100%;
    padding-top: 2rem;
    font-size: 0.9rem;
    color: var(--secondary-color);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    border-top: 2px solid var(--divider-color);
}

.footer-link {
    color: var(--highlight-color);
    text-decoration: none;
    font-weight: 500;
    align-self: center;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.footer-link:hover,
.footer-link:focus {
    background-color: rgba(203, 226, 254, 0.1);
    outline: 2px dashed var(--highlight-color);
    outline-offset: 2px;
}

/* ==========================================================================
   6. Motion Preferences
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
        transform: none !important;
    }
}


/* ==========================================================================
   Background Ambiance (Twinkling Stars & Color Engines)
   ========================================================================== */
@keyframes rainbowShift {
    0% {
        --color-1: #362547; /* Soft Pastel Violet */
        --color-2: #222d42; /* Soft Slate Navy */
    }
    20% {
        --color-1: #223740; /* Muted Seafoam Teal */
        --color-2: #263d37; /* Gentle Mint Sage */
    }
    40% {
        /* NEW: Soft, brightened pastel gold & creamy peach */
        --color-1: #4a4031; /* Cozy Warm Vanilla Gold */
        --color-2: #4f3b35; /* Soft Muted Peach Cream */
    }
    60% {
        --color-1: #4d2f2b; /* Dusty Rose Pink */
        --color-2: #382436; /* Soft Plum Silk */
    }
    80% {
        --color-1: #2a223d; /* Pastel Lavender Shadow */
        --color-2: #20313a; /* Soft Steel Blue */
    }
    100% {
        --color-1: #362547; /* Loop smoothly back to beginning */
        --color-2: #222d42;
    }
}

/* Modern CSS property registration to make linear gradients animatable */
@property --color-1 {
    syntax: '<color>';
    inherits: false;
    initial-value: #362547;
}
@property --color-2 {
    syntax: '<color>';
    inherits: false;
    initial-value: #222d42;
}

/* Starfield Overlay Element */
#starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none; /* Allows user clicks to pass completely through safely */
    z-index: -1; /* Placed behind content layout elements */
    overflow: hidden;
}

/* Base individual star profile */
.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background-color: #d1d5db; /* Silver sparkle */
    border-radius: 50%;
    opacity: 0;
    box-shadow: 0 0 4px #ffffff;
    animation: twinkle var(--duration, 4s) ease-in-out infinite;
    animation-delay: var(--delay, 0s);
}

@keyframes twinkle {
    0%, 100% { opacity: 0.1; transform: scale(0.8); }
    50% { opacity: 0.8; transform: scale(1.2); }
}

/* Handle system accessibility settings gracefully */
@media (prefers-reduced-motion: reduce) {
    body {
        animation: none !important;
        background: linear-gradient(135deg, var(--color1), var(--color2)); /* Fixed cozy setting */
    }
    .star {
        animation: none !important;
        opacity: 0.4; /* Fixed soft glow */
    }
}
