/**
 * Contacts Page Styles - Figma Design 2025-12-28 (Pixel Perfect)
 * Based on CONTACTS-PAGE-SPECIFICATION.md v1.0
 * BonEvents Theme
 */

/* ============================================
   CSS VARIABLES
   ============================================ */

:root {
    /* Contacts Page Specific Variables */
    --contacts-hero-aspect-ratio: 143.11%; /* Desktop: 717/501 * 100 */
    --contacts-hero-aspect-ratio-mobile: 143.2%; /* Mobile: 537/375 * 100 */
    --contacts-team-card-aspect-ratio: 143.27%; /* 447/312 * 100 */
    --contacts-section-gap: 80px;
    --contacts-card-width: 312px;
    --contacts-card-height: 447px;
}

/* ============================================
   HERO SECTION - Grid Layout: Left Column (Title + Company + Contact Info) + Right Column (Image)
   MOBILE: Title → Image → Company Info → Contact Info (different order!)
   ============================================ */

.contacts-hero {
    margin-top: 32px;
    background-color: #FCFDFF;
}

.contacts-hero__grid {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0; /* No padding - image flush right */
    display: grid;
    grid-template-columns: 1fr 501px; /* Left column flexible, Image 501px fixed */
    gap: 0; /* No gap - we control spacing with padding */
    align-items: start;
}

/* Left Column - Stacks Title + Company Info + Contact Info vertically */
.contacts-hero__left-column {
    display: flex;
    flex-direction: column;
    /* From Figma: left-[calc(8.33%+41px)] - using exact formula for responsive behavior */
    padding-left: calc(8.33% + 41px); /* 8.33% = 1/12 of container width + 41px offset */
    padding-right: 77px; /* Space before image */
}

.contacts-hero__title {
    font-family: 'Outfit', sans-serif;
    font-size: 128px;
    font-weight: 400;
    line-height: 1.01;
    color: #2C2C34;
    letter-spacing: 0;
    margin: 0;
    /* Gap calculation: Company top (363px) - Title top (154px) - Title height (128px * 1.01 ≈ 129px) = 80px */
    margin-bottom: 80px;
}

/* Hero Image - Padding-bottom трюк для aspect ratio 1:1.43 */
.contacts-hero__image-wrapper {
    position: relative;
    width: 100%;
    max-width: 501px;
    padding-bottom: var(--contacts-hero-aspect-ratio); /* 143.11% */
    overflow: hidden;
}

.contacts-hero__image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 50%;
}

/* ============================================
   COMPANY INFO SECTION (Inside hero left column)
   ============================================ */

.contacts-company {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px; /* Gap between name and registration */
    /* Gap calculation: Contact Info top (481px) - Company top (363px) - Company height (~66px) = ~52px */
    margin-bottom: 52px;
}

.contacts-company__name {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 400;
    line-height: 1.27;
    color: #2C2C34;
    letter-spacing: 0;
    margin: 0;
}

.contacts-company__registration {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 300;
    line-height: 2;
    color: rgba(44, 44, 52, 0.8);
    letter-spacing: 0;
    margin: 0;
}

/* ============================================
   CONTACT INFORMATION BLOCKS (Grid 2 columns) - Inside hero left column
   ============================================ */

.contacts-info {
    /* No margin-top needed - spacing handled by parent's margin-bottom */
    background-color: #FCFDFF;
}

.contacts-info__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    row-gap: 89px; /* Between rows per Figma */
    column-gap: auto; /* Auto distribute */
}

.contacts-info__block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.contacts-info__header {
    display: flex;
    align-items: center;
    gap: 9px;
}

.contacts-info__icon {
    font-size: 24px;
    color: #2C2C34;
}

.contacts-info__label {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 400;
    line-height: 1.27;
    color: #2C2C34;
    letter-spacing: 0;
    margin: 0;
}

.contacts-info__value {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 300;
    line-height: 2;
    color: rgba(44, 44, 52, 0.8);
    letter-spacing: 0;
    margin: 0;
}

.contacts-info__link {
    text-decoration: none;
    color: rgba(44, 44, 52, 0.8);
    transition: color 0.3s ease;
}

.contacts-info__link:hover {
    color: #B82D2D;
}

/* Phone numbers in a row */
.contacts-info__phones {
    display: flex;
    gap: 16px;
}

.contacts-info__phones .contacts-info__value {
    display: inline-block;
}

/* ============================================
   MAP + DIRECTIONS WRAPPER (Side by side on Desktop using Grid)
   ============================================ */

.contacts-map-wrapper {
    margin-top: 128px; /* From spec: большой отступ */
    background-color: #FCFDFF;
    max-width: 1440px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 48px;

    /* Desktop Grid: Directions left, Map right */
    display: grid;
    grid-template-columns: 1fr 551px; /* Directions takes remaining space, Map fixed 551px */
    gap: 0; /* No gap between */
    align-items: start;
}

/* Directions Section (Left side on Desktop) */
.contacts-directions {
    background-color: #FCFDFF;
}

.contacts-directions .container {
    max-width: 100%;
    margin: 0;
    padding: 0; /* Left padding: calc(16.67% + 35px) from left edge of wrapper = 275px - 48px wrapper padding = 227px */
    display: flex;
    flex-direction: column;
    gap: 35px; /* Between blocks */
}

/* Map Section Header - "How to find us" heading and description */
.contacts-directions__header-section {
    display: flex;
    flex-direction: column;
    gap: 16px; /* Gap between heading and description */
    width: 324px;
}

.contacts-directions__section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 36px;
    font-weight: 400;
    line-height: 1.28; /* 128% = 46.08px */
    color: #2C2C34;
    letter-spacing: 0;
    margin: 0;
}

.contacts-directions__section-description {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 300;
    line-height: 2; /* 200% = 28px */
    color: #2C2C34;
    opacity: 0.8;
    letter-spacing: 0;
    margin: 0;
    width: 324px;
}

/* Map Section (Right side on Desktop) */
.contacts-map {
    background-color: #FCFDFF;
}

.contacts-map .container {
    max-width: 100%;
    margin: 0;
    padding: 0;
}

.contacts-map__container {
    display: flex;
    justify-content: flex-end; /* Align map to right */
}

.contacts-map__image-wrapper {
    position: relative;
    width: 551px;
    height: 620px;
    overflow: hidden;
}

.contacts-map__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.contacts-directions__block {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-left: 15%;
}

.contacts-directions__header {
    display: flex;
    align-items: center;
    gap: 19px;
}

.contacts-directions__number {
    width: 24px;
    height: 24px;
    background-color: #2C2C34;
    border-radius: 222px;
    color: #FCFDFF;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.01;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.contacts-directions__title {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 400;
    line-height: 1.27;
    color: #2C2C34;
    margin: 0;
}

.contacts-directions__description {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 300;
    line-height: 2;
    color: rgba(44, 44, 52, 0.8);
    width: 324px;
    margin: 0;
}

.contacts-directions__phone {
    display: flex;
    align-items: center;
    gap: 24px;
}

.contacts-directions__phone i {
    font-size: 14px;
    color: #2C2C34;
}

.contacts-directions__phone a {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 300;
    line-height: 2;
    color: rgba(44, 44, 52, 0.8);
    text-decoration: none;
}

.contacts-directions__phone a:hover {
    color: #B82D2D;
}

/* ============================================
   PARTNERS SECTION (GLOBAL from ACF Options)
   ============================================ */

.contacts-partners {
    margin-top: 128px;
    background-color: #FCFDFF;
}

.contacts-partners .container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 76px; /* Between title and logos */
}

.contacts-partners__title {
    font-family: 'Outfit', sans-serif;
    font-size: 36px;
    font-weight: 400;
    line-height: 1.28;
    color: #2C2C34;
    letter-spacing: 0;
    text-align: center;
    margin: 0;
}

.contacts-partners__logos {
    width: 100%;
    max-width: 1344px; /* Max width from Figma, but responsive */
    display: flex;
    gap: 61px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

.contacts-partners__logo-link {
    display: block;
    height: 100px;
}

.contacts-partners__logo {
    height: 100px; /* Desktop height */
    width: auto;
    max-width: 100%; /* Prevent overflow */
    flex-shrink: 1; /* Allow shrinking */
    object-fit: contain;
}

/* ============================================
   TEAM SECTION (GLOBAL from CPT 'team_member')
   Grid 4 columns, aspect ratio 312:447 (1:1.43 NOT square!)
   ============================================ */

.contacts-team {
    margin-top: 128px; /* From spec: отступ от partners */
    background-color: #FCFDFF;
}

.contacts-team .container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 76px; /* Between title and grid */
}

.contacts-team__title {
    font-family: 'Outfit', sans-serif;
    font-size: 36px;
    font-weight: 400;
    line-height: 1.28;
    color: #2C2C34;
    letter-spacing: 0;
    text-align: center;
    margin: 0;
}

.contacts-team__grid {
    display: grid;
    grid-template-columns: repeat(4, 312px); /* Fixed 312px width */
    gap: 48px; /* Auto-distributed gap */
    justify-content: space-between;
    width: 100%;
}

/* Team Card */
.team-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px; /* Between photo and info */
}

/* Team Photo - aspect ratio 312:447 (1:1.43) */
.team-card__photo {
    width: 312px;
    height: 447px;
    overflow: hidden;
}

.team-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 50%;
    display: block;
}

.team-card__info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px; /* Between position and name */
    width: 280px;
    text-align: center;
}

/* IMPORTANT: Position BEFORE Name (specific order!) */
.team-card__position {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 300;
    line-height: 2;
    color: #2C2C34;
    width: 100%;
    margin: 0;
}

.team-card__name {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 400;
    line-height: 1.27;
    color: #2C2C34;
    width: 100%;
    margin: 0;
}

/* ============================================
   CTA SECTION
   ============================================ */

.contacts-cta {
    margin-top: 157px; /* From spec: gap from team */
    background-color: #FCFDFF;
}

.contacts-cta .container {
    max-width: 1344px;
    margin: 0 auto;
    padding: 0 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 48px; /* Between elements */
}

.contacts-cta__logo {
    width: 225px;
    height: 120px;
    object-fit: contain;
}

.contacts-cta__text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px; /* Between title and description */
    text-align: center;
}

.contacts-cta__title {
    font-family: 'Outfit', sans-serif;
    font-size: 36px;
    font-weight: 400;
    line-height: 1.28;
    color: #2C2C34;
    letter-spacing: 0;
    margin: 0;
}

.contacts-cta__description {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 300;
    line-height: 2;
    color: rgba(44, 44, 52, 0.8);
    letter-spacing: 0;
    margin: 0;
}

.contacts-cta__buttons {
    display: flex;
    gap: 24px;
    align-items: center;
    justify-content: center;
}

.contacts-cta__button {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 2;
    letter-spacing: 0;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.contacts-cta__button--primary {
    background-color: #2C2C34;
    color: #FCFDFF;
    padding: 4px 24px;
    border: none;
}

.contacts-cta__button--primary:hover {
    background-color: #B82D2D;
}

.contacts-cta__button--secondary {
    background-color: transparent;
    color: #2C2C34;
    padding: 4px 0;
    width: 189px;
    border: none;
}

.contacts-cta__button--secondary:hover {
    color: #B82D2D;
}

/* ============================================
   RESPONSIVE STYLES
   Desktop-first approach with pixel-perfect breakpoints
   ============================================ */

/* Tablet - Below 1440px */
@media (max-width: 1439px) {
    /* Slightly reduce spacing for smaller screens */
    .contacts-hero__grid {
        grid-template-columns: 1fr 400px;
    }

    .contacts-hero__left-column {
        padding-left: 20px; /* Reduce left padding */
    }

    .contacts-map-wrapper {
        padding: 0 24px;
        grid-template-columns: 1fr minmax(300px, 40%); /* Map takes 40% max */
    }

    .contacts-map__image-wrapper {
        width: 100%;
        height: auto;
        aspect-ratio: 551 / 620; /* Maintain aspect ratio */
    }

    .contacts-team__grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 32px;
    }

    /* Partners - Reduce gap */
    .contacts-partners__logos {
        gap: 40px;
    }

    .contacts-partners__logo {
        height: 80px; /* Smaller on tablets */
    }

    .contacts-partners__logo-link {
        height: 80px;
    }
}

/* Tablet - Below 1024px */
@media (max-width: 1023px) {
    .contacts-hero__title {
        font-size: 72px;
    }
    .contacts-hero__grid {
        grid-template-columns: 1fr 350px;
    }

    .contacts-hero__left-column {
        padding-right: 24px;
    }

    .contacts-map-wrapper {
        padding: 0 16px;
        grid-template-columns: 1fr; /* Stack vertically on smaller tablets */
        gap: 48px;
    }

    .contacts-directions .container {
        padding-left: 16px;
    }

    .contacts-map__image-wrapper {
        width: 100%;
        max-width: 100%;
    }

    .contacts-info__grid {
        grid-template-columns: 1fr;
        row-gap: 20px;
    }
    .contacts-info__phones {
        justify-content: flex-start;
        gap: 20px;
    }

    .contacts-team__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Partners - Further reduce */
    .contacts-partners__logos {
        gap: 32px;
    }

    .contacts-partners__logo {
        height: 70px;
    }

    .contacts-partners__logo-link {
        height: 70px;
    }
}

/* Mobile - Below 768px (375px base)
   CRITICAL: Element order changes! Title → Image → Company Info */
@media (max-width: 768px) {
    /* Hero Section - Mobile order: Title → Image → Company → Contact Info */
    .contacts-hero {
        margin-top: 32px; /* From spec: gap from header */
    }

    .contacts-hero__grid {
        padding: 0;
        display: flex;
        flex-direction: column; /* Stack vertically */
        gap: 0; /* We control gaps individually */
        overflow: hidden; /* Prevent overflow */
    }

    .contacts-hero__left-column {
        padding-left: 0;
        display: contents; /* Unwrap left column so children can be reordered */
    }

    .contacts-hero__title {
        order: 1; /* First */
        font-size: 50px; /* From spec: NOT 48px! */
        line-height: 1.28; /* Mobile line-height */
        text-align: left;
        margin-bottom: 24px; /* Gap to image */
        padding: 0 16px; /* Side padding for title */
    }

    /* Hero Image - full-width with padding-bottom 143.2% */
    .contacts-hero__image-wrapper {
        order: 2; /* Second */
        width: 100%;
        max-width: 100vw; /* Full viewport width */
        margin: 0 0 68px 0; /* Bottom gap only */
        padding-bottom: var(--contacts-hero-aspect-ratio-mobile); /* 143.2% */
    }

    /* Company Info */
    .contacts-company {
        order: 3; /* Third */
        margin-bottom: 35px; /* Gap to Contact Info */
        padding: 0 16px; /* Side padding for company info */
    }

    /* Contact Blocks - 1 column */
    .contacts-info {
        order: 4; /* Fourth */
    }

    .contacts-info__grid {
        padding: 0 16px; /* Side padding moved to grid */
        grid-template-columns: 1fr; /* Single column */
        row-gap: 35px;
    }

    .contacts-info__phones {
        flex-direction: column;
        gap: 16px;
    }

    /* Map + Directions Wrapper - Stack vertically on Mobile */
    .contacts-map-wrapper {
        margin-top: 200px;
        padding: 0; /* No padding - we control overflow per section */
        display: flex;
        flex-direction: column; /* Stack vertically */
        gap: 0;
        overflow: hidden; /* Prevent horizontal overflow */
    }

    /* Map */
    .contacts-map {
        /* Move map BEFORE directions in visual order on Mobile */
        order: -1; /* Map appears first */
        overflow: hidden; /* Prevent map from overflowing */
    }

    .contacts-map .container {
        padding: 0;
        max-width: 100%;
    }

    .contacts-map__container {
        padding: 0;
        justify-content: center;
        overflow: hidden;
    }

    .contacts-map__image-wrapper {
        width: 100%;
        max-width: 100vw; /* Full viewport width */
        height: 421.96px; /* From spec: mobile height */
        margin: 0; /* No negative margin needed */
    }

    /* Directions - OVERLAPS WITH MAP per Figma! */
    .contacts-directions {
        margin-top: -310px; /* Negative margin creates overlap effect on Mobile */
        position: relative;
        z-index: 2; /* Above map on Mobile */
    }

    /* Directions - Reset Desktop padding */
    .contacts-directions .container {
        padding: 0 16px; /* Side padding for Directions content */
        gap: 170px;
    }

    /* Map Section Header - Mobile styles */
    .contacts-directions__header-section {
        width: 100%;
        max-width: 343px;
    }

    .contacts-directions__section-description {
        width: 100%;
    }

    .contacts-directions__block {
        width: 100%;
        max-width: 343px;
    }

    /* Partners - Horizontal scroll on Mobile */
    .contacts-partners {
        margin-top: 408px;
    }

    .contacts-partners .container {
        padding: 0;
        overflow: hidden; /* Prevent Partners from creating page overflow */
    }

    .contacts-partners__title {
        padding: 0 16px;
    }

    .contacts-partners__logos {
        width: 100vw;
        max-width: 100vw; /* Prevent overflow */
        overflow-x: scroll;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 0 16px;
        justify-content: flex-start;
        flex-wrap: nowrap; /* No wrapping on mobile - scroll instead */
    }

    .contacts-partners__logos::-webkit-scrollbar {
        display: none;
    }

    .contacts-partners__logo {
        height: 70px; /* Mobile height from spec */
    }

    .contacts-partners__logo-link {
        height: 70px;
    }

    /* Team - 1 column */
    .contacts-team {
        margin-top: 166px;
    }

    .contacts-team .container {
        padding: 0 16px;
    }

    .contacts-team__grid {
        grid-template-columns: 1fr; /* Single column */
        gap: 112px; /* From spec: gap between cards */
        justify-content: center;
    }

    .team-card {
        max-width: 312px;
        margin: 0 auto;
    }

    .team-card__photo {
        width: 312px;
        height: 447px;
    }

    /* CTA - Buttons vertical */
    .contacts-cta {
        margin-top: 625px; /* From spec */
    }

    .contacts-cta .container {
        padding: 0 16px;
    }

    .contacts-cta__buttons {
        flex-direction: column; /* Vertical stack */
        gap: 16px;
        width: 100%;
    }

    .contacts-cta__button--primary,
    .contacts-cta__button--secondary {
        width: 100%;
        text-align: center;
    }
}

/* Extra Small Mobile - Below 375px */
@media (max-width: 374px) {
    .contacts-hero__title {
        font-size: 42px;
    }

    .team-card,
    .team-card__photo {
        width: 100%;
    }
}
