:root {
    --bg-color: #050505;
    --card-bg: rgba(10, 10, 10, 0.85);
    --text-primary: #00ff41;
    /* Matrix Green */
    --text-secondary: #a8b2d1;
    --accent-primary: #00ff41;
    --accent-secondary: #008F11;
    /* Darker Green */
    --accent-alert: #ff003c;
    /* Cyberpunk Red */
    --font-heading: 'Courier New', Courier, monospace;
    /* Classic Terminal Font */
    --font-body: 'Fira Code', 'Roboto Mono', monospace;
    --transition: all 0.2s ease;
    --border-color: #003b00;
    /* Safe area insets for notch devices (iOS, some Android) */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-secondary);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
    /* Respect device safe areas globally */
    padding-top: var(--safe-top);
    padding-right: var(--safe-right);
    padding-bottom: var(--safe-bottom);
    padding-left: var(--safe-left);
}

/* Matrix Background */
#matrix-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    opacity: 0.15;
}

/* Typography */
h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

/* Glitch Effect Class */
.glitch {
    position: relative;
    color: var(--text-primary);
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
}

.glitch::before {
    left: 2px;
    text-shadow: -1px 0 #ff00c1;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -1px 0 #00fff9;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim2 5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% {
        clip: rect(30px, 9999px, 10px, 0);
    }

    5% {
        clip: rect(80px, 9999px, 5px, 0);
    }

    10% {
        clip: rect(10px, 9999px, 90px, 0);
    }

    15% {
        clip: rect(50px, 9999px, 20px, 0);
    }

    20% {
        clip: rect(10px, 9999px, 100px, 0);
    }

    100% {
        clip: rect(0, 9999px, 0, 0);
    }
}

@keyframes glitch-anim2 {
    0% {
        clip: rect(10px, 9999px, 80px, 0);
    }

    5% {
        clip: rect(90px, 9999px, 10px, 0);
    }

    10% {
        clip: rect(20px, 9999px, 50px, 0);
    }

    15% {
        clip: rect(60px, 9999px, 30px, 0);
    }

    20% {
        clip: rect(100px, 9999px, 10px, 0);
    }

    100% {
        clip: rect(0, 9999px, 0, 0);
    }
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    padding: calc(1.2rem + var(--safe-top)) 5% 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(5, 5, 5, 0.95);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.logo::before {
    content: 'root@portfolio:~# ';
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-right: 5px;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    font-size: 0.9rem;
    color: var(--text-secondary);
    position: relative;
}

.nav-links a::before {
    content: '[';
    margin-right: 5px;
    opacity: 0;
    color: var(--accent-primary);
    transition: var(--transition);
}

.nav-links a::after {
    content: ']';
    margin-left: 5px;
    opacity: 0;
    color: var(--accent-primary);
    transition: var(--transition);
}

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

.nav-links a:hover::before,
.nav-links a:hover::after {
    opacity: 1;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Extra top padding so content sits below fixed navbar + safe area */
    padding: calc(4.5rem + var(--safe-top)) 10% 4rem;
    text-align: left;
}

.hero-content {
    max-width: 900px;
    z-index: 1;
}

.terminal-prompt {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    margin-bottom: 2rem;
    color: var(--text-secondary);
}

.prompt-user {
    color: #00ff41;
}

.prompt-path {
    color: #00b8ff;
}

.prompt-command {
    color: #fff;
}

.terminal-prompt::after {
    content: '▊';
    color: var(--accent-primary);
    animation: blink 1s infinite;
    margin-left: 5px;
}

@keyframes blink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

.hero-title {
    font-size: 4.5rem;
    margin-bottom: 1.5rem;
    text-shadow: 0 0 20px rgba(0, 255, 65, 0.5);
    line-height: 1.1;
}

.hero-subtitle {
    font-size: 1.3rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.hero-subtitle .tag {
    background: rgba(0, 255, 65, 0.1);
    border: 1px solid var(--border-color);
    padding: 5px 15px;
    color: var(--accent-primary);
}

.hero-subtitle .separator {
    color: var(--text-secondary);
}

.hero-description {
    margin-bottom: 3rem;
}

.hero-description .comment {
    color: #666;
    font-style: italic;
    font-size: 1.1rem;
}

.hero-buttons {
    display: flex;
    gap: 1.5rem;
}

.btn {
    padding: 1rem 2.5rem;
    font-family: var(--font-heading);
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    border: 2px solid var(--accent-primary);
    background: transparent;
    color: var(--accent-primary);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    letter-spacing: 2px;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--accent-primary);
    transition: all 0.3s ease;
    z-index: -1;
}

.btn:hover {
    color: #000;
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.6);
}

.btn:hover::before {
    left: 0;
}

.btn-secondary {
    border-color: var(--text-secondary);
    color: var(--text-secondary);
}

.btn-secondary::before {
    background: var(--text-secondary);
}

.btn-secondary:hover {
    box-shadow: 0 0 20px rgba(168, 178, 209, 0.4);
}

/* Social Links */
.social-links {
    display: flex;
    gap: 2rem;
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.social-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    transition: var(--transition);
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
}

.social-link svg {
    transition: var(--transition);
}

.social-link:hover {
    color: var(--accent-primary);
    border-color: var(--border-color);
}

.social-link:hover svg {
    transform: scale(1.1);
}

/* Section General */
.section {
    padding: 6rem 10%;
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 4rem;
    text-align: center;
    border-bottom: 2px solid var(--border-color);
    line-height: 0.1em;
    margin: 4rem 0 4rem;
}

.section-title span {
    background: var(--bg-color);
    padding: 0 20px;
}

/* Terminal Card Style */
.terminal-card {
    background: #0c0c0c;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 0 15px rgba(0, 59, 0, 0.3);
    transition: var(--transition);
}

.terminal-header {
    background: #1a1a1a;
    padding: 5px 10px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.terminal-buttons {
    display: flex;
    gap: 5px;
}

.terminal-btn {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.terminal-btn.red {
    background: #ff5f56;
}

.terminal-btn.yellow {
    background: #ffbd2e;
}

.terminal-btn.green {
    background: #27c93f;
}

.terminal-title {
    margin-left: 10px;
    font-size: 0.8rem;
    color: #666;
}

.terminal-body {
    padding: 1.5rem;
}

.hero-terminal {
    margin-bottom: 2.5rem;
}

.terminal-output {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-primary);
    white-space: pre-wrap;
    min-height: 120px;
}

/* About Section */
.about-content {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 3rem;
}

.about-text p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.about-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stat-card {
    background: rgba(0, 255, 65, 0.05);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    text-align: center;
}

.stat-card h3 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

/* Timeline */
.timeline {
    border-left: 2px solid rgba(0, 255, 65, 0.2);
    margin-left: 20px;
    padding-left: 30px;
    position: relative;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    left: -2px;
    width: 2px;
    height: 100%;
    background: linear-gradient(to bottom, transparent, var(--accent-primary), transparent);
    opacity: 0.5;
}

.timeline-item {
    position: relative;
    margin-bottom: 3.5rem;
}

.timeline-dot {
    position: absolute;
    left: -39px;
    top: 4px;
    width: 16px;
    height: 16px;
    background: var(--bg-color);
    border: 2px solid var(--accent-primary);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.5);
    transition: var(--transition);
    z-index: 1;
}

.timeline-item:hover .timeline-dot {
    background: var(--accent-primary);
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.8);
    transform: scale(1.2);
}

.timeline-date {
    display: inline-block;
    background: rgba(0, 255, 65, 0.1);
    color: var(--accent-primary);
    font-family: var(--font-heading);
    font-size: 0.85rem;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 1rem;
    border: 1px solid rgba(0, 255, 65, 0.2);
}

.timeline-content {
    background: rgba(10, 10, 10, 0.8);
    border: 1px solid rgba(0, 255, 65, 0.15);
    padding: 2rem;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.timeline-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: var(--accent-primary);
    opacity: 0.5;
    transition: var(--transition);
}

.timeline-item:hover .timeline-content {
    border-color: rgba(0, 255, 65, 0.5);
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.1);
    transform: translateX(5px);
}

.timeline-item:hover .timeline-content::before {
    opacity: 1;
    box-shadow: 0 0 10px var(--accent-primary);
}

.timeline-header {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
}

.timeline-content h3 {
    font-size: 1.4rem;
    color: #fff;
    margin-bottom: 0.3rem;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.timeline-content h4 {
    font-size: 1rem;
    color: var(--accent-primary);
    font-family: var(--font-heading);
    letter-spacing: 1px;
}

.timeline-content ul {
    padding-left: 1.2rem;
    margin-bottom: 1.5rem;
}

.timeline-content li {
    margin-bottom: 0.8rem;
    font-size: 1rem;
    color: #ccc;
    position: relative;
    list-style: none;
}

.timeline-content li::before {
    content: '>';
    position: absolute;
    left: -1.2rem;
    color: var(--accent-primary);
    font-family: var(--font-heading);
}

.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.tech-stack span {
    font-size: 0.8rem;
    font-family: var(--font-heading);
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid transparent;
    transition: var(--transition);
}

.timeline-item:hover .tech-stack span:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(0, 255, 65, 0.1);
    transform: translateY(-2px);
}

/* Skills */
.skills-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
}

.skill-category {
    background: #0a0a0a;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    flex: 1 1 300px;
    max-width: 400px;
}

.skill-category:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.2);
}

.skill-category h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 10px;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.tags span {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.tags span::before {
    content: '> ';
    color: var(--accent-primary);
}

/* Projects */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.project-card {
    background: #0a0a0a;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

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

.project-content {
    padding: 2rem;
}

.project-content h3 {
    margin-bottom: 1rem;
}

.project-content h3 a {
    color: var(--accent-primary);
    text-decoration: none;
    border-bottom: 1px dashed transparent;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.project-content h3 a:hover {
    border-bottom-color: var(--accent-primary);
    text-shadow: 0 0 8px rgba(0, 255, 65, 0.4);
}

.project-content h3 a::after {
    content: '↗';
    font-size: 0.8em;
    opacity: 0.7;
    transition: transform 0.3s ease;
}

.project-content h3 a:hover::after {
    transform: translate(3px, -3px);
    opacity: 1;
}

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

.project-tags span {
    font-size: 0.8rem;
    background: rgba(0, 255, 65, 0.1);
    color: var(--accent-primary);
    padding: 2px 8px;
    border: 1px solid var(--border-color);
}

/* Contact */
.contact-wrapper {
    text-align: center;
    border: 1px solid var(--border-color);
    padding: 4rem;
    background: rgba(0, 255, 65, 0.02);
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.contact-row {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2.5rem;
}

.contact-item {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 1.1rem;
}

.contact-item .icon {
    color: var(--accent-primary);
}

footer {
    text-align: center;
    padding: 2rem;
    border-top: 1px solid var(--border-color);
    margin-top: 4rem;
    font-size: 0.9rem;
}

/* Mobile */
@media (max-width: 768px) {
    .hero {
        /* Similar to Flutter SafeArea: respect notch + give breathing room */
        padding: calc(5.5rem + var(--safe-top)) 1.5rem 3rem;
        align-items: flex-start;
    }

    .hero-title {
        font-size: 2.4rem;
        line-height: 1.15;
    }

    .hero-subtitle {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .nav-links {
        display: none;
    }

    .section {
        padding: 4rem 1.5rem;
    }

    .section-title {
        font-size: 1.9rem;
        line-height: 1.2;
        margin: 3rem 0 2.5rem;
    }

    .about-content {
        grid-template-columns: 1fr;
    }

    .timeline {
        margin-left: 5px;
        padding-left: 20px;
    }

    .timeline-dot {
        left: -29px;
    }

    .timeline-content {
        padding: 1.5rem;
    }

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

    .contact-wrapper {
        padding: 2.5rem 1.5rem;
    }
}