/* ─── CSS Variables ─────────────────────────── */
:root {
    --font-sans: "Inter", ui-sans-serif, system-ui, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
    --color-accent: #2563eb;

    --bg-body: #ffffff;
    --bg-subtle: #f4f4f5;
    --bg-card: #ffffff;
    --border-subtle: #e4e4e7;
    --border-zinc-100: #f4f4f5;
    --text-primary: #18181b;
    --text-secondary: #52525b;
    --text-tertiary: #71717a;
    --text-muted: #a1a1aa;
}

html[data-theme="dark"] {
    --bg-body: #0a0a0c;
    --bg-subtle: #18181b;
    --bg-card: #131316;
    --border-subtle: #27272a;
    --border-zinc-100: #202023;
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-tertiary: #a1a1aa;
    --text-muted: #71717a;
}

/* ─── Base ──────────────────────────────────── */
body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body ::selection {
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--color-accent);
}

/* ─── Layout ────────────────────────────────── */
.section-container {
    max-width: 48rem;
    margin-left: auto;
    margin-right: auto;
    padding: 4rem 1.5rem;
    /* nav is h-16 (4rem) — keep section headings clear of it */
    scroll-margin-top: 4rem;
}

/* ─── Components ────────────────────────────── */
.label {
    font-size: 0.875rem;
    font-weight: 700;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    display: block;
    border-bottom: 2px solid var(--color-accent);
    width: fit-content;
    padding-bottom: 0.25rem;
}

.bucket {
    border: 1px solid var(--border-subtle);
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
    background: var(--bg-card);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.bucket:hover {
    border-color: var(--color-accent);
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.1);
}

/* ─── Navigation ────────────────────────────── */
.nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.3s ease, filter 0.3s ease;
}

.nav-link:hover {
    color: var(--color-accent);
    filter: drop-shadow(0 0 8px rgba(37, 99, 235, 0.3));
}

/* ─── Mobile Menu Animation ─────────────────── */
#mobile-menu {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#mobile-menu.hidden-drawer {
    transform: translateX(100%);
}

/* ─── Utility ───────────────────────────────── */
.text-accent {
    color: var(--color-accent);
}

.bg-accent {
    background-color: var(--color-accent);
}

.font-mono {
    font-family: var(--font-mono);
}

.details {
    transition: all 0.3s ease;
}

.expand-btn i {
    transition: transform 0.3s ease;
}

.rotate-180 {
    transform: rotate(180deg);
}

/* ─── Project Cards ──────────────────────────── */
.project-card {
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.project-card:hover {
    border-color: #2563eb;
    box-shadow: 0 8px 32px rgba(37, 99, 235, 0.13);
    transform: translateY(-3px);
}

/* Image tilt container */
.project-img-wrap {
    overflow: hidden;
    border-radius: 0.5rem;
    background: var(--bg-subtle);
    margin-top: 1rem;
    perspective: 800px;
}

.project-img-wrap img {
    width: 100%;
    display: block;
    transition: transform 0.45s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 0.45s ease;
    transform-origin: center bottom;
    will-change: transform;
}

.project-card:hover .project-img-wrap img {
    transform: perspective(600px) rotateX(5deg) scale(1.03);
    box-shadow: 0 16px 40px rgba(0,0,0,0.15);
}

/* Bottom action row */
.project-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-zinc-100);
}

.project-view-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
    transition: gap 0.2s ease, opacity 0.2s ease;
}

.project-view-link:hover {
    gap: 0.6rem;
    opacity: 0.8;
}

.project-ai-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--bg-subtle);
    transition: background 0.2s ease, transform 0.2s ease;
}

.project-ai-btn:hover {
    background: #e0e7ff;
    transform: scale(1.12);
}

/* ─── Project Info Button & Details ─────────── */
.project-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--bg-subtle);
    color: var(--text-tertiary);
    font-size: 0.85rem;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.project-info-btn:hover {
    background: #eff6ff;
    color: #2563eb;
}

.project-info-btn.active {
    background: #eff6ff;
    color: #2563eb;
    transform: rotate(20deg) scale(1.08);
}

.project-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease,
                margin-top 0.3s ease;
    opacity: 0;
    margin-top: 0;
}

.project-details.open {
    max-height: 300px;
    opacity: 1;
    margin-top: 0.75rem;
}

.project-details ul {
    list-style: none;
    padding: 0.75rem;
    margin: 0;
    background: var(--bg-subtle);
    border-radius: 0.5rem;
    border: 1px solid var(--border-subtle);
}

.project-details li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 0.2rem 0;
}

.project-details li::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #2563eb;
    flex-shrink: 0;
    margin-top: 0.35rem;
}

/* ─── Social Pills ──────────────────────────── */
.social-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 2.5rem;
    width: 2.5rem;
    border-radius: 50%;
    color: var(--text-secondary);
    background-color: transparent;
    transition: all 0.3s ease;
}

.social-pill:hover {
    color: #2563eb;
    background-color: var(--bg-subtle);
    transform: translateY(-2px);
}

/* ─── Skill Groups ──────────────────────────── */

.skill-group {
    margin-bottom: 1.5rem;
}

.skill-group-label {
    font-size: 0.65rem;
    font-weight: 700;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 0.625rem;
    display: block;
}

.skill-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3rem 0.75rem;
    border-radius: 9999px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    font-size: 0.8125rem;
    color: var(--text-secondary);
    transition: border-color 0.2s ease, background 0.2s ease;
    white-space: nowrap;
}

.skill-pill:hover {
    border-color: #cbd5e1;
    background: var(--bg-subtle);
}

.skill-pill i {
    font-size: 0.75rem;
    color: #2563eb;
}

/* ─── Theme Toggle ───────────────────────────── */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    color: var(--text-secondary);
    background: transparent;
    transition: background 0.2s ease, color 0.2s ease;
}

.theme-toggle:hover {
    background: var(--bg-subtle);
    color: var(--color-accent);
}

html[data-theme="dark"] .theme-toggle .fa-sun { display: inline-block; }
html[data-theme="dark"] .theme-toggle .fa-moon { display: none; }
html:not([data-theme="dark"]) .theme-toggle .fa-sun { display: none; }
html:not([data-theme="dark"]) .theme-toggle .fa-moon { display: inline-block; }

/* ─── Dark Mode: Tailwind Utility Overrides ───
   The Tailwind CDN build has no dark: variants configured, so surface/text
   utilities used throughout the markup are remapped here instead of
   sprinkling dark: classes across every element. */
html[data-theme="dark"] .bg-white { background-color: var(--bg-card) !important; }
html[data-theme="dark"] .bg-zinc-50 { background-color: var(--bg-subtle) !important; }
html[data-theme="dark"] .bg-zinc-100 { background-color: var(--bg-subtle) !important; }
html[data-theme="dark"] .bg-zinc-200 { background-color: var(--border-subtle) !important; }
html[data-theme="dark"] .bg-zinc-900 { background-color: #e4e4e7 !important; color: #18181b !important; }
html[data-theme="dark"] .border-zinc-100 { border-color: var(--border-zinc-100) !important; }
html[data-theme="dark"] .border-zinc-200 { border-color: var(--border-subtle) !important; }
html[data-theme="dark"] .text-zinc-400 { color: #71717a !important; }
html[data-theme="dark"] .text-zinc-500 { color: #a1a1aa !important; }
html[data-theme="dark"] .text-zinc-600 { color: #b4b4bb !important; }
html[data-theme="dark"] .text-zinc-700 { color: #d4d4d8 !important; }
html[data-theme="dark"] .text-zinc-800 { color: #e4e4e7 !important; }
html[data-theme="dark"] .text-zinc-900 { color: var(--text-primary) !important; }
html[data-theme="dark"] .bg-black\/20 { background-color: rgba(0, 0, 0, 0.5) !important; }
html[data-theme="dark"] .bg-emerald-50 { background-color: rgba(16, 185, 129, 0.12) !important; }
html[data-theme="dark"] .bg-blue-50 { background-color: rgba(37, 99, 235, 0.12) !important; }
html[data-theme="dark"] .bg-white\/80 { background-color: rgba(10, 10, 12, 0.8) !important; }
html[data-theme="dark"] .bg-white\/20 { background-color: rgba(255, 255, 255, 0.1) !important; }

/* Chat bubble attracts attention with a few bounces, then stops (see main.js
   which hides the bubble once this animation finishes). */
@keyframes chatbot-bubble-bounce {
    0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(0.8, 0, 1, 1); }
    50% { transform: translateY(0); animation-timing-function: cubic-bezier(0, 0, 0.2, 1); }
}

.chatbot-bubble-bounce {
    animation: chatbot-bubble-bounce 1s infinite;
    animation-iteration-count: 3;
}

/* Tailwind Typography plugin sets its own dark-agnostic color variables on
   .prose (used in chat bubbles); remap the ones actually visible there. */
html[data-theme="dark"] .prose {
    --tw-prose-body: #e4e4e7;
    --tw-prose-bold: #f4f4f5;
    --tw-prose-headings: #f4f4f5;
    --tw-prose-bullets: #71717a;
    --tw-prose-links: #a78bfa;
}
