/**
 * About Page
 * Desktop: two-column layout (heading left, content right)
 * Mobile: stacked layout
 */

.container--about-me {
    padding-top: 80px;
    padding-bottom: 80px;
}

/* Tablet (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .container--about-me {
        padding-top: 64px;
        padding-bottom: 64px;
        padding-left: 12px;
        padding-right: 12px;
    }

    .about-me-hero {
        height: 400px;
        margin-bottom: 40px;
        width: 100%;              /* не растягиваем шире контейнера */
        margin-left: 0;           /* убираем сдвиг на всю ширину экрана */
    }

    .about-me-hero__container {
        padding: 0 12px;
        gap: 12px; /* tablet gap */
    }

    .about-me-hero__image-img {
        position: relative;       /* обычный поток внутри hero */
        width: 100%;              /* по ширине блока hero */
        left: 0;
        top: 0;
        transform: none;
    }

    .about-me-hero__subtitle {
        font-size: var(--font-size-body-3-desktop); /* планшет: через переменную */
    }

    .about-me-divider {
        margin: 40px 0;
    }

    .about-me-section {
        margin-bottom: 0; /* отступ создается разделителями */
    }

    /* Секции в одну колонку: заголовок сверху, контент снизу */
    .about-me-section__content {
        grid-template-columns: 1fr !important;
    }

    .about-me-section__title {
        grid-column: 1 !important;
        margin-bottom: 20px;
    }

    .about-me-section__text,
    .about-me-section__contacts,
    .about-me-section__clients {
        grid-column: 1 !important;
    }

    /* On tablet we need the same left/right edges as the other pages */
    .about-me-divider {
        grid-column: 1 / -1 !important;
    }
}

/* Mobile (max-width: 768px) */
@media (max-width: 768px) {
    .container--about-me {
        padding-top: 40px;
        padding-bottom: 40px;
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* Hero Section */
.about-me-hero {
    position: relative;
    width: 100%;
    margin: 38px 0 60px 0; /* чуть ниже хедера */
    height: 585px; /* высота 585px на десктопе */
    background-color: var(--color-card);
    border: 1px solid var(--color-border-a8);
    overflow: hidden;
}

.about-me-hero__container {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 12px;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--grid-gap);
    position: relative;
}

.about-me-hero__image {
    grid-column: 3 / span 8; /* 8 колонок по центру (колонки 3-10 из 12) */
    width: 100%;
    height: 100%;
    position: relative;
    overflow: visible; /* разрешаем изображению выходить за края */
    border: none;
    outline: none;
}

.about-me-hero__image-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    border: none;
    outline: none;
    position: relative;
    left: 0;
    top: 0;
}

/* Up to 1315px: keep full photo visible inside hero */
@media (max-width: 1315px) {
    .about-me-hero {
        height: auto;
    }

    .about-me-hero__image {
        height: auto;
    }

    .about-me-hero__image-img {
        width: 100%;
        height: auto;
        object-fit: contain;
    }
}

/* Mobile: hero image centered inside viewport, no side cropping */
@media (max-width: 768px) {
    .about-me-hero {
        width: 100%;
        margin-left: 0;
        height: 400px;
    }

    .about-me-hero__image {
        grid-column: 1 / -1;
    }

    .about-me-hero__image-img {
        position: relative;
        width: 100%;
        height: 100%;
        left: 0;
        top: 0;
        transform: none;
    }
}

/* Tablet: same centering behavior, constrained to content width */
@media (min-width: 769px) and (max-width: 1024px) {
    .about-me-hero {
        width: 100%;
        margin-left: 0;
        height: 400px;
    }

    .about-me-hero__image {
        grid-column: 2 / span 10;
    }

    .about-me-hero__image-img {
        position: relative;
        width: 100%;
        height: 100%;
        left: 0;
        top: 0;
        transform: none;
    }
}

.about-me-hero__subtitle {
    position: absolute;
    top: 50%;
    left: 75%;
    transform: translateY(-50%);
    white-space: nowrap;
    font-family: var(--font-body);
    font-size: var(--font-size-body-3-desktop);
    font-weight: 300;
    color: var(--color-content);
    margin: 0;
    padding: 0;
}

.about-me-hero__container {
    position: relative;
    z-index: 1;
}

/* Divider between sections */
.about-me-divider {
    grid-column: 2 / span 10; /* колонки со 2-й по 11-ю включительно */
    height: 1px;
    background-color: var(--color-border-a8);
    margin: 20px 0; /* суммарный отступ сверху+снизу = 40px */
}

.about-me-divider:first-of-type {
    margin-top: 0;
}

/* About Section */
.about-me-section {
    grid-column: 1 / -1;
    margin-bottom: 0; /* отступ создается разделителями */
}

.about-me-section:last-child {
    margin-bottom: 0;
}

.about-me-section__content {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--grid-gap);
}

.about-me-section__title {
    grid-column: 1 / span 4; /* Заголовок начинается с 1-й колонки */
    font-family: var(--font-display);
    font-size: var(--font-size-display-3-desktop);
    font-weight: 400;
    line-height: var(--line-height-display-3-desktop);
    color: var(--color-content);
    margin: 0;
    padding: 0;
    text-transform: none;
    letter-spacing: -0.02em;
    align-self: flex-start;
}

.about-me-section__text {
    grid-column: 7 / span 6; /* Контент с 7-й по 12-ю колонку включительно */
}

.about-me-section__text p {
    font-family: var(--font-body);
    font-size: var(--font-size-body-2-desktop);
    font-weight: 300;
    line-height: var(--line-height-body-2-desktop);
    color: var(--color-content);
    margin: 0 0 24px 0;
    padding: 0;
    letter-spacing: -0.02em;
}

.about-me-section__text p:last-child {
    margin-bottom: 0;
}

/* Contacts */
.about-me-section__contacts {
    grid-column: 7 / span 6; /* Контент с 7-й по 12-ю колонку включительно */
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-self: start;
}

.about-me-section__contact-link {
    font-family: var(--font-body);
    font-size: var(--font-size-body-1-desktop);
    font-weight: 300;
    line-height: var(--line-height-body-1-desktop);
    color: var(--color-content);
    text-decoration: none;
    transition: color 0.5s ease, text-decoration-color 0.5s ease;
    letter-spacing: -0.02em;
}

.about-me-section__contact-link:hover {
    color: var(--color-subaccent);
    text-decoration-line: underline;
    text-decoration-color: var(--color-subaccent-a30);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: color 0s ease, text-decoration-color 0s ease;
}

/* Clients */
.about-me-section__clients {
    grid-column: 7 / span 6; /* Контент с 7-й по 12-ю колонку включительно */
    display: flex;
    flex-direction: column;
    gap: 40px;
    align-self: start;
}

.about-me-section__clients .about-me-card:not(:last-child) {
    padding-bottom: 40px;
    border-bottom: 1px solid var(--color-border-a8);
}

/* Desktop (1025px+): two-column layout */
@media (min-width: 1025px) {
    .about-me-section {
        margin-bottom: 40px;
    }

    .about-me-section__title {
        grid-column: 1 / span 4;
        position: sticky;
        top: 120px; /* остаётся под хедером при скролле */
    }

    .about-me-section__text,
    .about-me-section__contacts,
    .about-me-section__clients {
        grid-column: 7 / span 6;
    }
}

/* Mobile (max-width: 768px) */
@media (max-width: 768px) {
    .about-me-hero {
        height: 420px; /* достаточно для портрета, чтобы не обрезать нижнюю часть */
        margin-bottom: 40px;
    }

    .about-me-divider {
        margin: 40px 0;
    }

    .about-me-hero__container {
        padding: 0 12px;
        gap: 0;
        grid-template-columns: 1fr;
    }

    .about-me-hero__image {
        grid-column: 1 / -1;
    }

    .about-me-hero__subtitle {
        left: calc(75% + 20px);
        font-size: var(--font-size-body-3-mobile);
        white-space: normal;
    }

    .about-me-hero__subtitle-line {
        display: block;
    }

    .about-me-divider {
        grid-column: 1 / -1;
        margin: 40px 0;
    }

    .about-me-section {
        margin-bottom: 0; /* отступ создается разделителями */
    }

    .about-me-section__content {
        grid-template-columns: 1fr;
    }

    .about-me-section__title {
        grid-column: 1;
        margin-bottom: 20px;
        font-size: var(--font-size-display-3-mobile);
        line-height: var(--line-height-display-3-mobile);
    }

    .about-me-section__text,
    .about-me-section__contacts,
    .about-me-section__clients {
        grid-column: 1;
    }

    .about-me-section__text {
        display: flex;
        flex-direction: column;
        gap: 24px;
    }

    .about-me-section__text p {
        font-size: var(--font-size-body-2-mobile);
        line-height: var(--line-height-body-2-mobile);
        margin: 0;
        display: block;
    }

    .about-me-section__contact-link {
        font-size: var(--font-size-body-1-mobile);
        line-height: var(--line-height-body-1-mobile);
    }

    .about-me-section__clients {
        gap: 24px;
    }

    .about-me-section__clients .about-me-card:not(:last-child) {
        padding-bottom: 24px;
    }
}
