/* ========== Systems Page Overrides ========== */
.systems-page {
    background: var(--bg);
}

/* ========== Back Link ========== */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 100px 80px 0;
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.back-link:hover {
    color: var(--amber);
}

/* ========== Hero (Split Layout) ========== */
.systems-hero {
    padding: 40px 80px 60px;
    max-width: 1200px;
    margin: 0 auto;
}

.systems-hero-inner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 60px;
}

.systems-hero h1 {
    font-family: var(--font-heading);
    font-size: 4rem;
    font-weight: 400;
    color: var(--dark);
    line-height: 1.1;
    flex-shrink: 0;
}

.systems-hero-sub {
    font-size: 1.15rem;
    color: var(--text-light);
    line-height: 1.8;
    max-width: 480px;
    padding-top: 12px;
}

.hero-divider {
    border: none;
    height: 1px;
    background: var(--border);
    max-width: 1200px;
    margin: 0 auto;
}

/* ========== Directory ========== */
.directory {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 80px;
}

.directory-row {
    display: grid;
    grid-template-columns: 280px 1fr 1.2fr 56px;
    align-items: center;
    gap: 40px;
    padding: 48px 0;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.directory-row:hover {
    opacity: 0.85;
}

.directory-row:hover .directory-arrow {
    border-color: var(--amber);
    color: var(--amber);
}

.directory-image {
    width: 280px;
    height: 190px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
}

.directory-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.directory-row:hover .directory-image img {
    transform: scale(1.03);
}

.directory-title h2 {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 400;
    color: var(--dark);
    line-height: 1.2;
}

.directory-desc p {
    font-size: 0.95rem;
    color: var(--text-light);
    line-height: 1.7;
}

.directory-arrow {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.directory-divider {
    border: none;
    height: 1px;
    background: var(--border);
    margin: 0;
}

/* ========== Modal Overlay ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

body.modal-open {
    overflow: hidden;
}

.modal-content {
    background: var(--white);
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 16px;
    padding: 56px 48px;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close:hover {
    color: var(--amber);
    border-color: var(--amber);
}

.modal-panel {
    display: none;
}

.modal-panel.active {
    display: block;
}

/* ========== Case Study Content (inside modal) ========== */
.case-study-header {
    margin-bottom: 40px;
    padding-bottom: 16px;
    padding-right: 56px;
    border-bottom: 3px solid var(--amber);
}

.case-study-header h2 {
    font-family: var(--font-heading);
    color: var(--dark);
    font-size: 2.2rem;
    font-weight: 400;
    line-height: 1.2;
}

.case-study-body {
    padding: 0;
}

.case-study-label {
    font-size: 1rem;
    font-weight: 700;
    color: var(--amber);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 16px;
    margin-top: 48px;
}

.case-study-label:first-child {
    margin-top: 0;
}

.case-study-body p {
    font-size: 1.1rem;
    line-height: 1.9;
    color: var(--text);
}

/* ========== Contact CTA ========== */
.systems-cta {
    text-align: center;
    padding: 100px 80px;
    background: linear-gradient(135deg, #f5f5f5 0%, #ececec 100%);
    margin-top: 80px;
}

.systems-cta h2 {
    font-family: var(--font-heading);
    font-size: 2.8rem;
    font-weight: 400;
    color: var(--dark);
    margin-bottom: 16px;
}

.systems-cta p {
    font-size: 1.2rem;
    color: var(--text-light);
    margin-bottom: 40px;
    line-height: 1.7;
}

/* ========== Reduced Motion ========== */
@media (prefers-reduced-motion: reduce) {
    .modal-overlay {
        transition: none;
    }

    .modal-content {
        transition: none;
        transform: none;
    }

    .directory-image img {
        transition: none;
    }

    .directory-arrow {
        transition: none;
    }
}

/* ========== Responsive ========== */

/* Tablet landscape */
@media (max-width: 1024px) {
    .directory-row {
        grid-template-columns: 220px 1fr 1fr 48px;
        gap: 28px;
    }

    .directory-image {
        width: 220px;
        height: 150px;
    }

    .directory-title h2 {
        font-size: 1.6rem;
    }

    .directory-arrow {
        width: 48px;
        height: 48px;
    }
}

/* Tablet portrait */
@media (max-width: 900px) {
    .back-link {
        padding: 90px 30px 0;
    }

    .systems-hero {
        padding: 20px 30px 40px;
    }

    .systems-hero-inner {
        flex-direction: column;
        gap: 16px;
    }

    .systems-hero h1 {
        font-size: 2.6rem;
    }

    .systems-hero-sub {
        font-size: 1.05rem;
        padding-top: 0;
    }

    .hero-divider {
        margin-left: 30px;
        margin-right: 30px;
    }

    .directory {
        padding: 0 30px;
    }

    .directory-row {
        grid-template-columns: 180px 1fr 44px;
        gap: 24px;
        padding: 36px 0;
    }

    .directory-desc {
        display: none;
    }

    .directory-image {
        width: 180px;
        height: 120px;
    }

    .directory-title h2 {
        font-size: 1.4rem;
    }

    .directory-arrow {
        width: 44px;
        height: 44px;
    }

    .modal-content {
        width: 95%;
        padding: 48px 30px 40px;
    }

    .case-study-header {
        padding-right: 48px;
    }

    .case-study-header h2 {
        font-size: 1.6rem;
    }

    .case-study-label {
        margin-top: 36px;
    }

    .case-study-body p {
        font-size: 1.05rem;
    }

    .systems-cta {
        padding: 60px 30px;
    }

    .systems-cta h2 {
        font-size: 2.2rem;
    }
}

/* Small phones */
@media (max-width: 480px) {
    .back-link {
        padding: 80px 20px 0;
    }

    .systems-hero {
        padding: 16px 20px 30px;
    }

    .systems-hero h1 {
        font-size: 2rem;
    }

    .hero-divider {
        margin-left: 20px;
        margin-right: 20px;
    }

    .directory {
        padding: 0 20px;
    }

    .directory-row {
        grid-template-columns: 1fr 40px;
        gap: 16px;
        padding: 28px 0;
    }

    .directory-image {
        display: none;
    }

    .directory-title h2 {
        font-size: 1.25rem;
    }

    .directory-arrow {
        width: 40px;
        height: 40px;
    }

    /* Modal as bottom sheet on phones */
    .modal-overlay {
        align-items: flex-end;
    }

    .modal-content {
        width: 100%;
        max-height: 92vh;
        padding: 24px 20px 36px;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
    }

    .modal-overlay.active .modal-content {
        transform: translateY(0);
    }

    .modal-close {
        position: sticky;
        top: 0;
        float: right;
        margin: 0 0 8px 8px;
        z-index: 1;
        background: var(--white);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    }

    .case-study-header {
        margin-bottom: 28px;
    }

    .case-study-header h2 {
        font-size: 1.4rem;
    }

    .case-study-label {
        margin-top: 32px;
    }

    .case-study-body p {
        font-size: 1rem;
        line-height: 1.8;
    }

    .systems-cta {
        padding: 50px 20px;
    }

    .systems-cta h2 {
        font-size: 1.8rem;
    }
}
