/**
 * Legal Services Section Block Styles
 * Based on Figma Design Specifications
 */

/* ============================================
   FORCE FULL-WIDTH DISPLAY
   ============================================ */

.wp-block-mawconsultant-legal-services {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    position: relative;
}

/* ============================================
   LEGAL SERVICES SECTION BASE STYLES
   ============================================ */

.legal-services-section {
    position: relative;
    width: 100%;
    background-color: var(--color-accent);
    padding-block: 128px;
    padding-inline: var(--container-padding-outer);
    margin: 0 !important;
}

.legal-services__container {
    max-width: 1440px;
    margin: 0 auto;
    padding-inline: var(--container-padding-inner);
}

/* ============================================
   HEADER SECTION
   ============================================ */

.legal-services__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 80px;
}

.legal-services__header-content {
    max-width: 515px;
}

/* Label */
.legal-services__label {
    font-family: 'DM Sans', Arial, sans-serif;
    font-size: 14px;
    font-weight: 700;
    line-height: 20px;
    color: var(--color-chart-3);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0;
}

/* Heading */
.legal-services__heading {
    font-family: 'Gambetta', Georgia, serif;
    font-size: 48px;
    font-weight: 500;
    line-height: 56px;
    letter-spacing: -0.96px;
    /* -2% of 48px */
    color: var(--color-accent-foreground);
    margin: 0;
}

/* ============================================
   NAVIGATION BUTTONS
   ============================================ */

.legal-services__nav {
    display: flex;
    gap: 12px;
    align-items: center;
}

.legal-services__nav-btn {
    width: 48px;
    height: 48px;
    border: 1px solid var(--color-border);
    background-color: transparent;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--color-accent-foreground);
}

.legal-services__nav-btn:hover {
    background-color: var(--color-background);
    border-color: var(--color-accent-foreground);
}

.legal-services__nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.legal-services__nav-btn svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   SERVICES LIST / CAROUSEL
   ============================================ */

.legal-services__list-wrapper {
    position: relative;
    overflow: hidden;
    margin: 0 -230px 0 -80px;
    /* Asymmetric: left extends 80px, right extends 208px beyond section */
    padding: 0 80px;
}

.legal-services__list {
    display: flex;
    gap: 1px;
    overflow-x: auto;
    padding-right: 150px;
    scroll-behavior: smooth;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
}

.legal-services__list::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari, Opera */
}

/* ============================================
   SERVICE CARDS
   ============================================ */

.legal-services__card {
    flex: 0 0 287.25px;
    width: 287.25px;
    height: 312px;
    background-color: var(--color-background);
    padding: 40px;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: background-color 0.3s ease;
    cursor: default;
}

.legal-services__card:hover {
    background-color: var(--color-muted);
}

/* Divider */
.legal-services__card-divider {
    width: 40px;
    height: 2px;
    background-color: var(--color-secondary-foreground);
    margin-bottom: 32px;
    transition: width 0.3s ease;
}

.legal-services__card:hover .legal-services__card-divider {
    width: 80px;
}

/* Title */
.legal-services__card-title {
    font-family: 'Gambetta', Georgia, serif;
    font-size: 20px;
    font-weight: 500;
    line-height: 28px;
    letter-spacing: 0;
    color: var(--color-accent-foreground);
    margin: 0 0 24px 0;
}

/* Description */
.legal-services__card-description {
    font-family: 'DM Sans', Arial, sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 24px;
    letter-spacing: 0;
    color: var(--color-muted-foreground);
    margin: 0 0 auto 0;
    flex-grow: 1;
}

/* Link */
.legal-services__card-link {
    font-family: 'DM Sans', Arial, sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 16px;
    color: var(--color-accent-foreground);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: opacity 0.3s ease;
    margin-top: 24px;
    cursor: pointer;
}

.legal-services__card-link:hover {
    opacity: 0.7;
}

.legal-services__card-link svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ============================================
   CARD ANIMATIONS
   ============================================ */

@keyframes slideInCard {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

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

@keyframes slideOutCard {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(-20px);
    }
}

/* ============================================
   EDITOR PREVIEW STYLES
   ============================================ */

.legal-services-editor {
    background: #f5f5f5;
    padding: 40px;
    border: 1px solid #ddd;
}

.legal-services-preview {
    background: #ffffff;
    padding: 40px;
    border-radius: 4px;
}

.legal-services-preview__label {
    font-family: 'DM Sans', Arial, sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: #007AFF;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.legal-services-preview__heading {
    font-family: 'Gambetta', Georgia, serif;
    font-size: 24px;
    font-weight: 500;
    line-height: 1.2;
    margin-bottom: 24px;
}

.legal-services-preview__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.legal-services-preview__card {
    background: #f5f5f5;
    padding: 16px;
    border-radius: 4px;
}

.legal-services-preview__card h3 {
    font-size: 16px;
    margin: 0 0 8px 0;
}

.legal-services-preview__card p {
    font-size: 12px;
    color: #666;
    margin: 0;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1200px) {
    .legal-services-section {
        padding-block: 100px;
    }

    .legal-services__list-wrapper {
        margin: 0 -100px;
        /* -(40px container + 60px section) */
        padding: 0 60px;
    }
}

@media (max-width: 1024px) {
    .legal-services-section {
        padding-block: 80px;
    }

    .legal-services__header {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-end;
    }

    .legal-services__heading {
        font-size: 48px;
        line-height: 56px;
        letter-spacing: -0.02em;
        max-width: 515px;
    }

    .legal-services__list-wrapper {
        margin: 0 -80px;
        /* -(40px container + 40px section) */
        padding: 0 40px;
    }

    .legal-services__card {
        flex: 0 0 223px;
        width: 223px;
        height: 390px;
    }
}

@media (max-width: 768px) {
    .legal-services-section {
        padding-block: 60px;
        padding-inline: 16px;
    }

    .legal-services__container {
        padding-inline: 0;
    }

    .legal-services__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 24px;
        margin-bottom: 48px;
    }

    .legal-services__header-content {
        max-width: 100%;
        width: 100%;
    }

    .legal-services__heading {
        font-size: 32px;
        line-height: 40px;
        letter-spacing: -0.64px;
    }

    .legal-services__nav {
        margin-top: 24px;
    }

    .legal-services__list-wrapper {
        margin: 0;
        padding: 0;
    }

    .legal-services__list {
        gap: 12px;
        padding-right: 0;
    }

    .legal-services__card {
        flex: 0 0 calc(100vw - 32px);
        width: calc(100vw - 32px);
        max-width: 100%;
        height: auto;
        min-height: 320px;
        padding: 24px;
    }

    .legal-services__card:last-child {
        margin-right: 0;
    }

    .legal-services__card-title {
        font-size: 18px;
        line-height: 26px;
        margin-bottom: 16px;
    }

    .legal-services__card-description {
        font-size: 16px;
        line-height: 22px;
        margin-bottom: 16px;
    }

    .legal-services__card-link {
        font-size: 16px;
        line-height: 22px;
    }
}

@media (max-width: 480px) {
    .legal-services-section {
        padding-block: 40px;
        padding-inline: 16px;
    }

    .legal-services__container {
        padding-inline: 0;
    }

    .legal-services__header {
        margin-bottom: 40px;
    }

    .legal-services__heading {
        letter-spacing: -0.02em;
    }

    .legal-services__label {
        font-size: 12px;
        line-height: 18px;
        margin-bottom: 12px;
    }

    .legal-services__nav {
        gap: 10px;
        margin-top: 20px;
    }

    .legal-services__nav-btn {
        width: 40px;
        height: 40px;
        font-size: 12px;
    }

    .legal-services__nav-btn svg {
        width: 16px;
        height: 16px;
    }

    .legal-services__list-wrapper {
        margin: 0;
        padding: 0;
    }

    .legal-services__list {
        gap: 10px;
        padding-right: 0;
    }

    .legal-services__card {
        flex: 0 0 calc(100vw - 32px);
        width: calc(100vw - 32px);
        max-width: 100%;
        height: auto;
        min-height: 300px;
        padding: 20px;
        animation: slideInCard 0.5s ease-out forwards;
    }

    .legal-services__card:last-child {
        margin-right: 0;
    }

    .legal-services__list {
        scroll-behavior: smooth;
    }

    .legal-services__card:nth-child(1) {
        animation-delay: 0s;
    }

    .legal-services__card:nth-child(2) {
        animation-delay: 0.1s;
    }

    .legal-services__card:nth-child(3) {
        animation-delay: 0.2s;
    }

    .legal-services__card:nth-child(4) {
        animation-delay: 0.3s;
    }

    .legal-services__card:nth-child(5) {
        animation-delay: 0.4s;
    }

    .legal-services__card-divider {
        width: 32px;
        height: 2px;
        margin-bottom: 24px;
    }

    .legal-services__card:hover .legal-services__card-divider {
        width: 64px;
    }

    .legal-services__card-title {
        margin-bottom: 12px;
    }

    .legal-services__card-description {
        margin-bottom: 12px;
    }

    .legal-services__card-link {
        margin-top: 12px;
    }

    .legal-services__card-link svg {
        width: 14px;
        height: 14px;
    }
}

/* ============================================
   SCROLL-TRIGGERED ENTRANCE ANIMATIONS
   JS adds .is-visible to [data-animate] elements
   when section reaches 10% viewport visibility.
   ============================================ */

/* --- Base: all animatable elements start invisible --- */
.legal-services-section [data-animate] {
    opacity: 0;
    transform: translateY(32px);
    transition:
        opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: opacity, transform;
}

/* --- Visible state triggered by JS --- */
.legal-services-section [data-animate].is-visible {
    opacity: 1;
    transform: translateY(0);
    /* Override existing mobile slideInCard animation once visible */
    animation: none;
}

/* --- Respect reduced-motion preference --- */
@media (prefers-reduced-motion: reduce) {
    .legal-services-section [data-animate] {
        opacity: 1;
        transform: none;
        transition: none;
        animation: none;
    }
}