/* =========================================================
   Arnab Acharjee | Master Stylesheet
   ========================================================= */

/* --- 1. DEFINE LOCAL FONTS --- */
@font-face {
    font-family: 'Custom Heading';
    src: url('fonts/heading_font.otf') format('opentype');
    font-weight: 800; 
    font-style: normal; 
    font-display: swap;
}

@font-face {
    font-family: 'Custom Body';
    src: url('fonts/body_font.otf') format('opentype'); 
    font-weight: normal; 
    font-style: normal; 
    font-display: swap;
}

/* --- 2. APPLY FONTS TO VARIABLES --- */
:root {
    --font-heading: 'Custom Heading', sans-serif;
    --font-body: 'Custom Body', sans-serif; 
    
    --bg-main: #050508;
    --bg-secondary: #0a0a0f;
    --text-main: #ffffff;
    --text-muted: #8a8a93;
    --purple-light: #b388ff;
    --purple-deep: #5e35b1;
    --purple-glow: rgba(94, 53, 177, 0.4);
    --purple-accent: #7c4dff;
    --border-color: rgba(255, 255, 255, 0.05);

    --bg-button-initial: #ffffff;
    --text-button-initial: #050508; 
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

/* Custom Dark-Mode Scrollbar */
::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track { background: var(--bg-main); border-left: 1px solid var(--border-color); }
::-webkit-scrollbar-thumb { background-color: rgba(255, 255, 255, 0.3); border-radius: 10px; border: 3px solid var(--bg-main); }
::-webkit-scrollbar-thumb:hover { background-color: var(--purple-accent); }

/* --- GLOBAL ANIMATIONS & PROPERTIES --- */

@property --border-angle {
    syntax: '<angle>';
    inherits: false;
    initial-value: 0deg;
}

/* Ensure coordinates are fully animatable percentages */
@property --mouse-x {
    syntax: '<percentage>';
    inherits: true;
    initial-value: 85%; 
}

@property --mouse-y {
    syntax: '<percentage>';
    inherits: true;
    initial-value: 50%; 
}

@keyframes spin-border-angle {
    to { --border-angle: 360deg; }
}

/* Body */
body { 
    background-color: var(--bg-main); 
    color: var(--text-main); 
    font-family: var(--font-body); 
    line-height: 1.6; 
    overflow-x: hidden; 
    cursor: default; 
}

/* Headings use the Heading Font */
h1, h2, h3, h4, h5, h6 { 
    font-family: var(--font-heading); 
    font-weight: 800; 
    line-height: 1.1; 
    letter-spacing: -0.02em; 
}
a { color: var(--text-main); text-decoration: none; transition: color 0.3s ease; }
a:hover { color: var(--purple-light); }
.container { max-width: 1400px; margin: 0 auto; padding: 0 5%; }
.section-label { color: var(--purple-light); font-size: 0.8rem; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 1.5rem; }

/* Navigation - GPU Accelerated & FIXED Centering */
.top-nav { 
    position: fixed; 
    top: 0; 
    left: 50%; 
    transform: translateX(-50%) translateZ(0); 
    width: 100%; 
    max-width: 100%; 
    padding: 1.5rem 0; 
    background: rgba(5, 5, 8, 0.6); 
    backdrop-filter: blur(10px); 
    z-index: 100; 
    border: 1px solid transparent; 
    transition: all 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform, width, padding, background;
}
.top-nav .nav-container { padding: 0 5%; transition: padding 0.8s cubic-bezier(0.25, 1, 0.5, 1); display: flex; justify-content: space-between; align-items: center; }

/* Collapsed Pill State */
.top-nav.scrolled { 
    top: 25px; 
    width: 90%; 
    max-width: 800px; 
    padding: 1rem 0; 
    background: rgba(10, 10, 15, 0.85); 
    border: 1px solid rgba(255, 255, 255, 0.03); 
    border-radius: 50px; 
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6); 
}
.top-nav.scrolled .nav-container { padding: 0 2.5rem; }

/* DYNAMIC CIRCLING NAV GLOW - GPU Accelerated */
.top-nav.scrolled::after {
    content: '';
    position: absolute;
    inset: -1px; 
    border-radius: inherit;
    padding: 1px; 
    background: conic-gradient(
        from var(--border-angle), 
        transparent 65%, 
        rgba(124, 77, 255, 0.15) 85%, 
        rgba(124, 77, 255, 0.5) 100% 
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: spin-border-angle 6s linear infinite;
    pointer-events: none;
    z-index: 1;
    will-change: background; 
}

/* PNG Logo Integration */
.logo { 
    display: inline-flex; 
    align-items: center; 
    gap: 1px; 
    white-space: nowrap; 
    text-decoration: none;
    color: var(--text-main);
}
.logo-img {
    height: 26px; 
    width: auto;
    transform: translateY(-1px); 
}
.logo-text { 
    font-family: var(--font-heading); 
    font-size: 1.5rem; 
    display: inline-block; 
    max-width: 250px; 
    opacity: 1; 
    overflow: hidden;
    transition: max-width 0.6s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.4s ease; 
}
.top-nav.scrolled .logo-text { max-width: 0; opacity: 0; transition: max-width 0.6s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.2s ease; }

.nav-links { display: flex; gap: 2.5rem; }
.nav-links a { font-size: 0.9rem; font-weight: 500; text-transform: uppercase; letter-spacing: 1px; }

/* Restored True Curtain Panels */
.curtain-panel { 
    position: sticky; 
    top: 0; 
    min-height: 100vh; 
    background-color: var(--bg-main); 
    box-shadow: 0 -20px 50px rgba(0,0,0,0.8); 
    border-top: 1px solid var(--border-color); 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    overflow: hidden; 
}
#panel-hero { box-shadow: none; border-top: none; }
#panel-footer { min-height: auto; justify-content: flex-end; }

/* Ultra-subtle flashlight isolated entirely inside the Hero panel */
.flashlight-bg { 
    position: absolute; 
    top: 0; left: 0; width: 100%; height: 100%; 
    z-index: 1; 
    pointer-events: none; 
    mix-blend-mode: screen; 
    opacity: 0.15; 
    background-position: center center; 
    mask-image: radial-gradient(circle 500px at var(--mouse-x, -100%) var(--mouse-y, -100%), rgba(0,0,0,0.6) 0%, transparent 60%); 
    -webkit-mask-image: radial-gradient(circle 500px at var(--mouse-x, -100%) var(--mouse-y, -100%), rgba(0,0,0,0.6) 0%, transparent 60%); 
    will-change: mask-image, -webkit-mask-image; 
}

/* Hero */
.hero { position: relative; height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center; }
.hero::after { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-image: radial-gradient(circle at 50% 100%, var(--purple-glow) 0%, transparent 50%); pointer-events: none; z-index: 1; }
.hero-slideshow { position: absolute; top: 0; right: 0; width: 70%; height: 100%; z-index: 2; opacity: 0.45; pointer-events: none; mask-image: radial-gradient(circle at top right, rgba(0,0,0,1) 0%, transparent 70%); -webkit-mask-image: radial-gradient(circle at top right, rgba(0,0,0,1) 0%, transparent 70%); }
.hero-slideshow .slide { 
    position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0; animation: fadeSlide 24s infinite ease-in-out; 
    will-change: transform, opacity; 
    backface-visibility: hidden; 
}
.slide-1 { animation-delay: 0s; } .slide-2 { animation-delay: 8s; } .slide-3 { animation-delay: 16s; }
@keyframes fadeSlide { 0%, 100% { opacity: 0; transform: scale(1); } 33.33% { opacity: 1; transform: scale(1.02); } 66.66% { opacity: 0; transform: scale(1); } }
.hero-content { position: relative; z-index: 3; max-width: 900px; padding: 0 20px; }

/* EXACT HERO TEXT - Calibrated to match the provided image reference */
.main-heading { 
    font-family: var(--font-heading); 
    font-size: clamp(3rem, 6vw, 6rem); 
    background: linear-gradient(180deg, #c2a8ff 0%, #d4bdff 20%, #e8ddff 40%, #ffffff 60%, #e0dde5 80%, #a8a5ae 100%); 
    -webkit-background-clip: text; 
    -webkit-text-fill-color: transparent; 
}

/* --- UPGRADED: Cinematic Full-Bleed About Section --- */
.about { 
    position: relative; 
    display: flex; 
    align-items: center; 
    min-height: 100vh; 
    overflow: hidden; 
    z-index: 3; 
}

/* Full screen artwork stretching behind the text */
.about-bg-artwork { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background-size: cover; 
    background-position: center right; 
    z-index: 1; 
}

/* Gradient overlay masks the left side for readable text */
.about-bg-overlay { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: linear-gradient(to right, var(--bg-main) 0%, rgba(5,5,8,0.9) 40%, transparent 80%); 
    z-index: 2; 
    pointer-events: none; 
}

.about .container {
    position: relative;
    z-index: 3;
    width: 100%;
}

.about-content-wrapper {
    max-width: 600px; 
    padding: 2rem 0;
}

/* Bio Text Typography */
.about-bio-text p { 
    font-size: clamp(1.1rem, 1.5vw, 1.3rem); 
    color: var(--text-muted); 
    margin-bottom: 1.5rem; 
    line-height: 1.6; 
}
.about-bio-text strong { color: var(--text-main); }
.about-bio-text .workplace { 
    font-size: 1.1rem; 
    color: var(--text-main); 
    margin-top: 2rem; 
    font-weight: 500; 
}

/* Diagonal Grid Preview - GPU Accelerated */
.projects { padding: 4rem 0; overflow: hidden; position: relative; z-index: 3; }
.split-preview { display: flex; align-items: center; gap: 4rem; min-height: 70vh; }
.preview-left { flex: 1.2; mask-image: linear-gradient(to right, transparent 0%, black 20%, black 80%, transparent 100%); -webkit-mask-image: linear-gradient(to right, transparent 0%, black 20%, black 80%, transparent 100%); }
.isometric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; width: 140%; margin-left: -15%; transform: rotate(-20deg) scale(1.1); transition: transform 0.5s ease; }
.split-preview:hover .isometric-grid { transform: rotate(-15deg) scale(1.15); }
.iso-item { 
    aspect-ratio: 3/4; background-size: cover; background-position: center; border-radius: 6px; box-shadow: -10px 15px 25px rgba(0,0,0,0.6); transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), filter 0.4s ease; filter: brightness(0.7); 
    will-change: transform, filter, box-shadow; 
}
.iso-item:hover { transform: scale(1.08); filter: brightness(1.1); box-shadow: -15px 25px 40px rgba(0,0,0,0.8); z-index: 2; position: relative; }
.preview-right { flex: 1; padding-left: 2rem; }

/* Scaled down ~7.5% from 3.5rem */
.preview-right h2 { font-size: 3.25rem; margin-bottom: 1.5rem; line-height: 1; }
.preview-right p { color: var(--text-muted); font-size: 1.1rem; margin-bottom: 2.5rem; }

/* =========================================================
   PERFECT MAGNETIC DEMO BUTTON - GPU Accelerated
   ========================================================= */
.btn-glow { 
    position: relative;
    display: inline-flex; 
    align-items: center; 
    justify-content: center;
    gap: 10px; 
    font-family: var(--font-body); 
    font-size: 0.85rem; 
    font-weight: 500; 
    padding: 0.6rem 2.5rem; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    border-radius: 50px; 
    background-color: transparent; 
    color: var(--text-button-initial); 
    border: 1px solid rgba(255, 255, 255, 0.05); 
    cursor: pointer; 
    transition: transform 0.3s ease, box-shadow 0.3s ease, color 0.3s ease, border-color 0.3s ease, --mouse-x 3s ease-in-out 0.5s, --mouse-y 3s ease-in-out 0.5s; 
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); 
    will-change: transform, box-shadow, --mouse-x, --mouse-y; 
    transform: translateZ(0); 
    z-index: 1; 
}

/* Hover States */
.btn-glow:hover { 
    box-shadow: 0 8px 30px rgba(124, 77, 255, 0.4); 
    color: var(--text-button-initial); 
    border-color: rgba(124, 77, 255, 0.5);
    transition: transform 0.3s ease, box-shadow 0.3s ease, color 0.3s ease, border-color 0.3s ease, --mouse-x 0s, --mouse-y 0s;
}

/* Base slightly dimmed white background */
.btn-glow::after {
    content: '';
    position: absolute;
    inset: 0;
    background-color: #e5e5eb; 
    z-index: -2;
    border-radius: inherit;
    transition: background-color 0.3s ease;
}

/* The Magnetic Flashlight Glow */
.btn-glow::before {
    content: '';
    position: absolute;
    inset: -2px; 
    z-index: -1; 
    border-radius: inherit;
    
    background: radial-gradient(
        circle 85px at calc(var(--mouse-x) + 2px) calc(var(--mouse-y) + 2px), 
        rgba(255, 255, 255, 0.95) 29%, 
        rgba(220, 190, 255, 0.8) 48.5%, 
        rgba(124, 77, 255, 0.6) 60.71%, 
        transparent 100%
    );
    
    filter: blur(5px); 
    opacity: 0.75; 
    transition: opacity 0.6s ease;
    pointer-events: none;
    will-change: opacity; 
}

.btn-glow:hover::before {
    opacity: 1; 
    transition: opacity 0.2s ease;
}

/* ========================================================= */

.expertise { padding: 4rem 0; position: relative; z-index: 3; }

/* Scaled down ~7.5% from 4rem */
.expertise h2 { font-size: 3.7rem; margin-bottom: 4rem; }
.expertise-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2rem; }
.expertise-card { background: var(--bg-secondary); border: 1px solid var(--border-color); padding: 3rem 2rem; border-radius: 4px; transition: background 0.3s ease; }
.expertise-card:hover { background: #11111a; }
.expertise-card .icon { color: var(--purple-accent); font-size: 1.5rem; margin-bottom: 2rem; }

.process { padding: 4rem 0; position: relative; z-index: 3; }

/* Scaled down ~7.5% from 4rem */
.process h2 { font-size: 3.7rem; margin-bottom: 4rem; }
.process-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2rem; position: relative; }
.process-grid::before { content: ''; position: absolute; top: 6px; left: 0; width: 100%; height: 1px; background: var(--border-color); z-index: 0; }
.process-step { position: relative; z-index: 1; padding-top: 2rem; }
.step-dot { width: 12px; height: 12px; background: var(--purple-accent); border-radius: 50%; position: absolute; top: 0; left: 0; box-shadow: 0 0 10px var(--purple-accent); }

.contact { padding: 4rem 0; position: relative; z-index: 3; text-align: center; }

/* Scaled down ~7.5% from 3rem-4.5rem */
.contact h2 { font-size: clamp(2.8rem, 4.6vw, 4.15rem); margin-bottom: 2rem; }
.contact-content p { font-size: 1.2rem; color: var(--text-muted); margin-bottom: 3rem; }

/* Modal Form */
.contact-modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(5, 5, 8, 0.85); backdrop-filter: blur(8px); z-index: 10000; display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: opacity 0.4s ease, visibility 0.4s ease; }
.contact-modal-overlay.active { opacity: 1; visibility: visible; }
.contact-modal-box { background: var(--bg-secondary); border: 1px solid var(--border-color); padding: 3rem; border-radius: 8px; width: 90%; max-width: 500px; position: relative; transform: translateY(30px); transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7); }
.contact-modal-overlay.active .contact-modal-box { transform: translateY(0); }
.close-modal-btn { position: absolute; top: 1.5rem; right: 1.5rem; background: transparent; border: none; color: var(--text-muted); font-size: 2rem; cursor: pointer; line-height: 1; transition: color 0.3s ease; }
.close-modal-btn:hover { color: var(--purple-accent); }
.form-group { margin-bottom: 1.5rem; text-align: left; }
.form-group label { display: block; margin-bottom: 0.5rem; font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.form-group input, .form-group textarea { width: 100%; background: var(--bg-main); border: 1px solid var(--border-color); color: var(--text-main); padding: 1rem; border-radius: 4px; font-family: var(--font-body); outline: none; transition: border-color 0.3s ease; }
.form-group input:focus, .form-group textarea:focus { border-color: var(--purple-accent); }
.btn-submit.w-100 { width: 100%; border: none; cursor: pointer; margin-top: 1rem; }

/* Gallery Page */
.gallery-page { background: var(--bg-main); position: relative; }
.gallery-header { padding: 12rem 0 4rem; text-align: center; position: relative; z-index: 3; }

/* OVERRIDE: Scaled down ~30-35% specifically for the gallery page to protect the hero section */
.gallery-header .main-heading { font-size: clamp(2rem, 4vw, 4rem); }
.gallery-header p { color: var(--text-muted); font-size: 0.8rem; max-width: 600px; margin: 1rem auto 0; }

.full-gallery { position: relative; z-index: 3; }
.full-gallery .container { max-width: 100%; padding: 0; }

/* Pure Masonry layout ensuring absolute zero gaps */
.gapless-grid { 
    column-count: 5; 
    column-gap: 0; 
    width: 100%; 
    line-height: 0; 
    font-size: 0;   
}

/* Forced inline-block to prevent items from splitting across columns and maintain zero margins */
.gallery-item { 
    position: relative; 
    overflow: hidden; 
    cursor: pointer; 
    z-index: 2; 
    display: inline-block; 
    width: 100%; 
    margin: 0; 
    padding: 0;
    break-inside: avoid; 
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
}

.img-placeholder { 
    width: 100%; 
    height: auto !important; 
    display: block; 
    margin: 0;
    padding: 0;
    transition: transform 0.6s cubic-bezier(0.3, 0, 0.2, 1); 
}

.gallery-item:hover .img-placeholder { transform: scale(1.08); }
.overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(5, 5, 8, 0.8); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.3s ease; }
.gallery-item:hover .overlay { opacity: 1; }
.overlay span { font-family: var(--font-body); font-size: 1.5rem; text-align: center; padding: 0 1rem; transform: translateY(20px); transition: transform 0.4s ease; }
.gallery-item:hover .overlay span { transform: translateY(0); }

/* Project Case Study Page */
.project-page { background: var(--bg-main); overflow-y: auto; }
.project-container { display: flex; min-height: 100vh; position: relative; z-index: 3; }
.project-left { flex: 1.2; background: #000; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; border-right: 1px solid var(--border-color); padding-top: 100px; padding-bottom: 40px; }
.project-hero-img { max-width: 90%; max-height: 80vh; object-fit: contain; box-shadow: 0 20px 50px rgba(0,0,0,0.8); border-radius: 4px; }
.project-right { flex: 1; padding: 7rem 4rem 5rem; display: flex; flex-direction: column; justify-content: center; background: var(--bg-secondary); }
.project-details-wrapper { max-width: 500px; }

/* Scaled down ~7.5% from 4rem */
.project-title { font-size: 3.7rem; text-transform: uppercase; margin-bottom: 0.5rem; line-height: 1; letter-spacing: -0.02em; }
.project-subtitle { font-family: var(--font-body); font-size: 1rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 3rem; }
.project-desc { font-size: 1.1rem; color: var(--text-main); margin-bottom: 3rem; line-height: 1.8; }
.project-desc p { margin-bottom: 1rem; }
.project-specs { font-size: 0.9rem; color: #5aa6d8; font-weight: 500; margin-bottom: 4rem; line-height: 2; }
.btn-back { display: inline-block; font-family: var(--font-body); font-size: 0.9rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 2px; border-bottom: 1px solid var(--border-color); padding-bottom: 5px; transition: 0.2s; }
.btn-back:hover { color: var(--purple-light); border-bottom-color: var(--purple-light); }

/* Footer & Utils */
footer { padding: 3rem 0; text-align: center; background: var(--bg-secondary); position: relative; z-index: 3; }
.footer-links { margin-bottom: 1.5rem; display: flex; justify-content: center; gap: 1.5rem; }
.footer-links a { color: var(--text-muted); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 1px; font-weight: 500; transition: color 0.2s; }
.footer-links a:hover { color: var(--text-main); }
footer p { color: var(--text-muted); font-size: 0.9rem; }
.reveal-on-scroll { opacity: 0; transform: translateY(40px); transition: opacity 0.8s ease-out, transform 0.8s ease-out; }
.reveal-on-scroll.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1024px) {
    .curtain-panel { min-height: auto; }
    .split-preview { grid-template-columns: 1fr; flex-direction: column; gap: 3rem; }
    .preview-left { mask-image: none; -webkit-mask-image: none; margin-bottom: 2rem; }
    .isometric-grid { width: 100%; margin-left: 0; transform: rotate(0deg) scale(1); }
    .expertise-grid, .process-grid { grid-template-columns: repeat(2, 1fr); }
    .process-grid::before { display: none; }
    
    .project-container { flex-direction: column; }
    .project-left { min-height: 60vh; border-right: none; border-bottom: 1px solid var(--border-color); padding: 7rem 0 3rem; }
    .project-hero-img { max-height: 70vh; }
    .project-right { padding: 4rem 2rem; }
    .about-content-wrapper { padding: 2rem 5%; }
    
    /* Responsive adjustments for the new 5-column masonry grid */
    .gapless-grid { column-count: 3; }
}

@media (max-width: 768px) {
    .about-bio-text p { font-size: 1.2rem; }
    .expertise-grid, .process-grid { grid-template-columns: 1fr; }
    .nav-links { display: none; }
    .top-nav.scrolled { width: 95%; }
    
    /* Responsive adjustments for the new 5-column masonry grid */
    .gapless-grid { column-count: 2; }
}