/* Google Stitch -> Osmo Migration Core Values */
:root {
    /* Core Palette */
    --primary: #386FA4;
    --secondary: #9E7682;
    --tertiary: #C36F09;
    --neutral-base: #75777B;

    /* Light Theme (M3 Structural) */
    --bg-body: #F1F3F4;
    --surface-card: #FFFFFF;
    --text-main: #202124;
    --text-muted: #5f6368;
    --border-color: #E8EAED;

    /* Semantic */
    --accent-blue: var(--primary);

    /* Shape & Form */
    --radius-card: 8px;
    --radius-btn: 4px;
    
    /* Spacing Units */
    --spacing: 8px;
    --gap: calc(var(--spacing) * 3); /* 24px */
    --nav-height: 70px;
}

:root[data-theme="dark"] {
    --bg-body: #131314;           
    --surface-card: #1E1F22;      
    --text-main: #f9fafb;         
    --text-muted: #9ca3af;        
    --border-color: #374151;      
    --accent-blue: #8AB4F8; /* Light blue popup for dark mode */
}

/* Base Styles */
* { box-sizing: border-box; margin: 0; padding: 0; }
html {
    background-color: var(--bg-body);
    overflow-x: hidden;
    overflow-y: scroll; /* Force vertical scrollbar track to prevent layout jumping between long/short pages */
    scroll-behavior: smooth;
    transition: background-color 0.3s ease;
}
body {
    margin: 0;
    padding: 0;
    font-family: 'Manrope', system-ui, -apple-system, sans-serif;
    color: var(--text-main);
    background-color: transparent;
    min-height: 100vh;
    transition: color 0.3s ease;
    line-height: 1.4;
}
button, input, select, textarea { font-family: inherit; }
h1, h2, h3, h4 { font-weight: 700; line-height: 1.2; color: var(--text-main); }
h1 { font-size: 3rem; } h2 { font-size: 2.2rem; } h3 { font-size: 1.5rem; }
p { font-weight: 400; margin-bottom: 16px; }

.text-primary { color: var(--primary); }
[data-theme="dark"] .text-primary { color: var(--text-main); }
.text-accent { color: var(--tertiary); }

/* The dark mode switch */
.label { display: inline-flex; align-items: center; cursor: pointer; color: var(--text-main); }
.toggle { isolation: isolate; position: relative; height: 18px; width: 36px; border-radius: 999px; overflow: hidden; background: var(--border-color); }
.toggle-state { display: none; }
.indicator { height: 100%; width: 200%; background: var(--text-muted); border-radius: 999px; transform: translate3d(-75%, 0, 0); transition: transform 0.4s cubic-bezier(0.85, 0.05, 0.18, 1.35); }
.toggle-state:checked ~ .indicator { transform: translate3d(25%, 0, 0); background: var(--accent-blue); }

/* Global Nav */
.navbar { position: fixed; top: 0; width: 100%; height: var(--nav-height); background: var(--bg-body); border-bottom: 1px solid var(--border-color); transition: border-color 0.3s, background 0.3s; z-index: 1000; display: flex; justify-content: center; }
.nav-container { width: 100%; max-width: 1200px; padding: 0 40px; display: flex; justify-content: space-between; align-items: center; }
.nav-logo { font-size: 1.8rem; font-weight: 800; text-decoration: none; color: var(--accent-blue); }
.nav-links { display: flex; gap: 32px; align-items: center; }
.nav-link { color: var(--text-main); text-decoration: none; font-weight: 600; font-size: 1.05rem; }

/* Main Content */
.main-content { max-width: 1200px; margin: 0 auto; padding: calc(var(--nav-height) + 40px) 40px 40px; }
section { display: flex; flex-direction: column; justify-content: flex-start; opacity: 0; transform: translateY(20px); transition: opacity 0.8s ease, transform 0.8s ease; padding: 40px 0; }
section.visible { opacity: 1; transform: translateY(0); }

.hero-content h1 { margin-bottom: 16px; font-weight: 800; letter-spacing: -1px; }
.hero-content h2 { color: var(--text-muted); font-size: 2rem; margin-bottom: 32px; font-weight: 400; }

/* Osmo Card UI (NO SHADOWS, 1PX BORDER) */
.card {
    background: var(--surface-card);
    border-radius: var(--radius-card); 
    padding: 32px;
    border: 1px solid var(--border-color);
    transition: transform 0.2s, background 0.2s;
}
.card:hover {
    transform: translateY(-4px); /* Lift without shadow */
}

/* Osmo Button UI (Pill, NO SHADOWS) */
.btn {
    white-space: nowrap;
    padding: 12px 24px;
    border-radius: var(--radius-btn); 
    background: var(--accent-blue);
    color: #fff;
    border: 1px solid var(--border-color);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
    text-decoration: none;
    display: inline-block;
}
[data-theme="dark"] .btn { color: #111827; border: 1px solid var(--accent-blue); }
.btn:hover { opacity: 0.9; transform: translateY(-2px); }

/* Geometric Social Icons */
.icon-btn {
    flex-shrink: 0;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-btn);
    background: var(--surface-card);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    transition: transform 0.2s, background 0.2s, color 0.2s;
}
.icon-btn:hover {
    transform: translateY(-4px);
    background: var(--secondary);
    color: #fff;
    border-color: var(--secondary);
}

/* Project Grid */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--gap); }
.project-card h3 { margin-bottom: 12px; }
.tech-stack { display: flex; gap: 8px; margin-top: 24px; flex-wrap: wrap; }

/* Tech Tags (Pills) */
.tech-tag { font-size: 0.75rem; padding: 6px 14px; border-radius: var(--radius-btn); font-weight: 700; color: #111; background: var(--border-color); border: 1px solid transparent; }
[data-theme="dark"] .tech-tag { color: #fff; background: var(--border-color); border: 1px solid var(--border-color); }

/* Dictionary mappings (Hardcoded from Linguist logic) */
.tech-tag[data-lang="html"] { background: #e34c26; color: #fff; border-color: #e34c26;}
.tech-tag[data-lang="css"] { background: #563d7c; color: #fff; border-color: #563d7c;}
.tech-tag[data-lang="javascript"] { background: #f1e05a; color: #111; border-color: #f1e05a;}
.tech-tag[data-lang="react"] { background: #61dafb; color: #111; border-color: #61dafb;}
.tech-tag[data-lang="node"] { background: #339933; color: #fff; border-color: #339933;}
.tech-tag[data-lang="python"] { background: #3572A5; color: #fff; border-color: #3572A5;}

/* Game UI (Zero shadow, rounded bounds, inline top score) */
.game-container { width: 320px; height: 320px; background: var(--border-color); border-radius: var(--radius-card); position: relative; touch-action: none; border: 1px solid var(--border-color); margin-top: 10px; }

.grid-bg { display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, 1fr); gap: 8px; width: 100%; height: 100%; padding: 12px; }
.grid-cell { background: var(--surface-card); border-radius: 8px; border: 1px solid var(--surface-card); }

#tile-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
.tile-wrapper { position: absolute; transition: transform 0.15s ease-in-out; display: flex; justify-content: center; align-items: center; }
.tile-inner { width: calc(100% - 12px); height: calc(100% - 12px); background: var(--surface-card); border-radius: 8px; display: flex; justify-content: center; align-items: center; font-size: 1.5rem; font-weight: 700; color: var(--accent-blue); border: 1px solid var(--accent-blue); transition: background 0.2s, color 0.2s; }

/* 2048 Progress Scaling (Letters A-K map to 2-2048) */
.tile-A .tile-inner { background: rgba(56, 111, 164, 0.05); } /* 2 */
.tile-B .tile-inner { background: rgba(56, 111, 164, 0.15); } /* 4 */
.tile-C .tile-inner { background: rgba(56, 111, 164, 0.3); } /* 8 */
.tile-D .tile-inner { background: rgba(56, 111, 164, 0.5); color: #fff; } /* 16 */
.tile-E .tile-inner { background: rgba(56, 111, 164, 0.8); color: #fff; border-color: transparent;} /* 32 */
.tile-F .tile-inner { background: var(--primary); color: #fff; border-color: transparent; } /* 64 */
.tile-G .tile-inner { background: rgba(158, 118, 130, 0.8); color: #fff; border-color: transparent; } /* 128 (Secondary mix) */
.tile-H .tile-inner { background: var(--secondary); color: #fff; border-color: transparent; } /* 256 */
.tile-I .tile-inner { background: rgba(195, 111, 9, 0.7); color: #fff; border-color: transparent; } /* 512 (Tertiary mix) */
.tile-J .tile-inner { background: rgba(195, 111, 9, 0.9); color: #fff; border-color: transparent; } /* 1024 */
.tile-K .tile-inner { background: var(--tertiary); color: #fff; border-color: transparent; } /* 2048 */

.tile-super .tile-inner { color: #fff; background: var(--text-main); border-color: var(--text-main); }
.game-message { position: absolute; inset: 0; background: rgba(0,0,0,0.8); border-radius: var(--radius-card); display: flex; flex-direction: column; justify-content: center; align-items: center; color: #fff; opacity: 1; z-index: 100; flex-direction: column; }


/* Code Blocks Styling */
pre { background: #fafafa; padding: 20px; border-radius: 12px; overflow-x: auto; font-family: monospace; font-size: 0.95rem; border: 1px solid var(--border-color); margin-bottom: 24px; }
pre code { background: transparent; padding: 0; border: none; font-size: 1em; } 
code { background: #fafafa; color: #e01258; padding: 4px 8px; border-radius: 6px; font-family: monospace; font-size: 0.9em; border: 1px solid var(--border-color); }

/* Note: syntax highlighting colors are now driven by Highlight.js CSS link tags! */
[data-theme="dark"] pre { border-color: #374151; background: #1f2937; } /* slightly elevate off bg */
[data-theme="dark"] code { background: #1f2937; border-color: #374151; }

.blog-list { display: flex; flex-direction: column; gap: 30px; margin-top: 30px;}
.blog-date { color: var(--text-muted); font-size: 0.9rem; font-weight: 700; text-transform: uppercase; margin-bottom: 8px; display: block;}
.blog-card { text-decoration: none; color: inherit; display: block; padding: 32px; border: 1px solid var(--border-color); border-radius: var(--radius-card); background: var(--surface-card); transition: transform 0.2s;}
.blog-card:hover { transform: translateY(-4px); }
.blog-title { margin-bottom: 8px; font-weight: 800; letter-spacing: -0.5px;}

.article-container { max-width: 680px; margin: 0 auto; width: 100%; }
.article-header { margin-bottom: 40px; }
.article-meta { display: flex; gap: 15px; color: var(--text-muted); font-size: 0.95rem; padding-bottom: 20px; border-bottom: 1px solid var(--border-color); }
.article-content { margin-top: 40px; }
.article-content h2 { margin-top: 40px; font-weight: 800; letter-spacing:-0.5px;}
.article-content a { color: var(--secondary); text-decoration: none; border-bottom: 1px solid var(--secondary); font-weight: 600; }
.article-content blockquote { border-left: 4px solid var(--secondary); padding: 16px 20px; font-style: italic; color: var(--text-muted); background: var(--surface-card); border-radius: 0 var(--radius-btn) var(--radius-btn) 0; }
.game-header .btn { background: var(--surface-card); color: var(--text-main); border: 1px solid var(--border-color); }
.game-header .btn:hover { background: var(--tertiary); color: #fff; border-color: var(--tertiary); }

.back-link { display: inline-flex; align-items: center; gap: 8px; color: var(--text-main); text-decoration: none; font-weight: 700; margin-bottom: 40px; transition: transform 0.2s, color 0.15s, border-color 0.15s; padding: 8px 16px; background: var(--surface-card); border-radius: var(--radius-btn); border: 1px solid var(--border-color); }
.back-link:hover { transform: translateY(-2px); color: var(--primary); border-color: var(--primary); }

/* Custom Brands */
.btn-resume { background: var(--surface-card); color: var(--text-main); border: 1px solid var(--border-color); }
[data-theme="dark"] .btn-resume { color: var(--text-main); border: 1px solid var(--border-color); }

.icon-btn[data-brand="email"]:hover { background: var(--secondary); border-color: var(--secondary); color: #fff; }
.icon-btn[data-brand="linkedin"]:hover { background: #0077b5; border-color: #0077b5; color: #fff; }
.icon-btn[data-brand="github"]:hover { background: #6e5494; border-color: #6e5494; color: #fff; }
.btn-resume:hover { background: #4A7C59 !important; border-color: #4A7C59 !important; color: #fff !important; }

/* Interactive Background */
#bg-canvas { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -10; pointer-events: none; opacity: 1; }

/* Desktop-only badge */
.badge-desktop {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: var(--radius-btn);
    background: var(--border-color);
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 12px;
}

/* ======================== */
/* Mobile Responsive Styles */
/* ======================== */

@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.2rem; }

    .nav-container { padding: 0 16px; }
    .nav-links { gap: 16px; }
    .nav-link { font-size: 0.9rem; }

    .main-content { padding: calc(var(--nav-height) + 20px) 16px 20px; }

    /* Hero: stack vertically, center everything */
    #hero {
        flex-direction: column !important;
        gap: 40px !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center;
    }
    .hero-content { min-width: 0 !important; width: 100%; }
    .hero-content h2 { font-size: 1.3rem; }

    /* Social links: wrap and center */
    .social-links {
        flex-wrap: wrap !important;
        justify-content: center !important;
    }
    .social-links .btn { margin-left: 0 !important; }

    /* Game: center and scale down on very small screens */
    .hero-game { flex-shrink: 1 !important; }
    .game-container { width: 280px; height: 280px; }

    /* Project grid: single column */
    .projects-grid { grid-template-columns: 1fr; }

    /* Article */
    .article-container { padding: 0; }

    /* Blog cards */
    .blog-card { padding: 20px; }
}

@media (max-width: 380px) {
    h1 { font-size: 1.6rem; }
    .game-container { width: 240px; height: 240px; }
    .nav-logo { font-size: 1.4rem; }
}