/* Design System Typography */
:root {
    /* Fonts */
    --font-headline: 'Cormorant', serif;
    --font-body: 'Inter', sans-serif;
    
    /* Colors */
    --bg-color: #1a1a1a;
    --text-color: #ffffff;
    --text-muted: #888888;
    --pill-bg: #9B9B9B;
    --pill-bg-hover: rgba(155, 155, 155, 0.3);
    
    /* Layout */
    --header-height: 64px;
    --content-max-width: 1000px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

/* --- Header --- */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background-color: transparent; /* Changed from semi-transparent black to transparent initially */
    backdrop-filter: blur(0px); /* Remove blur initially */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 60px;
    z-index: 2000;
    border-bottom: none; /* Remove border initially */
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), background-color 0.3s ease, padding 0.3s ease; /* Smoother transform */
    transform: translateY(0); /* For hide/show animation */
}

/* Scrolled state class (to be added via JS) */
.main-header.scrolled {
    background-color: rgba(26, 26, 26, 0.8); /* Add background on scroll if needed, or keep minimal */
    backdrop-filter: blur(12px); /* Add blur on scroll */
    border-bottom: 1px solid rgba(255, 255, 255, 0.05); /* Subtle border on scroll */
    /* Removed padding change to prevent layout shift */
}

/* Hidden state for scroll down */
.main-header.hidden {
    transform: translateY(-100%);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-name {
    font-family: var(--font-headline);
    font-size: 24px;
    color: #fff;
    text-decoration: none;
    font-weight: 700; /* Ensure visibility */
    text-shadow: 0 2px 10px rgba(0,0,0,0.3); /* Add shadow for readability against hero images */
}

.header-nav {
    display: flex;
    gap: 8px; /* Gap between pills */
    /* Removed container background to separate items like reference */
    background: transparent; 
    padding: 0;
    border-radius: 0;
    backdrop-filter: none;
}

/* Header Tabs Styling */
.header-nav-item {
    position: relative;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    padding: 8px 20px; /* Adjusted padding */
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    z-index: 1;
    border-radius: 100px; /* Fully rounded pills */
    background: transparent; /* Transparent initially */
    backdrop-filter: none; /* No blur initially */
}

/* Specific style for Resume link to include arrow */
.header-nav-item:last-child::after {
    content: '↗'; /* Up-right arrow */
    display: inline-block;
    margin-left: 4px;
    font-family: system-ui, -apple-system, sans-serif;
    transition: transform 0.3s ease;
}

.header-nav-item:last-child:hover::after {
    transform: translate(2px, -2px); /* Arrow movement animation */
}

/* The Pill Background Hover Effect */
.header-nav-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1); /* Light background on hover only */
    backdrop-filter: blur(10px); /* Add blur on hover */
}

/* Removed the pseudo-element based background animation for a simpler, cleaner pill transition */
.header-nav-item::before {
    display: none;
}

/* --- Sidebar (Sticky) --- */
.sidebar {
    position: sticky;
    top: 100px; /* Stays 100px from top when scrolling */
    width: 180px; /* Increased from 140px to fit longer text */
    flex-shrink: 0;
    z-index: 100;
    margin-top: 10px; /* Adjust to visually align with the Title text */
    align-self: flex-start;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 20px; /* Frame 41322 gap */
    list-style: none;
}

.sidebar-link {
    position: relative;
    display: block;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    padding: 6px 16px; /* Reduced side padding */
    transition: color 0.3s ease;
    width: fit-content;
    white-space: nowrap; /* Prevent text from wrapping */
}

/* Sidebar Pill Background (Rectangle 93 Style) */
.sidebar-link::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%; /* Reset to match text width exactly */
    min-width: unset;
    height: 34px; /* Slightly reduced height for tighter fit */
    background: var(--pill-bg); /* #9B9B9B */
    border-radius: 20px; /* High border-radius for full rounded ends */
    opacity: 0; /* Hidden by default */
    z-index: -1;
    transform: translate(-50%, -50%) scale(0.9); /* Centered transform */
    transition: all 0.3s ease;
    box-sizing: border-box; /* Include padding in width calculation */
    padding: 0; /* Remove extra padding causing excessive length */
}

/* Sidebar Hover State */
.sidebar-link:hover {
    color: #fff;
}
.sidebar-link:hover::before {
    opacity: 0.3;
    transform: translate(-50%, -50%) scale(1); /* Ensure transform keeps centering */
}

/* Sidebar Active State */
.sidebar-link.active {
    color: #fff;
    font-weight: 600;
}
.sidebar-link.active::before {
    opacity: 1; /* Fully visible on active */
    background: var(--pill-bg); /* #9B9B9B */
    transform: translate(-50%, -50%) scale(1);
}

/* --- Main Content Layout --- */
.main-layout {
    padding-top: 80px;
    margin-top: 65vh; /* Push content down to reveal parallax image */
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 100px; /* Increased from 60px to push sidebar further away */
    position: relative; /* Ensure it stacks above the fixed image */
    z-index: 10;
    background-color: var(--bg-color); /* Cover the fixed image on scroll */
}

/* Balance the sidebar width to center the content visually on large screens */
@media (min-width: 1200px) {
    .main-layout::after {
        content: '';
        width: 120px; /* Reduced from 180px to decrease right empty space */
        flex-shrink: 0;
        display: block;
    }
}

/* --- Parallax Hero --- */
.parallax-hero {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 65vh; /* Adjust height as needed (1/2 page) */
    background-image: url('assets/Intelligent_Patrol_Inspection_BoardMU.jpg');
    background-size: cover; /* Back to cover to ensure width fills */
    background-position: center top; /* Align top to show header/name */
    background-repeat: no-repeat;
    z-index: -1; /* Behind everything */
}

/* --- Sections & Typography --- */
.hero-section {
    text-align: center;
    margin-bottom: 100px;
}

.hero-title {
    font-family: var(--font-headline);
    font-size: 64px;
    line-height: 1.1;
    margin-bottom: 40px;
}

.content-section {
    margin-bottom: 120px;
    scroll-margin-top: 100px; /* Offset for sticky header */
}

.section-header {
    margin-bottom: 40px;
}

.section-number {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 10px;
    display: block;
}

h2 {
    font-size: 32px;
    font-weight: 500;
}

p {
    color: #cccccc;
    margin-bottom: 20px;
    max-width: 100%; /* Matches width of images/container */
}

.subtitle-1 {
    font-size: 24px;
    font-weight: 500;
    line-height: 1.4;
    color: #ffffff;
    text-align: center;
    max-width: 800px;
    margin: 80px auto 80px auto; /* Increased spacing for better breathing room */
}

/* --- Tables & Grids --- */
.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    border-top: 1px solid #333;
    border-bottom: 1px solid #333;
    padding: 20px 0;
    margin-bottom: 40px;
}
.meta-item strong { display: block; color: var(--text-muted); font-size: 12px; text-transform: uppercase; margin-bottom: 5px; }

/* Challenge Grid */
.two-col-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-top: 40px;
}

.card {
    background: rgba(34, 34, 34, 0.5); /* Semi-transparent background */
    padding: 30px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1); /* Subtle border */
}

.card h3 { 
    font-size: 20px; 
    margin-bottom: 20px; 
    color: #fff;
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
}

.card ul { 
    padding-left: 20px; 
    color: #ccc; 
    list-style-type: disc;
}

.card li { 
    margin-bottom: 12px; 
    line-height: 1.5;
}

/* Discovery Table */
.discovery-table {
    width: 100%;
    border-collapse: separate; /* Changed to separate to allow spacing if needed, though usually collapse is fine. Using collapse for borders. */
    border-spacing: 0;
    margin-top: 20px;
    background: #222;
    border-radius: 8px;
    overflow: hidden;
}
.discovery-table th, .discovery-table td {
    padding: 20px;
    text-align: left;
    border-bottom: 1px solid #333;
    vertical-align: top;
}
.discovery-table th { color: var(--text-muted); font-size: 12px; text-transform: uppercase; }
.highlight-bar { border-left: 3px solid #ff9800; padding-left: 15px; }

/* Inner cell styling for separated items */
.inner-cell {
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 14px;
}
.inner-cell:last-child {
    margin-bottom: 0;
}

/* Utilities for Index Grid (Ammaar Reshi Style) */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* Further reduced min-width to fit 3 cards */
    gap: 20px;
    margin-top: 40px;
}

.project-card {
    text-decoration: none;
    display: block;
    background: #1e1e1e; /* Slightly lighter than bg */
    border-radius: 16px; /* Slightly reduced radius for smaller cards */
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
}

.project-card:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.15);
}

.card-image-wrapper {
    width: 100%;
    aspect-ratio: 16/10; /* Standard card aspect ratio */
    overflow: hidden;
    position: relative;
}

.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.project-card:hover .card-image-wrapper img {
    transform: scale(1.05); /* Subtle zoom on hover */
}

.card-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-tags {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.card-tag {
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 10px;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.project-card h3 {
    margin: 0;
    color: #fff;
    font-size: 24px;
    font-weight: 600;
    font-family: var(--font-body); /* Switch to Inter for cleaner look, or keep Headline */
    line-height: 1.3;
}

.project-card p {
    color: var(--text-muted);
    font-size: 15px;
    margin: 0;
    line-height: 1.5;
}

.spacer-lg {
    margin-bottom: 120px;
}

/* Footer Link Hover Effects */
.footer-cta-link {
    text-decoration: none; 
    color: #fff; 
    transition: opacity 0.3s; 
    display: flex; 
    align-items: center; 
    gap: 8px;
}
.footer-cta-link:hover {
    opacity: 0.7;
}

.footer-link {
    color: #fff; 
    text-decoration: none; 
    font-size: 16px;
    transition: color 0.3s ease;
}
.footer-link:hover {
    color: var(--text-muted);
}

.footer-social-link {
    color: var(--text-muted); 
    text-decoration: none; 
    font-size: 14px; 
    transition: color 0.3s ease;
}
.footer-social-link:hover {
    color: #fff;
}

/* Updated content-wrapper */
.content-wrapper {
    width: 100%;
    max-width: var(--content-max-width);
    padding: 0 20px;
    /* margin: 0 auto; Removed to fix flex alignment in main-layout */
}

/* Specific centering for Footer content */
footer .content-wrapper, .main-header .content-wrapper {
    margin: 0 auto;
}

/* --- Scroll Reveal Animation --- */
.reveal > * {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    will-change: opacity, transform;
}

.reveal.active > * {
    opacity: 1;
    transform: translateY(0);
}

.reveal {
    opacity: 1 !important;
    transform: none !important;
}

/* --- Responsive Queries --- */
@media (max-width: 1200px) {
    /* Hide sticky sidebar on smaller desktops/tablets to prevent overlap */
    .sidebar {
        display: none; 
    }
    .content-wrapper {
        padding: 0 40px;
    }
}

@media (max-width: 768px) {
    .hero-title { font-size: 42px; }
    .two-col-grid { grid-template-columns: 1fr; }
    .project-grid { grid-template-columns: 1fr; }
    .main-header { padding: 0 20px; }
    .header-nav { display: none; /* Simplify for mobile for now */ }
}