/* --- Main Page Styles ---
   Design tokens are defined in css/base.css (loaded before this file).
   -------------------------------------------------------------------- */

/* Force dark mode class on body */
body {
    background-color: var(--background-color);
    color: var(--text-color);
}

/* Base styles to ensure text color is inherited properly */
html, body {
    color: var(--text-color);
}

/* --- Refined Dark Mode Toggle Styles --- */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
}

.theme-switch {
    display: inline-block;
    height: 26px;
    position: relative;
    width: 50px;
}

.theme-switch input { display: none; }

.slider {
    background-color: var(--toggle-bg-light);
    bottom: 0; cursor: pointer; left: 0; position: absolute; right: 0; top: 0;
    transition: background-color 0.3s ease;
    border-radius: 13px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 5px;
}
body.dark-mode .slider { background-color: var(--toggle-bg-dark); }

.slider::before {
    background-color: var(--toggle-circle-light);
    bottom: 3px; content: ""; height: 20px; left: 3px; position: absolute;
    transition: transform 0.3s ease, background-color 0.3s ease;
    width: 20px; border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    z-index: 2;
}
body.dark-mode .slider::before { background-color: var(--toggle-circle-dark); }

.slider .fa-sun, .slider .fa-moon {
    font-size: 12px; color: var(--toggle-icon-light);
    transition: opacity 0.3s ease, color 0.3s ease; z-index: 1;
}
.slider .fa-moon { color: var(--toggle-icon-dark); }

input:checked + .slider::before { transform: translateX(24px); }

/* Icon visibility based on mode */
.slider .fa-sun { opacity: 1; }
.slider .fa-moon { opacity: 0; }
input:checked + .slider .fa-sun { opacity: 0; }
input:checked + .slider .fa-moon { opacity: 1; }
/* --- End Dark Mode Toggle Styles --- */


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

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height) + 20px);
    font-size: var(--base-font-size);
    overflow-x: hidden; /* prevent horizontal scroll from any overflowing element */
}

body {
    font-family: var(--font-primary);
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.7;
    font-size: 1rem;
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--heading-color);
    margin-bottom: 0.75em;
    font-weight: 700;
    line-height: 1.3;
    transition: color 0.3s ease;
    letter-spacing: -0.02em;
}

h1 { font-size: clamp(2.5rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.8rem, 4vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.75rem); }

p { margin-bottom: 1.25em; max-width: 65ch; }
section p { max-width: 60ch; }

a {
    color: #ffffff;
    text-decoration: none;
    transition: color 0.2s ease, opacity 0.2s ease;
}
a:hover {
    color: var(--primary-color);
    opacity: 0.8;
    text-decoration: none;
}

img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; }

.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.content-section {
    padding: clamp(3rem, 8vh, 4rem) 0; /* Reduced from 4rem, 10vh, 6rem */
    transition: background-color 0.3s ease;
}

.section-title {
    text-align: center;
    margin-bottom: clamp(2.5rem, 6vw, 4rem);
    font-size: clamp(2rem, 5vw, 2.8rem);
    position: relative;
    padding-bottom: 1rem;
}
.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 4px;
    background-color: var(--primary-color);
    border-radius: 2px;
    transition: background-color 0.3s ease;
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 0.75rem 1.75rem;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    font-size: 0.95rem;
    margin: 0.5rem;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}
.btn-primary:hover {
    background-color: color-mix(in srgb, var(--primary-color) 90%, black);
    border-color: color-mix(in srgb, var(--primary-color) 90%, black);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background-color: transparent;
    color: #7EB6FF; /* Lighter shade of blue */
    border-color: #7EB6FF;
}
.btn-secondary:hover {
    background-color: var(--primary-color);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.btn-outline {
    background-color: transparent;
    color: var(--text-color);
    border-color: var(--border-color);
}
.btn-outline:hover {
    background-color: var(--highlight-bg);
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn i {
    margin-right: 0.5rem;
}

/* --- Header & Navigation --- */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background-color: var(--header-bg);
    box-shadow: var(--header-shadow);
    z-index: 1000;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
body.dark-mode .site-header {
    background-color: var(--header-bg-dark);
    box-shadow: var(--header-shadow-dark);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

/* Desktop Navigation Structure */
.main-nav {
    display: flex;
    align-items: center;
}
.main-nav ul {
    display: flex;
    align-items: center;
}
.main-nav li {
    margin-left: 1.75rem;
}
.main-nav a {
    color: var(--header-text);
    font-weight: 500;
    position: relative;
    padding: 0.5rem 0;
    transition: color 0.3s ease;
}
body.dark-mode .main-nav a {
    color: var(--header-text-dark);
}

.main-nav a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}
.main-nav a:hover::after,
.main-nav a.active::after {
    width: 100%;
}
.main-nav a:hover,
.main-nav a.active {
    color: var(--primary-color);
}

/* Dropdown menu — desktop */
.nav-dropdown {
    position: relative;
}
.dropdown-menu {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    min-width: 160px;
    padding: 0.5rem 0;
    list-style: none;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 200;
}
body.dark-mode .dropdown-menu {
    background-color: var(--surface-color-dark);
    border-color: var(--border-color);
}
.nav-dropdown:hover .dropdown-menu,
.nav-dropdown:focus-within .dropdown-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
.dropdown-menu li {
    margin: 0;
}
.dropdown-menu a {
    display: block;
    padding: 0.5rem 1rem;
    white-space: nowrap;
}
.dropdown-menu a::after {
    display: none;
}
.nav-dropdown-toggle i {
    font-size: 0.75em;
    margin-left: 0.25rem;
    transition: transform 0.2s ease;
}

/* Mobile Navigation Toggle */
.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--header-text);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s ease;
    padding: 0.5rem;
}
body.dark-mode .menu-toggle {
    color: var(--header-text-dark);
}
.menu-toggle:hover {
    color: var(--primary-color);
}

/* Logo */
.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
}

/* Mobile Theme Toggle (Hidden on Desktop) */
.mobile-theme-toggle {
    display: none;
}

/* --- Hero Section --- */
.hero-section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    padding: 6rem 0 3rem;
    background: linear-gradient(135deg, #0f172a 0%, #1a3a5c 40%, #0f2d4a 70%, #0f172a 100%);
    color: white;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    border-radius: 1rem;
    background-color: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.hero-section h1 {
    color: white;
    margin-bottom: 0.5rem;
    font-weight: 800;
}

.hero-section h2 {
    color: var(--accent-color);
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.hero-section .tagline {
    font-size: clamp(1rem, 2vw, 1.25rem);
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-cta {
    margin-top: 2rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.scroll-down-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    animation: bounce 2s infinite;
}

.scroll-down-indicator a {
    color: white;
    font-size: 1.5rem;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.scroll-down-indicator a:hover {
    opacity: 1;
}

/* Hero content entrance — applied to .hero-content (safe: not body, doesn't break fixed) */
@keyframes heroEntrance {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}
.hero-content {
    animation: heroEntrance 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both;
}
@media (prefers-reduced-motion: reduce) {
    .hero-content { animation: none; }
}

/* ── Scroll-to-top button ────────────────────────────────────────────────── */
#scroll-top-btn {
    position: fixed;
    bottom: 130px; /* above chatbot toggle */
    right: 28px;
    z-index: 9997;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(76, 154, 255, 0.35);
    color: #F1F5F9;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease, background 0.2s ease, border-color 0.2s ease;
}
#scroll-top-btn.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
#scroll-top-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
}
@media (max-width: 480px) {
    #scroll-top-btn { right: 16px; bottom: 114px; }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Hero section — dark vignette over bottom-right to suppress background image watermarks */
.hero-section::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 100% 100%, rgba(15, 23, 42, 0.92) 0%, transparent 55%),
        radial-gradient(ellipse at 0% 100%, rgba(15, 23, 42, 0.5) 0%, transparent 40%);
    pointer-events: none;
    z-index: 0;
}
/* hero-content needs z-index to sit above the ::after vignette overlay */
.hero-content {
    position: relative;
    z-index: 1;
}
/* scroll-down-indicator must stay position:absolute (set in base styles below);
   only add z-index here so it renders above the ::after overlay */
.scroll-down-indicator {
    z-index: 1;
}

/* Header — scrolled state: stronger shadow + fully opaque background */
.site-header.scrolled {
    background-color: rgba(15, 23, 42, 0.99);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.45);
}

/* --- About Section --- */
.about-section {
    background-color: var(--surface-color);
    transition: background-color 0.3s ease;
}
body.dark-mode .about-section {
    background-color: var(--surface-color-dark);
}

.about-container {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 3rem;
    align-items: start;
}

.about-image {
    position: relative;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color-light-enhanced); /* Enhanced border */
}

.about-image img {
    width: 100%;
    height: auto;
    transition: transform 0.5s ease;
}

.about-image:hover img {
    transform: scale(1.03);
}

.about-social {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    padding: 1rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.about-social a {
    color: white;
    font-size: 1.25rem;
    transition: transform 0.3s ease, color 0.3s ease;
}

.about-social a:hover {
    color: var(--accent-color);
    transform: translateY(-3px);
}

.about-text h2 {
    margin-bottom: 1.5rem;
    position: relative;
    display: inline-block;
}

.about-text h2::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    width: 50px;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

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

.about-highlights {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 2.5rem;
}

.highlight {
    background-color: var(--highlight-bg);
    padding: 1.5rem;
    border-radius: 0.75rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-left: 3px solid var(--primary-color);
}

.highlight:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.highlight i {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.highlight h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.highlight p {
    font-size: 0.9rem;
    margin-bottom: 0;
}

/* --- Experience Section (Timeline) --- */
.experience-section {
    background-color: var(--background-color);
    transition: background-color 0.3s ease;
}
body.dark-mode .experience-section {
    background-color: var(--background-color-dark);
}

.timeline {
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 0;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 3px;
    background-color: var(--border-color);
    transform: translateX(-50%);
}
body.dark-mode .timeline::before {
    background-color: var(--border-color-dark);
}

.timeline-item {
    position: relative;
    margin-bottom: 3rem;
    width: 100%;
}

.timeline-item:nth-child(odd) {
    padding-right: calc(50% + 2rem);
}

.timeline-item:nth-child(even) {
    padding-left: calc(50% + 2rem);
}

.timeline-marker {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background-color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 1;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.timeline-content {
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color-light-enhanced); /* Enhanced border */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}
body.dark-mode .timeline-content {
    background-color: var(--surface-color-dark);
}

.timeline-content:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.timeline-header {
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color-light-enhanced); /* Enhanced border */
    padding-bottom: 1rem;
}
body.dark-mode .timeline-header {
    border-bottom-color: var(--border-color-dark);
}

.timeline-header h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.timeline-company {
    font-weight: 600;
    margin-right: 1rem;
}

.timeline-location {
    color: var(--secondary-color);
    margin-right: 1rem;
}

.timeline-period {
    display: block;
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin-top: 0.25rem;
}

.timeline-body ul {
    padding-left: 1.25rem;
    list-style-type: disc;
}

.timeline-body li {
    margin-bottom: 0.5rem;
    list-style-type: disc;
}

/* Animation classes for timeline */
.fade-in-left {
    animation-name: fadeInLeft;
}

.fade-in-right {
    animation-name: fadeInRight;
}

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

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

/* --- Portfolio Section --- */
.portfolio-section {
    background-color: var(--surface-color);
    transition: background-color 0.3s ease;
}
body.dark-mode .portfolio-section {
    background-color: var(--surface-color-dark);
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.portfolio-item {
    background-color: var(--background-color);
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color-light-enhanced); /* Enhanced border */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}
body.dark-mode .portfolio-item {
    background-color: var(--background-color-dark);
}

.portfolio-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(76, 154, 255, 0.18), 0 10px 25px rgba(0, 0, 0, 0.15);
}

.portfolio-image-container {
    position: relative;
    overflow: hidden;
    height: 200px;
    aspect-ratio: 16 / 9; /* reserves space before image loads — eliminates CLS */
}

.portfolio-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.portfolio-item:hover .portfolio-image {
    transform: scale(1.05);
}

.portfolio-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 82, 204, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
body.dark-mode .portfolio-overlay {
    background-color: rgba(76, 154, 255, 0.8);
}

.portfolio-item:hover .portfolio-overlay {
    opacity: 1;
}

.portfolio-overlay-content {
    display: flex;
    gap: 1rem;
}

.portfolio-link {
    width: 48px;
    height: 48px;
    background-color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.portfolio-link:hover {
    transform: translateY(-3px);
    background-color: var(--accent-color);
    color: white;
}

.portfolio-info {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.portfolio-info h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--heading-color);
}
body.dark-mode .portfolio-info h3 {
    color: var(--heading-color-dark);
}

.portfolio-info p {
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.portfolio-info p:not(.tech-stack) {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tech-stack {
    display: block;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    color: var(--secondary-color);
}

.portfolio-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.portfolio-links .btn {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: transparent;
}

.portfolio-links .btn:hover {
    background-color: var(--primary-color);
    color: #fff;
    transform: translateY(-2px);
}

/* --- Skills Section --- */
.skills-section {
    background-color: var(--background-color);
    transition: background-color 0.3s ease;
}
body.dark-mode .skills-section {
    background-color: var(--background-color-dark);
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.skill-category {
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color-light-enhanced); /* Enhanced border */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
body.dark-mode .skill-category {
    background-color: var(--surface-color-dark);
}

.skill-category:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.skill-category h3 {
    font-size: 1.25rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary-color);
    color: var(--heading-color);
}
body.dark-mode .skill-category h3 {
    color: var(--heading-color-dark);
}

.skill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.skill-tag {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: rgba(126, 182, 255, 0.15); /* Lighter background with blue tint */
    color: #7EB6FF; /* Lighter shade of blue */
    border-radius: 2rem;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.3s ease;
}
body.dark-mode .skill-tag {
    background-color: var(--highlight-bg-dark);
}

.skill-tag:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-3px);
}

/* --- Achievements Section --- */
.achievements-section {
    background-color: var(--surface-color);
    transition: background-color 0.3s ease;
}
body.dark-mode .achievements-section {
    background-color: var(--surface-color-dark);
}

.achievements-list {
    max-width: 900px;
    margin: 0 auto;
}

.achievements-list li {
    display: flex;
    align-items: flex-start;
    margin-bottom: 2.5rem;
    padding: 1.5rem;
    background-color: var(--background-color);
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color-light-enhanced); /* Enhanced border */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
body.dark-mode .achievements-list li {
    background-color: var(--background-color-dark);
}

.achievements-list li:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.achievement-icon {
    font-size: 1.5rem;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1.5rem;
    flex-shrink: 0;
}

.achievement-details h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--heading-color);
}
body.dark-mode .achievement-details h3 {
    color: var(--heading-color-dark);
}

.achievement-details p {
    margin-bottom: 0;
}

/* --- Education Section --- */
.education-section {
    background-color: var(--background-color);
    transition: background-color 0.3s ease;
}
body.dark-mode .education-section {
    background-color: var(--background-color-dark);
}

.education-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 1000px;
    margin: 0 auto;
}

.education-item {
    display: flex;
    align-items: flex-start;
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color-light-enhanced); /* Enhanced border */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
body.dark-mode .education-item {
    background-color: var(--surface-color-dark);
}

.education-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.education-icon {
    font-size: 1.25rem;
    color: white;
    background-color: var(--primary-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    flex-shrink: 0;
}

.education-details h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--heading-color);
}
body.dark-mode .education-details h3 {
    color: var(--heading-color-dark);
}

.education-details p {
    font-size: 0.9rem;
    margin-bottom: 0;
    color: var(--secondary-color);
}

/* --- Contact Section --- */
.contact-section {
    background-color: var(--surface-color);
    text-align: center;
    transition: background-color 0.3s ease;
}
body.dark-mode .contact-section {
    background-color: var(--surface-color-dark);
}

.contact-intro {
    max-width: 700px;
    margin: 0 auto 3rem;
}

.contact-methods {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 3rem;
}

.contact-method {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    background-color: var(--highlight-bg);
    border-radius: 0.75rem;
    border: 1px solid var(--border-color-light-enhanced); /* Enhanced border */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    min-width: 200px;
}
body.dark-mode .contact-method {
    background-color: var(--highlight-bg-dark);
}

.contact-method:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.contact-method i {
    font-size: 1.5rem;
    color: #7EB6FF; /* Lighter shade of blue */
    margin-bottom: 1rem;
}

.contact-method a {
    font-weight: 500;
    color: #7EB6FF; /* Lighter shade of blue */
}

.contact-method a:hover {
    color: #A5CFFF; /* Even lighter shade on hover */
    opacity: 1;
}

.cta-container {
    margin-top: 3rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

/* --- Footer --- */
.site-footer {
    background-color: var(--heading-color);
    color: white;
    padding: 2rem 0;
    text-align: center;
    transition: background-color 0.3s ease;
    padding-bottom: calc(2rem + 37px); /* Add extra padding to account for ticker height */
}
body.dark-mode .site-footer {
    background-color: var(--background-color-dark);
}

.site-footer .container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
}

.site-footer p {
    margin-bottom: 0;
}

.footer-social {
    display: flex;
    gap: 1rem;
}

.footer-social a {
    color: white;
    font-size: 1.25rem;
    transition: color 0.3s ease, transform 0.3s ease;
}

.footer-social a:hover {
    color: var(--accent-color);
    transform: translateY(-3px);
}

/* --- Animation Classes --- */
.animate-on-scroll {
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in {
    transform: translateY(20px);
}

.fade-in-up {
    transform: translateY(30px);
}

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

/* --- Responsive Design --- */
@media (max-width: 992px) {
    .about-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .about-image {
        max-width: 400px;
        margin: 0 auto;
    }
    
    .timeline::before {
        left: 40px;
    }
    
    .timeline-item:nth-child(odd),
    .timeline-item:nth-child(even) {
        padding-left: 80px;
        padding-right: 0;
    }
    
    .timeline-marker {
        left: 40px;
    }
}

@media (max-width: 768px) {
    /* Disable fixed-attachment parallax — causes GPU paint on every scroll frame on iOS */
    .hero-section {
        background-attachment: scroll;
    }

    .site-header {
        height: auto;
        min-height: var(--header-height);
    }
    
    .header-container {
        flex-wrap: wrap;
        padding: 1rem 0;
    }
    
    .logo {
        flex: 1;
    }
    
    .nav-wrapper {
        order: 3;
    }
    
    .desktop-theme-toggle {
        display: none;
    }
    
    .mobile-theme-toggle {
        display: block;
        margin: 1rem 0;
    }
    
    .menu-toggle {
        display: block;
        order: 2;
    }
    
    .main-nav {
        flex-basis: 100%;
        order: 4;
        flex-direction: column;
        align-items: flex-start;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
      .main-nav.active {
        max-height: 800px;
        overflow-y: auto;
    }
    
    .main-nav ul {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
    
    .main-nav li {
        margin: 0.5rem 0;
        width: 100%;
    }
    
    .main-nav a {
        display: block;
        padding: 0.5rem 0;
        width: 100%;
    }

    /* Dropdown — mobile overrides */
    .dropdown-menu {
        position: static;
        background: transparent;
        border: none;
        box-shadow: none;
        border-radius: 0;
        padding: 0;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        padding-left: 1rem;
    }
    .nav-dropdown.dropdown-open .dropdown-menu {
        max-height: 300px;
    }
    .nav-dropdown.dropdown-open .nav-dropdown-toggle i {
        transform: rotate(180deg);
    }

    .hero-cta {
        flex-direction: column;
        align-items: center;
    }
    
    .hero-cta .btn {
        width: 100%;
        margin: 0.5rem 0;
    }
    
    .portfolio-grid,
    .skills-grid,
    .education-grid {
        grid-template-columns: 1fr;
    }
    
    .contact-methods {
        flex-direction: column;
        align-items: center;
    }
    
    .contact-method {
        width: 100%;
    }
    
    .site-footer .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .news-ticker {
        margin-left: 85px; /* Adjust margin to match new label width */
    }
}

@media (max-width: 576px) {
    .section-title {
        font-size: 1.8rem;
    }
    
    .timeline-item {
        margin-bottom: 2rem;
    }
    
    .timeline::before {
        left: 20px;
    }
    
    .timeline-item:nth-child(odd),
    .timeline-item:nth-child(even) {
        padding-left: 60px;
    }
    
    .timeline-marker {
        left: 20px;
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
    
    .achievement-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        margin-right: 1rem;
    }
    
    .cta-container {
        flex-direction: column;
    }
    
    .cta-container .btn {
        width: 100%;
    }
}

/* --- Chatbot Styles --- */
.chat-fab {
    position: fixed;
    bottom: calc(2rem + 50px); /* Increased distance from bottom */
    right: 2rem;
    width: 60px;
    height: 60px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, background-color 0.3s ease;
    z-index: 1010; /* Above header */
}

.chat-fab:hover {
    transform: scale(1.1);
    background-color: color-mix(in srgb, var(--primary-color) 85%, black);
}

.chat-window {
    position: fixed;
    bottom: calc(2rem + 120px); /* Increased to maintain same distance from chat-fab */
    right: 2rem;
    width: 350px;
    max-width: calc(100vw - 4rem);
    height: 500px;
    max-height: calc(100vh - 4rem - 70px);
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1009; /* Below FAB when closed, but above content */
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    pointer-events: none; /* Prevent interaction when hidden */
}

.chat-window:not([hidden]) {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto; /* Allow interaction when visible */
}

body.dark-mode .chat-window {
    background-color: var(--surface-color-dark);
    border-color: var(--border-color-dark);
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background-color: var(--primary-color);
    color: white;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

body.dark-mode .chat-header {
    border-bottom-color: var(--border-color-dark);
}

.chat-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: white;
}

.chat-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.chat-close-btn:hover {
    opacity: 1;
}

.chat-messages {
    flex-grow: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background-color: var(--background-color);
    transition: background-color 0.3s ease;
}

body.dark-mode .chat-messages {
    background-color: var(--background-color-dark);
}

.message {
    padding: 0.6rem 1rem;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
    line-height: 1.4;
    font-size: 0.9rem;
}

.bot-message {
    background-color: var(--surface-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

body.dark-mode .bot-message {
    background-color: var(--surface-color-dark);
    color: var(--text-color-dark);
    border-color: var(--border-color-dark);
}

.user-message {
    background-color: var(--primary-color);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.thinking-message {
    font-style: italic;
    color: var(--secondary-color);
    align-self: flex-start;
    background-color: transparent;
    padding: 0.2rem 0;
    font-size: 0.85rem;
}
body.dark-mode .thinking-message {
    color: var(--secondary-color-dark);
}

.chat-input-area {
    display: flex;
    padding: 0.75rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--surface-color);
    flex-shrink: 0;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

body.dark-mode .chat-input-area {
    border-top-color: var(--border-color-dark);
    background-color: var(--surface-color-dark);
}

#chat-input {
    flex-grow: 1;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.9rem;
    margin-right: 0.5rem;
    background-color: var(--background-color);
    color: var(--text-color);
    transition: border-color 0.2s ease, background-color 0.3s ease, color 0.3s ease;
}

body.dark-mode #chat-input {
    background-color: var(--background-color-dark);
    color: var(--text-color-dark);
    border-color: var(--border-color-dark);
}

#chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 82, 204, 0.2);
}
body.dark-mode #chat-input:focus {
     box-shadow: 0 0 0 2px rgba(76, 154, 255, 0.2);
}


#chat-send-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

#chat-send-btn:hover {
    background-color: color-mix(in srgb, var(--primary-color) 85%, black);
}

#chat-send-btn:disabled {
    background-color: var(--secondary-color);
    cursor: not-allowed;
}
body.dark-mode #chat-send-btn:disabled {
    background-color: var(--secondary-color-dark);
}

/* --- End Chatbot Styles --- */

/* --- Shortcuts Section --- */
.shortcuts-section {
    background-color: var(--surface-color);
    transition: background-color 0.3s ease;
    padding-top: 0; /* Remove top padding since it's following another section */
}
body.dark-mode .shortcuts-section {
    background-color: var(--surface-color-dark);
}

.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(2, 250px); /* Fixed width columns */
    gap: 2rem;
    justify-content: center; /* Center the grid items */
}

.shortcut-item {
    background-color: var(--background-color);
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color-light-enhanced);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-decoration: none;
    color: var(--text-color);
    height: auto;
    min-height: 120px;
    max-width: none; /* Remove max-width restriction */
    margin: 0 auto;
    padding: 0.75rem;
}
body.dark-mode .shortcut-item {
    background-color: var(--background-color-dark);
    color: var(--text-color-dark);
}

.shortcut-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.shortcut-image {
    width: 80%; /* Back to original larger size */
    height: auto;
    max-height: 100px; /* Control maximum height */
    object-fit: contain;
    transition: transform 0.5s ease;
    margin: 1rem auto;
    display: block;
    object-position: center;
}

.shortcut-item:hover .shortcut-image {
    transform: scale(1.05);
}

.shortcut-info {
    padding: 0.75rem;
    text-align: center; /* Center align all text */
}

.shortcut-info h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--heading-color);
    text-align: center; /* Ensure headings are centered */
}
body.dark-mode .shortcut-info h3 {
    color: var(--heading-color-dark);
}

.shortcut-info p {
    font-size: 0.85rem;
    margin-bottom: 0;
    color: var(--secondary-color);
    text-align: center; /* Ensure paragraphs are centered */
}
body.dark-mode .shortcut-info p {
    color: var(--secondary-color-dark);
}

/* Responsive adjustments for shortcuts */
@media (max-width: 768px) {
    .shortcuts-grid {
        grid-template-columns: 250px; /* Single column on mobile */
        gap: 1rem;
    }
    
    .shortcut-item {
        margin-bottom: 1.5rem;
    }
}

/* RSS News Ticker Styles */
.news-ticker-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
    padding: 8px 0;
    overflow: hidden;
    z-index: 1000;
    height: 37px; /* Set explicit height */
}

.news-ticker-label {
    background-color: var(--primary-color);
    color: white;
    padding: 5px 10px;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    text-align: center;
    line-height: 1.2;
    font-size: 0.9rem;
}

.news-ticker {
    margin-left: 101px;
    overflow: hidden;
    white-space: nowrap;
    padding-right: 80px; /* Add padding to prevent overlap with chat button */
}

.news-ticker ul {
    display: inline-block;
    padding-left: 0;
    margin: 0;
    animation: ticker 500s linear infinite; /* Slowed down from 60s to 600s (10 minutes) */
}

.news-ticker ul li {
    display: inline-block;
    padding: 0 30px;
    color: #333;
}

@keyframes ticker {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

/* Dark mode support for the ticker */
body.dark-mode .news-ticker-container {
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-color);
}

body.dark-mode .news-ticker ul li {
    color: var(--text-color);
}

/* ==========================================================================
   Responsive styles (merged from responsive-fixes.css)
   ========================================================================== */

/* Inline style replacement */
.portfolio-image--top { object-position: top; }

/* EmbedAI widget position */
.embedai-widget-container { bottom: 80px !important; }

/* Global image safety */
img { max-width: 100%; height: auto; }

/* --- Mobile (≤480px) --- */
@media screen and (max-width: 480px) {
    html { font-size: 14px; }
    .hero-section h1 { font-size: 2rem; }
    .hero-section h2 { font-size: 1.2rem; }
    .hero-section .tagline { font-size: 0.9rem; }
    .btn { padding: 0.6rem 1.2rem; font-size: 0.9rem; width: 100%; margin: 0.3rem 0; }
    .section-title { font-size: 1.6rem; }
    .about-highlights { grid-template-columns: 1fr; }
    .timeline-content { padding: 1rem; }
    .timeline-header h3 { font-size: 1.1rem; }
    .portfolio-item { margin-bottom: 1.5rem; }
    .portfolio-image-container { height: 180px; }
    .skill-category { padding: 1rem; }
    .skill-tag { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
    .achievements-list li { padding: 1rem; flex-direction: column; }
    .achievement-icon { margin-bottom: 1rem; margin-right: 0; }
    .contact-method { padding: 1rem; }
}

/* --- Tablet (481px–768px) --- */
@media screen and (min-width: 481px) and (max-width: 768px) {
    .about-highlights { grid-template-columns: repeat(2, 1fr); }
    .portfolio-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
    .skills-grid { grid-template-columns: repeat(2, 1fr); }
    .education-grid { grid-template-columns: repeat(2, 1fr); }
    .btn { padding: 0.7rem 1.5rem; }
}

/* --- Mobile (≤768px) --- */
@media screen and (max-width: 768px) {
    .site-header { position: fixed; top: 0; left: 0; width: 100%; z-index: 1000; }
    .logo { font-size: 1.3rem; padding: 0.5rem 0; }
    .main-nav { background-color: var(--surface-color); width: 100%; padding: 1rem; border-radius: 0 0 0.5rem 0.5rem; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
    body.dark-mode .main-nav { background-color: var(--surface-color-dark); }
    .main-nav li { margin: 0.75rem 0; }
    .main-nav a { padding: 0.5rem; display: block; }
    .menu-toggle { display: block; background: transparent; border: none; font-size: 1.5rem; cursor: pointer; padding: 0.5rem; z-index: 1001; }
    .hero-section { padding-top: calc(var(--header-height) + 2rem); }
    .container { padding: 0 1rem; }
    .portfolio-links { flex-direction: column; align-items: stretch; }
    .portfolio-links .btn { margin: 0.3rem 0; }
    .timeline::before { left: 30px; }
    .timeline-item:nth-child(odd), .timeline-item:nth-child(even) { padding-left: 70px; padding-right: 0; }
    .timeline-marker { left: 30px; }
    .content-section { padding: 3rem 0; }
    .section-title { margin-bottom: 2rem; }
    p { margin-bottom: 1rem; }
    .site-footer .container { flex-direction: column; gap: 1rem; text-align: center; }
    .footer-social { justify-content: center; }
    .contact-methods { flex-direction: column; }
    .contact-method { width: 100%; margin-bottom: 1rem; }
    .cta-container { flex-direction: column; }
    .cta-container .btn { width: 100%; margin: 0.5rem 0; }
    .hero-cta { flex-direction: column; width: 100%; }
    .hero-cta .btn { width: 100%; margin: 0.5rem 0; }
    .about-container { grid-template-columns: 1fr; }
    .about-image { max-width: 250px; margin: 0 auto 2rem; }
    .skill-list { gap: 0.5rem; }
    .skill-tag { font-size: 0.8rem; padding: 0.4rem 0.8rem; }
}
