/* ==========================================================================
   Sameera Ayeshmantha - Core Design System & Layout Tokens
   ========================================================================== */

:root {
    --bg-color: #0b0f19;
    --bg-secondary: #0f172a;
    --surface-color: rgba(30, 41, 59, 0.6);
    --surface-card: rgba(26, 35, 50, 0.7);
    --surface-hover: rgba(45, 59, 85, 0.5);
    
    --primary: #0ea5e9;
    --primary-glow: rgba(14, 165, 233, 0.35);
    --secondary: #8b5cf6;
    --secondary-glow: rgba(139, 92, 246, 0.35);
    --accent-cyan: #06b6d4;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --border-subtle: rgba(255, 255, 255, 0.07);
    --border-glow: rgba(14, 165, 233, 0.4);
    
    --font-heading: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-body: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;
    --radius-full: 9999px;
    
    --transition-smooth: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    --transition-bounce: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Light Theme Variables (Ready for toggle) */
[data-theme="light"] {
    --bg-color: #f8fafc;
    --bg-secondary: #f1f5f9;
    --surface-color: rgba(255, 255, 255, 0.8);
    --surface-card: #ffffff;
    --surface-hover: rgba(241, 245, 249, 0.9);
    --text-main: #0f172a;
    --text-muted: #475569;
    --text-dim: #64748b;
    --border-subtle: rgba(0, 0, 0, 0.08);
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 85px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-body);
    text-decoration: none;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    line-height: 1.6;
}

/* --- Interactive Canvas Background --- */
#circuit-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -2;
    pointer-events: none;
    opacity: 0.65;
}

/* --- Radial Ambient Glows --- */
body::before,
body::after {
    content: '';
    position: fixed;
    width: 55vw;
    height: 55vw;
    border-radius: 50%;
    z-index: -3;
    filter: blur(120px);
    opacity: 0.12;
    pointer-events: none;
    will-change: transform;
}

body::before {
    top: -15%;
    left: -15%;
    background: radial-gradient(circle, var(--primary), transparent 65%);
    animation: ambientFloat1 24s infinite alternate ease-in-out;
}

body::after {
    bottom: -15%;
    right: -15%;
    background: radial-gradient(circle, var(--secondary), transparent 65%);
    animation: ambientFloat2 20s infinite alternate ease-in-out -4s;
}

@keyframes ambientFloat1 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(6%, 8%) scale(1.1); }
}

@keyframes ambientFloat2 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-6%, -8%) scale(1.15); }
}

/* --- Scrollbar Customization --- */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
    background: linear-gradient(var(--primary), var(--secondary));
    border-radius: 10px;
}

/* --- Main Layout Container --- */
.container {
    max-width: 1240px;
    margin: 110px auto 60px;
    padding: 0 5%;
    flex: 1;
    width: 100%;
}

/* --- Scroll Reveal Animations --- */
.reveal {
    opacity: 0;
    transform: translateY(35px);
    visibility: hidden;
    transition: opacity 1.1s cubic-bezier(0.25, 1, 0.5, 1), transform 1.1s cubic-bezier(0.25, 1, 0.5, 1), visibility 1.1s;
    will-change: opacity, transform;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

.reveal-delay-1 { transition-delay: 0.15s; }
.reveal-delay-2 { transition-delay: 0.3s; }
.reveal-delay-3 { transition-delay: 0.45s; }
.reveal-delay-4 { transition-delay: 0.6s; }

/* --- Section Typography & Headers --- */
.section-title {
    font-size: clamp(24px, 3.8vw, 30px);
    font-weight: 700;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.section-title i {
    color: var(--primary);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 15px;
    margin-top: -20px;
    margin-bottom: 35px;
    max-width: 650px;
}

/* --- Hero Section --- */
.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 50px;
    margin-bottom: 80px;
    padding: 20px 0;
}

.hero-text {
    flex: 1.2;
}

.greeting-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: rgba(14, 165, 233, 0.1);
    border: 1px solid rgba(14, 165, 233, 0.25);
    border-radius: var(--radius-full);
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-emerald);
    box-shadow: 0 0 10px var(--accent-emerald);
    animation: statusPulse 2s infinite ease-in-out;
}

@keyframes statusPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.6; }
}

.hero-title {
    font-size: clamp(28px, 5.8vw, 52px);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 16px;
    letter-spacing: -1px;
}

.hero-title span.gradient-text {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.typewriter {
    font-size: clamp(18px, 2.6vw, 24px);
    color: var(--text-muted);
    margin-bottom: 24px;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.typewriter #typing-text {
    color: var(--secondary);
    font-weight: 600;
    border-bottom: 2px solid var(--secondary);
    padding-bottom: 2px;
}

.hero-desc {
    color: var(--text-muted);
    line-height: 1.8;
    margin-bottom: 28px;
    font-size: 16px;
    max-width: 95%;
}

.hero-desc b {
    color: var(--text-main);
    font-weight: 600;
}

.hero-meta-row {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.hero-location {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-main);
    font-size: 14px;
    background: var(--surface-color);
    padding: 10px 20px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
    backdrop-filter: blur(10px);
    transition: var(--transition-smooth);
}

.hero-location:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.hero-cta-group {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

/* --- Hero Profile Box --- */
.hero-img-box {
    position: relative;
    width: clamp(210px, 60vw, 340px);
    aspect-ratio: 1/1;
    flex-shrink: 0;
}

.hero-img-box::before {
    content: '';
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    z-index: -1;
    filter: blur(25px);
    opacity: 0.45;
    animation: profileGlow 5s infinite alternate ease-in-out;
}

@keyframes profileGlow {
    0% { opacity: 0.35; filter: blur(20px); transform: scale(0.98); }
    100% { opacity: 0.7; filter: blur(35px); transform: scale(1.03); }
}

.profile-img-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    padding: 6px;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.6), rgba(139, 92, 246, 0.6));
}

.profile-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 5px solid var(--bg-color);
    transition: var(--transition-smooth);
    background-color: var(--bg-secondary);
}

.profile-img-wrap:hover .profile-img {
    transform: scale(1.02);
}

.hero-badge-floating {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: var(--surface-card);
    border: 1px solid var(--border-glow);
    backdrop-filter: blur(15px);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    animation: floatBadge 4s infinite alternate ease-in-out;
}

@keyframes floatBadge {
    0% { transform: translateY(0); }
    100% { transform: translateY(-8px); }
}

/* --- Stats Grid --- */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
    gap: 24px;
    margin-bottom: 80px;
}

.stat-card {
    background: var(--surface-color);
    backdrop-filter: blur(12px);
    padding: 28px 24px;
    border-radius: var(--radius-lg);
    text-align: center;
    border: 1px solid var(--border-subtle);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.stat-card:hover {
    transform: translateY(-6px);
    border-color: rgba(14, 165, 233, 0.35);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
}

.stat-card:hover::after {
    opacity: 1;
}

.stat-card h3 {
    font-size: 42px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
    line-height: 1.1;
}

.stat-card p {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- Services Grid --- */
.services-section {
    margin-bottom: 85px;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 28px;
}

.service-card {
    background: var(--surface-color);
    backdrop-filter: blur(14px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 38px 30px;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.service-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top right, rgba(14, 165, 233, 0.08), transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.service-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
}

.service-card:hover::after {
    opacity: 1;
}

.service-icon {
    font-size: 32px;
    color: var(--primary);
    margin-bottom: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.15), transparent);
    width: 66px;
    height: 66px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(14, 165, 233, 0.25);
    transition: var(--transition-bounce);
}

.service-card:hover .service-icon {
    transform: scale(1.1) rotate(4deg);
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--primary-glow);
}

.service-card.hardware .service-icon {
    color: var(--secondary);
    border-color: rgba(139, 92, 246, 0.25);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), transparent);
}

.service-card.hardware:hover {
    border-color: var(--secondary);
}

.service-card.hardware:hover .service-icon {
    box-shadow: 0 0 20px var(--secondary-glow);
}

.service-title {
    font-size: 21px;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--text-main);
}

.service-desc {
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.75;
}

/* --- Content Grid (Skills & Engineering Highlights) --- */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
    gap: 36px;
    margin-bottom: 85px;
}

.skills-wrapper {
    background: var(--surface-color);
    padding: 34px 28px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    backdrop-filter: blur(12px);
}

.skill-category {
    margin-bottom: 26px;
}

.skill-category:last-child {
    margin-bottom: 0;
}

.skill-category h4 {
    color: var(--text-main);
    margin-bottom: 14px;
    font-size: 15px;
    font-weight: 600;
    border-left: 3px solid var(--primary);
    padding-left: 12px;
}

.skill-category.hardware-cat h4 {
    border-left-color: var(--secondary);
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
    cursor: default;
}

.tag:hover {
    background: rgba(14, 165, 233, 0.12);
    color: var(--primary);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
}

.project-card {
    background: var(--surface-color);
    border: 1px solid var(--border-subtle);
    padding: 28px;
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(12px);
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--secondary);
    transition: width 0.35s ease;
}

.project-card.hardware::before {
    background: var(--primary);
}

.project-card:hover {
    transform: translateX(8px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.15);
}

.project-card:hover::before {
    width: 6px;
}

.project-card h4 {
    font-size: 19px;
    margin-bottom: 8px;
    color: var(--text-main);
}

.project-card p {
    color: var(--text-muted);
    font-size: 14.5px;
    line-height: 1.7;
    margin-bottom: 14px;
}

.project-tech {
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
    background: rgba(14, 165, 233, 0.1);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    display: inline-block;
    border: 1px solid rgba(14, 165, 233, 0.2);
}

/* --- Responsive Media Queries --- */
@media (max-width: 992px) {
    .hero {
        flex-direction: column;
        text-align: center;
        gap: 40px;
        margin-bottom: 60px;
    }
    .hero-text {
        order: 2;
        width: 100%;
    }
    .hero-img-box {
        order: 1;
        margin: 0 auto;
    }
    .hero-desc,
    .hero-location,
    .greeting-badge {
        margin-left: auto;
        margin-right: auto;
    }
    .hero-meta-row,
    .hero-cta-group,
    .typewriter {
        justify-content: center;
    }
    .content-grid {
        grid-template-columns: 1fr;
        gap: 28px;
    }
}

@media (max-width: 768px) {
    .container {
        margin-top: 85px;
        margin-bottom: 40px;
        padding: 0 4%;
    }
    .hero {
        padding: 10px 0;
        gap: 32px;
        margin-bottom: 50px;
    }
    .hero-title {
        letter-spacing: -0.5px;
        line-height: 1.2;
    }
    .hero-desc {
        font-size: 14.5px;
        line-height: 1.7;
        max-width: 100%;
    }
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
        margin-bottom: 60px;
    }
    .stat-card {
        padding: 20px 14px;
    }
    .stat-card h3 {
        font-size: 32px;
    }
    .stat-card p {
        font-size: 12px;
    }
    .services-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .service-card {
        padding: 28px 22px;
    }
    .services-section {
        margin-bottom: 65px;
    }
    .content-grid {
        margin-bottom: 65px;
    }
    .skills-wrapper {
        padding: 26px 20px;
    }
    .project-card {
        padding: 22px 18px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }
    .hero-meta-row {
        gap: 12px;
    }
    .hero-location {
        padding: 8px 16px;
        font-size: 13px;
    }
    .hero-cta-group {
        flex-direction: column;
        width: 100%;
        gap: 12px;
    }
    .hero-cta-group .btn-primary,
    .hero-cta-group .btn-secondary {
        width: 100%;
        justify-content: center;
        padding: 13px 20px;
    }
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .stat-card {
        padding: 18px 10px;
    }
    .stat-card h3 {
        font-size: 28px;
    }
    .stat-card p {
        font-size: 11px;
        letter-spacing: 0.5px;
    }
    .tags {
        gap: 7px;
    }
    .tag {
        padding: 6px 12px;
        font-size: 12.5px;
    }
}

@media (max-width: 360px) {
    .stats-container {
        grid-template-columns: 1fr;
    }
    .hero-title {
        font-size: 25px;
    }
    .stat-card h3 {
        font-size: 26px;
    }
}
