/* --- CSS Variables (DEFAULT = DARK MODE) --- */
:root {
    --bg-color: #0f1115;
    --surface-color: #181b21;
    --text-main: #e6e6e6;
    --text-muted: #a0a0a0;
    --accent-color: #4db8ff; 
    --nav-bg: rgba(15, 17, 21, 0.85);
    --card-border: 1px solid rgba(255,255,255,0.08);
    --shadow-soft: 0 10px 30px -10px rgba(0,0,0,0.5);
    --shadow-hover: 0 20px 40px -10px rgba(0,0,0,0.7);
    --gradient-overlay: radial-gradient(circle at top right, rgba(0, 124, 186, 0.15) 0%, transparent 40%);
    --footer-bg: #0a0b0e;
    --radius-lg: 24px;
    --radius-sm: 12px;
    --container-width: 1100px;
    --font-body: "Inter", sans-serif;
    --font-heading: "Cardo", serif;
}

/* --- Light Mode Overrides --- */
body.light-mode {
    --bg-color: #fafafa;
    --surface-color: #ffffff;
    --text-main: #2d2d2d;
    --text-muted: #666666;
    --accent-color: #007cba;
    --nav-bg: rgba(255, 255, 255, 0.8);
    --card-border: 1px solid rgba(0,0,0,0.05);
    --shadow-soft: 0 10px 30px -10px rgba(0,0,0,0.08);
    --shadow-hover: 0 20px 40px -10px rgba(0,0,0,0.15);
    --gradient-overlay: radial-gradient(circle at top right, #eef7fc 0%, transparent 40%);
    --footer-bg: #f1f1f1;
}

/* --- Reset --- */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg-color);
    background-image: var(--gradient-overlay);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a { text-decoration: none; color: inherit; transition: 0.3s ease; }
img { max-width: 100%; height: auto; display: block; border-radius: var(--radius-sm); }

/* --- Typography --- */
h1, h2, h3 { font-family: var(--font-heading); color: var(--text-main); font-weight: 400; }
h1 { font-size: 3.5rem; letter-spacing: -0.02em; line-height: 1.1; margin-bottom: 1.5rem; }
h2 { font-size: 2.5rem; text-align: center; margin-bottom: 3rem; position: relative; display: inline-block; }
h3 { font-size: 1.25rem; font-weight: 700; font-family: var(--font-body); margin-bottom: 0.5rem; }
p { color: var(--text-muted); margin-bottom: 1rem; }

/* --- Layout --- */
.container { max-width: var(--container-width); margin: 0 auto; padding: 0 1.5rem; }
.section { padding: 5rem 0; }

/* --- Buttons --- */
.btn {
    display: inline-block;
    background: var(--text-main);
    color: var(--bg-color);
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}
.btn:hover { transform: translateY(-2px); opacity: 0.9; }

.btn-link, .back-link { 
    color: var(--accent-color); 
    font-weight: 600; 
    border-bottom: 1px solid transparent; 
}
.btn-link:hover, .back-link:hover { border-bottom-color: var(--accent-color); }

/* --- Header --- */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--card-border);
    padding: 1rem 0;
    transition: background 0.3s ease;
}
.nav-wrapper { display: flex; justify-content: space-between; align-items: center; }
.logo-area { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 1.2rem; }
.site-logo { width: 36px; height: 36px; }
.nav-actions { display: flex; align-items: center; gap: 2rem; }
.nav-links a { font-size: 0.9rem; font-weight: 500; color: var(--text-main); }
.nav-links a:hover { color: var(--accent-color); }

/* Theme Toggle */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-main);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}
.theme-toggle:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: rotate(15deg);
}

/* --- Footer --- */
footer { background: var(--footer-bg); padding: 4rem 0; margin-top: 4rem; transition: background 0.3s ease; }
.footer-content { display: flex; justify-content: space-between; align-items: flex-start; }
.footer-brand p { font-size: 0.9rem; margin-top: 0.5rem; color: var(--text-muted); }
.social-links { list-style: none; }
.social-links li { margin-bottom: 0.5rem; text-align: right; }
.social-links a { font-weight: 600; font-size: 0.9rem; color: var(--text-main); }
.social-links a:hover { color: var(--accent-color); }

/* --- Mobile --- */
@media (max-width: 768px) {
    h1 { font-size: 2.5rem; }
    .nav-actions { gap: 1rem; }
    .nav-links { display: none; } 
    .footer-content { flex-direction: column; gap: 2rem; text-align: center; }
    .social-links li { text-align: center; }
}

/* card and grids */
.grid-3 { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); 
    gap: 2rem; 
}

.card {
    background: var(--surface-color);
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: var(--card-border);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
}