/* static/css/sections/services.css */

/* ============================================================
   УСЛУГИ — LYNXREACTOR
   ============================================================ */

.services-section {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    padding: 100px 0;
    padding-top: 120px;
    padding-bottom: 100px;
    background: var(--color-primary-dark);
    overflow-x: hidden;
    overflow-y: visible;
}

.services-header {
    max-width: var(--section-header-width, 900px);
    margin: 0 auto 60px;
    text-align: center;
}

.services-header .section-description {
    max-width: var(--section-description-width, 800px);
    margin-left: auto;
    margin-right: auto;
}

.services-header .section-title {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    width: 100%;
    padding: 0 20px;
    margin: 0 auto;
}

/* ============================================================
   КАРТОЧКА УСЛУГИ
   ============================================================ */

.service-card {
    position: relative;
    aspect-ratio: 16/9;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
    border-radius: 16px;
    cursor: pointer;
    min-width: 0;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: 4px solid transparent;
    box-shadow: var(--shadow-sm);
    margin: 6px 0;
}

[data-theme="dark"] .service-card {
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .service-card {
    border-color: var(--color-border, #E4DED5);
}

.service-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-gold) !important;
}

/* ============================================================
   ОВЕРЛЕЙ — ЗАТЕМНЕНИЕ СНИЗУ (БЕЗ BLUR)
   ============================================================ */

.service-card-overlay {
    position: absolute;
    inset: 0;
    padding: 14px 16px 12px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-radius: 16px;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        transparent 50%,
        rgba(0, 0, 0, 0.2) 70%,
        rgba(0, 0, 0, 0.5) 85%,
        rgba(0, 0, 0, 0.7) 100%
    );
}

/* Тёмная тема */
[data-theme="dark"] .service-card-overlay {
    background: linear-gradient(
        to bottom,
        transparent 0%,
        transparent 50%,
        rgba(0, 0, 0, 0.3) 70%,
        rgba(0, 0, 0, 0.6) 85%,
        rgba(0, 0, 0, 0.85) 100%
    );
}

[data-theme="dark"] .service-card:hover .service-card-overlay {
    background: linear-gradient(
        to bottom,
        transparent 0%,
        transparent 40%,
        rgba(0, 0, 0, 0.2) 60%,
        rgba(0, 0, 0, 0.4) 80%,
        rgba(0, 0, 0, 0.6) 100%
    );
}

/* Светлая тема */
[data-theme="light"] .service-card-overlay {
    background: linear-gradient(
        to bottom,
        transparent 0%,
        transparent 70%,
        rgba(0, 0, 0, 0.03) 80%,
        rgba(0, 0, 0, 0.15) 90%,
        rgba(0, 0, 0, 0.35) 100%
    );
}

[data-theme="light"] .service-card:hover .service-card-overlay {
    background: linear-gradient(
        to bottom,
        transparent 0%,
        transparent 65%,
        rgba(0, 0, 0, 0.02) 78%,
        rgba(0, 0, 0, 0.1) 88%,
        rgba(0, 0, 0, 0.25) 100%
    );
}

/* ============================================================
   ПОДЛОЖКА ПОД ТЕКСТ (С BLUR)
   ============================================================ */

.service-card-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    padding: 10px 14px 8px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Тёмная тема — подложка */
[data-theme="dark"] .service-card-content {
    background: rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .service-card:hover .service-card-content {
    background: rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.02);
}

/* Светлая тема — подложка */
[data-theme="light"] .service-card-content {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="light"] .service-card:hover .service-card-content {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.05);
}

/* ============================================================
   КОНТЕНТ КАРТОЧКИ
   ============================================================ */

.service-number {
    font-family: var(--font-serif);
    font-size: 28px;
    font-weight: 900;
    color: var(--color-text-light, #FFFFFF);
    opacity: 0.8;
    line-height: 1;
    margin-bottom: 4px;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.service-card:hover .service-number {
    opacity: 1;
    transform: translateX(4px);
}

[data-theme="light"] .service-number {
    color: var(--color-text-primary, #202321);
    opacity: 0.8;
    text-shadow: 0 2px 8px rgba(255, 255, 255, 0.3);
}

[data-theme="light"] .service-card:hover .service-number {
    opacity: 1;
    color: var(--color-gold, #B8734F);
}

.service-title {
    font-family: var(--font-serif);
    font-size: 15px;
    color: var(--color-text-light, #FFFFFF);
    margin-bottom: 2px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.2;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .service-title {
    color: var(--color-text-primary, #202321);
    text-shadow: 0 2px 8px rgba(255, 255, 255, 0.3);
}

.service-description {
    font-size: 11px;
    color: var(--color-text-light, rgba(255, 255, 255, 0.85));
    line-height: 1.3;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .service-description {
    color: var(--color-text-secondary, #6E706C);
    text-shadow: 0 1px 4px rgba(255, 255, 255, 0.2);
}

.service-more-btn {
    font-size: 11px;
    color: var(--color-gold-light, #D8AD95);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: var(--font-sans);
    width: fit-content;
    position: relative;
    z-index: 5;
    pointer-events: auto !important;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.service-more-btn:hover {
    gap: 8px;
    color: var(--color-gold-light, #D8AD95);
}

[data-theme="light"] .service-more-btn {
    color: var(--color-gold, #B8734F);
    text-shadow: 0 1px 4px rgba(255, 255, 255, 0.3);
}

[data-theme="light"] .service-more-btn:hover {
    color: var(--color-gold-dark, #965A3D);
}

/* ============================================================
   АДАПТИВНОСТЬ
   ============================================================ */

@media (max-width: 1200px) {
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 0 20px;
    }
    .service-card {
        aspect-ratio: 4/3;
    }
}

@media (max-width: 992px) {
    .services-section {
        padding-top: 80px;
        padding-bottom: 60px;
    }
    .services-header {
        margin-bottom: 40px;
    }
    .service-card {
        aspect-ratio: 4/5;
        border-radius: 12px;
        border-width: 3px;
        margin: 4px 0;
    }
    .service-card-overlay {
        border-radius: 12px;
        padding: 12px 14px 10px;
    }
    .service-number {
        font-size: 24px;
    }
    .service-title {
        font-size: 14px;
    }
    .service-description {
        font-size: 10px;
    }
}

@media (max-width: 768px) {
    .services-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        padding: 0 16px;
    }
    .service-card {
        aspect-ratio: 4/5;
        border-radius: 8px;
        border-width: 3px;
        margin: 3px 0;
    }
    .service-card-overlay {
        border-radius: 8px;
        padding: 10px 10px 8px;
    }
    .service-number {
        font-size: 20px;
        margin-bottom: 3px;
    }
    .service-title {
        font-size: 13px;
        margin-bottom: 2px;
    }
    .service-description {
        font-size: 10px;
        margin-bottom: 4px;
        -webkit-line-clamp: 2;
    }
    .service-more-btn {
        font-size: 10px;
        pointer-events: auto !important;
    }
}

@media (max-width: 576px) {
    .services-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        padding: 0 12px !important;
    }
    .service-card {
        aspect-ratio: 16/9 !important;
        border-radius: 12px !important;
        min-height: 180px;
        margin: 0 !important;
        border-width: 3px !important;
    }
    .service-card-overlay {
        padding: 12px 14px 10px !important;
        border-radius: 12px !important;
    }
    .service-number {
        font-size: 22px !important;
        margin-bottom: 3px !important;
    }
    .service-title {
        font-size: 15px !important;
        margin-bottom: 2px !important;
    }
    .service-description {
        font-size: 11px !important;
        -webkit-line-clamp: 3 !important;
        margin-bottom: 4px !important;
    }
    .service-more-btn {
        font-size: 10px !important;
        pointer-events: auto !important;
        position: relative;
        z-index: 10;
    }
    .service-card-content {
        padding-top: 4px !important;
    }
}

@media (max-width: 480px) {
    .services-grid {
        gap: 10px !important;
        padding: 0 8px !important;
    }
    .service-card {
        min-height: 140px;
        border-width: 2px !important;
    }
    .service-card-overlay {
        padding: 8px 10px 8px !important;
    }
    .service-number {
        font-size: 18px !important;
    }
    .service-title {
        font-size: 13px !important;
    }
    .service-description {
        font-size: 10px !important;
        -webkit-line-clamp: 2 !important;
    }
    .service-more-btn {
        font-size: 9px !important;
        pointer-events: auto !important;
    }
}

@media (max-width: 360px) {
    .services-grid {
        gap: 8px !important;
        padding: 0 6px !important;
    }
    .service-card {
        min-height: 120px;
        border-radius: 8px !important;
    }
    .service-card-overlay {
        padding: 6px 8px 6px !important;
    }
    .service-number {
        font-size: 14px !important;
        margin-bottom: 2px !important;
    }
    .service-title {
        font-size: 11px !important;
        margin-bottom: 1px !important;
    }
    .service-description {
        font-size: 9px !important;
        -webkit-line-clamp: 2 !important;
        margin-bottom: 3px !important;
    }
    .service-more-btn {
        font-size: 8px !important;
        pointer-events: auto !important;
    }
}

/* ============================================================
   ЛАНДШАФТНАЯ ОРИЕНТАЦИЯ
   ============================================================ */

@media (max-height: 500px) and (orientation: landscape) {
    .services-section {
        padding-top: 60px;
        padding-bottom: 40px;
    }
    .services-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
        padding: 0 8px;
    }
    .service-card {
        aspect-ratio: 3/4;
        border-radius: 6px;
        border-width: 2px;
        margin: 2px 0;
    }
    .service-card-overlay {
        border-radius: 6px;
        padding: 8px 8px 6px;
    }
    .service-number {
        font-size: 16px;
    }
    .service-title {
        font-size: 10px;
    }
    .service-description {
        font-size: 8px;
        -webkit-line-clamp: 2;
    }
    .service-more-btn {
        font-size: 8px;
        pointer-events: auto !important;
    }
}

/* ============================================================
   SERVICE MODAL
   ============================================================ */

.service-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(11, 11, 12, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: none !important;
    align-items: center;
    justify-content: center;
    padding: 30px;
}

.service-modal-overlay.active {
    display: flex !important;
}

.service-modal-container {
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    background: var(--color-card-bg, #1a1a1d);
    border-radius: 16px;
    border: 1px solid var(--color-border);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

[data-theme="light"] .service-modal-container {
    background: #FCFBF8;
}

.service-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.4);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #ffffff;
    transition: all 0.3s ease;
    z-index: 10;
}

.service-modal-close:hover {
    background: rgba(0, 0, 0, 0.6);
    transform: rotate(90deg);
}

.service-modal-close svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

[data-theme="light"] .service-modal-close {
    background: rgba(0, 0, 0, 0.08);
    color: #333333;
}

[data-theme="light"] .service-modal-close:hover {
    background: rgba(0, 0, 0, 0.15);
}

.service-modal-image {
    width: 100%;
    height: auto;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--color-secondary-dark);
    position: relative;
}

.service-modal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.service-modal-content {
    padding: 12px 18px 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.service-modal-header {
    margin-bottom: 6px;
    flex-shrink: 0;
}

.service-modal-number {
    font-family: var(--font-serif);
    font-size: 20px;
    color: var(--color-gold);
    opacity: 0.3;
    display: block;
    line-height: 1;
    margin-bottom: 1px;
}

.service-modal-title {
    font-family: var(--font-serif);
    font-size: clamp(18px, 2vw, 22px);
    color: var(--color-text-primary);
    line-height: 1.2;
    margin: 0;
}

.service-modal-body {
    flex: 1;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    min-height: auto;
}

.service-modal-description {
    font-size: 13px;
    line-height: 1.5;
    color: var(--color-text-secondary);
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
    display: block;
    overflow: visible;
    max-height: none;
}

.service-modal-footer {
    padding-top: 10px;
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}

.service-modal-cta {
    padding: 8px 18px;
    font-size: 12px;
    width: 100%;
    justify-content: center;
}

/* ============================================================
   АДАПТИВНОСТЬ МОДАЛКИ
   ============================================================ */

@media (max-width: 768px) {
    .service-modal-overlay {
        padding: 16px;
    }
    .service-modal-image {
        width: 100%;
        height: auto;
    }
    .service-modal-content {
        padding: 10px 14px 14px;
    }
    .service-modal-number {
        font-size: 18px;
    }
    .service-modal-title {
        font-size: clamp(16px, 4vw, 20px);
    }
    .service-modal-description {
        font-size: 12px;
        line-height: 1.5;
    }
    .service-modal-close {
        top: 8px;
        right: 8px;
        width: 26px;
        height: 26px;
    }
    .service-modal-close svg {
        width: 12px;
        height: 12px;
    }
    .service-modal-cta {
        padding: 8px 14px;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .service-modal-overlay {
        padding: 10px;
    }
    .service-modal-image {
        width: 100%;
        height: auto;
    }
    .service-modal-content {
        padding: 8px 12px 12px;
    }
    .service-modal-header {
        margin-bottom: 4px;
    }
    .service-modal-number {
        font-size: 16px;
        margin-bottom: 0px;
    }
    .service-modal-title {
        font-size: clamp(14px, 4vw, 18px);
    }
    .service-modal-body {
        margin-bottom: 8px;
    }
    .service-modal-description {
        font-size: 11px;
        line-height: 1.4;
    }
    .service-modal-footer {
        padding-top: 8px;
    }
    .service-modal-cta {
        padding: 6px 12px;
        font-size: 10px;
    }
}

@media (max-width: 360px) {
    .service-modal-overlay {
        padding: 8px;
    }
    .service-modal-image {
        width: 100%;
        height: auto;
    }
    .service-modal-content {
        padding: 6px 10px 10px;
    }
    .service-modal-number {
        font-size: 14px;
    }
    .service-modal-title {
        font-size: clamp(12px, 4vw, 16px);
    }
    .service-modal-description {
        font-size: 10px;
        line-height: 1.3;
    }
    .service-modal-cta {
        padding: 6px 10px;
        font-size: 9px;
    }
}

/* ============================================================
   SERVICE CARD BACKGROUND — themed-image совместимость
   ============================================================ */

.service-card {
    position: relative;
    overflow: hidden;
    background-image: none !important;
    background-color: var(--color-card-bg);
}

.service-card-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: inherit;
}

.service-card-bg .themed-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.service-card-overlay {
    z-index: 1;
}

.service-card-content {
    z-index: 2;
}