/* ===========================
   Matrix-Lite Design System
   Retro-Modern Terminal Aesthetic
   =========================== */
:root {
    /* Colors - Dark Matrix Theme (20% darker) */
    --bg-primary: #0d0d0d;
    --bg-secondary: #141414;
    --bg-tertiary: #1a1a1a;
    --bg-card: #161616;

    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
    --text-muted: #b0b0b0;

    /* Matrix CRT green accent (classic phosphor green) */
    --accent-primary: #00cc00;
    --accent-secondary: #00cc00;
    --accent-glow: rgba(0, 204, 0, 0.5);

    --border-default: #3a3a3a;
    --border-accent: #00ff41;
    --border-muted: #2a2a2a;

    /* Status Colors - Matrix Style */
    --status-active: #00cc00;
    --status-maintained: #ffaa00;
    --status-archived: #666666;
    --status-beta: #00e5ff;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Typography - Terminal/Monospace */
    --font-mono: 'IBM Plex Mono';
    --font-display: 'IBM Plex Mono';

    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1.15rem;
    /* Increased 15% for readability */
    --text-lg: 1.25rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 2rem;
    --text-4xl: 2.5rem;

    /* Borders & Shadows - Retro Tech (SQUARE) */
    --radius-sm: 0;
    --radius-md: 0;
    --radius-lg: 0;
    --radius-full: 0;

    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-neon: 0 0 0 2px var(--accent-primary);
    --shadow-neon-hover: 0 0 0 3px var(--accent-primary), 0 4px 0 var(--accent-primary);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;

    /* Z-Index Layers */
    --z-background: -1;
    --z-base: 1;
    --z-card-content: 2;
    --z-card-overlay: 5;
    --z-sticky: 100;
    --z-header: 1000;
    --z-modal: 10000;
    --z-tooltip: 10001;

    /* Component Colors */
    --bg-header: #000000;
}

/* ===========================
   CRT Phosphor Color Schemes
   Classic Terminal Themes
   =========================== */

/* P1 Green Phosphor - Classic "Green Screen" (1960s-1980s) */
body[data-theme="p1-green"] {
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --bg-tertiary: #1a1a1a;
    --bg-card: #0d0d0d;

    --text-primary: #33ff33;
    --text-secondary: #00cc00;
    --text-muted: #009900;

    --accent-primary: #00ff00;
    --accent-primary-rgb: 0, 255, 0;
    --accent-secondary: #00ff00;
    --accent-glow: rgba(0, 255, 0, 0.5);
    --border-default: #3a3a3a;
    --border-accent: #00ff41;
}

/* P1+ Matrix Green - Darker "Matrix" Green (Original Theme) */
body[data-theme="p1-matrix"] {
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --bg-tertiary: #1a1a1a;
    --bg-card: #0d0d0d;

    --text-primary: #00ff41;
    --text-secondary: #00cc33;
    --text-muted: #009922;

    --accent-primary: #00ff41;
    --accent-primary-rgb: 0, 255, 65;
    --accent-secondary: #00ff41;
    --accent-glow: rgba(0, 255, 65, 0.5);
    --border-default: #3a3a3a;
    --border-accent: #00ff41;
}

/* P3 Amber Phosphor - Warm late-80s terminal (1987-1990) */
body[data-theme="p3-amber"] {
    --bg-primary: #000000;
    --bg-secondary: #0a0600;
    --bg-tertiary: #1a1200;
    --bg-card: #0d0800;

    --text-primary: #ffb000;
    --text-secondary: #cc8800;
    --text-muted: #996600;

    --accent-primary: #ff9000;
    --accent-primary-rgb: 255, 144, 0;
    --accent-secondary: #ff9000;
    --accent-glow: rgba(255, 144, 0, 0.5);
    --border-default: #3a2a1a;
    --border-accent: #ffb000;
}

/* P4 White Phosphor - "Page White" IBM/Apple (1970s-1980s) */
body[data-theme="p4-white"] {
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --bg-tertiary: #1a1a1a;
    --bg-card: #0d0d0d;

    --text-primary: #f0f0f0;
    --text-secondary: #c0c0c0;
    --text-muted: #909090;

    --accent-primary: #ffffff;
    --accent-primary-rgb: 255, 255, 255;
    --accent-secondary: #ffffff;
    --accent-glow: rgba(255, 255, 255, 0.5);
    --border-default: #3a3a3a;
    --border-accent: #ffffff;
}

/* IBM Blue - Cyan on dark blue mainframe aesthetic (1980s) */
body[data-theme="ibm-blue"] {
    --bg-primary: #000033;
    --bg-secondary: #001144;
    --bg-tertiary: #002255;
    --bg-card: #000a44;

    --text-primary: #00d4ff;
    --text-secondary: #00aacc;
    --text-muted: #008099;

    --accent-primary: #00aaff;
    --accent-primary-rgb: 0, 170, 255;
    --accent-secondary: #00aaff;
    --accent-glow: rgba(0, 170, 255, 0.5);
    --border-default: #003366;
    --border-accent: #00d4ff;
}

/* ===========================
   Reset & Base Styles
   =========================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 14px;
    /* Base: Mobile-first sizing */
}

/* Tablet: Slightly larger */
@media (min-width: 768px) {
    html {
        font-size: 15px;
    }
}

/* Desktop: Standard size */
@media (min-width: 1200px) {
    html {
        font-size: 16px;
    }
}

/* Large Desktop: More comfortable */
@media (min-width: 1600px) {
    html {
        font-size: 17px;
    }
}

body {
    font-family: var(--font-mono);
    background: #1a1a1a;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
}

/* Matrix scanlines & Boot-up effects - REMOVED per user request */

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: all var(--transition-fast);
}

a:hover {
    color: var(--accent-primary);
    text-shadow: 0 0 8px var(--accent-glow);
}

ul {
    list-style: none;
}

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

/* ===========================
   Unified Sticky Header
   =========================== */
/* ===========================
   Unified Sticky Header
   =========================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    display: flex;
    justify-content: flex-start;
    /* V5: Start from left */
    align-items: center;
    gap: var(--space-lg);
    /* Space between Logo and Title */
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-header);
    /* V5.4: Solid Black */
    border-bottom: 3px solid var(--accent-primary);
    /* V5.4: Strong Underline */
    backdrop-filter: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

/* ===========================
   Logo (Left Side)
   =========================== */
.logo {
    flex-shrink: 0;
}

.logo img {
    width: 80px;
    height: auto;
    display: block;
    transition: all var(--transition-base);
}

.logo:hover img {
    transform: scale(1.05);
}

/* ===========================
   Buttons
   =========================== */


/* Main Title - Retro Terminal Style */
.header-title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0;
    line-height: 1.1;
    text-shadow: 0 0 10px var(--accent-glow);
    animation: glow 2s ease-in-out infinite alternate;
    position: relative;
    display: inline-block;
}

/* Blinking Cursor Effect */
.header-title::after {
    content: '_';
    display: inline-block;
    margin-left: 0.2em;
    animation: cursor-blink 1s step-end infinite;
    color: var(--accent-primary);
    text-shadow: none;
    opacity: 1;
}

@keyframes glow {
    from {
        text-shadow: 0 0 10px var(--accent-glow);
    }

    to {
        text-shadow: 0 0 20px var(--accent-glow), 0 0 30px var(--accent-glow);
    }
}

@keyframes cursor-blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.header-tagline {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

/* ===========================
   Upper Right Info (Stargate)
   =========================== */
.upper-right-info {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-xs);
    font-family: var(--font-mono);
    opacity: 0.7;
    transition: opacity var(--transition-fast);
    margin-left: auto;
    /* V5: Push to far right */
}

.upper-right-info:hover {
    opacity: 1;
}

/* Terminal output styling */
/* Terminal output styling - Themed Mini Screen */
.terminal-output {
    font-size: 11px;
    color: var(--accent-primary);
    font-family: var(--font-mono);
    line-height: 1.4;
    text-align: left;
    transition: opacity 0.3s ease;

    /* Themed Box Style (Matches Project Cards) */
    width: 125px;
    /* Square to match logo */
    height: 125px;
    background: #000;
    /* Deep black for screen contrast */
    border: 1px solid var(--border-default);
    /* Standard theme border */
    border-radius: var(--radius-sm);
    padding: var(--space-sm);

    /* Screen Effects */
    box-shadow:
        inset 0 0 15px rgba(0, 255, 65, 0.05);
    /* Subtle inner glow */

    /* Content Alignment */
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    position: relative;
    overflow: hidden;
}

/* Light hover glow for future interactivity */
.terminal-output:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.15);
    cursor: pointer;
    /* Indication it might be clickable later */
}

.terminal-line {
    color: var(--accent-primary);
    text-shadow: 0 0 2px var(--accent-glow);
    white-space: normal;
    /* Allow text wrapping in small box */
    word-break: break-all;
    /* Break long strings if needed */
    z-index: 10;
}

/* Blinking cursor for terminal feel */
.terminal-line::after {
    content: '_';
    opacity: 1;
    animation: cursor-blink 1s step-end infinite;
    margin-left: 2px;
}

@keyframes cursor-blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* ===========================
   Layout
   =========================== */
.page-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-2xl);
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-lg) var(--space-3xl);
    min-height: 100vh;
}

.main-content {
    grid-column: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-2xl);
}

/* Sidebar - Commented out, keeping CSS for future use
.sidebar {
    grid-column: 2;
    position: sticky;
    top: var(--space-2xl);
    height: fit-content;
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}
*/

.footer {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--space-xl) 0;
    border-top: 2px dashed var(--border-default);
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

/* ===========================
/* ===========================
   Buttons
   =========================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: var(--text-sm);
    transition: all var(--transition-base);
    text-decoration: none;
    border: 2px solid transparent;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn:hover {
    text-decoration: none;
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 var(--accent-primary);
}

.btn-primary {
    background: var(--accent-primary);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.btn-primary:hover {
    background: var(--bg-card);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-neon);
    color: var(--accent-primary);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border-default);
}

.btn-secondary:hover {
    background: var(--bg-card);
    border-color: var(--accent-primary);
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 var(--accent-primary);
    color: var(--accent-primary);
}

.icon {
    width: 18px;
    height: 18px;
}

.icon-sm {
    width: 14px;
    height: 14px;
}

/* ===========================
   Main Content Area
   =========================== */
.main-content {
    padding-top: var(--space-3xl);
}

/* ===========================
   Section Styles
   =========================== */
section {
    margin-bottom: var(--space-3xl);
}

section h2 {
    font-size: var(--text-xl);
    font-weight: 600;
    margin-bottom: var(--space-2xl);
    color: var(--text-primary);
    position: relative;
    display: inline-block;
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: var(--space-sm) var(--space-md);
    border: 2px solid var(--accent-primary);
    background: rgba(var(--accent-primary-rgb), 0.03);
}

section h2::before {
    content: '> ';
    color: var(--accent-primary);
}

section h2::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-primary);
    box-shadow: 0 0 8px var(--accent-glow);
}

/* ===========================
   Projects Section
   =========================== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-xl);
}

.project-card {
    background: #050505;
    /* Almost Black (User Selection) */
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    transition: all var(--transition-normal);
    aspect-ratio: 2/3;
    /* Movie Poster Ratio (27x40) */
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    position: relative;
    z-index: 10;
    overflow: hidden;
}

/* Reduce scanline visibility on cards */
/* Scanline overlay removed for cleaner black aesthetic */

.project-card>* {
    position: relative;
    z-index: 2;
}

/* Pulsing dot indicator - Commented out
.project-card::before {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--accent-primary);
    border-radius: 0;
    box-shadow: 0 0 8px var(--accent-glow);
    animation: pulse-dot 2s ease-in-out infinite;
}
*/

/* Pulse animation - Commented out
@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}
*/

.project-card:hover {
    border-color: var(--accent-primary);
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 var(--accent-primary);
    background: var(--bg-secondary);
}

/* Placeholder cards */
.project-card.placeholder-card {
    opacity: 0.5;
    border-style: dashed;
}

.project-card.placeholder-card::before {
    background: var(--border-muted);
    box-shadow: none;
    animation: none;
}

.project-card.placeholder-card:hover {
    opacity: 0.8;
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.project-header h3 {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.project-status {
    font-size: var(--text-xs);
    font-weight: 600;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: var(--font-mono);
}

.status-active {
    background: rgba(var(--accent-primary-rgb), 0.15);
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
}

.status-maintained {
    background: rgba(255, 170, 0, 0.15);
    color: #cc8800;
    border: 1px solid var(--status-maintained);
}

.status-archived {
    background: rgba(136, 136, 136, 0.15);
    color: var(--status-archived);
    border: 1px solid var(--border-default);
}

.status-beta {
    background: rgba(var(--accent-primary-rgb), 0.15);
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
}

.project-description {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    flex-grow: 1;
    line-height: 1.7;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.tech-tag {
    font-size: var(--text-xs);
    font-family: var(--font-mono);
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
}

.project-links {
    display: flex;
    gap: var(--space-md);
    padding-top: var(--space-sm);
    border-top: 1px dashed var(--border-muted);
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    font-family: var(--font-mono);
}

.project-link:hover {
    color: var(--accent-primary);
    text-decoration: underline;
}

/* ===========================
   Skills Section
   =========================== */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    /* Adaptive default */
    gap: var(--space-lg);
}

/* Enforce 4 columns on desktop - Per user request */
@media (min-width: 1200px) {
    .project-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }

    .skills-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

/* Tablet: 2 columns (600-1199px) */
@media (min-width: 600px) and (max-width: 1199px) {
    .project-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .skills-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

.skill-category {
    background: #050505;
    /* Almost Black (User Selection) */
    border: 1px solid var(--border-default);
    padding: var(--space-lg);
    height: 100%;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    aspect-ratio: 1/1;
    /* Square box */
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Center content vertically in the box */
}

/* Reduce scanline visibility on skill cards */
/* Scanline overlay removed for cleaner black aesthetic */

.skill-category>* {
    position: relative;
    z-index: 2;
}

.skill-category:hover {
    border-color: var(--accent-primary);
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 var(--accent-primary);
}

.skill-category h3 {
    font-size: var(--text-sm);
    /* Reduced to prevent cutoff */
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: var(--space-md);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    /* Fixed: Prevent title wrapping */
}

.skill-category h3::before {
    content: '$ ';
    color: var(--accent-primary);
}

.skill-list li {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    padding: var(--space-xs) 0;
    border-bottom: 1px dashed var(--border-muted);
    font-family: var(--font-mono);
    white-space: nowrap;
    /* Prevent skill wrapping */
}

.skill-list li::before {
    content: '• ';
    color: var(--accent-primary);
}

.skill-list li:last-child {
    border-bottom: none;
}

/* ===========================
   Contact Section
   =========================== */
.contact p {
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
    font-size: var(--text-base);
}

.contact-links {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.contact-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    background: transparent;
    border: 2px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-weight: 500;
    transition: all var(--transition-base);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: var(--text-sm);
}

.contact-link:hover {
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
    color: var(--accent-primary);
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 var(--accent-primary);
    text-shadow: none;
}

/* ===========================
   Sidebar
   =========================== */
.sidebar-card {
    background: var(--bg-card);
    border: 2px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-xl);
    text-align: center;
}

.sidebar-avatar {
    margin-bottom: var(--space-lg);
}

.avatar-placeholder {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    background: var(--bg-tertiary);
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-primary);
    font-family: var(--font-display);
    border: 2px solid var(--accent-primary);
}

.sidebar-name {
    font-size: var(--text-xl);
    font-weight: 600;
    margin-bottom: var(--space-xs);
    font-family: var(--font-mono);
}

.sidebar-bio {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin-bottom: var(--space-lg);
    font-family: var(--font-mono);
}

.sidebar-stats {
    display: flex;
    justify-content: center;
    gap: var(--space-xl);
    margin-bottom: var(--space-lg);
    padding: var(--space-md) 0;
    border-top: 1px dashed var(--border-default);
    border-bottom: 1px dashed var(--border-default);
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--accent-primary);
    font-family: var(--font-display);
    text-shadow: 0 0 8px var(--accent-glow);
}

.stat-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--font-mono);
}

.sidebar-link {
    display: inline-block;
    font-size: var(--text-sm);
    font-weight: 500;
    font-family: var(--font-mono);
}

.sidebar-badge {
    text-align: center;
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.sidebar-badge span {
    display: block;
    margin-bottom: var(--space-xs);
}

/* ===========================
   Responsive Design
   =========================== */
@media (max-width: 900px) {

    /* Sticky Header - Mobile */
    .site-header {
        flex-direction: column;
        gap: var(--space-md);
        padding: var(--space-md);
    }

    .header-center {
        order: -1;
        padding: 0;
    }

    .header-title {
        font-size: 1.5rem;
    }

    .header-tagline {
        font-size: 0.75rem;
    }

    .logo img {
        width: 60px;
        height: 60px;
    }

    .upper-right-info {
        display: none;
        /* Hide Stargate on mobile for cleaner header */
    }

    .page-wrapper {
        grid-template-columns: 1fr;
        padding: var(--space-lg);
    }

    .sidebar {
        grid-column: 1;
        position: static;
        order: -1;
    }

    .sidebar-card {
        max-width: 400px;
        margin: 0 auto;
    }

    .hero {
        padding: var(--space-xl) 0;
    }

    .title {
        font-size: var(--text-3xl);
    }

    .tagline {
        font-size: var(--text-lg);
    }
}

@media (max-width: 600px) {
    .cta-buttons {
        flex-direction: column;
        align-items: center;
    }

    .btn {
        width: 100%;
        justify-content: center;
        max-width: 280px;
    }

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

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

/* ===========================
   High-Resolution Display Optimizations
   =========================== */

/* 2K+ Displays (Effective width > 1700px to account for OS chrome) */
@media (min-width: 1700px) {

    /* Reduce scanline opacity for better readability */
    body::before {
        background: repeating-linear-gradient(0deg,
                transparent 0px,
                transparent 2px,
                rgba(0, 0, 0, 0.20) 2px,
                /* Reduced from 0.40 */
                rgba(0, 0, 0, 0.20) 4px);
    }

    /* Larger base font size for 2K */
    html {
        font-size: 20px;
        /* Up from 18px default */
    }

    /* Wider layout for larger screens */
    .page-wrapper {
        max-width: 1600px;
        /* Increased for 2K displays - 4-column comfort */
    }

    /* Scale up logo */
    .logo img {
        width: 130px;
        height: 130px;
    }

    /* Larger clock and date */
    .clock {
        font-size: 1.125rem;
    }

    .date {
        font-size: 0.875rem;
    }
}

/* 4K+ Displays (Effective width > 2300px to account for OS chrome) */
@media (min-width: 2300px) {

    /* Further reduce scanline intensity with wider spacing */
    body::before {
        background: repeating-linear-gradient(0deg,
                transparent 0px,
                transparent 3px,
                /* Wider spacing */
                rgba(0, 0, 0, 0.15) 3px,
                /* Even lighter */
                rgba(0, 0, 0, 0.15) 5px);
    }

    /* Optimal font size for 4K */
    html {
        font-size: 20px;
        /* Reduced from 22px */
    }

    /* Wider layout for 4K */
    .page-wrapper {
        max-width: 1900px;
        padding: 0 var(--space-3xl) var(--space-3xl);
    }

    /* Scale up project cards */
    /* Enforce 4 columns on 4K too */
    .project-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: var(--space-2xl);
    }

    .project-card {
        padding: var(--space-2xl);
    }

    /* Scale up skills grid */
    /* Enforce 4 columns on 4K too */
    .skills-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        /* Fix overwrite */
        gap: var(--space-2xl);
    }

    .skill-category {
        padding: var(--space-2xl);
    }

    /* Larger logo for 4K */
    .logo img {
        width: 150px;
        height: 150px;
    }

    /* Scale up terminal output to match logo */
    .terminal-output {
        width: 150px;
        height: 150px;
        font-size: 13px;
    }

    /* Scale up terminal output to match logo */
    .terminal-output {
        width: 150px;
        height: 150px;
        font-size: 13px;
        /* Slightly larger text inside */
    }

    /* Larger clock and date for 4K */
    .clock {
        font-size: 1.25rem;
    }

    .date {
        font-size: 1rem;
    }

    /* Scale up section headings */
    section h2 {
        font-size: 2.5rem;
        padding: var(--space-md) var(--space-lg);
    }

    /* Larger title */
    /* Larger title (scaled down slightly) */
    .title {
        font-size: 3rem;
        /* Reduced from 3.5rem */
    }

    .tagline {
        font-size: 1.75rem;
    }
}


/* ===========================
   Animations
   =========================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.hero,
section,
.sidebar-card {
    animation: fadeIn 0.6s ease-out;
}

section:nth-child(2) {
    animation: slideInLeft 0.7s ease-out;
    animation-delay: 0.1s;
}

section:nth-child(3) {
    animation: slideInLeft 0.7s ease-out;
    animation-delay: 0.2s;
}

section:nth-child(4) {
    animation: slideInLeft 0.7s ease-out;
    animation-delay: 0.3s;
}

/* Glow pulse for focus states */
@keyframes glow-pulse {

    0%,
    100% {
        box-shadow: 0 0 5px var(--accent-glow);
    }

    50% {
        box-shadow: 0 0 20px var(--accent-glow), 0 0 30px var(--accent-glow);
    }
}

.btn-primary:focus,
.project-card:focus-within {
    animation: glow-pulse 2s ease-in-out infinite;
}

/* Font Families via Data Attribute */
[data-font="ibm"] {
    --font-display: 'IBM Plex Mono', monospace;
    --font-mono: 'IBM Plex Mono', monospace;
}

[data-font="vt323"] {
    --font-display: 'VT323', monospace;
    --font-mono: 'VT323', monospace;
    font-size: 1.4em;
}

/* VT323 is small, boost significantly */
[data-font="space"] {
    --font-display: 'Space Mono', monospace;
    --font-mono: 'Space Mono', monospace;
}

[data-font="fira"] {
    --font-display: 'Fira Code', monospace;
    --font-mono: 'Fira Code', monospace;
}

[data-font="jetbrains"] {
    --font-display: 'JetBrains Mono', monospace;
    --font-mono: 'JetBrains Mono', monospace;
}

/* --- STARGATE TERMINAL WIDGET --- */
:root {
    --lcd-green: #00ff41;
    --lcd-off: #003311;
    --bg-dark: #0a0a0a;
}

/* Container adapted for Upper Right Header - Transparent (Gate Only) */
.sg-terminal {
    background: transparent;
    /* Removed box background */
    border: none;
    /* Removed border */
    padding: 10px;
    font-family: 'Courier New', monospace;
    color: var(--lcd-green);
    box-shadow: none;
    /* Removed box glow */
    width: 180px;
    /* Reduced from 300px to prevent overlap */
    position: relative;
    transform: scale(0.7);
    /* Scale down slightly to fit */
    transform-origin: top right;
}

/* Scanline Effect - Disabled for gate-only view */
.sg-terminal::before {
    display: none;
    /* Removed scanline overlay */
}

@keyframes flicker {
    0% {
        opacity: 0.95
    }

    100% {
        opacity: 1
    }
}

.sg-header {
    border-bottom: 2px dashed var(--lcd-green);
    padding-bottom: 5px;
    margin-bottom: 10px;
    text-shadow: 2px 0 rgba(255, 0, 0, 0.5), -2px 0 rgba(0, 0, 255, 0.5);
    /* Aberration */
    font-weight: bold;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
}

.sg-footer {
    border-top: 2px dashed var(--lcd-green);
    padding-top: 5px;
    margin-top: 10px;
    text-align: center;
    text-shadow: 0 0 5px var(--lcd-green);
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.sg-footer:hover {
    background: var(--lcd-off);
    color: #fff;
}

/* The Gate Geometry */
.sg-display {
    position: relative;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stargate {
    width: 160px;
    height: 160px;
    position: relative;
}

.ring {
    border-radius: 50%;
    position: absolute;
    border: 2px solid var(--lcd-green);
    box-sizing: border-box;
    top: 0;
    left: 0;
}

.outer-ring {
    width: 100%;
    height: 100%;
    box-shadow: 0 0 10px var(--lcd-green), inset 0 0 8px rgba(0, 255, 65, 0.2);
}

.inner-ring {
    width: 84%;
    height: 84%;
    top: 8%;
    left: 8%;
    border: 4px dashed var(--lcd-green);
    opacity: 0.7;
    transition: transform 0.5s cubic-bezier(0.5, 0, 0.5, 1);
}

/* Chevrons */
.chevron {
    position: absolute;
    width: 12px;
    height: 8px;
    background: var(--bg-dark);
    border: 1px solid var(--lcd-green);
    top: -4px;
    left: 50%;
    margin-left: -6px;
    transform-origin: center 84px;
    /* 80px radius + 4px offset */
    transition: all 0.2s;
    z-index: 5;
}

.chevron.locked {
    background: var(--lcd-green);
    box-shadow: 0 0 10px var(--lcd-green);
}

.c1 {
    transform: rotate(0deg);
}

.c2 {
    transform: rotate(40deg);
}

.c3 {
    transform: rotate(80deg);
}

.c4 {
    transform: rotate(120deg);
}

.c5 {
    transform: rotate(160deg);
}

.c6 {
    transform: rotate(200deg);
}

.c7 {
    transform: rotate(240deg);
}

.c8 {
    transform: rotate(280deg);
}

.c9 {
    transform: rotate(320deg);
}

/* Event Horizon */
.event-horizon {
    position: absolute;
    top: 15%;
    left: 15%;
    width: 70%;
    height: 70%;
    background: radial-gradient(circle, var(--lcd-green) 0%, transparent 60%);
    border-radius: 50%;
    opacity: 0;
    transform: scale(0);
    transition: opacity 1s, transform 0.2s;
}

.event-horizon.active {
    opacity: 0.6;
    transform: scale(1);
    animation: shimmer 0.1s infinite alternate;
}

.kawoosh {
    animation: kawoosh-anim 1s ease-out forwards;
}

@keyframes shimmer {
    from {
        opacity: 0.5;
    }

    to {
        opacity: 0.7;
    }
}

@keyframes kawoosh-anim {
    0% {
        transform: scale(0);
        opacity: 1;
        background: #fff;
    }

    50% {
        transform: scale(1.5);
        opacity: 0.8;
        background: var(--lcd-green);
    }

    100% {
        transform: scale(1);
        opacity: 0.6;
        background: radial-gradient(circle, var(--lcd-green) 0%, transparent 60%);
    }
}

/* V4 Restore: Sun Jan  4 06:27:13 MST 2026 */