/* ==========================================================================
   1. GLOBAL SYSTEM RESETS & VARIABLES
   ========================================================================== */
*, ::before, ::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-color: #000000;
    --card-bg: rgba(10, 10, 10, 0.4);
    --card-bg-back: #0a0a0a;
    --border-color: #171717;
    --border-hover: #404040;
    
    /* Typography Palette */
    --text-pure: #ffffff;
    --text-main: #e5e5e5;
    --text-muted: #a3a3a3;
    --text-dark: #737373;
    --text-deep: #525252;
}

html {
    scroll-behavior: smooth;
    background-color: var(--bg-color);
    color: var(--text-pure);
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    overflow-x: hidden;
}

/* ==========================================================================
   2. UTILITY LAYOUT CLASSES
   ========================================================================== */
.max-w-3xl { max-w: 48rem; }
.max-w-4xl { max-w: 56rem; }
.max-w-5xl { max-w: 64rem; }
.max-w-6xl { max-w: 72rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.text-center { text-align: center; }

.section {
    padding: 10rem 1.5rem;
    margin-left: auto;
    margin-right: auto;
    border-top: 1px solid var(--border-color);
}

/* ==========================================================================
   3. NAVIGATION ARCHITECTURE
   ========================================================================== */
.nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 50;
    padding: 2rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

@media (min-width: 768px) {
    .nav-bar { padding: 2rem 3rem; }
}

.nav-logo {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-decoration: none;
    color: var(--text-pure);
    transition: opacity 0.25s ease;
}

.nav-logo:hover {
    opacity: 0.7;
}

.nav-links {
    display: flex;
    gap: 2rem;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.25s ease;
}

.nav-links a:hover {
    color: var(--text-pure);
}

/* ==========================================================================
   4. HERO SECTION & BACKGROUND GRID
   ========================================================================== */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0 1.5rem;
}

.grid-bg {
    background-size: 60px 60px;
    background-image: 
        linear-gradient(to right, rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
}

.hero-content {
    text-align: center;
    max-w: 48rem;
    z-index: 10;
}

.hero-tag {
    font-size: 0.75rem;
    letter-spacing: 0.5em;
    color: var(--text-dark);
    text-transform: uppercase;
    display: block;
    margin-bottom: 1.5rem;
}

.hero-title {
    font-size: 2.75rem;
    font-weight: 500;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: var(--text-pure);
    margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
    .hero-title { font-size: 4rem; }
}

.hero-description {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-w: 32rem;
    margin: 0 auto;
    font-weight: 300;
    line-height: 1.625;
}

@media (min-width: 640px) {
    .hero-description { font-size: 1.05rem; }
}

.hero-buttons {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2.5rem;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

@media (min-width: 640px) {
    .hero-buttons { flex-direction: row; }
}

/* ==========================================================================
   5. COMPONENT INTERFACES: BUTTONS & HEADERS
   ========================================================================== */
.btn {
    width: 100%;
    padding: 0.8rem 1.75rem;
    border-radius: 0.25rem;
    text-align: center;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 640px) {
    .btn { width: auto; }
}

.btn-primary {
    background-color: var(--text-pure);
    color: #000000;
    border: 1px solid var(--text-pure);
}

.btn-primary:hover {
    background-color: #e5e5e5;
    border-color: #e5e5e5;
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-pure);
    border: 1px solid #262626;
}

.btn-secondary:hover {
    border-color: var(--text-deep);
    background-color: rgba(15, 15, 15, 0.4);
}

.btn-sm {
    padding: 0.5rem 1.25rem;
    font-size: 0.75rem;
    width: auto;
    align-self: flex-start;
}

.scroll-indicator {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-deep);
}

.section-header {
    margin-bottom: 5rem;
}

.section-tag {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dark);
    display: block;
    margin-bottom: 0.75rem;
}

.section-title {
    font-size: 1.75rem;
    font-weight: 300;
    letter-spacing: -0.025em;
}

/* ==========================================================================
   6. PREMIUM 3D FLIP CARD SYSTEM
   ========================================================================== */
.project-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.flip-card {
    background-color: transparent;
    height: 17rem;
    perspective: 1200px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    transform-style: preserve-3d;
}

/* Trigger 3D flips via desktop hover or JS class toggle for mobile */
.flip-card:hover .flip-card-inner,
.flip-card.flipped .flip-card-inner {
    transform: rotateX(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 2.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: border-color 0.3s ease;
}

.flip-card-front {
    background-color: var(--card-bg);
}

.flip-card:hover .flip-card-front {
    border-color: var(--border-hover);
}

.flip-card-back {
    background-color: var(--card-bg-back);
    transform: rotateX(180deg);
}

.card-icon {
    width: 1.75rem;
    height: 1.75rem;
    border: 1px solid #262626;
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    color: var(--text-muted);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.card-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 300;
    line-height: 1.6;
    flex-grow: 1;
}

.card-action {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-deep);
    padding-top: 1rem;
}

/* Coming Soon Placeholder */
.card-placeholder {
    border: 1px dashed var(--border-color);
    border-radius: 0.5rem;
    padding: 2.25rem;
    height: 17rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    opacity: 0.6;
}

.card-icon-dashed {
    color: var(--text-deep);
    font-size: 0.75rem;
}

.text-muted { color: var(--text-dark); }

.status-tag {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-deep);
}

/* ==========================================================================
   7. CENTURED ALTERNATING TIMELINE SYSTEM
   ========================================================================== */
.timeline {
    position: relative;
    max-width: 48rem;
    margin: 0 auto;
    padding: 3rem 0;
}

/* Central spine line */
.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    background-color: var(--border-color);
    transform: translateX(-50%);
}

.timeline-item {
    position: relative;
    width: 50%;
    margin-bottom: 4rem;
    will-change: transform, opacity;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

/* Left-aligned column styling */
.timeline-item:nth-child(odd) {
    left: 0;
    text-align: right;
    padding-right: 3.5rem;
    padding-left: 0;
}

/* Right-aligned column styling */
.timeline-item:nth-child(even) {
    left: 50%;
    text-align: left;
    padding-left: 3.5rem;
    padding-right: 0;
}

/* Dynamic Axis Center Dot Layout */
.timeline-dot {
    position: absolute;
    top: 6px;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background-color: #262626;
    border: 1px solid var(--bg-color);
    transition: background-color 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s ease;
    z-index: 5;
}

.timeline-item:nth-child(odd) .timeline-dot {
    right: -4px;
}

.timeline-item:nth-child(even) .timeline-dot {
    left: -4px;
}

.timeline-item:hover .timeline-dot {
    background-color: var(--text-pure);
    transform: scale(1.3);
}

.timeline-year {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.timeline-heading {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-pure);
    margin-bottom: 0.35rem;
}

.timeline-text {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 300;
    line-height: 1.55;
}

/* Mobile Responsive Override rules for Timeline Track */
@media (max-width: 767px) {
    .timeline::before {
        left: 8px;
        transform: none;
    }
    
    .timeline-item {
        width: 100%;
        text-align: left !important;
        padding-left: 2.5rem !important;
        padding-right: 0 !important;
        left: 0 !important;
        margin-bottom: 3.5rem;
    }
    
    .timeline-dot {
        left: 4px !important;
        right: auto !important;
    }
}

/* ==========================================================================
   8. IDENTITY, TESTIMONIALS & ENGINEERING BOXES
   ========================================================================== */
.about-quote {
    font-size: 1.35rem;
    font-weight: 300;
    max-w: 42rem;
    margin: 0 auto;
    line-height: 1.6;
    color: var(--text-main);
}

@media (min-width: 640px) {
    .about-quote { font-size: 1.65rem; }
}

.italic-white { color: var(--text-pure); font-style: italic; }

.about-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    max-w: 36rem;
    margin: 2rem auto 0 auto;
    font-weight: 300;
    line-height: 1.65;
}

.about-footer-tag {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-deep);
    margin-top: 2.5rem;
}

.testimonial-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 3rem;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .testimonial-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.testimonial-card {
    border-left: 1px solid #262626;
    padding-left: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: left;
}

.testimonial-quote {
    font-size: 0.9rem;
    color: #d4d4d4;
    font-style: italic;
    font-weight: 300;
    line-height: 1.5;
}

.testimonial-author {
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-dark);
}

.missing-syntax-box {
    background-color: rgba(10, 10, 10, 0.2);
}

.missing-syntax-content {
    max-w: 36rem;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.div-tag {
    font-size: 9px;
    letter-spacing: 0.3em;
    color: var(--text-dark);
}

.syntax-title {
    font-size: 1.35rem;
    font-weight: 500;
    letter-spacing: -0.025em;
}

.syntax-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 300;
    line-height: 1.65;
}

/* ==========================================================================
   9. SYSTEM FOOTER
   ========================================================================== */
.footer {
    border-top: 1px solid var(--border-color);
    padding: 5rem 1.5rem;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    font-size: 0.75rem;
    color: var(--text-dark);
}

@media (min-width: 768px) {
    .footer {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-logo {
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--text-pure);
    font-size: 0.875rem;
}

.footer-sub {
    font-weight: 300;
    letter-spacing: 0.025em;
    color: var(--text-deep);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.footer-links a {
    text-decoration: none;
    color: inherit;
    transition: color 0.25s ease;
}

.footer-links a:hover {
    color: var(--text-pure);
}

.footer-copyright {
    color: var(--text-deep);
    font-family: monospace;
    font-size: 11px;
}

/* ==========================================================================
   10. HARDWARE-ACCELERATED ANIMATION ENGINES
   ========================================================================== */
@keyframes pulse { 
    0%, 100% { opacity: 1; } 
    50% { opacity: .35; } 
}

@keyframes bounce { 
    0%, 100% { transform: translateY(-20%) translateX(-50%); animation-timing-function: cubic-bezier(0.8,0,1,1); } 
    50% { transform: translateY(0) translateX(-50%); animation-timing-function: cubic-bezier(0,0,0.2,1); } 
}

.animate-pulse { animation: pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.animate-bounce { animation: bounce 1.2s infinite; }

/* Scroll reveal system classes applied globally */
.reveal {
    opacity: 0;
    transform: translateY(25px);
    transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1), transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform, opacity;
}

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