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

.mg-contacts {
    --mg-field-h: 50px;
    --mg-field-bg: #171717;
    --mg-field-border: #292929;
    padding: clamp(1.5rem, 3vw, 2.5rem) 0 clamp(2.5rem, 4vw, 3.75rem);
}

.mg-contacts__title {
    margin: 0 0 clamp(1.5rem, 2.5vw, 1.875rem);
    font-size: clamp(2rem, 4vw, 2.5rem);
    font-weight: 800;
    line-height: 1;
    color: #fff;
}

.mg-contacts__success {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    min-height: clamp(320px, 52vh, 520px);
    padding: clamp(2rem, 4vw, 3rem) clamp(1rem, 2vw, 1.5rem);
    text-align: center;
}

.mg-contacts__success-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--mg-accent);
    color: #171717;
}

.mg-contacts__success-icon svg {
    width: 34px;
    height: 34px;
}

.mg-contacts__success-title {
    margin: 0;
    max-width: 22rem;
    font-size: clamp(1.375rem, 2.4vw, 1.75rem);
    font-weight: 700;
    line-height: 1.2;
    color: #fff;
}

.mg-contacts__success-text {
    margin: 0;
    max-width: 28rem;
    font-size: 0.9375rem;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.78);
}

.mg-contacts__card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 471px);
    gap: clamp(1.5rem, 3vw, 3.75rem);
    align-items: stretch;
    padding: clamp(1.5rem, 2.5vw, 1.875rem) clamp(1.25rem, 2.2vw, 2.125rem);
    border-radius: 30px;
    background: #202020;
    box-shadow: 0 0 60px 30px rgba(0, 0, 0, 0.03);
}

.mg-contacts__form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}

.mg-contacts__fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9375rem;
}

.mg-contacts__field label,
.mg-contacts__message label {
    display: block;
}

.mg-contacts__field input,
.mg-contacts__message textarea {
    width: 100%;
    border: 1px solid var(--mg-field-border);
    background: var(--mg-field-bg);
    color: #fff;
    font: inherit;
    font-size: 0.875rem;
}

.mg-contacts__field input {
    height: var(--mg-field-h);
    padding: 0 1.25rem;
    border-radius: 65px;
}

.mg-contacts__field input::placeholder,
.mg-contacts__message textarea::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.mg-contacts__field input:focus,
.mg-contacts__message textarea:focus {
    outline: none;
    border-color: rgba(199, 169, 67, 0.65);
}

.mg-contacts__field--invalid input,
.mg-contacts__message--invalid textarea {
    border-color: #e85d5d;
    background: rgba(232, 93, 93, 0.08);
}

.mg-contacts__field--invalid input:focus,
.mg-contacts__message--invalid textarea:focus {
    border-color: #ff9a9a;
}

.mg-contacts__field-error {
    display: block;
    margin-top: 0.4rem;
    padding-left: 1.25rem;
    font-size: 0.75rem;
    line-height: 1.35;
    color: #ff8a8a;
}

.mg-contacts__services--invalid .mg-contacts__services-label {
    color: #ff8a8a;
}

.mg-contacts__services--invalid .mg-contacts__service-mark {
    border-color: #e85d5d;
}

.mg-contacts__services .mg-contacts__field-error {
    padding-left: 0;
}

.mg-contacts__services {
    margin: 0;
    padding: 0;
    border: 0;
}

.mg-contacts__services-label {
    display: block;
    margin-bottom: 0.625rem;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.25;
    color: #fff;
}

.mg-contacts__services-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9375rem 1.0625rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.mg-contacts__service {
    display: inline-flex;
    align-items: center;
    gap: 0.3125rem;
    cursor: pointer;
    font-size: 0.875rem;
    line-height: 1.25;
    color: #fff;
    white-space: nowrap;
}

.mg-contacts__service input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    overflow: hidden;
    white-space: nowrap;
}

.mg-contacts__service-mark {
    position: relative;
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    border: 1.5px solid rgba(255, 255, 255, 0.45);
    border-radius: 50%;
    background: transparent;
}

.mg-contacts__service-mark::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0.4375rem;
    height: 0.25rem;
    border-left: 1.5px solid #171717;
    border-bottom: 1.5px solid #171717;
    opacity: 0;
    transform: translate(-50%, -65%) rotate(-45deg);
}

.mg-contacts__service input:checked + .mg-contacts__service-mark {
    border-color: var(--mg-accent);
    background: var(--mg-accent);
}

.mg-contacts__service input:checked + .mg-contacts__service-mark::after {
    opacity: 1;
}

.mg-contacts__service:focus-within .mg-contacts__service-mark {
    outline: 2px solid rgba(199, 169, 67, 0.65);
    outline-offset: 2px;
}

.mg-contacts__message textarea {
    min-height: 123px;
    padding: 1.0625rem 1.25rem;
    border-radius: 20px;
    resize: vertical;
    line-height: 1.45;
}

.mg-contacts__submit-wrap {
    display: flex;
    justify-content: center;
}

.mg-contacts__submit {
    min-height: var(--mg-field-h);
    padding: 0.9375rem 3rem;
    border: 0;
    border-radius: 65px;
    background: var(--mg-accent);
    color: #fff;
    font: inherit;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 0 14px rgba(0, 0, 0, 0.12);
    transition: background-color 0.2s ease, opacity 0.2s ease;
}

.mg-contacts__submit:hover {
    opacity: 0.92;
}

.mg-contacts__panel {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: clamp(2rem, 3vw, 2.8125rem) clamp(1.25rem, 2vw, 2.8125rem) clamp(1.5rem, 2.5vw, 2rem);
    border-radius: 30px;
    background: var(--mg-accent);
    color: #fff;
}

.mg-contacts__panel-title {
    margin: 0 0 1.5rem;
    font-size: clamp(1.375rem, 2.2vw, 1.75rem);
    font-weight: 700;
    line-height: 1.2;
    color: #fff;
}

.mg-contacts__panel-contacts {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    margin: 0 0 1.5rem;
    padding: 0;
    list-style: none;
}

.mg-contacts__panel-item {
    display: flex;
    align-items: center;
    gap: 0.6875rem;
    min-height: 1.625rem;
}

.mg-contacts__panel-icon {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    color: #fff;
}

.mg-contacts__panel-icon--phone {
    width: 26px;
    height: 26px;
}

.mg-contacts__panel-icon--phone path {
    fill: #fff;
}

.mg-contacts__panel-link {
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.25;
    text-decoration: none;
}

.mg-contacts__panel-link:hover {
    opacity: 0.85;
}

.mg-contacts__panel-address {
    margin: 0 0 auto;
    font-size: 0.875rem;
    line-height: 1.45;
    color: #fff;
}

.mg-contacts__panel-address strong {
    font-weight: 700;
}

.mg-contacts__social {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
    margin: 1.75rem 0 0;
    padding: 0;
    list-style: none;
}

.mg-contacts__social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #171717;
    transition: opacity 0.2s ease;
}

.mg-contacts__social-link:hover {
    opacity: 0.88;
}

.mg-contacts__social-link img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

@media (max-width: 991px) {
    .mg-contacts__card {
        grid-template-columns: 1fr;
    }

    .mg-contacts__panel {
        min-height: auto;
    }
}

@media (max-width: 639px) {
    .mg-contacts__fields {
        grid-template-columns: 1fr;
    }

    .mg-contacts__services-list {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.625rem;
    }

    .mg-contacts__submit {
        width: 100%;
    }
}
