/* =============================================
   Portfolio App CSS — Light / Dark Theme
   ============================================= */

/* ---------- CSS Variables ---------- */
:root {
    --bg: #ffffff;
    --bg2: #f4f6f9;
    --card-bg: #ffffff;
    --text: #1a1a2e;
    --text-muted: #6b7280;
    --accent: #0ea5e9;
    --accent-dark: #0284c7;
    --border: #e5e7eb;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --radius: 12px;
    --nav-bg: rgba(255,255,255,0.95);
    --timeline-line: #e5e7eb;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --bg2: #1e293b;
    --card-bg: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --accent: #38bdf8;
    --accent-dark: #0ea5e9;
    --border: #334155;
    --shadow: 0 4px 20px rgba(0,0,0,0.3);
    --nav-bg: rgba(15,23,42,0.95);
    --timeline-line: #334155;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', 'Noto Sans Bengali', sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; transition: background 0.3s, color 0.3s; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style: none; }

/* ---------- Utilities ---------- */
.container { max-width: 1140px; margin: 0 auto; padding: 0 1.5rem; }
.container-narrow { max-width: 780px; margin: 0 auto; padding: 0 1.5rem; }
.section { padding: 80px 0; }
.text-center { text-align: center; }
.mt-lg { margin-top: 3rem; }
.section-title { text-align: center; font-size: 2rem; font-weight: 700; margin-bottom: 3rem; color: var(--text); }
.section-title span { color: var(--accent); }
.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.65rem 1.6rem; border-radius: 8px; font-size: 0.95rem; font-weight: 500; cursor: pointer; border: none; transition: all 0.2s; text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); text-decoration: none; }
.btn-outline { background: transparent; color: var(--accent); border: 2px solid var(--accent); }
.btn-outline:hover { background: var(--accent); color: #fff; text-decoration: none; }
.empty-state { text-align: center; color: var(--text-muted); padding: 3rem; }

/* ---------- Navbar ---------- */
.navbar { position: fixed; top: 0; left: 0; right: 0; z-index: 1000; background: var(--nav-bg); backdrop-filter: blur(12px); border-bottom: 1px solid transparent; transition: border-color 0.3s, background 0.3s; }
.navbar.scrolled { border-color: var(--border); }
.nav-container { display: flex; align-items: center; justify-content: space-between; max-width: 1140px; margin: 0 auto; padding: 0 1.5rem; height: 64px; }
.nav-brand { font-size: 1.25rem; font-weight: 700; color: var(--accent); text-decoration: none; }
.nav-brand:hover, .nav-brand:focus { text-decoration: none; }
.nav-logo { max-height: 40px; width: auto; display: block; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-link { color: var(--text); font-size: 0.9rem; font-weight: 500; transition: color 0.2s; }
.nav-link:hover, .nav-link.active { color: var(--accent); text-decoration: none; }
.nav-controls { display: flex; gap: 0.5rem; }
.control-btn { background: var(--bg2); border: 1px solid var(--border); color: var(--text); padding: 0.35rem 0.75rem; border-radius: 8px; cursor: pointer; font-size: 0.8rem; transition: all 0.2s; }
.control-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.nav-hamburger { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 4px; }
.nav-hamburger span { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: all 0.3s; }

/* ---------- Hero ---------- */
.hero-section { min-height: 100vh; display: flex; align-items: center; background: var(--bg); padding-top: 64px; }
.hero-container { width: 100%; max-width: 1140px; margin: 0 auto; padding: 3rem 1.5rem; display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: center; }
.hero-greeting { color: var(--accent); font-size: 1.1rem; margin-bottom: 0.5rem; }
.hero-name { font-size: clamp(2.5rem, 5vw, 4rem); font-weight: 800; line-height: 1.1; margin-bottom: 1rem; }
.hero-title-wrapper { font-size: 1.5rem; color: var(--text-muted); margin-bottom: 2rem; }
.hero-title-text { color: var(--accent); font-weight: 600; }
.hero-cursor { animation: blink 0.7s infinite; color: var(--accent); }
@keyframes blink { 0%,50%,100% { opacity: 1; } 51%,99% { opacity: 0; } }
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 2rem; }
.hero-socials { display: flex; gap: 1rem; }
.social-link { display: flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 50%; background: var(--bg2); color: var(--text); border: 1px solid var(--border); transition: all 0.2s; }
.social-link:hover { background: var(--accent); color: #fff; border-color: var(--accent); text-decoration: none; }
.hero-image { display: flex; justify-content: center; align-items: center; }
.hero-image img { width: 320px; height: 320px; border-radius: 50%; object-fit: cover; border: 4px solid var(--accent); box-shadow: var(--shadow); }

/* ---------- About ---------- */
.about-section { background: var(--bg2); }
.about-grid { display: grid; grid-template-columns: 300px 1fr; gap: 3rem; align-items: start; }
.about-image img { border-radius: var(--radius); box-shadow: var(--shadow); }
.about-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1.5rem; }
.stat { text-align: center; background: var(--card-bg); border-radius: var(--radius); padding: 1rem; border: 1px solid var(--border); }
.stat-num { display: block; font-size: 1.75rem; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); }
.about-right h3 { font-size: 1.5rem; font-weight: 600; margin-bottom: 0.5rem; }
.about-company { color: var(--accent); margin-bottom: 1rem; }
.about-bio { color: var(--text-muted); margin-bottom: 1.5rem; line-height: 1.8; }
.about-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.info-item strong { color: var(--text); margin-right: 0.4rem; }
.info-item span, .info-item a { color: var(--text-muted); }

/* ---------- Skills ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.skill-item { }
.skill-header { display: flex; justify-content: space-between; margin-bottom: 0.5rem; }
.skill-name { font-weight: 500; }
.skill-percent { color: var(--accent); font-weight: 600; }
.skill-bar { background: var(--border); border-radius: 10px; height: 8px; overflow: hidden; }
.skill-progress { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-dark)); border-radius: 10px; transition: width 1s ease; }

/* ---------- Resume ---------- */
.resume-section { background: var(--bg2); }
.resume-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.resume-block.full-width { grid-column: 1 / -1; }
.resume-block-title { font-size: 1.25rem; font-weight: 600; margin-bottom: 1.5rem; color: var(--text); }
.resume-summary p { color: var(--text-muted); line-height: 1.8; margin-bottom: 0.5rem; }
.timeline { position: relative; padding-left: 1.5rem; border-left: 2px solid var(--timeline-line); }
.timeline-item { position: relative; margin-bottom: 2rem; }
.timeline-item:last-child { margin-bottom: 0; }
.timeline-dot { position: absolute; left: -1.75rem; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg2); }
.timeline-content h4 { font-weight: 600; margin-bottom: 0.25rem; }
.timeline-org { color: var(--accent); font-size: 0.9rem; }
.timeline-period { color: var(--text-muted); font-size: 0.85rem; margin: 0.25rem 0; }
.timeline-bullets { margin-top: 0.5rem; padding-left: 1.25rem; list-style: disc; }
.timeline-bullets li { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 0.25rem; }
.bullet-line::before { content: ''; }

/* ---------- Portfolio ---------- */
.portfolio-filters { display: flex; gap: 0.75rem; justify-content: center; margin-bottom: 2rem; flex-wrap: wrap; }
.filter-btn { padding: 0.5rem 1.25rem; border: 2px solid var(--border); background: transparent; color: var(--text); border-radius: 25px; cursor: pointer; font-size: 0.9rem; transition: all 0.2s; }
.filter-btn.active, .filter-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.portfolio-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.portfolio-card { border-radius: var(--radius); overflow: hidden; background: var(--card-bg); border: 1px solid var(--border); transition: transform 0.2s, box-shadow 0.2s; }
.portfolio-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.portfolio-img img { width: 100%; height: 220px; object-fit: cover; }
.portfolio-info { padding: 1rem; }
.portfolio-info h4 { font-weight: 600; margin-bottom: 0.5rem; }
.portfolio-info p { color: var(--text-muted); font-size: 0.9rem; }
.portfolio-overlay { padding: 0.5rem 1rem; display: flex; justify-content: space-between; align-items: center; background: var(--bg2); }
.portfolio-cat { font-size: 0.75rem; color: var(--accent); font-weight: 600; text-transform: uppercase; }
.portfolio-link-btn { font-size: 0.85rem; color: var(--text-muted); transition: color 0.2s; }
.portfolio-link-btn:hover { color: var(--accent); }

/* Cards open a detail modal, so show they are interactive */
.portfolio-card { cursor: pointer; }
.portfolio-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- Project detail modal ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px;
    padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.project-modal { position: fixed; inset: 0; z-index: 9500; display: flex;
    align-items: center; justify-content: center; padding: 2rem 1.5rem; }
.project-modal[hidden] { display: none; }

.project-modal-backdrop { position: absolute; inset: 0; background: rgba(9, 12, 20, 0.72);
    backdrop-filter: blur(4px); animation: pmFade 0.18s ease-out; }

.project-modal-dialog { position: relative; z-index: 1; display: flex; flex-direction: column;
    width: 100%; max-width: 680px; max-height: min(88vh, 900px); overflow: hidden;
    background: var(--card-bg); color: var(--text);
    border: 1px solid var(--border); border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
    animation: pmRise 0.22s cubic-bezier(0.22, 1, 0.36, 1); }

/* Sits over the image, so it needs its own contrast rather than the theme's */
.project-modal-close { position: absolute; top: 0.85rem; right: 0.85rem; z-index: 3;
    width: 38px; height: 38px; padding: 0; border: none; border-radius: 50%; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; background: rgba(17, 20, 28, 0.62); backdrop-filter: blur(6px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    transition: background 0.18s, transform 0.18s; }
.project-modal-close:hover { background: rgba(17, 20, 28, 0.88); transform: scale(1.06); }
.project-modal-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* contain, not cover: logos and screenshots must not be cropped */
.project-modal-media { flex: 0 0 auto; background: var(--bg2);
    border-bottom: 1px solid var(--border); }
.project-modal-media[hidden] { display: none; }
.project-modal-media img { display: block; width: 100%; height: auto;
    max-height: 46vh; object-fit: contain; }

.project-modal-body { flex: 1 1 auto; overflow-y: auto; padding: 1.6rem 1.75rem 1.9rem; }

.project-modal-cat { display: inline-block; font-size: 0.7rem; font-weight: 700;
    letter-spacing: 0.09em; text-transform: uppercase; color: var(--accent);
    /* Neutral fallback first; color-mix (Chrome 111+/Safari 16.2+) tints it where supported */
    background: var(--bg2);
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
    padding: 0.28rem 0.6rem; border-radius: 999px; }
.project-modal-cat:empty { display: none; }

.project-modal-body h3 { font-size: 1.55rem; line-height: 1.25; font-weight: 700;
    margin: 0.85rem 0 0.7rem; }
.project-modal-body p { color: var(--text-muted); font-size: 0.97rem; line-height: 1.75;
    white-space: pre-line; max-width: 62ch; margin: 0 0 1.5rem; }
.project-modal-body p:empty { display: none; }

.project-modal-cta[hidden] { display: none; }

/* Stop the page behind the modal from scrolling */
body.modal-open { overflow: hidden; }

@keyframes pmFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pmRise { from { opacity: 0; transform: translateY(14px) scale(0.985); }
                    to   { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
    .project-modal-backdrop, .project-modal-dialog { animation: none; }
    .project-modal-close { transition: none; }
}

@media (max-width: 640px) {
    .project-modal { padding: 0; align-items: stretch; }
    .project-modal-dialog { max-width: none; max-height: 100%; height: 100%;
        border: none; border-radius: 0; }
    .project-modal-media img { max-height: 38vh; }
    .project-modal-body { padding: 1.25rem 1.25rem 1.75rem; }
    .project-modal-body h3 { font-size: 1.3rem; }
}

/* ---------- Blog ---------- */
.blog-section { background: var(--bg2); }
.blog-list-section { padding-top: 100px; }
.blog-controls { display: flex; gap: 1rem; margin-bottom: 1.5rem; }
.search-input { flex: 1; padding: 0.65rem 1rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font-size: 0.95rem; }
.search-input:focus { outline: 2px solid var(--accent); }
.tag-filters { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 2rem; }
.tag-filter-btn { padding: 0.3rem 0.9rem; border: 1px solid var(--border); background: var(--bg2); color: var(--text); border-radius: 20px; cursor: pointer; font-size: 0.85rem; transition: all 0.2s; }
.tag-filter-btn.active, .tag-filter-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.blog-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.blog-card { background: var(--card-bg); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; transition: transform 0.2s, box-shadow 0.2s; }
.blog-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.blog-card-img img { width: 100%; height: 200px; object-fit: cover; }
.blog-card-body { padding: 1.25rem; }
.blog-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.tag { background: var(--bg2); color: var(--accent); font-size: 0.75rem; padding: 0.2rem 0.6rem; border-radius: 4px; font-weight: 500; }
.blog-card-body h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: 0.5rem; line-height: 1.4; }
.blog-card-body h3 a { color: var(--text); }
.blog-card-body h3 a:hover { color: var(--accent); text-decoration: none; }
.blog-card-body p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1rem; }
.blog-meta { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; color: var(--text-muted); }
.read-more { color: var(--accent); font-weight: 500; }

/* ---------- Blog Detail ---------- */
.blog-detail-section { padding-top: 90px; }
.blog-detail-cover { border-radius: var(--radius); overflow: hidden; margin-bottom: 2rem; }
.blog-detail-cover img { width: 100%; height: 420px; object-fit: cover; }
.blog-detail-header { margin-bottom: 2rem; }
.blog-detail-header h1 { font-size: 2rem; font-weight: 700; margin: 1rem 0 0.5rem; }
.blog-date { color: var(--text-muted); font-size: 0.9rem; }
.blog-detail-content p { color: var(--text-muted); line-height: 1.9; margin-bottom: 1.25rem; }
.blog-gallery { margin-top: 3rem; }
.blog-gallery h3 { font-size: 1.25rem; font-weight: 600; margin-bottom: 1.25rem; }
.gallery-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.gallery-item { cursor: pointer; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.gallery-item img { width: 100%; height: 200px; object-fit: cover; transition: transform 0.2s; }
.gallery-item:hover img { transform: scale(1.03); }
.gallery-caption { padding: 0.5rem; font-size: 0.85rem; color: var(--text-muted); }
.blog-back { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border); }

/* ---------- Lightbox ---------- */
.lightbox { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.9); z-index: 9000; flex-direction: column; align-items: center; justify-content: center; }
.lightbox.open { display: flex; }
.lightbox-content { max-width: 90vw; max-height: 80vh; text-align: center; }
.lightbox-content img { max-width: 100%; max-height: 80vh; border-radius: 8px; }
.lightbox-caption { color: #ccc; margin-top: 0.75rem; }
.lightbox-close { position: absolute; top: 1rem; right: 1.5rem; background: none; border: none; color: #fff; font-size: 2rem; cursor: pointer; }
.lightbox-prev, .lightbox-next { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,0.1); border: none; color: #fff; font-size: 2.5rem; cursor: pointer; padding: 0.5rem 1rem; border-radius: 8px; }
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }

/* ---------- Contact ---------- */
.contact-section { background: var(--bg2); }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; }
.contact-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; text-align: center; }
.contact-icon { font-size: 2rem; display: block; margin-bottom: 0.75rem; }
.contact-card h4 { font-weight: 600; margin-bottom: 0.5rem; }
.contact-card p, .contact-card a { color: var(--text-muted); }
.contact-map { margin-top: 2rem; }

/* ---------- Footer ---------- */
.footer { background: var(--bg2); border-top: 1px solid var(--border); padding: 1.5rem 0; text-align: center; }
.footer-container { max-width: 1140px; margin: 0 auto; padding: 0 1.5rem; }
.footer-credit { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.25rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .portfolio-grid { grid-template-columns: repeat(2, 1fr); }
    .blog-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .nav-links { display: none; flex-direction: column; position: fixed; top: 64px; left: 0; right: 0; background: var(--nav-bg); border-bottom: 1px solid var(--border); padding: 1rem 1.5rem; gap: 1rem; }
    .nav-links.open { display: flex; }
    .nav-hamburger { display: flex; }
    .hero-container { grid-template-columns: 1fr; text-align: center; }
    .hero-image { display: none; }
    .hero-actions, .hero-socials { justify-content: center; }
    .about-grid { grid-template-columns: 1fr; }
    .resume-grid { grid-template-columns: 1fr; }
    .skills-grid { grid-template-columns: 1fr; }
    .portfolio-grid, .blog-grid { grid-template-columns: 1fr; }
    .gallery-grid { grid-template-columns: repeat(2, 1fr); }
    .about-info-grid { grid-template-columns: 1fr; }
}
