:root {
    --color-primary: #0066cc; /* Clean Apple-like blue */
    --color-primary-hover: #0077ed;
    --color-background: #ffffff; /* Clean white */
    --color-bg-secondary: #f5f5f7; /* Apple off-white */
    --color-text-main: #1d1d1f; /* Apple dark charcoal */
    --color-text-muted: #515154; /* Apple grey-text */
    --color-text-light: #86868b; /* Apple caption grey */
    --color-card-bg: #ffffff;
    --color-border: #d2d2d7; /* Apple light border */
    --color-tag-bg: #e8e8ed; /* Apple tag light grey */
    --font-stack: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Base Styles & Typography */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-stack);
    background-color: var(--color-background);
    color: var(--color-text-main);
    line-height: 1.6;
    scroll-behavior: smooth;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 30px;
}

h1, h2, h3, h4 {
    color: var(--color-text-main);
    font-weight: 700;
}

h1 {
    font-size: 2.5rem;
    letter-spacing: -0.03em;
}

h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 20px;
    letter-spacing: 0.02em;
}

/* Header/Hero Section */
.hero-section {
    padding: 100px 0 60px 0;
    background-color: var(--color-background);
}

.hero-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 60px;
    align-items: start;
}

/*.profile-sidebar h1 spacing added*/
.profile-sidebar {
    position: sticky;
    top: 40px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.profile-sidebar h1 {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: 20px;
}

.profile-pic {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--color-border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
}

.skills-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px 0 24px 0;
}

.skill-tag {
    background-color: var(--color-tag-bg);
    color: var(--color-text-muted);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.2;
    transition: background-color 0.2s, color 0.2s;
}

.skill-tag:hover {
    background-color: var(--color-border);
    color: var(--color-text-main);
}

.links {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
}

.linkedin-link,
.chat-agent-btn {
    display: inline-block;
    padding: 12px 28px;
    background-color: var(--color-text-main);
    color: var(--color-background);
    text-decoration: none;
    border-radius: 30px;
    transition: background-color 0.2s, transform 0.2s;
    font-weight: 500;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    width: fit-content;
}

.linkedin-link:hover,
.chat-agent-btn:hover {
    background-color: #333336;
    transform: translateY(-1px);
}

.intro-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-top: 10px;
}

.intro-text {
    font-size: 1.1rem;
    line-height: 1.65;
    color: var(--color-text-muted);
    margin: 0;
    max-width: 100%;
}

/* Section Styling */
.section {
    padding: 80px 0;
}

.section.highlights-section {
    background-color: var(--color-bg-secondary);
}

.section h3 {
    text-align: center;
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
}

.section-intro {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 50px auto;
    color: var(--color-text-light);
    font-size: 1.05rem;
}

/* Projects Grid */
.project-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    padding-top: 20px;
}

.project-card {
    background-color: var(--color-card-bg);
    padding: 40px 30px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--color-text-main);
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.4s ease, border-color 0.4s;
    border: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* Project Card Hover Animation */
.project-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
    border-color: var(--color-text-light);
}

.project-logo {
    width: 64px;
    height: 64px;
    margin-bottom: 20px;
    animation: pulse 4s infinite cubic-bezier(0.65, 0.05, 0.36, 1);
}

.project-card h4 {
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.project-summary {
    font-size: 0.95rem;
    color: var(--color-text-muted);
    line-height: 1.5;
}

/* Career Highlights Grid */
.highlight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 30px;
}

.highlight-item {
    background-color: transparent;
    padding: 24px 0 0 0;
    border-radius: 0;
    border: none;
    border-top: 2px solid var(--color-text-main);
    box-shadow: none;
    transition: border-color 0.3s ease;
}

.highlight-item:hover {
    transform: none;
    box-shadow: none;
    border-top-color: var(--color-primary);
}

.highlight-item h4 {
    margin-bottom: 16px;
    color: var(--color-text-main);
    font-size: 1.25rem;
    font-weight: 600;
    transition: color 0.3s ease;
}

.highlight-item:hover h4 {
    color: var(--color-primary);
}

.highlight-item ul {
    list-style-type: none;
    padding-left: 0;
    font-size: 0.95rem;
}

.highlight-item li {
    position: relative;
    padding-left: 16px;
    margin-bottom: 12px;
    color: var(--color-text-muted);
    line-height: 1.5;
}

.highlight-item li::before {
    content: "—";
    position: absolute;
    left: 0;
    color: var(--color-text-light);
}

/* Divider */
hr {
    border: 0;
    height: 1px;
    background-color: var(--color-border);
}

/* Footer */
footer {
    text-align: center;
    padding: 30px 0;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-light);
    font-size: 0.85rem;
}

/* Animations (Keyframes) */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* Utility classes for initial load animation */
.fade-in-delay {
    opacity: 0;
    animation: fadeIn 0.8s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.profile-sidebar.fade-in-delay {
    animation-delay: 0.1s;
}

.intro-content.fade-in-delay {
    animation-delay: 0.3s;
}

/* Scroll Reveal Animation (Targeted by JS) */
.reveal-item {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s cubic-bezier(0.25, 1, 0.5, 1), transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

.reveal-item.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Media Queries for Responsiveness */
@media (max-width: 900px) {
    .hero-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    .profile-sidebar {
        position: static;
        align-items: center;
        text-align: center;
    }
    .skills-list {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .hero-section {
        padding: 60px 0 40px 0;
    }
    .content-wrapper {
        padding: 0 20px;
    }
    .profile-sidebar h1 {
        font-size: 2.2rem;
    }
    .section {
        padding: 60px 0;
    }
    .project-grid, .highlight-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Chat Widget Styles */
.chat-widget-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    font-family: var(--font-stack);
}

/* Speech Bubble Tooltip styling */
.chat-tooltip {
    position: absolute;
    bottom: 95px;
    right: 0;
    background-color: var(--color-text-main);
    color: var(--color-background);
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 999;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

.chat-tooltip.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Little triangle pointing down to the trigger button */
.chat-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 24px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--color-text-main);
}

.close-tooltip-btn {
    background: none;
    border: none;
    color: #8e8e93;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0;
    margin-left: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: color 0.2s;
}

.close-tooltip-btn:hover {
    color: var(--color-background);
}

/* Attention Grabber Keyframes (Jiggle + subtle zoom out/in) */
@keyframes bubble-jiggle {
    0%, 100% { transform: scale(1); }
    15%, 45% { transform: scale(1.1) rotate(-4deg); }
    30%, 60% { transform: scale(1.1) rotate(4deg); }
    75% { transform: scale(0.95); }
    90% { transform: scale(1.05); }
}

.chat-trigger-btn.attention-animation {
    animation: bubble-jiggle 1.4s ease;
}

.chat-trigger-btn {
    width: 75px;
    height: 75px;
    border-radius: 50%;
    background-color: #e5e5ea; /* Lighter grey so the dark avatar stands out */
    color: var(--color-background);
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), background-color 0.2s;
    overflow: hidden;
    padding: 0;
}

.chat-trigger-btn:hover {
    transform: scale(1.05) translateY(-2px);
    background-color: #d1d1d6;
}

.chat-avatar-sprite {
    background-image: url('images/avatar-grid.png');
    background-size: 444.6% 300%;
    background-repeat: no-repeat;
    background-position: 6.99% 0%; /* Initial waving avatar */
    border-radius: 50%;
}

.chat-trigger-avatar {
    width: 100%;
    height: 100%;
    display: block;
    transition: transform 0.3s;
}

.chat-widget-container.active .chat-trigger-avatar {
    transform: scale(0.92);
}

.chat-window-panel {
    position: absolute;
    bottom: 95px;
    right: 0;
    width: 380px;
    height: 780px;
    max-height: calc(100vh - 150px);
    max-height: calc(100dvh - 150px);
    background-color: var(--color-background);
    border-radius: 16px;
    border: 1px solid var(--color-border);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: opacity 0.3s cubic-bezier(0.25, 1, 0.5, 1), transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.chat-window-panel.hidden {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}

.chat-header {
    background-color: var(--color-text-main);
    color: var(--color-background);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-avatar {
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: block;
}

.chat-header-info h4 {
    color: var(--color-background);
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
}

.chat-status {
    font-size: 0.75rem;
    color: #34c759; /* Apple green */
    margin: 0;
    font-weight: 500;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.chat-reset-btn {
    background: none;
    border: none;
    color: var(--color-background);
    cursor: pointer;
    opacity: 0.8;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    transition: opacity 0.2s, transform 0.2s;
}

.chat-reset-btn:hover {
    opacity: 1;
    transform: rotate(-45deg);
}

.chat-close-btn {
    background: none;
    border: none;
    color: var(--color-background);
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.8;
    line-height: 1;
    padding: 4px;
    transition: opacity 0.2s;
}

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

.chat-messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: #fafafa;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-break: break-word;
}

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

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

.chat-input-area {
    padding: 14px 20px;
    border-top: 1px solid var(--color-border);
    background-color: var(--color-background);
}

#chat-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

#chat-input {
    flex: 1;
    border: 1px solid var(--color-border);
    padding: 10px 14px;
    border-radius: 20px;
    font-family: var(--font-stack);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
    color: var(--color-text-main);
    background-color: #f5f5f7;
}

#chat-input:focus {
    border-color: var(--color-text-light);
    background-color: #ffffff;
}

#chat-send-btn {
    background: none;
    border: none;
    color: var(--color-primary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, color 0.2s;
}

#chat-send-btn:hover {
    color: var(--color-primary-hover);
    transform: scale(1.05);
}

#chat-send-btn:disabled {
    color: var(--color-text-light);
    cursor: not-allowed;
}

/* Typing Indicator Animation */
.typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 0;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background-color: var(--color-text-light);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite both;
}

.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Scrollbar styling for message container */
.chat-messages-container::-webkit-scrollbar {
    width: 6px;
}

.chat-messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages-container::-webkit-scrollbar-thumb {
    background: #e5e5e7;
    border-radius: 3px;
}

.chat-messages-container::-webkit-scrollbar-thumb:hover {
    background: #d2d2d7;
}

@media (max-width: 480px) {
    .chat-window-panel {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        border: none;
    }
    .chat-widget-container {
        bottom: 20px;
        right: 20px;
    }
}