/* =========================================
   NueCtrl Design System
   Apple HIG-Inspired Styles
   ========================================= */

/* =========================================
   CSS Variables
   ========================================= */
:root {
    /* Colors */
    --bg-color: #ffffff;
    --bg-secondary: #f5f5f7;
    --bg-tertiary: #fbfbfd;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --text-tertiary: #6e6e73;
    --accent-color: #0071e3;
    --border-color: rgba(0, 0, 0, 0.04);

    /* Layout */
    --container-width: 980px;
    --container-wide: 1200px;
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --header-height: 44px;

    /* Apple HIG Typography Scale */
    --font-large-title: clamp(48px, 8vw, 80px);
    --font-title-1: clamp(32px, 5vw, 56px);
    --font-title-2: clamp(24px, 3.5vw, 40px);
    --font-title-3: clamp(20px, 2.5vw, 28px);
    --font-headline: 17px;
    --font-body: 17px;
    --font-body-large: clamp(19px, 2vw, 21px);
    --font-callout: 16px;
    --font-subheadline: 15px;
    --font-footnote: 13px;
    --font-caption: 12px;

    /* Spacing */
    --spacing-xs: 8px;
    --spacing-sm: 16px;
    --spacing-md: 24px;
    --spacing-lg: 40px;
    --spacing-xl: 80px;
    --spacing-xxl: 120px;

    /* Border Radius */
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 28px;
    --radius-xl: 32px;
    --radius-pill: 980px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* =========================================
   Reset & Base
   ========================================= */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", 'Inter', system-ui, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-size: var(--font-body);
    line-height: 1.47059;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* =========================================
   Typography - Apple HIG Precise
   ========================================= */

/* Large Title - Hero headlines */
.large-title {
    font-size: var(--font-large-title);
    font-weight: 600;
    letter-spacing: -0.015em;
    line-height: 1.05;
}

/* Title 1 - Section headers */
.title-1 {
    font-size: var(--font-title-1);
    font-weight: 600;
    letter-spacing: -0.012em;
    line-height: 1.07143;
}

/* Title 2 - Subsection headers */
.title-2 {
    font-size: var(--font-title-2);
    font-weight: 600;
    letter-spacing: -0.007em;
    line-height: 1.1;
}

/* Title 3 */
.title-3 {
    font-size: var(--font-title-3);
    font-weight: 600;
    letter-spacing: -0.004em;
    line-height: 1.14286;
}

/* Body Large */
.body-large {
    font-size: var(--font-body-large);
    font-weight: 400;
    letter-spacing: -0.022em;
    line-height: 1.42857;
    color: var(--text-secondary);
}

/* Body */
.body {
    font-size: var(--font-body);
    font-weight: 400;
    letter-spacing: -0.022em;
    line-height: 1.47059;
    color: var(--text-secondary);
}

/* Footnote */
.footnote {
    font-size: var(--font-footnote);
    font-weight: 400;
    letter-spacing: -0.008em;
    line-height: 1.38462;
}

/* =========================================
   Header - Apple Glassmorphism
   ========================================= */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: calc(var(--header-height) + var(--safe-area-top));
    padding-top: var(--safe-area-top);
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 0.5px solid var(--border-color);
    display: flex;
    align-items: center;
    transition: background var(--transition-base), backdrop-filter var(--transition-base);
}

header.scrolled {
    background: rgba(255, 255, 255, 0.92);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 22px;
}

.nav-logo {
    font-size: var(--font-headline);
    font-weight: 600;
    letter-spacing: -0.022em;
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-logo img {
    height: 24px;
    width: auto;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.nav-links a {
    font-size: var(--font-footnote);
    font-weight: 400;
    letter-spacing: -0.008em;
    text-decoration: none;
    color: var(--text-primary);
    opacity: 0.8;
    transition: opacity var(--transition-fast);
}

.nav-links a:hover,
.nav-links a.active {
    opacity: 1;
}

/* =========================================
   Buttons
   ========================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-size: var(--font-footnote);
    font-weight: 500;
    letter-spacing: -0.008em;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    background: var(--text-primary);
    color: #ffffff !important;
    padding: 8px 20px;
    border-radius: var(--radius-pill);
    opacity: 1 !important;
}

.btn-primary:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-large {
    font-size: var(--font-body);
    padding: 16px 32px;
}

/* Liquid Glass Button Style */
.btn-liquid {
    background: rgba(0, 0, 0, 0.75);
    /* Dark semi-transparent */
    color: white !important;
    padding: 16px 40px;
    /* Slightly wider capsule */
    border-radius: 100px;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    /* Top inner highlight */
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    opacity: 1 !important;
}

.btn-liquid:hover {
    background: rgba(0, 0, 0, 0.85);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Liquid Glass Color Variants */
.btn-liquid.btn-green {
    background: rgba(36, 171, 92, 0.85);
    border-color: rgba(255, 255, 255, 0.25);
}

.btn-liquid.btn-green:hover {
    background: rgba(36, 171, 92, 0.95);
}

.btn-liquid.btn-orange-red {
    background: rgba(255, 88, 50, 0.85);
    border-color: rgba(255, 255, 255, 0.25);
}

.btn-liquid.btn-orange-red:hover {
    background: rgba(255, 88, 50, 0.95);
}

.btn-liquid.btn-pink {
    background: rgba(249, 175, 228, 0.85);
    color: #1d1d1f !important;
    /* Dark text for light background */
    border-color: rgba(255, 255, 255, 0.35);
}

.btn-liquid.btn-pink:hover {
    background: rgba(249, 175, 228, 0.95);
}

.btn-liquid.btn-orange {
    background: rgba(255, 155, 50, 0.85);
    border-color: rgba(255, 255, 255, 0.25);
}

.btn-liquid.btn-orange:hover {
    background: rgba(255, 155, 50, 0.95);
}

/* Header button size fix (minimal) */
.btn-liquid.btn-small {
    padding: 4px 12px;
    font-size: var(--font-footnote);
}

/* =========================================
   Layout
   ========================================= */
.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 22px;
}

.container-wide {
    max-width: var(--container-wide);
}

main {
    padding-top: calc(var(--header-height) + var(--safe-area-top));
}

section {
    padding: var(--spacing-xl) 0;
}

/* =========================================
   Hero Section
   ========================================= */
.hero {
    text-align: center;
    padding: var(--spacing-xxl) 22px var(--spacing-xl);
}

.hero-title {
    max-width: 900px;
    margin: 0 auto var(--spacing-md);
}

.hero-subtitle {
    max-width: 600px;
    margin: 0 auto var(--spacing-lg);
}

.hero-image {
    margin-top: var(--spacing-xl);
}

.hero-image img {
    max-width: 100%;
    height: auto;
}

/* =========================================
   Bento Grid (Features)
   ========================================= */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
}

.bento-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition-slow);
}

.bento-card:hover {
    transform: translateY(-4px);
}

.bento-card.span-2 {
    grid-column: span 2;
}

.bento-card.dark {
    background: var(--text-primary);
    color: #ffffff;
}

.bento-card.dark .body-large {
    color: var(--text-secondary);
}

.bento-card-image {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, transparent 0%, rgba(245, 245, 247, 0.9) 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 0;
}

.bento-card-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -70%);
    font-size: var(--font-footnote);
    color: var(--text-tertiary);
    font-weight: 500;
    background: rgba(255, 255, 255, 0.8);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
}

.bento-card-content {
    position: relative;
    z-index: 1;
}

/* Split Layout - Text Left, Image Right */
.bento-card.split {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 0;
    padding: 0 !important;
    /* Remove container padding for full-bleed */
}

.bento-card.split .bento-card-content {
    flex: 1;
    max-width: 50%;
    padding: var(--spacing-lg);
    /* Add padding back to text */
    padding-right: 0;
}

.bento-card.split .bento-card-image {
    position: relative;
    flex: 1;
    max-width: 50%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    /* Align image to right edge */
    background: none;
    margin: 0;
}

.bento-card.split .bento-card-image img {
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: cover;
    /* Fill the card height */
    border-radius: 0;
    /* Removing radius to merge with card edge */
}

@media (max-width: 768px) {
    .bento-card.split {
        flex-direction: column;
        text-align: left;
        /* Match other cards */
    }

    .bento-card.split .bento-card-content {
        max-width: 100%;
        padding: var(--spacing-md);
        padding-top: 0;
        order: 2;
        /* Text below image */
        position: relative;
        z-index: 2;
    }

    .bento-card.split .bento-card-image {
        max-width: 100%;
        height: 300px;
        order: 1;
        /* Image on top */
    }

    /* Gradient overlay for split cards on mobile */
    .bento-card.split::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 60%;
        background: linear-gradient(to top, var(--bg-secondary) 30%, rgba(245, 245, 247, 0) 100%);
        z-index: 1;
        border-bottom-left-radius: var(--radius-xl);
        border-bottom-right-radius: var(--radius-xl);
        pointer-events: none;
    }

    /* Move Workflow Card Image DOWN on Mobile - Using specific src selector for reliability */
    .bento-card.image-top .bento-card-image img[src*="Workflow.png"] {
        margin-top: -730px !important;
        transform: scale(1.1);
        /* Slightly zoom in if needed to cover gaps */
    }
}

/* Image Top Layout (Vertical) */
/* .bento-card.image-top removed as no specific styles needed for parent currently */


.bento-card.image-top .bento-card-image {
    height: 100%;
    /* Fill the entire card so image doesn't get clipped */
    min-height: 0;
    top: 0;
    bottom: 0;
    padding-top: 0;
    /* Flush with top */
}

.bento-card.image-top .bento-card-image img {
    width: 85.7%;
    /* Slight margin just for aesthetics (or 100% if desired) */
    height: auto;
    margin-top: -730px;
    /* Move image up */
    object-fit: contain;
    object-position: top center;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

/* Gradient Overlay for Text Readability */
.bento-card.image-top::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    /* Gradient from card background color to transparent, ensuring text legibility but no hard block */
    background: linear-gradient(to top, var(--bg-secondary) 0%, rgba(245, 245, 247, 0) 100%);
    z-index: 1;
    /* Above image (z-index: 0), below content (z-index: 2) */
    border-bottom-left-radius: var(--radius-xl);
    border-bottom-right-radius: var(--radius-xl);
    pointer-events: none;
}

.bento-card.image-top .bento-card-content {
    z-index: 2;
    /* Above gradient overlay */
}

/* Specific Style for Zen Card Photo */
.bento-card.image-top.zen-card .bento-card-image img {
    /* To move image UP: make this number more negative (e.g. -120px) */
    /* To move image DOWN: make this number closer to 0 (e.g. -40px) */
    margin-top: -150px;

    width: 100%;
    object-fit: cover;

    /* FIX: Increase height to 200% so you can move it up A LOT without the bottom lifting up */
    height: 200%;
}

/* Motion Card Image - Reset margin and ensure full coverage (keep default gradient) */

/* Fix Motion Card Image - Reset margin and ensure full coverage */
.bento-card.image-top.motion-card .bento-card-image img {
    margin-top: 0 !important;
    height: auto !important;
    width: 50%;
    object-fit: cover;
    object-position: center;
    border-radius: var(--radius-lg);
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* =========================================
   Steps (How It Works)
   ========================================= */
.steps-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xxl);
}

.step-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.step-image {
    width: 100%;
    max-width: 800px;
    aspect-ratio: 16 / 9;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    margin-bottom: var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    font-weight: 500;
}

.step-number {
    display: inline-block;
    font-size: var(--font-footnote);
    font-weight: 600;
    background: var(--text-primary);
    color: #ffffff;
    padding: 4px 14px;
    border-radius: var(--radius-pill);
    margin-bottom: var(--spacing-md);
}

.step-content {
    max-width: 500px;
}

/* =========================================
   Footer
   ========================================= */
footer {
    background: var(--bg-secondary);
    padding: var(--spacing-lg) 0;
    padding-bottom: calc(var(--spacing-lg) + var(--safe-area-bottom));
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.footer-brand {
    font-size: var(--font-footnote);
    color: var(--text-tertiary);
}

.footer-brand strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.footer-links {
    display: flex;
    gap: var(--spacing-md);
}

.footer-links a {
    font-size: var(--font-footnote);
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

.footer-socials {
    display: flex;
    gap: var(--spacing-sm);
}

.footer-socials a {
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.footer-socials a:hover {
    color: var(--text-primary);
}

/* =========================================
   Scroll Reveal Animation
   ========================================= */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s cubic-bezier(0.25, 0.1, 0.25, 1),
        transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

.reveal-delay-1 {
    transition-delay: 0.1s;
}

.reveal-delay-2 {
    transition-delay: 0.2s;
}

.reveal-delay-3 {
    transition-delay: 0.3s;
}

/* =========================================
   Mobile Menu Overlay
   ========================================= */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 2000;
    /* Ensure button stays on top of overlay (z-index 1001) */
    padding: 0;
}

.mobile-menu-btn span {
    width: 20px;
    height: 1.5px;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* Hamburger to X Animation */
.mobile-menu-btn.active span:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
    background-color: var(--text-primary);
    /* Ensure visible on overlay */
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
    background-color: var(--text-primary);
    /* Ensure visible on overlay */
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    padding: calc(var(--safe-area-top) + 60px) 24px 40px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: all 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.mobile-menu-overlay.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.mobile-menu-link {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    padding: 16px 0;
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.05);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.mobile-menu-overlay.active .mobile-menu-link {
    opacity: 1;
    transform: translateY(0);
}

.mobile-menu-overlay.active .mobile-menu-link:nth-child(1) {
    transition-delay: 0.1s;
}

.mobile-menu-overlay.active .mobile-menu-link:nth-child(2) {
    transition-delay: 0.15s;
}

.mobile-menu-overlay.active .mobile-menu-link:nth-child(3) {
    transition-delay: 0.2s;
}

.mobile-menu-overlay.active .mobile-menu-link:nth-child(4) {
    transition-delay: 0.25s;
}

/* Close Button inside Overlay */
.mobile-menu-close {
    position: absolute;
    top: calc(var(--safe-area-top) + 10px);
    right: 22px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 10;
}

.mobile-menu-close::before,
.mobile-menu-close::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 2px;
    background-color: var(--text-primary);
    border-radius: 2px;
}

.mobile-menu-close::before {
    transform: rotate(45deg);
}

.mobile-menu-close::after {
    transform: rotate(-45deg);
}


/* =========================================
   Responsive - Tablet
   ========================================= */
@media (max-width: 1024px) {
    .bento-grid {
        gap: var(--spacing-sm);
    }

    .bento-card {
        padding: var(--spacing-md);
        min-height: 350px;
    }
}

/* =========================================
   Responsive - Mobile
   ========================================= */
@media (max-width: 768px) {
    :root {
        --spacing-xl: 60px;
        --spacing-xxl: 80px;
    }

    .mobile-menu-btn {
        display: flex;
        margin-left: auto;
        /* Push to right */
    }

    .bento-grid {
        grid-template-columns: 1fr;
    }

    .bento-card.span-2 {
        grid-column: span 1;
    }

    /* Hide desktop nav links but keep the container for layout if needed, 
       or simpler: hide specific desktop links */
    .nav-links {
        display: none;
    }

    .hero {
        padding-top: var(--spacing-lg);
        padding-bottom: var(--spacing-md);
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}

/* =========================================
   Responsive - Small Mobile
   ========================================= */
@media (max-width: 390px) {
    nav {
        padding: 0 16px;
    }

    .container {
        padding: 0 16px;
    }
}

/* =========================================
   Utility Classes
   ========================================= */
.text-center {
    text-align: center;
}

.text-secondary {
    color: var(--text-secondary);
}

.mt-lg {
    margin-top: var(--spacing-lg);
}

.mb-lg {
    margin-bottom: var(--spacing-lg);
}