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

:root {
    --navy: #0a1628;
    --dark-gray: #1a2838;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --accent: #cbd5e1;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
    background-color: var(--navy);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px;
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
}

#rain-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: auto;
    filter: blur(0.5px);
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
    background: rgba(10, 22, 40, 0.8);
    backdrop-filter: blur(12px);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Navigation */
nav {
    border-bottom: 1px solid var(--dark-gray);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

nav a {
    color: var(--text-secondary);
    text-decoration: none;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1.5px;
    transition: color 0.2s;
    position: relative;
    font-weight: 500;
}

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

nav a.active {
    color: var(--text-primary);
}

nav a.active::after {
    content: '';
    position: absolute;
    bottom: -1.7rem;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--accent);
}

/* Page Header */
.page-header {
    margin-bottom: 3rem;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Section Headers */
h2 {
    font-size: 1.8rem;
    margin: 2.5rem 0 1.5rem;
    color: var(--text-primary);
    border-left: 3px solid var(--accent);
    padding-left: 1rem;
    font-weight: 600;
}

h3 {
    font-size: 1.3rem;
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    font-weight: 600;
}

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

h3 a:hover {
    color: var(--accent);
    opacity: 1;
}

p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    max-width: 70ch;
}

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

a:hover {
    opacity: 0.8;
}

/* Experience Items */
.experience-item {
    background: transparent;
    border-left: 2px solid var(--dark-gray);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: border-color 0.2s;
}

.experience-item:hover {
    border-left-color: var(--accent);
}

.meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

/* Blog Posts */
.blog-post {
    border-bottom: 1px solid var(--dark-gray);
    padding: 1.5rem 0;
    transition: padding-left 0.2s;
}

.blog-post:hover {
    padding-left: 1rem;
}

.blog-post h3 {
    margin-top: 0;
}

.blog-post .date {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.blog-post a {
    color: var(--text-primary);
}

.blog-post a:hover {
    color: var(--accent);
}

/* Typography */
h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-weight: 700;
}

h2 {
    font-size: 1.8rem;
    margin: 2.5rem 0 1.5rem;
    color: var(--text-primary);
    border-left: 3px solid var(--accent);
    padding-left: 1rem;
    font-weight: 600;
}

h3 {
    font-size: 1.3rem;
    margin: 1.5rem 0 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
}

p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    max-width: 70ch;
}

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

a:hover {
    opacity: 0.8;
}

/* Hero Section */
.hero {
    padding: 2rem 0 3rem 0;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.hero .subtitle {
    font-size: 1.2rem;
    color: var(--accent);
    margin-bottom: 1.5rem;
    font-weight: 400;
}

.hero .intro {
    font-size: 1.1rem;
    line-height: 1.8;
}

/* Name hover with Urdu - fixed positioning to prevent reflow */
.name-hover {
    color: var(--accent);
    cursor: help;
    position: relative;
    border-bottom: 1px dotted var(--accent);
    transition: opacity 0.2s;
    display: inline-block;
}

.name-hover:hover {
    opacity: 0.8;
}

/* English stays in normal flow, Urdu overlays it */
.name-hover .english {
    visibility: visible;
}

.name-hover .urdu {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Noto Nastaliq Urdu', serif;
    color: var(--text-primary);
    visibility: hidden;
    white-space: nowrap;
}

.name-hover:hover .english {
    visibility: hidden;
}

.name-hover:hover .urdu {
    visibility: visible;
}

/* IPA tooltip */
.name-hover::after {
    content: attr(data-ipa);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark-gray);
    color: var(--text-primary);
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--accent);
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    margin-bottom: 0.5rem;
    font-family: 'Doulos SIL', 'Charis SIL', 'Gentium', serif;
    z-index: 10;
}

.name-hover:hover::after {
    opacity: 1;
}

/* Loading animation */
.name-hover.loading .english {
    display: none;
}

.name-hover.loading::before {
    content: attr(data-ipa);
    font-family: 'Doulos SIL', 'Charis SIL', 'Gentium', serif;
}

.name-hover.loading::after {
    display: none;
}

/* Links Section */
.links {
    display: flex;
    gap: 1.5rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.links a {
    padding: 0.7rem 1.5rem;
    border: 1px solid var(--dark-gray);
    background: transparent;
    color: var(--text-primary);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1.5px;
    transition: all 0.2s;
    font-weight: 500;
}

.links a:hover {
    border-color: var(--accent);
    background: transparent;
}

/* Project Items - Grid Layout */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.project-item {
    background: transparent;
    border: 1px solid var(--dark-gray);
    padding: 1.5rem;
    transition: border-color 0.2s;
    display: flex;
    flex-direction: column;
}

.project-item:hover {
    border-color: var(--accent);
}

.project-item h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.project-item h3 a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s;
}

.project-item h3 a:hover {
    color: var(--accent);
    opacity: 1;
}

.project-item .meta {
    margin-bottom: 0.75rem;
}

.project-item p {
    flex-grow: 1;
    margin-bottom: 1rem;
}

.project-item .tags {
    margin-top: auto;
}

.tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.tag {
    background: transparent;
    padding: 0.3rem 0.8rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    border: 1px solid var(--dark-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Language Map Styles */
.map-container {
    position: relative;
    max-width: 100%;
    margin: 2rem 0;
    padding: 2rem;
    border: 1px solid var(--dark-gray);
    background: var(--dark-gray);
}

#language-map {
    width: 100%;
    height: auto;
    display: block;
    background: transparent;
}

.country {
    fill: #2a3544 !important;
    stroke: #0f172a;
    stroke-width: 0.5;
    transition: opacity 0.2s;
    cursor: default;
}

.country:hover {
    opacity: 0.8;
}

.country.native {
    fill: #7BA3C0 !important;
    cursor: pointer;
}

.country.advanced {
    fill: #5A8AAF !important;
    cursor: pointer;
}

.country.intermediate {
    fill: #4A6B85 !important;
    cursor: pointer;
}

.country.basic {
    fill: #3D5466 !important;
    cursor: pointer;
}

.tooltip {
    position: fixed;
    background: var(--dark-gray);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border: 1px solid var(--accent);
    font-size: 0.9rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 1000;
    white-space: nowrap;
    border-radius: 4px;
}

.tooltip.visible {
    opacity: 1;
}

.tooltip-language {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.tooltip-level {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.map-legend {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--dark-gray);
    max-width: 900px; /* Match container width */
    margin-left: auto;
    margin-right: auto;
}

.map-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.map-legend-color {
    width: 20px;
    height: 20px;
    border: 1px solid var(--dark-gray);
}

/* Footer */
footer {
    margin-top: 5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--dark-gray);
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
}

footer p {
    text-align: center;
    margin: 0 auto;
    max-width: none;
}

/* Responsive */
@media (max-width: 1024px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    h1 {
        font-size: 1.8rem;
    }

    nav ul {
        gap: 1rem;
    }

    .container {
        padding: 1rem;
    }

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