/* ==========================================================================
   TELEPATHIC - Main Stylesheet
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties (Design Tokens)
   -------------------------------------------------------------------------- */
:root {
    /* Colors */
    --color-black: #0D0D0D;
    --color-white: #F5F5F5;
    --color-gray-100: #f7f7f7;
    --color-gray-200: #eeeeee;
    --color-gray-300: #dddddd;
    --color-gray-600: #666666;
    --color-gray-800: #222222;

    /* Typography */
    --font-primary: 'Inter', system-ui, -apple-system, sans-serif;

    --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
    --text-sm: clamp(0.875rem, 0.8rem + 0.375vw, 1rem);
    --text-base: clamp(1rem, 0.9rem + 0.5vw, 1.125rem);
    --text-lg: clamp(1.125rem, 1rem + 0.625vw, 1.375rem);
    --text-xl: clamp(1.25rem, 1rem + 1.25vw, 1.75rem);
    --text-2xl: clamp(1.5rem, 1.25rem + 1.25vw, 2.25rem);
    --text-3xl: clamp(2rem, 1.5rem + 2.5vw, 3.5rem);
    --text-4xl: clamp(2.5rem, 2rem + 2.5vw, 4.5rem);
    --text-hero: clamp(3rem, 2rem + 5vw, 8rem);

    /* Spacing - fluid */
    --space-xs: clamp(0.5rem, 0.4rem + 0.5vw, 0.75rem);
    --space-sm: clamp(0.75rem, 0.6rem + 0.75vw, 1.25rem);
    --space-md: clamp(1rem, 0.8rem + 1vw, 1.5rem);
    --space-lg: clamp(1.5rem, 1rem + 2.5vw, 3rem);
    --space-xl: clamp(2rem, 1.5rem + 2.5vw, 4rem);
    --space-2xl: clamp(3rem, 2rem + 5vw, 6rem);
    --space-3xl: clamp(4rem, 3rem + 5vw, 8rem);
    --space-section: clamp(3rem, 4rem + 5vw, 8rem);

    /* Layout */
    --container-max: 1400px;
    --container-padding: clamp(1.5rem, 1rem + 2.5vw, 4rem);

    /* Page margin - single source of truth for horizontal alignment */
    /* Header, footer, container, and case content all use this */
    --page-margin: var(--container-padding);

    /* Transitions */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
    --duration-fast: 200ms;
    --duration-base: 400ms;
    --duration-slow: 800ms;
    --duration-reveal: 1000ms;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    scroll-padding-top: 5rem;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    font-weight: 400;
    line-height: 1.6;
    color: var(--color-black);
    background-color: var(--color-white);
    overflow-x: hidden;
}

img, video {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
    transition: opacity var(--duration-fast) var(--ease-out-quart);
}

a:hover {
    opacity: 0.6;
}

ul, ol {
    list-style: none;
}

button {
    font: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */
.container {
    width: 100%;
    margin: 0;
    padding: 0 var(--page-margin);
}

.section {
    padding: var(--space-section) 0;
}

.section--dark {
    background-color: var(--color-black);
    color: var(--color-white);
}

.section-title {
    font-size: var(--text-3xl);
    font-weight: 500;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-xl);
}

/* --------------------------------------------------------------------------
   Header & Navigation
   -------------------------------------------------------------------------- */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: var(--space-md) var(--page-margin);
    display: flex;
    justify-content: space-between;
    align-items: center;
    mix-blend-mode: difference;
    color: var(--color-white);
}

.logo-img {
    width: 150px;
    height: auto;
    filter: brightness(0) invert(1);
}

@media (max-width: 768px) {
    .logo-img {
        width: 120px !important;
    }
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

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

/* --------------------------------------------------------------------------
   Hero Video
   -------------------------------------------------------------------------- */
.hero-video {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: var(--color-black);
}

.hero-video__media {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-video__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.hero-video__content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2;
}

.hero-video__logo {
    width: clamp(180px, 30vw, 400px);
    height: auto;
}

/* --------------------------------------------------------------------------
   Intro
   -------------------------------------------------------------------------- */
.intro-content {
    max-width: 700px;
}

.intro-title {
    font-size: var(--text-4xl);
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: var(--space-md);
}

.intro-text {
    font-size: var(--text-xl);
    font-weight: 300;
    color: var(--color-gray-600);
    line-height: 1.5;
}

.intro-link {
    display: inline-block;
    margin-top: var(--space-lg);
    font-size: var(--text-base);
    color: var(--color-gray-600);
    text-decoration: underline;
    text-underline-offset: 4px;
    transition: color var(--duration-fast) ease;
}

.intro-link:hover {
    color: var(--color-black);
}

/* --------------------------------------------------------------------------
   Work Button
   -------------------------------------------------------------------------- */
.work-button {
    display: inline-block;
    font-size: var(--text-3xl);
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--color-black);
    text-decoration: none;
    padding: var(--space-md) var(--space-xl);
    border: 2px solid var(--color-black);
    border-radius: 100px;
    transition:
        background-color var(--duration-base) var(--ease-out-expo),
        color var(--duration-base) var(--ease-out-expo),
        transform var(--duration-fast) var(--ease-out-quart);
}

.work-button:hover {
    background-color: var(--color-black);
    color: var(--color-white);
    opacity: 1;
    transform: scale(1.05);
}

/* --------------------------------------------------------------------------
   About
   -------------------------------------------------------------------------- */
.about-content {
    max-width: 700px;
}

.about-text {
    font-size: var(--text-2xl);
    font-weight: 300;
    line-height: 1.4;
}

.about-text--secondary {
    margin-top: var(--space-md);
    font-size: var(--text-lg);
    opacity: 0.7;
}

/* --------------------------------------------------------------------------
   Client Logos
   -------------------------------------------------------------------------- */
.client-logos-header {
    font-size: 0.65rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.35);
    margin-top: var(--space-2xl);
    margin-bottom: 0;
    text-align: center;
    width: 100%;
}

.client-logos {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: clamp(1.5rem, 3vw, 2.5rem);
    margin-top: var(--space-md);
    align-items: center;
    justify-items: center;
    width: 100%;
}

.client-logo {
    width: 100% !important;
    max-width: 120px !important;
    height: auto !important;
    max-height: clamp(35px, 5vw, 55px) !important;
    -o-object-fit: contain;
    object-fit: contain;
    opacity: 0.6;
    -webkit-filter: brightness(0) invert(1);
    filter: brightness(0) invert(1);
    -webkit-transition: opacity var(--duration-fast) var(--ease-out-quart);
    transition: opacity var(--duration-fast) var(--ease-out-quart);
}

.client-logo:hover {
    opacity: 1;
}

.client-logo--svg {
    -webkit-filter: none !important;
    filter: none !important;
}

/* Size adjustments for individual logos */
.client-logo--sm {
    transform: scale(0.7);
}

.client-logo--lg {
    transform: scale(1.3);
}

@media (max-width: 768px) {
    .client-logos {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1.5rem 1rem;
    }

    .client-logo {
        max-width: 90px !important;
        max-height: clamp(25px, 6vw, 40px) !important;
    }
}

/* --------------------------------------------------------------------------
   Contact Form
   -------------------------------------------------------------------------- */
.contact-intro {
    font-size: clamp(1.1rem, 2vw, 1.3rem);
    color: var(--color-text-muted);
    max-width: 700px;
    margin-bottom: var(--space-xl);
}

.contact-form {
    max-width: 700px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(0.5rem, 2vw, 1rem);
}

.form-group {
    margin-bottom: clamp(0.5rem, 2vw, 1rem);
}

.form-group label {
    display: block;
    font-size: clamp(0.75rem, 1.5vw, 0.875rem);
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--color-gray-600);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: clamp(0.4rem, 1vw, 0.75rem);
    font-family: var(--font-primary);
    font-size: clamp(0.875rem, 1.5vw, 1rem);
    color: var(--color-black);
    background: var(--color-white);
    border: 1px solid var(--color-gray-300);
    border-radius: 0;
    transition: border-color var(--duration-fast) var(--ease-out-quart);
    -webkit-appearance: none;
    appearance: none;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-black);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--color-gray-300);
}

.form-group textarea {
    resize: vertical;
    min-height: clamp(60px, 10vh, 100px);
}

.form-submit {
    display: inline-block;
    padding: clamp(0.4rem, 1vw, 0.75rem) clamp(1rem, 3vw, 2rem);
    font-family: var(--font-primary);
    font-size: clamp(0.75rem, 1.5vw, 0.875rem);
    font-weight: 500;
    color: var(--color-white);
    background: var(--color-black);
    border: none;
    cursor: pointer;
    transition: opacity var(--duration-fast) var(--ease-out-quart);
}

.form-submit:hover {
    opacity: 0.7;
}

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

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .contact-form {
        padding-bottom: 5rem;
    }
}

/* --------------------------------------------------------------------------
   Services Table (Work Page)
   -------------------------------------------------------------------------- */
.services-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0;
    margin-top: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.services-column {
    padding: 0.8rem 1rem 0.8rem 0;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
}

.services-column:nth-child(6n) {
    border-right: none;
}

.services-column:not(:first-child) {
    padding-left: 1rem;
}

.services-header {
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: clamp(0.6rem, 1vw, 0.7rem);
    color: var(--color-white);
    margin-bottom: 0.5rem;
}

.services-list {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.service-item {
    font-size: clamp(0.65rem, 1vw, 0.8rem);
    color: rgba(255, 255, 255, 0.3);
    line-height: 1.4;
}

.service-item.active {
    color: rgba(255, 255, 255, 0.9);
}

.service-item.active::before {
    content: '✓\00A0';  /* Non-breaking space keeps checkmark with first word */
}

/* Services Table - Responsive 3x2 on mobile */
@media (max-width: 768px) {
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Remove right border on 3rd and 6th columns (end of each row) */
    .services-column:nth-child(3n) {
        border-right: none;
    }

    /* Add bottom border to first row (columns 1-3) */
    .services-column:nth-child(-n+3) {
        border-bottom: 1px solid rgba(255, 255, 255, 0.15);
        padding-bottom: 0.8rem;
    }

    /* Add top padding to second row (columns 4-6) */
    .services-column:nth-child(n+4) {
        padding-top: 0.8rem;
    }

    .services-column {
        padding: 0.6rem 0.6rem 0.6rem 0;
    }

    .services-column:not(:first-child):not(:nth-child(4)) {
        padding-left: 0.6rem;
    }

    .services-column:nth-child(4) {
        padding-left: 0;
    }

    .services-header {
        font-size: 0.55rem;
    }

    .service-item {
        font-size: 0.6rem;
    }
}

@media (max-width: 480px) {
    .services-column {
        padding: 0.5rem 0.4rem 0.5rem 0;
    }

    .services-column:not(:first-child):not(:nth-child(4)) {
        padding-left: 0.4rem;
    }

    .services-column:nth-child(4) {
        padding-left: 0;
    }

    .services-header {
        font-size: 0.45rem;
        letter-spacing: 0.05em;
    }

    .service-item {
        font-size: 0.5rem;
        line-height: 1.3;
    }
}

/* --------------------------------------------------------------------------
   Case Gallery (Work Page)
   -------------------------------------------------------------------------- */
.case__gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-md);
    margin-top: var(--space-xl);
}

.case__gallery img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    cursor: pointer;
    transition: transform var(--duration-fast) var(--ease-out-quart),
                opacity var(--duration-fast) var(--ease-out-quart);
}

.case__gallery img:hover {
    transform: scale(1.02);
    opacity: 0.9;
}

@media (max-width: 600px) {
    .case__gallery {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: var(--space-md) var(--page-margin);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: none;
    mix-blend-mode: difference;
    color: var(--color-white);
    font-size: var(--text-xs);
}

.footer a {
    pointer-events: auto;
    color: inherit;
    text-decoration: none;
    opacity: 0.7;
    transition: opacity var(--duration-fast) var(--ease-out-quart);
}

.footer a:hover {
    opacity: 1;
}

.footer__left,
.footer__right {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.footer__right {
    text-align: right;
}

/* --------------------------------------------------------------------------
   Scroll Reveal Animations
   -------------------------------------------------------------------------- */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition:
        opacity var(--duration-reveal) var(--ease-out-expo),
        transform var(--duration-reveal) var(--ease-out-expo);
}

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

/* Staggered reveals for grid items */
.work-grid .reveal:nth-child(1) { transition-delay: 0ms; }
.work-grid .reveal:nth-child(2) { transition-delay: 100ms; }
.work-grid .reveal:nth-child(3) { transition-delay: 200ms; }
.work-grid .reveal:nth-child(4) { transition-delay: 300ms; }
.work-grid .reveal:nth-child(5) { transition-delay: 400ms; }
.work-grid .reveal:nth-child(6) { transition-delay: 500ms; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    :root {
        /* Thin sleek margin on tablet - matches work page clip-path border */
        --page-margin: 16px;
    }

    .nav-links {
        gap: 1.5rem;
    }

    .footer {
        padding: var(--space-sm) var(--page-margin);
    }
}

@media (max-width: 480px) {
    :root {
        /* Even thinner margin on mobile - matches work page clip-path border */
        --page-margin: 12px;
    }

    .nav-links a {
        font-size: var(--text-xs);
    }

    .footer {
        font-size: 0.7rem;
    }
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }

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