:root {
    /* Base Colors */
    --bg-color: #0d1117;
    --card-bg: rgba(22, 27, 34, 0.8);
    --border-color: #30363d;

    /* Themes (Variables to be swapped) */
    --primary-color: #2f81f7;
    /* Default Blue */
    --accent-color: #3fb950;

    --text-main: #c9d1d9;
    --text-muted: #8b949e;

    /* Fonts */
    --font-main: 'JetBrains Mono', monospace;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-main);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* Dot Matrix Background */
    background-image: radial-gradient(var(--border-color) 1px, transparent 1px);
    background-size: 20px 20px;
    transition: all 0.3s ease;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Controls Panel - Collapsible */
.controls {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 0;
    border-radius: 50%;
    /* Circle by default */
    backdrop-filter: blur(10px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    width: 40px;
    height: 40px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
}

.controls:hover {
    width: 250px;
    height: auto;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    background: rgba(13, 17, 23, 0.95);
    /* More opaque when open */
}

.controls-icon {
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: opacity 0.3s;
    pointer-events: none;
    /* Let hover affect parent */
}

.controls:hover .controls-icon {
    opacity: 0;
}

.controls-content {
    opacity: 0;
    width: 250px;
    /* Fixed width for consistent layout */
    transform: translateY(10px);
    transition: all 0.3s ease;
    pointer-events: none;
    /* Disable interaction when closed */
    padding-top: 5px;
    /* Tiny buffer */
}

.controls:hover .controls-content {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.control-group {
    margin-bottom: 15px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: block;
}

.theme-btn {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    display: inline-block;
    margin-right: 5px;
    transition: transform 0.2s;
}

.theme-btn:hover {
    transform: scale(1.2);
}

.theme-btn.active {
    border-color: #fff;
}

select {
    width: 100%;
    background: var(--bg-color);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 8px;
    border-radius: 4px;
    font-family: inherit;
}

/* Hero Section & Header */
header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

h1 {
    font-size: 3rem;
    margin: 0;
    color: var(--primary-color);
    text-shadow: 0 0 15px rgba(var(--primary-rgb), 0.3);
    letter-spacing: -2px;
    line-height: 1;
}

.tag {
    background: var(--primary-color);
    color: var(--bg-color);
    padding: 4px 8px;
    font-size: 0.8rem;
    font-weight: bold;
    border-radius: 4px;
    vertical-align: middle;
    margin-left: 10px;
}

/* Navigation (Imported from V2) */
nav {
    display: flex;
    align-items: center;
}

nav a {
    color: var(--text-muted);
    text-decoration: none;
    margin-left: 20px;
    font-size: 0.95rem;
    transition: color 0.2s;
}

nav a:hover {
    color: var(--primary-color);
}

/* Content Grid */
.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 40px;
    transition: transform 0.2s, border-color 0.2s;
    position: relative;
    overflow: hidden;
    text-align: center;
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
}

.card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s;
}

.card:hover::before {
    transform: scaleX(1);
}

h3 {
    margin-top: 0;
    color: #fff;
    font-size: 1.5rem;
    margin-bottom: 20px;
}

p {
    line-height: 1.6;
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--accent-color);
}

/* Footer */
footer {
    margin-top: 60px;
    border-top: 1px solid var(--border-color);
    padding: 30px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
}

/* Font Specific Classes for Demo */
.font-pixel {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.7rem;
    line-height: 1.4;
}

.font-fira {
    font-family: 'Fira Code', monospace;
}

.font-space {
    font-family: 'Space Mono', monospace;
}

.font-jetbrains {
    font-family: 'JetBrains Mono', monospace;
}

/* Blinking Cursor */
.cursor {
    display: inline-block;
    width: 10px;
    height: 1em;
    background-color: var(--primary-color);
    animation: blink 1s step-end infinite;
    vertical-align: text-bottom;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}
