/* ==========================================================================
   Sagar Engineering - Master Stylesheet
   File: assets/css/style.css
   ========================================================================== */

/* Day Mode (Default) Design Tokens */
:root {
    --brand-primary: #0A3D82;
    --brand-primary-rgb: 10 61 130;
    --brand-accent: #E86A17;
    --brand-accent-hover: #C2510C;
    --brand-accent-rgb: 232 106 23;
    --bg-body: #F8FAFC;
    --bg-surface: #F1F5F9;
    --bg-card: #FFFFFF;
    --bg-nav: rgba(255, 255, 255, 0.94);
    --text-main: #0F172A;
    --text-muted: #475569;
    --border-color: #E2E8F0;
    --glare-color: rgba(255, 255, 255, 0.45);
}

/* Night Mode Design Tokens */
[data-theme="dark"] {
    --brand-primary: #2563EB;
    --brand-primary-rgb: 37 99 235;
    --brand-accent: #FB923C;
    --brand-accent-hover: #EA580C;
    --brand-accent-rgb: 251 146 60;
    --bg-body: #050914;
    --bg-surface: #0D1628;
    --bg-card: #111C33;
    --bg-nav: rgba(6, 11, 22, 0.92);
    --text-main: #F1F5F9;
    --text-muted: #94A3B8;
    --border-color: rgba(148, 163, 184, 0.18);
    --glare-color: rgba(56, 189, 248, 0.22);
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

img, video, canvas, svg {
    max-width: 100%;
}

.responsive-modal-panel {
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    overscroll-behavior: contain;
}

@supports (height: 100dvh) {
    .responsive-modal-panel {
        max-height: calc(100dvh - 2rem);
    }
}

@media (max-width: 639px) {
    .theme-nav .brand-name {
        font-size: 1rem;
    }

    .theme-nav .brand-tagline {
        display: none;
    }

    .theme-nav .header-theme-toggle {
        padding: 0.5rem;
    }

    .header-theme-toggle .theme-label {
        display: none;
    }

    .iso-map-wrapper {
        padding: 1.5rem 0.25rem 2rem;
    }

    .iso-map-plane {
        height: 220px;
    }
}

@media (max-width: 359px) {
    .brand-name-secondary {
        display: none;
    }
}

/* Fixed Ambient 3D Architectural Background Canvas */
#bg-3d-canvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    display: block;
}

.theme-nav {
    background-color: var(--bg-nav);
    border-color: var(--border-color);
}

.theme-card {
    background-color: color-mix(in srgb, var(--bg-card) 92%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-color: var(--border-color);
    box-shadow: 0 10px 28px -12px rgba(15, 23, 42, 0.14);
}
[data-theme="dark"] .theme-card {
    background-color: rgba(17, 28, 51, 0.84);
    box-shadow: 0 14px 32px -12px rgba(0, 0, 0, 0.55);
}

/* Semi-Transparent Industrial Blueprint Overlay */
.blueprint-bg {
    background-color: rgba(7, 19, 38, 0.78);
    background-image:
        linear-gradient(rgba(56, 189, 248, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(56, 189, 248, 0.08) 1px, transparent 1px),
        radial-gradient(circle at 80% 20%, rgba(10, 61, 130, 0.52), transparent 55%),
        radial-gradient(circle at 15% 85%, rgba(232, 106, 23, 0.18), transparent 50%);
    background-size: 36px 36px, 36px 36px, 100% 100%, 100% 100%;
    backdrop-filter: blur(2px);
}
[data-theme="dark"] .blueprint-bg {
    background-color: rgba(4, 10, 22, 0.72);
}

/* 3D Perspective Layered Photo Showcase */
.hero-photo-stage {
    perspective: 1200px;
}
.hero-photo-card {
    transform-style: preserve-3d;
    transform: rotateY(-8deg) rotateX(4deg);
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease;
    box-shadow: 24px 28px 55px -16px rgba(2, 8, 23, 0.75);
}
.hero-photo-stage:hover .hero-photo-card {
    transform: rotateY(-2deg) rotateX(1deg) translateY(-4px);
    box-shadow: 12px 24px 50px -14px rgba(2, 8, 23, 0.8);
}

/* 3D Perspective Tilt Card with Dynamic Light Glare */
.tilt-card {
    transform-style: preserve-3d;
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.25s ease, box-shadow 0.25s ease;
    position: relative;
    will-change: transform;
}
.tilt-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(circle 240px at var(--mx, 50%) var(--my, 50%), var(--glare-color), transparent 70%);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
    z-index: 2;
}
.tilt-card:hover::after {
    opacity: 1;
}
.tilt-z-1 { transform: translateZ(18px); }
.tilt-z-2 { transform: translateZ(32px); }
.tilt-z-3 { transform: translateZ(46px); }

/* 3D Tactile Extruded Metallic Industrial Button */
.btn-metallic {
    background: linear-gradient(135deg, var(--brand-accent) 0%, var(--brand-accent-hover) 100%);
    box-shadow: 0 5px 0 #9A3412, 0 10px 22px -4px rgba(232, 106, 23, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    transition: transform 0.14s ease, box-shadow 0.14s ease, filter 0.2s ease;
    position: relative;
    cursor: pointer;
}
.btn-metallic:hover {
    transform: translateY(-2px);
    filter: brightness(1.07);
    box-shadow: 0 7px 0 #9A3412, 0 14px 26px -4px rgba(232, 106, 23, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.42);
}
.btn-metallic:active {
    transform: translateY(3px);
    box-shadow: 0 2px 0 #9A3412, 0 4px 10px -2px rgba(232, 106, 23, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* 3D Isometric Engineering Execution Pipeline */
.iso-pipeline-scene {
    perspective: 1200px;
}
.iso-block-wrap {
    transform-style: preserve-3d;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}
.iso-block-wrap:hover, .iso-block-wrap.active-stage {
    transform: translateY(-8px);
}
.iso-cube {
    position: relative;
    width: 100%;
    height: 118px;
    transform-style: preserve-3d;
    transform: rotateX(18deg) rotateY(-12deg);
    transition: transform 0.35s ease;
}
.iso-block-wrap:hover .iso-cube, .iso-block-wrap.active-stage .iso-cube {
    transform: rotateX(12deg) rotateY(-6deg) translateZ(10px);
}
.iso-face-front {
    position: absolute;
    inset: 0;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    box-shadow: 0 14px 28px -8px rgba(6, 11, 22, 0.25), inset 0 1px 0 rgba(255,255,255,0.15);
    transform: translateZ(12px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 16px;
}
.iso-block-wrap.active-stage .iso-face-front {
    border-color: var(--brand-accent);
    box-shadow: 0 18px 32px -8px rgba(232, 106, 23, 0.35), 0 0 0 1px var(--brand-accent);
}
.iso-face-bottom {
    position: absolute;
    left: 6px; right: 6px; bottom: -9px; height: 12px;
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent));
    border-radius: 0 0 12px 12px;
    transform: rotateX(-75deg);
    transform-origin: top;
    opacity: 0.85;
}
@keyframes flowPulse {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}
.power-flow-line {
    height: 4px;
    width: 100%;
    background: linear-gradient(90deg, transparent, var(--brand-accent), #38BDF8, transparent);
    background-size: 200% 100%;
    animation: flowPulse 2.2s linear infinite;
    border-radius: 999px;
}

/* 3D Perspective Isometric Regional Operations Map */
.iso-map-wrapper {
    perspective: 1100px;
    padding: 2.5rem 1.25rem 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.iso-map-plane {
    position: relative;
    width: 100%;
    max-width: 540px;
    height: 270px;
    transform-style: preserve-3d;
    transform: rotateX(48deg) rotateZ(-12deg);
    background:
        linear-gradient(rgba(56, 189, 248, 0.14) 1px, transparent 1px),
        linear-gradient(90deg, rgba(56, 189, 248, 0.14) 1px, transparent 1px),
        radial-gradient(circle at 50% 50%, rgba(10, 61, 130, 0.48), rgba(6, 11, 22, 0.94));
    background-size: 32px 32px, 32px 32px, 100% 100%;
    border: 2px solid rgba(56, 189, 248, 0.35);
    border-radius: 20px;
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.65), inset 0 0 40px rgba(56, 189, 248, 0.12);
    transition: transform 0.5s ease;
}
@media (min-width: 640px) {
    .iso-map-plane { height: 300px; }
}
.iso-pin {
    position: absolute;
    transform: translate(-50%, -50%);
    transform-style: preserve-3d;
    cursor: pointer;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.iso-pin-base {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: rgba(251, 146, 60, 0.35);
    border: 2px solid #FB923C;
    box-shadow: 0 0 12px rgba(251, 146, 60, 0.8);
}
.iso-pin.active-hub .iso-pin-base {
    background: rgba(56, 189, 248, 0.45);
    border-color: #38BDF8;
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.95);
}
.iso-pin-pillar {
    width: 10px;
    height: 44px;
    background: linear-gradient(180deg, #FB923C 0%, #0A3D82 100%);
    border-radius: 6px;
    transform: rotateX(-48deg) rotateZ(12deg) translateY(-18px);
    box-shadow: 0 0 16px rgba(251, 146, 60, 0.7);
    transition: height 0.25s ease, box-shadow 0.25s ease;
    margin-bottom: -10px;
}
.iso-pin:hover .iso-pin-pillar, .iso-pin.active-hub .iso-pin-pillar {
    height: 58px;
    background: linear-gradient(180deg, #38BDF8 0%, #FB923C 100%);
    box-shadow: 0 0 24px rgba(56, 189, 248, 0.95);
}
.iso-pin-label {
    transform: rotateX(-48deg) rotateZ(12deg) translateY(-22px);
    white-space: nowrap;
}

/* 3D Flip Cards for Awards & Credentials */
.flip-card {
    perspective: 1100px;
    height: 235px;
    cursor: pointer;
}
.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}
.flip-card:hover .flip-card-inner, .flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}
.flip-card-front, .flip-card-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 1rem;
    overflow: hidden;
}
.flip-card-back {
    transform: rotateY(180deg);
}

/* Desktop Dropdown Hover Menu */
.nav-dropdown:hover .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.nav-dropdown-menu {
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Active Nav Link */
.nav-link-active {
    color: var(--brand-accent) !important;
    font-weight: 700;
}

/* Night Mode Toggle Icon Animation */
.theme-toggle-btn svg {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
}
[data-theme="dark"] .icon-sun { display: block; transform: rotate(0deg) scale(1); }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; transform: rotate(0deg) scale(1); }

/* Smooth Page Fade */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in { animation: fadeIn 0.3s ease-out forwards; }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: #64748b; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--brand-accent); }
