/* FILE: css/global.css */

:root {
    /* --- THEME 1: CYBERPUNK (Default) --- */
    --bg-color: #0f0f12;
    --card-bg: #16161a;
    --code-bg: #1a1a1d;
    --text-main: #e0e0e0;
    --text-muted: #a0aab5;
    /* Lightened for WCAG AA Compliance */
    --primary-color: #00f3ff;
    /* Neon Cyan */
    --accent-color: #0aff0a;
    /* Terminal Green */
    --border-color: #2d2d35;
    --nav-bg: rgba(15, 15, 18, 0.98);
    /* Higher opacity for readability */
    --shadow-glow: 0 16px 40px -24px rgba(0, 243, 255, 0.7);
    --space-section: clamp(3rem, 7vw, 5rem);
    /* Typography */
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

:focus-visible {
    outline: 2px dashed var(--primary-color);
    outline-offset: 4px;
    border-radius: 2px;
}

:focus:not(:focus-visible) {
    outline: none;
}

#typing-text::after {
    content: "|";
    display: inline-block;
    color: var(--primary-color);
    animation: blink 1s infinite;
    vertical-align: bottom;
}

/* --- THEME 2: MINIMALIST (Light) --- */

[data-theme="minimalist"] {
    --bg-color: #ffffff;
    --card-bg: #f4f4f5;
    --code-bg: #f4f4f5;
    --text-main: #18181b;
    --text-muted: #52525b;
    --primary-color: #0056b3;
    /* Darker Blue for contrast on white */
    --accent-color: #15803d;
    /* Darker green for WCAG AA on light bg */
    --border-color: #e4e4e7;
    --nav-bg: rgba(255, 255, 255, 0.98);
}

/* --- THEME 3: HIGH CONTRAST (Accessibility) --- */

[data-theme="contrast"] {
    --bg-color: #000000;
    --card-bg: #000000;
    --code-bg: #000000;
    --text-main: #ffffff;
    --text-muted: #ffff00;
    --primary-color: #00ffff;
    --accent-color: #00ff00;
    --border-color: #ffffff;
    --nav-bg: #000000;
}

/* Skip to content link (a11y) */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    z-index: 10000;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: var(--bg-color);
    font-family: var(--font-mono);
    font-weight: 700;
    text-decoration: none;
}
.skip-link:focus {
    top: 0;
}

/* Reset & Base */

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body.nav-open {
    overflow: hidden;
}

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

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Typography */

h1,
h2,
h3,
h4 {
    font-family: var(--font-mono);
    font-weight: 700;
    line-height: 1.2;
}

.neon-text {
    color: var(--primary-color);
}

/* ----- HIRING BADGE / STATUS LINE ----- */
.status-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.hiring-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    background: rgba(10, 255, 10, 0.08);
    animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* --- PERMANENTLY STICKY HEADER --- */

.site-header {
    position: sticky;
    top: 0;
    width: 100%;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    padding: 1rem 0;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

/* Logo Link Style */

.logo-link {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--primary-color);
    text-decoration: none;
    display: inline-block;
}

.blink {
    animation: blink 1s infinite;
}

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

/* --- THEME SWITCHER (TOGGLE GROUP) --- */

.theme-switch-wrapper {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.theme-btn {
    background: var(--card-bg);
    border: none;
    border-right: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 0.5rem 0.8rem;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    transition: background 0.2s;
}

.theme-btn:last-child {
    border-right: none;
}

.theme-btn:hover,
.theme-btn:focus-visible {
    background: rgba(128, 128, 128, 0.14);
    color: var(--text-main);
}

.theme-btn.active {
    background: var(--primary-color);
    color: var(--bg-color);
    font-weight: 600;
}

/* --- CLS FIXES (Layout Stability) --- */

/* Reserve space for typing text to prevent layout shift */

.console-text {
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-family: var(--font-mono);
    min-height: 1.6em;
    display: flex;
    align-items: center;
}

/* Hero and Home Page */

.hero-section {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: 6rem;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin-bottom: 1rem;
    color: var(--text-main);
}

.social-links {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.social-icon {
    color: var(--text-muted);
}

.social-icon:hover,
.social-icon:focus-visible {
    color: var(--primary-color);
    transform: translateY(-2px);
}

.social-icon svg {
    width: 28px;
    height: 28px;
}

.cta-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.technical-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.feature-card {
    border-left-color: var(--primary-color);
}

.status-list {
    color: var(--accent-color);
    margin: 1.5rem 0;
}

.colophon {
    border-top: 1px dashed var(--border-color);
    padding-top: 2rem;
    margin-bottom: 2rem;
}

.colophon-inner {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
}

.colophon-title {
    font-size: 1rem;
}

.colophon-copy {
    max-width: 600px;
    font-size: 0.9rem;
}

.colophon-meta {
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.no-js-banner {
    background: #ff0000;
    color: white;
    text-align: center;
    padding: 10px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 9999;
}

/* --- QR CODE THEME SWAPPING --- */

.qr-dark,
.qr-light {
    border-radius: 4px;
    display: none;
}

.qr-dark {
    display: block;
}

.qr-light {
    display: none;
}

[data-theme="contrast"] .qr-dark {
    display: block;
    border: 2px solid var(--primary-color);
}

[data-theme="contrast"] .qr-light {
    display: none;
}

[data-theme="minimalist"] .qr-dark {
    display: none;
}

[data-theme="minimalist"] .qr-light {
    display: block;
}

/* Layout Utilities */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.grid {
    display: grid;
    gap: 2rem;
}

/* Navigation Menu */

.nav-menu ul {
    display: flex;
    gap: clamp(1rem, 2vw, 2rem);
}

.nav-menu a {
    position: relative;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-muted);
}

.nav-menu a:hover,
.nav-menu a.active,
.nav-menu a[aria-current="page"] {
    color: var(--primary-color);
}

.nav-menu a[aria-current="page"]::after,
.nav-menu a:hover::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -0.35rem;
    height: 1px;
    background: currentColor;
}

/* Mobile Nav Toggle */

.nav-toggle {
    display: none;
    width: 44px;
    height: 44px;
    background: none;
    border: 1px solid var(--border-color);
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--primary-color);
    transition: var(--transition);
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Performance & Animations */

.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Reusable Layout */

.page-main {
    padding-top: clamp(4rem, 8vw, 6rem);
}

.section {
    margin-top: var(--space-section);
}

.section-compact {
    margin-top: 2rem;
}

.section-heading {
    margin-bottom: 2rem;
    color: var(--primary-color);
}

.section-heading.centered {
    text-align: center;
}

/* Utility: consistent subsection heading */
.subsection-heading {
    color: var(--primary-color);
    font-family: var(--font-mono);
    font-weight: 700;
    margin: 2rem 0 1rem;
    line-height: 1.3;
}

/* Utility: muted text paragraphs */
.intro-copy,
.muted-copy {
    color: var(--text-muted);
    line-height: 1.8;
}

.intro-copy {
    max-width: 800px;
}

.hero-copy {
    max-width: 700px;
    margin-bottom: 2rem;
    font-size: 1rem;
}

.cluster {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Cards: consolidated single definition */
.card,
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--border-color);
    padding: 1.5rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.card:hover,
.stat-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-glow);
}

.stat-number {
    display: block;
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-number.accent {
    color: var(--accent-color);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    padding: 3rem 0;
    border-top: 1px solid var(--border-color);
}

.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tech-tag {
    display: inline-flex;
    align-items: center;
    min-height: 1.75rem;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 0.3rem 0.75rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    color: var(--text-main);
}

.code-block {
    background: var(--code-bg, #1a1a1d);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    overflow-x: auto;
    font-family: var(--font-mono);
    color: var(--text-main);
    transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.code-block code {
    font-family: inherit;
    font-size: 0.85rem;
    color: inherit;
    line-height: 1.6;
}

.card-title {
    color: var(--text-main);
    margin-bottom: 1rem;
}

.card-copy {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.card-link {
    margin-top: 1.5rem;
    color: var(--primary-color);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 600;
}

.card-link:hover,
.read-more:hover,
.contact-link:hover {
    color: var(--accent-color);
}

.list-disc {
    list-style: disc;
    margin-left: 1.5rem;
    color: var(--text-muted);
}

.list-disc li + li {
    margin-top: 0.35rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    font-family: var(--font-mono);
}

.form-control {
    width: 100%;
    background: transparent;
    border: 1px solid transparent;
    border-bottom-color: var(--border-color);
    color: var(--text-main);
    padding: 0.6rem 0;
    font-family: var(--font-mono);
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-control:focus-visible {
    border-bottom-color: var(--primary-color);
    border-bottom-width: 2px;
    outline: none;
}

.form-status {
    margin-top: 1.5rem;
    font-family: var(--font-mono);
}

.success-panel {
    margin-top: 1rem;
    padding: 2rem;
    text-align: center;
    background: rgba(10, 255, 10, 0.1);
    border: 1px solid var(--accent-color);
}

.success-panel h3 {
    color: var(--accent-color);
}

.error-text {
    color: #ff5555;
}

.kicker {
    font-family: var(--font-mono);
    color: var(--primary-color);
    font-size: 0.8rem;
    letter-spacing: 0.04em;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 44px;
    padding: 0.8rem 1.5rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    font-size: 0.9rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(0, 243, 255, 0.05);
}

.btn-primary:hover,
.btn-primary:focus-visible {
    background: var(--primary-color);
    color: var(--bg-color);
    transform: translateY(-2px);
}

.btn-secondary {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(10, 255, 10, 0.05);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
    background: var(--accent-color);
    color: var(--bg-color);
    transform: translateY(-2px);
}

.btn-accent {
    border-color: var(--primary-color);
    color: var(--bg-color);
    background: var(--primary-color);
    box-shadow: 0 0 12px rgba(0, 243, 255, 0.3);
}

.btn-accent:hover,
.btn-accent:focus-visible {
    background: transparent;
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.5);
}

/* Footer */

footer {
    padding: 3rem 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
    margin-top: 4rem;
}

.ip-disclaimer {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 1rem;
    opacity: 1;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Scroll Top Button */

#scroll-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--primary-color);
    color: var(--bg-color);
    width: 45px;
    height: 45px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
    z-index: 900;
}

#scroll-top-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Media Queries */

@media (max-width: 768px) {
    .site-header {
        padding: 0.75rem 0;
    }

    .nav-container {
        gap: 0.75rem;
    }

    .nav-actions {
        gap: 0.5rem;
    }

    .nav-toggle {
        display: flex;
        z-index: 1001;
        flex: 0 0 auto;
    }

    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: min(82vw, 340px);
        height: 100vh;
        background: var(--bg-color);
        border-left: 1px solid var(--border-color);
        padding: 6rem 2rem;
        transition: right 0.3s ease;
        z-index: 1000;
        display: block;
    }

    .nav-menu.open {
        right: 0;
    }

    .nav-menu ul {
        flex-direction: column;
        gap: 1.5rem;
    }

    .theme-btn {
        padding: 0.35rem 0.45rem;
        font-size: 0.65rem;
    }

    .hero-content h1 {
        font-size: 2rem;
    }

    .logo-link {
        font-size: 1rem;
    }

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

    .page-main {
        padding-top: 3rem;
    }

    .panel,
    .card,
    .stat-card {
        padding: 1.25rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }

    .theme-switch-wrapper {
        max-width: 48vw;
    }

    .theme-btn {
        font-size: 0;
        width: 2.25rem;
    }

    .theme-btn .btn-label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .theme-btn::first-letter {
        font-size: 0.85rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media print {
    .site-header,
    .theme-switch-wrapper,
    footer,
    .btn,
    #scroll-top-btn {
        display: none !important;
    }
    body {
        background: white;
        color: black;
    }
    .project-card,
    .internship-item,
    .card,
    .panel {
        border: 1px solid #000;
        page-break-inside: avoid;
    }
}

/* --- HERO OPTIMIZATIONS (LCP Fix) --- */

.hero-entry {
    animation: fadeUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}