/* =========================
   CSS VARIABLES & BASE
   ========================= */
:root {
    /* Colors */
    --bg-primary: #121212;
    --bg-secondary: #1f1f1f;
    --bg-card: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --accent-primary: #007bff;
    --accent-hover: #0056b3;
    --accent-secondary: #00d9ff;

    /* Typography */
    --font-primary: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;

    /* Spacing scale */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Layout */
    --border-radius: 8px;
    --transition-speed: 0.3s;
    --header-height: 120px;
    --max-width-content: 1200px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-primary);
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* =========================
   ACCESSIBILITY HELPERS
   ========================= */

/* Skip link for keyboard users */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent-primary);
    color: var(--text-primary);
    padding: var(--spacing-xs) var(--spacing-sm);
    text-decoration: none;
    border-radius: 0 0 var(--border-radius) 0;
    z-index: 9999;
}

.skip-link:focus {
    top: 0;
    outline: 2px solid var(--accent-secondary);
    outline-offset: 2px;
}

/* Focus outline for interactive elements */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--accent-secondary);
    outline-offset: 2px;
}

/* =========================
   HEADER & NAVIGATION
   ========================= */

/* Header bar (fixed on desktop, static on mobile via media query) */
header {
    background-color: var(--bg-secondary);
    padding: var(--spacing-sm) 0;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

/* Contain header content */
.header-container {
    max-width: var(--max-width-content);
    margin: 0 auto;
    padding: 0 var(--spacing-sm);
}

/* Row with title + hamburger button */
.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

header h1 {
    margin: 0 0 var(--spacing-xs);
    text-align: left;
}

/* Sub‑title on home page */
.tagline {
    margin: 0 0 var(--spacing-sm);
    text-align: center;
    color: var(--text-secondary);
}

/* Desktop nav list */
nav .nav-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

/* Links inside nav */
nav ul li a {
    color: var(--text-primary);
    text-decoration: none;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius);
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

nav ul li a:hover,
nav ul li a:focus {
    background-color: var(--accent-primary);
}

/* Current page indicator */
nav ul li a[aria-current="page"] {
    background-color: var(--bg-card);
    border-bottom: 2px solid var(--accent-secondary);
}

/* Hamburger button (shown only on small screens via media query) */
.nav-toggle {
    display: none;
    background-color: var(--bg-card);
    border: 1px solid #444;
    color: var(--text-primary);
    padding: 0.35rem 0.75rem;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.nav-toggle:hover,
.nav-toggle:focus {
    background-color: var(--accent-primary);
}

/* =========================
   MAIN LAYOUT
   ========================= */

main {
    /* Leave room for fixed header on desktop */
    padding-top: calc(var(--header-height) + var(--spacing-lg));
    max-width: var(--max-width-content);
    margin: 0 auto;
    padding-left: var(--spacing-sm);
    padding-right: var(--spacing-sm);
}

section {
    margin-bottom: var(--spacing-xl);
}

section h2 {
    border-bottom: 2px solid var(--accent-primary);
    padding-bottom: var(--spacing-xs);
}

/* =========================
   ABOUT & CARD BLOCKS
   ========================= */

/* Block used on About and Gaming pages */
.about-content {
    background-color: var(--bg-card);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
}

/* Skills list on home page */
.skills-highlight {
    background-color: var(--bg-secondary);
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    margin: var(--spacing-md) 0;
}

.skills-highlight h3 {
    margin-top: 0;
    color: var(--accent-secondary);
}

/* Generic card grid (used for home feature cards) */
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(260px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

/* Project grids (public + admin) */
.project-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(260px, 1fr));
    gap: var(--spacing-lg);
}

.project-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;          /* space between Edit and Delete */
    margin-top: 0.75rem;
}

.project-actions form {
    margin: 0;             /* remove default form margin */
}

/* Card base styles */
.feature-card,
.project-card {
    background-color: var(--bg-card);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

/* Project cards kept at consistent min height */
.project-card {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: 260px;
}

.feature-card:hover,
.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 217, 255, 0.2);
}

/* =========================
   BUTTONS
   ========================= */

.cta-button,
button[type="submit"],
.btn {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-md);
    background-color: var(--accent-primary);
    color: var(--text-primary);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
    transition: background-color var(--transition-speed), transform var(--transition-speed);
    text-align: center;
}

.cta-button:hover,
button[type="submit"]:hover,
.btn:hover,
.cta-button:focus,
button[type="submit"]:focus,
.btn:focus {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
}

/* =========================
   FORMS (contact + admin)
   ========================= */

form {
    background-color: var(--bg-card);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
    max-width: 600px;
    margin: var(--spacing-lg) auto;
}

form label {
    display: block;
    margin-bottom: var(--spacing-xs);
}

/* All text‑like fields share the same look */
form input[type="text"],
form input[type="email"],
form input[type="password"],
form input[type="tel"],
form textarea,
form select {
    width: 100%;
    padding: var(--spacing-sm);
    border: 1px solid #444;
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-md);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-family: var(--font-primary);
}

form textarea {
    min-height: 120px;
}

/* Success / error messages under forms */
.form-response,
.form-error {
    max-width: 600px;
    margin: 1rem auto;
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
}

.form-response {
    background-color: #00c851;
}

.form-error {
    background-color: #ff4444;
}

/* =========================
   SOCIAL LINKS & EMBEDS
   ========================= */

.socials-list {
    list-style: none;
    padding: 0;
    display: flex;
    gap: var(--spacing-md);
    flex-wrap: wrap;
    justify-content: center;
}

.socials-list a {
    background-color: var(--bg-card);
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--text-primary);
}

.socials-list a:hover,
.socials-list a:focus {
    background-color: var(--accent-primary);
}

/* Optional wrapper for iframes (YouTube, Discord) */
.embed-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    max-width: 100%;
    border-radius: var(--border-radius);
}

.embed-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* =========================
   FOOTER
   ========================= */

footer {
    background-color: var(--bg-secondary);
    text-align: center;
    padding: var(--spacing-lg);
    margin-top: var(--spacing-xl);
}

/* =========================
   UTILITIES
   ========================= */

.text-center {
    text-align: center;
}

.mt-lg {
    margin-top: var(--spacing-lg);
}

/* =========================
   RESPONSIVE (TABLET/MOBILE)
   ========================= */

@media (max-width: 768px) {
    /* Header taller on small screens */
    :root {
        --header-height: 150px;
    }

    /* Stack nav links vertically in mobile menu */
    nav .nav-links {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        background-color: var(--bg-secondary);
        width: 100%;
        padding: 0;
        margin-top: var(--spacing-sm);
        display: none; /* hidden until hamburger toggles it */
    }

    nav .nav-links li {
        width: 100%;
    }

    nav .nav-links li a {
        display: block;
        width: 100%;
        padding: 0.75rem var(--spacing-sm);
    }

    /* Mobile: show hamburger button */
    .nav-toggle {
        display: inline-block;
    }

    /* When JS adds .nav-open, reveal the menu */
    nav .nav-links.nav-open {
        display: flex;
    }

    /* On mobile, header is not fixed so content scrolls naturally */
    header {
        position: static;
    }

    /* Adjust main padding when header isn't fixed */
    main {
        padding-top: var(--spacing-lg);
    }

    /* On small screens, one card per row */
    .card-grid,
    .project-grid {
        grid-template-columns: 1fr;
    }
}
