:root {
    /* Light Mode (Default) */
    --bg-color: #f7f2f2;
    --text-primary: #0d1117;
    --text-secondary: #8a949e;

    /* Buttons */
    --btn-text-color: #ffffff;

    /* Card Backgrounds */
    --card-bg-white: #ffffff;
    --card-text-white: var(--text-primary);

    --card-bg-dark: #1f2937;
    --card-text-dark: #ffffff;

    --card-bg-accent: #e5e7eb;
    --card-text-accent: var(--text-primary);

    --card-bg-light: #f3f4f6;
    --card-text-light: var(--text-primary);

    --border-radius: 32px;
    --font-primary: 'Roboto', sans-serif;
    --font-secondary: 'Roboto Mono', monospace;
    --transition-fast: 0.2s ease;
    --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-theme {
    /* Main Layout */
    --bg-color: #0d1117;
    --text-primary: #f7f2f2;
    --text-secondary: #8a949e;

    /* Buttons */
    --btn-text-color: #0d1117;

    /* Card Backgrounds */
    --card-bg-white: #161b22;
    --card-text-white: var(--text-primary);

    --card-bg-dark: #21262d;
    --card-text-dark: var(--text-primary);

    --card-bg-accent: #30363d;
    --card-text-accent: var(--text-primary);

    --card-bg-light: #161b22;
    --card-text-light: var(--text-primary);
}

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

img {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    user-select: none;
    -moz-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    pointer-events: none;
    /* Disables right-click menu and other interactions on the image itself */
}

.bg-light {
    background-color: #f6f6f6;
    color: var(--text-primary);
}

/* Pricing cards: Soft gray in light mode, Soft dark gray in dark mode */
.bg-pricing {
    background-color: #e5e7eb;
    color: var(--text-primary);
}

body.dark-theme .bg-pricing {
    background-color: #30363d;
    color: var(--text-primary);
}

.bg-pricing .pricing-body {
    color: var(--text-primary) !important;
}

/* Popular Ribbon */
.ribbon {
    position: absolute;
    top: 24px;
    right: -32px;
    background: #0d1117;
    color: #ffffff;
    padding: 6px 40px;
    font-family: var(--font-secondary);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    transform: rotate(45deg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

body.dark-theme .ribbon {
    background: #ffffff;
    color: #0d1117;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-weight: 400;
    /* Roboto Normal */
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    transition: background-color var(--transition-smooth), color var(--transition-smooth);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-secondary);
    font-weight: 300;
    text-transform: uppercase;
    margin: 0;
}

.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header & Navigation */
.header {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.logo {
    display: flex;
    align-items: center;
}

.logo-img {
    height: 20px;
    width: auto;
    object-fit: contain;
    transition: filter var(--transition-fast);
}

body.dark-theme .logo-img {
    filter: brightness(0) invert(1);
}

.logo-text {
    font-size: 24px;
    letter-spacing: -0.5px;
}

.filters {
    position: relative;
    display: flex;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 23px;
    padding: 5px;
}

.filter-btn {
    position: relative;
    z-index: 1;
    border: none;
    background: transparent;
    padding: 0 16px;
    height: 32px;
    border-radius: 16px;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: color var(--transition-fast);
}

.filter-btn.active {
    color: #0d1117;
    /* Always dark text to contrast with the white highlight */
}

.filter-btn:hover {
    opacity: 0.7;
}

.filter-highlight {
    position: absolute;
    top: 5px;
    left: 5px;
    height: 32px;
    background: #fff;
    border-radius: 16px;
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), width 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 0;
}

.contact-btn {
    text-decoration: none;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
    transition: opacity var(--transition-fast);
}

.contact-btn:hover {
    opacity: 0.6;
}

/* Bento Grid */
.grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 280px;
    grid-auto-flow: dense;
    gap: 16px;
    /* Matched to nevflynn's exactly 16px gap (280*2 + 16 = 576) */
    padding-bottom: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.site-footer {
    text-align: center;
    padding: 24px 20px 32px;
    font-family: var(--font-secondary);
    font-size: 11px;
    font-weight: 300;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-secondary);
    opacity: 0.6;
}

/* Privacy Policy link button (inline in footer) */
.privacy-link {
    background: none;
    border: none;
    padding: 0;
    font-family: var(--font-secondary);
    font-size: 11px;
    font-weight: 300;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-secondary);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: opacity var(--transition-fast);
}

.privacy-link:hover {
    opacity: 0.5;
}

/* Privacy Policy Modal Overlay */
.privacy-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.privacy-overlay.is-open {
    opacity: 1;
    pointer-events: all;
}

.privacy-modal {
    position: relative;
    width: min(600px, 90vw);
    max-height: 80vh;
    overflow-y: auto;
    border-radius: 24px;
    padding: 48px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.12);
    transform: scale(0.96) translateY(12px);
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

.privacy-overlay.is-open .privacy-modal {
    transform: scale(1) translateY(0);
}

/* Project Modal */
.project-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.project-overlay.is-open {
    opacity: 1;
    pointer-events: all;
}

.project-modal.iframe-mode {
    width: min(1400px, 95vw);
    height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Header and body handled separately */
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.15);
    transform: scale(0.96) translateY(12px);
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

body.dark-theme .project-modal.iframe-mode {
    background: #161b22;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.project-overlay.is-open .project-modal.iframe-mode {
    transform: scale(1) translateY(0);
}

.project-modal-header {
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.5);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

body.dark-theme .project-modal-header {
    background: rgba(0, 0, 0, 0.2);
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

.project-modal-header h2 {
    font-size: 14px;
    letter-spacing: 2px;
    margin: 0;
    opacity: 0.7;
}

.project-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

body.dark-theme .project-close-btn {
    background: rgba(255, 255, 255, 0.1);
}

.project-close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: rotate(90deg);
}

.project-modal-body {
    flex-grow: 1;
    position: relative;
    background: #fff;
    overflow: hidden;
    /* Prevent dynamic expansion and scroll leaks */
}

body.dark-theme .project-modal-body {
    background: #0d1117;
}

#modalProjectIframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    opacity: 0;
    transition: opacity 0.4s ease;
}

#modalProjectIframe.loaded {
    opacity: 1;
}

.project-loader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 5;
    background: inherit;
    transition: opacity 0.3s ease;
}

.project-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--text-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

body.dark-theme .spinner {
    border-color: rgba(255, 255, 255, 0.1);
    border-top-color: var(--text-primary);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 799px) {
    .project-modal.iframe-mode {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        /* Dynamic viewport height for modern browsers */
        border-radius: 0;
        box-shadow: none;
        transform: none !important;
        /* Disable scale transition on mobile to keep layout simple and fit the viewport perfectly */
    }

    .project-modal-header {
        padding: 16px 20px;
        /* Slightly taller for better touch target spacing */
    }

    .project-close-btn {
        width: 44px;
        /* Apple UI Guideline 44px touch target */
        height: 44px;
        font-size: 24px;
    }
}

body.dark-theme .privacy-modal {
    background: rgba(13, 17, 23, 0.80);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.privacy-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.07);
    color: var(--text-primary);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.privacy-close:hover {
    background: rgba(0, 0, 0, 0.14);
    transform: scale(1.1);
}

body.dark-theme .privacy-close {
    background: rgba(255, 255, 255, 0.08);
}

body.dark-theme .privacy-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

.privacy-modal h2 {
    font-family: var(--font-secondary);
    font-size: 18px;
    font-weight: 300;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 32px;
    padding-right: 40px;
    color: var(--text-primary);
}

.privacy-section {
    margin-bottom: 28px;
    padding-bottom: 28px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}

body.dark-theme .privacy-section {
    border-bottom-color: rgba(255, 255, 255, 0.07);
}

.privacy-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.privacy-section h3 {
    font-family: var(--font-secondary);
    font-size: 11px;
    font-weight: 300;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.privacy-section h3 span {
    opacity: 0.5;
}

.privacy-section p {
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.7;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.privacy-section p.malay {
    font-size: 13px;
    opacity: 0.55;
    margin-bottom: 0;
    font-style: italic;
}

.privacy-section a {
    color: var(--text-primary);
    text-underline-offset: 3px;
}

.card {
    border-radius: var(--border-radius);
    padding: 40px;
    overflow: hidden;
    position: relative;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-smooth), background-color var(--transition-smooth), color var(--transition-smooth);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    container-type: inline-size;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.05);
}

/* Card Sizes */
.card-large {
    grid-column: span 2;
    grid-row: span 2;
}

.card-square {
    grid-column: span 1;
    grid-row: span 1;
}

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

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



.card-form {
    grid-row: span 2;
}

/* Colors */
.bg-white {
    background-color: var(--card-bg-white);
    color: var(--card-text-white);
}

.bg-dark {
    background-color: var(--card-bg-dark);
    color: var(--card-text-dark);
}

.bg-accent {
    background-color: var(--card-bg-accent);
    color: var(--card-text-accent);
}

.bg-light {
    background-color: var(--card-bg-light);
    color: var(--card-text-light);
}

.card-bio {
    padding: 32px;
    /* Reduced padding gives the text more vertical breathing room */
}

/* Card Content */
.bio-content h1 {
    font-family: var(--font-primary);
    font-weight: 700;
    font-size: clamp(40px, 12cqw, 52px);
    line-height: 1.1;
    margin-bottom: 10px;
    max-width: 85%;
}

.bio-content h1 span {
    color: var(--accent);
}

.bio-content p {
    font-size: clamp(13px, 4cqw, 18px);
    color: var(--text-primary);
    max-width: 65%;
    opacity: 0.8;
}

.card-inner h2 {
    font-size: clamp(18px, 8cqw, 26px);
    margin-bottom: 8px;
}

.card-inner p {
    font-size: clamp(14px, 1.5vw, 16px);
    line-height: 1.6;
    opacity: 0.8;
}

/* Service Card Specifics */
.card-type {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 600;
}

.service-card h2.card-title {
    font-size: clamp(20px, 10cqw, 32px);
    line-height: 1.1;
    margin-bottom: 16px;
}

.service-card p.card-body {
    font-size: clamp(14px, 1.5vw, 16px);
    color: var(--text-secondary);
    opacity: 0.8;
}

.card-wide.service-card h2.card-title {
    font-size: clamp(20px, 5cqw, 32px);
}

.card-wide.service-card .card-inner {
    max-width: 50%;
}



/* Roadmap Animation */
.roadmap-animation {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
    min-height: 120px;
    color: var(--text-primary);
}

.roadmap-animation svg {
    height: 100%;
    max-height: 180px;
    width: auto;
}

.roadmap-path {
    stroke-dasharray: 280;
    stroke-dashoffset: 280;
    animation: drawRoadmap 4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.roadmap-node {
    opacity: 0;
}

.node-1 {
    animation: popNode 4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    animation-delay: 0.2s;
}

.node-2 {
    animation: popNode 4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    animation-delay: 1.5s;
}

.node-3 {
    animation: popNode 4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    animation-delay: 2.8s;
}

@keyframes drawRoadmap {
    0% {
        stroke-dashoffset: 280;
    }

    40%,
    60% {
        stroke-dashoffset: 0;
    }

    100% {
        stroke-dashoffset: -280;
    }
}

@keyframes popNode {

    0%,
    5% {
        opacity: 0;
    }

    15%,
    85% {
        opacity: 1;
    }

    95%,
    100% {
        opacity: 0;
    }
}

/* Automation Animation (Service 3) */
.automation-animation {
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    width: 35%;
    max-width: 120px;
    height: auto;
    display: flex;
    justify-content: flex-end;
}

.automation-animation svg {
    width: 100%;
    height: auto;
}

.bot-rect {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: drawBot 4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.bot-scanner {
    opacity: 0;
    animation: scanLine 4s infinite;
}

.bot-eye {
    opacity: 0;
    animation: showEye 4s infinite;
}

.right-eye {
    animation-delay: 0.2s;
}

@keyframes drawBot {
    0% {
        stroke-dashoffset: 200;
    }

    40%,
    60% {
        stroke-dashoffset: 0;
    }

    100% {
        stroke-dashoffset: -200;
    }
}

@keyframes scanLine {

    0%,
    35% {
        opacity: 0;
        transform: translateY(-15px);
    }

    40% {
        opacity: 1;
        transform: translateY(15px);
    }

    50% {
        opacity: 1;
        transform: translateY(-15px);
    }

    55%,
    100% {
        opacity: 0;
        transform: translateY(-15px);
    }
}

@keyframes showEye {

    0%,
    25% {
        opacity: 0;
    }

    35%,
    65% {
        opacity: 1;
    }

    75%,
    100% {
        opacity: 0;
    }
}

/* Visuals Animation (Service 2) */
.visuals-animation {
    position: absolute;
    right: 24px;
    bottom: 24px;
    width: 64px;
    height: 64px;
    opacity: 0.8;
}

/* Move animation to upper right for 1x1 and 2x2 cards ONLY on desktop */
@media (min-width: 1201px) {

    .card-square .visuals-animation,
    .card-large .visuals-animation {
        top: 24px;
        bottom: auto;
        width: 48px;
        height: 48px;
    }
}

/* Center bottom positioning and scale up on tablet/mobile */
@media (max-width: 1200px) {
    .visuals-animation {
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        bottom: 32px;
        width: 70px;
        /* +10% from 64px */
        height: 70px;
    }
}

.visuals-animation svg {
    width: 100%;
    height: 100%;
}

.cube-path {
    stroke-dasharray: 240;
    stroke-dashoffset: 240;
    animation: drawCube 4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.cube-inner {
    stroke-dasharray: 120;
    stroke-dashoffset: 120;
    animation: drawCube 4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    animation-delay: 0.3s;
    opacity: 0.5;
}

@keyframes drawCube {
    0% {
        stroke-dashoffset: 240;
    }

    40%,
    60% {
        stroke-dashoffset: 0;
    }

    100% {
        stroke-dashoffset: -240;
    }
}


.corner-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    bottom: 24px;
    right: 24px;
    z-index: 3;
    /* Ensures it floats above the gradient overlay */
    color: #0d1117;
    /* Always dark text to contrast with the white background */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    cursor: pointer;
}

.corner-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.5);
    /* Creates the floating ring effect */
}

/* Image Cards */
.card-image {
    padding: 0;
    background: var(--card-bg-light);
}

.bg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.8) 100%);
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    color: white;
}

.overlay-strong {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.9) 100%);
}

.card-image.service-card .overlay {
    padding-right: 80px;
    /* Prevent text from overlapping corner button */
}

.card-image.service-card .card-type,
.card-image.service-card .card-body {
    color: rgba(255, 255, 255, 0.8);
}

.overlay p {
    margin: 0;
    font-weight: 500;
}

/* Lead Funnel Form */
.lead-funnel {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.download-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
    width: 100%;
    max-width: 320px;
    align-items: center;
}


.download-form input {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 12px;
    font-family: var(--font-body);
    font-size: 14px;
    background: white;
    outline: none;
    transition: box-shadow var(--transition-fast);
}

.download-form input:focus {
    box-shadow: 0 0 0 2px var(--text-primary);
}

.cf-turnstile {
    align-self: center;
}

.cta-btn {
    display: inline-block;
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    background: var(--text-primary);
    color: var(--btn-text-color);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.cta-btn:hover {
    opacity: 0.8;
    transform: translateY(-2px);
}

.submit-btn {
    width: 100%;
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    background: var(--text-primary);
    color: var(--btn-text-color);
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    transition: opacity var(--transition-fast);
}

.submit-btn:hover {
    opacity: 0.8;
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-consent {
    font-family: var(--font-primary);
    font-size: 10px;
    color: #9ca3af;
    opacity: 1;
    text-align: center;
    margin: 0;
    line-height: 1.5;
}

.form-privacy-link {
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    font-size: inherit;
    color: #9ca3af;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.form-feedback {
    margin-top: 12px;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    font-family: var(--font-body);
}

.form-feedback.hidden {
    display: none;
}

.form-feedback.success {
    background-color: rgba(76, 175, 80, 0.1);
    color: #2e7d32;
    border: 1px solid rgba(76, 175, 80, 0.2);
}

.form-feedback.error {
    background-color: rgba(244, 67, 54, 0.1);
    color: #c62828;
    border: 1px solid rgba(244, 67, 54, 0.2);
}

/* Card success state */
#leadCard.card-success {
    background-color: #22c55e;
    color: #ffffff;
    transition: background-color 0.6s cubic-bezier(0.4, 0, 0.2, 1), color 0.6s ease;
}

.success-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 16px;
    animation: fadeInUp 0.5s ease forwards;
}

.success-message.hidden {
    display: none;
}

.success-message h2 {
    color: #ffffff;
    font-size: clamp(18px, 5cqw, 28px);
    line-height: 1.3;
}

.success-subtext {
    font-size: 12px;
    opacity: 0.7;
    color: #ffffff;
    font-style: italic;
    line-height: 1.5;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* iPhone-style Theme Toggle */
.theme-toggle-track {
    cursor: grab;
    width: 140px;
    height: 64px;
    background: #e5e7eb;
    border-radius: 32px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    transition: background-color var(--transition-smooth);
}

body.dark-theme .theme-toggle-track {
    background: #0d1117;
    /* Very dark background to inset the track */
}

.theme-toggle-icon {
    width: 28px;
    height: 28px;
    z-index: 2;
    /* Keep icons above the thumb visually */
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    /* Let clicks/drags pass through to the thumb */
}

.theme-toggle-icon.left {
    color: #f59e0b;
    /* Sun Yellow */
}

.theme-toggle-icon.right {
    color: #4b5563;
    /* Darker Moon Gray so it pops against white thumb and light track */
}

.theme-toggle-thumb {
    width: 56px;
    height: 56px;
    background: #ffffff;
    border-radius: 50%;
    position: absolute;
    top: 4px;
    left: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform var(--transition-smooth), background-color var(--transition-smooth);
    z-index: 1;
    /* Below the icons */
    cursor: grab;
    touch-action: none;
    /* Prevents scroll interference on mobile */
}

.theme-toggle-thumb:active {
    cursor: grabbing;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

body.dark-theme .theme-toggle-thumb {
    /* transform is intentionally omitted — JS owns thumb position to avoid CSS/inline conflicts */
    background: #ffffff;
    /* Keep thumb pure white in dark mode for maximum contrast */
}

/* Responsive - Keep 4 columns for tablet but scale down proportionally */
@media (max-width: 1200px) {
    .page-container {
        max-width: 100%;
    }

    .grid-container {
        grid-template-columns: repeat(4, 1fr);
        max-width: 100%;
        grid-auto-rows: calc((100vw - 88px) / 4);
        /* 88px = 40px page padding + 48px total gaps */
    }

    .card {
        padding: 24px;
    }

    .card-image {
        padding: 0;
    }

    .card-bio {
        padding: 24px;
        grid-row: span 2;
        /* Make About Us taller on tablet to prevent truncation */
    }

    .card:nth-child(3) {
        grid-row: span 2;
        /* Make Service 2 taller on tablet to prevent text truncation without shrinking fonts */
    }

    .overlay {
        padding: 24px;
    }

    .bio-content h1 {
        max-width: 100%;
    }

    .bio-content p {
        max-width: 100%;
    }

    .service-card h2.card-title {
        margin-bottom: 8px;
    }
}

@media (max-width: 799px) {

    /* Mobile */
    .page-container {
        max-width: 100%;
        /* Allow it to span full width of mobile device */
        padding: 0 16px;
    }

    .header {
        flex-direction: column;
        justify-content: center;
        gap: 20px;
        height: auto;
        padding: 30px 20px;
    }

    .filters {
        overflow-x: auto;
        max-width: 100%;
        padding-bottom: 5px;
        /* for scrollbar */
    }

    .grid-container {
        /* Maintain 2 columns just like nevflynn */
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: calc((100vw - 44px) / 2);
        /* Perfect 1:1 ratio based on viewport (32px padding + 12px gap) */
        gap: 12px;
        /* Tighter gap on mobile */
        max-width: 100%;
    }

    .card {
        padding: 24px;
        /* Reduce padding so content fits in smaller cards */
    }

    .card-image {
        padding: 0;
        /* Override the 24px padding so image/overlay fills the card */
    }

    .bio-content h1 {
        max-width: 80%;
    }

    .bio-content p {
        max-width: 80%;
    }

    .overlay {
        padding: 24px;
    }

    .card-image.service-card .overlay {
        padding-right: 64px;
        /* Adjust right padding for mobile to avoid button overlap */
    }

    .card-wide.service-card .card-inner {
        max-width: 65%;
    }

    .automation-animation {
        right: 24px;
        max-width: 80px;
    }


    /* Explicit mobile spans for 2-column grid */
    .card-large {
        grid-column: span 2;
        grid-row: span 2;
    }

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

    .card-form {
        grid-row: span 2;
    }

    .card-bio {
        grid-row: span 2;
        /* Ensure the larger hero card content fits on mobile */
    }

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

    .card-square {
        grid-column: span 1;
        grid-row: span 1;
    }


    /* Make sure Service 1 and 2 are explicitly 1x2 on mobile */
    .card:nth-child(2),
    .card:nth-child(3) {
        grid-column: span 1;
        grid-row: span 2;
    }

    /* Force Output 4 to the right side on mobile */
    #output4Card {
        grid-column: 2 / span 1;
    }

    /* Move Sample 2 after Output 4 on mobile */
    #sample2Card {
        order: 10;
    }

    #output5Card {
        order: 11;
    }

    #output6Card {
        order: 12;
    }

    #spatialAwarenessCard {
        order: 13;
    }

    #leadCard {
        order: 15;
    }

    body[data-active-tab="about"] #leadCard {
        order: -1;
    }

    #whyUsCard {
        order: 16;
        grid-row: span 1;
    }

    body[data-active-tab="about"] #whyUsCard {
        order: -2;
    }

}

@media (max-width: 400px) {
    /* Captures S24 Ultra, OnePlus 13, and small iPhones */

    .grid-container {
        /* Forces the 1:1 ratio for square cards */
        grid-auto-rows: calc((100vw - 44px) / 2);
        gap: 10px;
    }

    .card {
        padding: 16px;
        /* Reclaims space to prevent vertical cropping */
    }

    /* Fixed typography for the 'Spatial Awareness' & 'Eye for Detail' cards */
    .bio-content h1 {
        font-size: 36px !important;
        line-height: 1.1;
        max-width: 100%;
    }

    .bio-content p,
    .service-card p.card-body,
    .card-inner p,
    .overlay p {
        font-size: 12.5px !important;
        /* Perfect size to fit 3 lines of text in 170px height */
        line-height: 1.35;
        max-width: 100% !important;
    }

    .service-card h2.card-title {
        font-size: 18px !important;
        margin-bottom: 4px;
    }

    /* Animation scaling for narrow screens */
    .automation-animation {
        right: 12px;
        max-width: 50px;
    }

    .visuals-animation {
        width: 40px;
        height: 40px;
        bottom: 12px;
    }



    /* Portfolio Form Fix: Prevents button from cutting off */
    .card-form {
        grid-row: span 3 !important;
        height: auto;
        min-height: 350px;
    }

    .card-form input {
        padding: 10px;
        margin-bottom: 8px;
        font-size: 14px;
    }

    .card-form button {
        padding: 12px;
        font-size: 14px;
    }

    /* Overlay Fix for 'Your IP Secured' and other image cards */
    .card-image {
        padding: 0 !important;
        display: block;
    }

    .overlay {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        padding: 16px;
        box-sizing: border-box;
    }

    /* Prevents overlay text from overlapping the arrow button */
    .card-image.service-card .overlay {
        padding-right: 42px !important;
    }

    .bg-image {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

@media (max-width: 325px) {
    /* Extreme Narrow Mobile (iPhone SE 1st Gen) */

    .grid-container {
        /* Recalculated for 320px: (Viewport - (2x16px container padding + 8px gap)) / 2 */
        grid-auto-rows: calc((100vw - 40px) / 2);
        gap: 8px;
        /* Tighter gap to save width */
    }

    .card {
        padding: 12px !important;
        /* Minimum padding to keep text from touching edges */
    }

    /* Typography: Survival mode sizing */
    .bio-content h1 {
        font-size: 32px !important;
        line-height: 1.1;
    }

    .bio-content p,
    .service-card p.card-body,
    .card-inner p,
    .overlay p {
        font-size: 11px !important;
        /* Very small but readable for 140px tall cards */
        line-height: 1.2;
    }

    .service-card h2.card-title {
        font-size: 15px !important;
        margin-bottom: 2px;
        line-height: 1.1;
    }

    /* Animation Scaling */
    .automation-animation {
        right: 8px;
        max-width: 40px;
    }

    .visuals-animation {
        width: 35px;
        height: 35px;
        bottom: 8px;
        right: 8px;
    }



    /* Form Adjustment: If 2 columns are too small, you could make this full width */
    .card-form {
        grid-row: span 3 !important;
    }

    .card-form input,
    .card-form button {
        padding: 8px;
        font-size: 13px;
    }

    /* Overlay padding fix so text doesn't hide behind buttons */
    .card-image.service-card .overlay {
        padding-right: 30px !important;
        padding-bottom: 12px;
    }
}

/* Image Comparison Slider */
.image-compare-card {
    padding: 0;
    overflow: hidden;
    position: relative;
    border: none;
}

.image-compare-container {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.image-compare-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.image-before {
    clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
}

.compare-slider {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    /* invisible */
    cursor: ew-resize;
    z-index: 10;
    margin: 0;
}

.compare-slider-line {
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background-color: white;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 5;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.compare-slider-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background-color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    color: #111;
}

.compare-slider-handle svg {
    width: 20px;
    height: 20px;
}

/* Arrow spacing for the handle */
.compare-slider-handle svg:first-child {
    margin-right: -4px;
}

.compare-slider-handle svg:last-child {
    margin-left: -4px;
}

/* Output 1 Hover Comparison */
.card-tall-compare {
    cursor: crosshair;
}

.hover-clip-layer {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    transition: clip-path 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-tall-compare:hover .hover-clip-layer {
    clip-path: polygon(0 0, 100% 0, 100% 0%, 0 0%);
}

.hover-scan-line {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 2px;
    background: #fff;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.8), 0 0 24px rgba(255, 255, 255, 0.5);
    transition: top 0.7s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
    z-index: 5;
}

.card-tall-compare:hover .hover-scan-line {
    top: 0%;
    opacity: 1;
}

/* Ken Burns Effect */
.ken-burns {
    animation: kenBurns 15s ease-in-out infinite alternate;
    transform-origin: center center;
}

@keyframes kenBurns {
    0% {
        transform: scale(1) translate(0, 0);
    }

    100% {
        transform: scale(1.15) translate(-2%, -2%);
    }
}

/* Hide specific cards permanently regardless of JS filtering */
.hide-permanently {
    display: none !important;
}

/* Flip Card Animation */
.card-flip {
    perspective: 1000px;
    padding: 0;
    border: none;
    background: transparent;
}

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

.card-flip.is-flipped .flipper {
    transform: rotateY(180deg);
}

.card-flip .front,
.card-flip .back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.card-flip .back {
    transform: rotateY(180deg);
}

.card-flip img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}