/* ── Reset & Base ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #fafafa;
    --bg-card: #ffffff;
    --text: #0a0a0a;
    --text-muted: #6b7280;
    --border: rgba(0,0,0,0.06);
    --border-hover: rgba(0,0,0,0.1);
    --pill-border: rgba(0,0,0,0.08);
    --pill-text: #444;
    --pill-hover-bg: #0a0a0a;
    --pill-hover-text: #fff;
    --nav-bg: rgba(255,255,255,0.7);
    --gradient-start: #000;
    --gradient-mid: #3a3a3a;
    --gradient-end: #555;
    --glow: rgba(0,0,0,0.04);
    --dot: #0a0a0a;
    --shadow-card: 0 8px 40px rgba(0,0,0,0.06);
    --shadow-hover: 0 20px 50px rgba(0,0,0,0.08);
    --shadow-img: 0 25px 50px -12px rgba(0,0,0,0.15);
    --kicker: #999;
    --footer-text: #999;
    --skill-bar: #0a0a0a;
    --skill-bar-bg: rgba(0,0,0,0.06);
    --toggle-bg: #f0f0f0;
    --toggle-icon: #555;
    --mobile-menu-bg: rgba(255,255,255,0.95);
    --focus-ring: rgba(0,0,0,0.3);
}

[data-theme="dark"] {
    --bg: #0a0a0a;
    --bg-card: #141414;
    --text: #f0f0f0;
    --text-muted: #9ca3af;
    --border: rgba(255,255,255,0.08);
    --border-hover: rgba(255,255,255,0.15);
    --pill-border: rgba(255,255,255,0.12);
    --pill-text: #bbb;
    --pill-hover-bg: #fff;
    --pill-hover-text: #0a0a0a;
    --nav-bg: rgba(10,10,10,0.75);
    --gradient-start: #fff;
    --gradient-mid: #ccc;
    --gradient-end: #999;
    --glow: rgba(255,255,255,0.03);
    --dot: #f0f0f0;
    --shadow-card: 0 8px 40px rgba(0,0,0,0.3);
    --shadow-hover: 0 20px 50px rgba(0,0,0,0.4);
    --shadow-img: 0 25px 50px -12px rgba(0,0,0,0.5);
    --kicker: #666;
    --footer-text: #555;
    --skill-bar: #f0f0f0;
    --skill-bar-bg: rgba(255,255,255,0.08);
    --toggle-bg: #222;
    --toggle-icon: #f0f0f0;
    --mobile-menu-bg: rgba(10,10,10,0.95);
    --focus-ring: rgba(255,255,255,0.4);
}

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    transition: background 0.4s ease, color 0.4s ease;
}

/* ── Skip to content (a11y) ── */
.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: 10000;
    padding: 0.75rem 1.5rem;
    background: var(--text);
    color: var(--bg);
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    transition: top 0.2s ease;
}
.skip-link:focus {
    top: 1rem;
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

/* ── Focus visible (a11y) ── */
a:focus-visible, button:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ── Gradient text ── */
.gradient-text {
    background: linear-gradient(180deg, var(--gradient-start) 0%, var(--gradient-mid) 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

/* ── Preloader ── */
.preloader {
    position: fixed; inset: 0; z-index: 9999; background: var(--bg-card);
    display: flex; align-items: center; justify-content: center;
    transition: background 0.4s ease;
}
.preloader-text {
    font-size: 1.75rem; font-weight: 900; letter-spacing: -0.02em; text-align: center; padding: 0 1rem;
    background: linear-gradient(180deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
@media (min-width: 480px) { .preloader-text { font-size: 2.5rem; } }
@media (min-width: 640px) { .preloader-text { font-size: 3.5rem; letter-spacing: -0.03em; } }
@media (min-width: 768px) { .preloader-text { font-size: 4.5rem; } }

/* ── Reveal animations ── */
.reveal { opacity: 0; transform: translateY(30px); }

/* ── Hero image stack ── */
.image-stack {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
}
@media (min-width: 480px) { .image-stack { height: 320px; max-width: 380px; } }
@media (min-width: 640px) { .image-stack { height: 360px; max-width: 420px; } }
@media (min-width: 768px) { .image-stack { height: 400px; max-width: 500px; } }

.stack-img {
    width: 140px; height: 180px; object-fit: cover;
    border-radius: 1rem; position: absolute;
    left: 50%;
    box-shadow: var(--shadow-img);
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
@media (min-width: 480px) {
    .stack-img { width: 180px; height: 230px; border-radius: 1.125rem; }
}
@media (min-width: 640px) {
    .stack-img { width: 220px; height: 280px; border-radius: 1.25rem; }
}
@media (min-width: 768px) {
    .stack-img { width: 260px; height: 320px; }
}

/* Centered positions with overlapping spread */
.stack-one   { z-index: 1; top: 5px;  transform: translateX(calc(-50% - 30px)) rotate(-6deg); }
.stack-two   { z-index: 3; top: 20px; transform: translateX(-50%) rotate(2deg); }
.stack-three { z-index: 2; top: 40px; transform: translateX(calc(-50% + 30px)) rotate(-2deg); }

@media (min-width: 480px) {
    .stack-one   { transform: translateX(calc(-50% - 50px)) rotate(-6deg); }
    .stack-two   { transform: translateX(-50%) rotate(2deg); }
    .stack-three { transform: translateX(calc(-50% + 50px)) rotate(-2deg); }
}
@media (min-width: 640px) {
    .stack-one   { transform: translateX(calc(-50% - 65px)) rotate(-6deg); }
    .stack-two   { transform: translateX(-50%) rotate(2deg); }
    .stack-three { transform: translateX(calc(-50% + 65px)) rotate(-2deg); }
}
@media (min-width: 768px) {
    .stack-one   { top: 10px; transform: translateX(calc(-50% - 90px)) rotate(-6deg); }
    .stack-two   { top: 30px; transform: translateX(-50%) rotate(2deg); }
    .stack-three { top: 50px; transform: translateX(calc(-50% + 90px)) rotate(-2deg); }
}

.image-stack:hover .stack-one   { transform: translateX(calc(-50% - 90px)) rotate(-8deg) translateY(-8px); }
.image-stack:hover .stack-two   { transform: translateX(-50%) rotate(4deg) translateY(-14px); }
.image-stack:hover .stack-three { transform: translateX(calc(-50% + 90px)) rotate(0deg) translateY(-6px); }

/* HackHive image — crop focus on person */
.hackhive-img {
    object-position: 80% 40%;
}

/* ── Anchor scroll offset (for fixed navbar) ── */
#about, #education, #experience, #projects, #skills {
    scroll-margin-top: 5rem;
}
@media (min-width: 640px) { #about, #education, #experience, #projects, #skills { scroll-margin-top: 5.5rem; } }

/* ── Section card ── */
.section-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 1.25rem; transition: box-shadow 0.4s ease, background 0.4s ease, border 0.4s ease;
}
@media (min-width: 768px) { .section-card:hover { box-shadow: var(--shadow-card); } }

/* ── Project card ── */
.project-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 1.25rem; overflow: hidden;
    transition: transform 0.4s ease, box-shadow 0.4s ease, background 0.4s ease, border 0.4s ease;
}
@media (min-width: 768px) {
    .project-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-hover); }
}
.project-card .card-image { overflow: hidden; }
.project-card .card-image img { transition: transform 0.5s ease; }
@media (min-width: 768px) {
    .project-card:hover .card-image img { transform: scale(1.04); }
}

/* ── Social link ── */
.social-link {
    display: inline-flex; align-items: center; gap: 0.375rem;
    padding: 0.4rem 0.75rem; border-radius: 9999px;
    border: 1px solid var(--border-hover); font-size: 0.8125rem; font-weight: 500;
    transition: all 0.3s ease; color: var(--text-muted);
}
@media (min-width: 640px) {
    .social-link { gap: 0.5rem; padding: 0.5rem 1rem; font-size: 0.875rem; }
}
.social-link:hover { background: var(--pill-hover-bg); color: var(--pill-hover-text); border-color: var(--pill-hover-bg); }

/* ── Nav link ── */
.nav-link { position: relative; transition: color 0.3s; }
.nav-link::after {
    content: ''; position: absolute; bottom: -4px; left: 0;
    width: 0; height: 2px; background: var(--text); transition: width 0.3s ease;
}
.nav-link:hover::after { width: 100%; }

/* ── Mobile menu ── */
.mobile-menu-btn {
    width: 40px; height: 40px; border-radius: 50%;
    border: 1px solid var(--border); background: var(--toggle-bg);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.3s ease; color: var(--toggle-icon);
    font-size: 1rem;
}
.mobile-menu-btn:hover { border-color: var(--border-hover); }

.mobile-menu {
    max-height: 0; overflow: hidden;
    transition: max-height 0.35s ease, padding 0.35s ease;
    background: var(--mobile-menu-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}
.mobile-menu.open {
    max-height: 300px;
    padding: 0.75rem 0;
}
.mobile-menu-link {
    display: block; padding: 0.75rem 1.5rem;
    font-size: 0.9375rem; font-weight: 500;
    color: var(--text-muted); text-decoration: none;
    transition: color 0.2s ease, background 0.2s ease;
}
.mobile-menu-link:hover, .mobile-menu-link:focus-visible {
    color: var(--text); background: rgba(128,128,128,0.05);
}

/* ── Skill pill ── */
.skill-pill {
    display: inline-block; padding: 0.3rem 0.75rem; border-radius: 9999px;
    border: 1px solid var(--pill-border); font-size: 0.8125rem; color: var(--pill-text);
    transition: all 0.25s ease;
}
@media (min-width: 640px) { .skill-pill { padding: 0.375rem 1rem; font-size: 0.875rem; } }
.skill-pill:hover { background: var(--pill-hover-bg); color: var(--pill-hover-text); border-color: var(--pill-hover-bg); }

/* ── Glow effect ── */
.hero-glow {
    position: absolute; width: 250px; height: 250px; border-radius: 50%;
    background: radial-gradient(circle, var(--glow) 0%, transparent 70%);
    top: 50%; left: 50%; transform: translate(-50%, -50%); pointer-events: none;
}
@media (min-width: 768px) { .hero-glow { width: 350px; height: 350px; } }

/* ── Resume list ── */
.resume-list { list-style: none; margin-top: 0.75rem; }
.resume-list li {
    position: relative; padding-left: 1.25rem; margin-top: 0.5rem;
    font-size: 0.875rem; line-height: 1.6; color: var(--text-muted);
}
@media (min-width: 640px) { .resume-list li { font-size: 0.9375rem; line-height: 1.65; } }
.resume-list li::before {
    content: ''; position: absolute; left: 0; top: 0.6rem;
    width: 5px; height: 5px; border-radius: 50%; background: var(--dot);
}
.resume-list li strong { color: var(--text); }

/* ── Section kicker ── */
.section-kicker {
    font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.15em;
    font-weight: 600; color: var(--kicker);
}
@media (min-width: 640px) { .section-kicker { font-size: 0.75rem; } }

/* ── Project link ── */
.project-link {
    display: inline-flex; align-items: center; gap: 0.375rem;
    font-size: 0.8125rem; font-weight: 600; color: var(--text);
    transition: gap 0.3s ease;
}
@media (min-width: 640px) { .project-link { font-size: 0.875rem; } }
.project-link:hover { gap: 0.625rem; }

/* ── Footer (full-width border) ── */
.site-footer {
    width: 100%;
    margin-top: 2.5rem;
    border-top: 1px solid var(--border);
    transition: border 0.4s ease;
}
.footer-inner {
    max-width: 80rem; /* matches max-w-6xl + extra padding */
    margin: 0 auto;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    text-align: center;
}
@media (min-width: 640px) {
    .footer-inner { padding: 1.5rem 2rem; flex-direction: row; text-align: left; }
}
@media (min-width: 1024px) {
    .footer-inner { padding: 1.5rem 6rem; }
}
.footer-links {
    display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center;
}
@media (min-width: 640px) { .footer-links { gap: 1.25rem; } }
.footer-link {
    display: inline-flex; align-items: center; gap: 0.25rem;
    font-size: 0.8125rem; color: var(--footer-text); transition: color 0.3s ease;
    text-decoration: none;
}
@media (min-width: 640px) { .footer-link { font-size: 0.875rem; gap: 0.375rem; } }
.footer-link:hover { color: var(--text); }

/* ── Dark mode toggle ── */
.theme-toggle {
    width: 36px; height: 36px; border-radius: 50%;
    border: 1px solid var(--border); background: var(--toggle-bg);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.3s ease; color: var(--toggle-icon);
    font-size: 0.875rem; flex-shrink: 0;
}
@media (min-width: 640px) { .theme-toggle { width: 40px; height: 40px; font-size: 1rem; } }
.theme-toggle:hover { border-color: var(--border-hover); transform: scale(1.05); }

/* ── Skills section ── */
.skill-category { margin-bottom: 1.25rem; }
@media (min-width: 640px) { .skill-category { margin-bottom: 1.5rem; } }
.skill-category:last-child { margin-bottom: 0; }
.skill-bar-wrap { margin-top: 0.5rem; }
.skill-bar-item {
    display: flex; align-items: center; gap: 0.5rem;
    margin-bottom: 0.5rem;
}
@media (min-width: 640px) { .skill-bar-item { gap: 0.75rem; } }
.skill-bar-label {
    font-size: 0.75rem; min-width: 65px; color: var(--text-muted);
}
@media (min-width: 640px) { .skill-bar-label { font-size: 0.8125rem; min-width: 90px; } }
.skill-bar-track {
    flex: 1; height: 5px; border-radius: 9999px;
    background: var(--skill-bar-bg); overflow: hidden;
}
@media (min-width: 640px) { .skill-bar-track { height: 6px; } }
.skill-bar-fill {
    height: 100%; border-radius: 9999px; background: var(--skill-bar);
    transition: width 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    width: 0;
}

/* ── Nav / Navbar ── */
.navbar {
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border);
    transition: background 0.4s ease, border 0.4s ease;
}

/* ── Strong text in cards ── */
.section-card strong, .project-card strong { color: var(--text); }

/* ── Reduced motion (a11y) ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .reveal { opacity: 1; transform: none; }
    .stack-img { transition: none; }
    .image-stack:hover .stack-one,
    .image-stack:hover .stack-two,
    .image-stack:hover .stack-three { transform: none; }
}

/* ── Print styles ── */
@media print {
    .preloader, .navbar, .theme-toggle, .mobile-menu-btn, .mobile-menu { display: none !important; }
    .reveal { opacity: 1; transform: none; }
    body { background: white; color: black; }
}
