/* How it works page, fourth section (template-parts/hiw/levels.php, docs/sections/hiw/hiw-work-independly.png). Fonts,
   --amh-* colours and .amh-button: home-hero.css (body .amerlink-genesis-home). */

.hiw-levels {
    --hiw-levels-line: #e1e9f4;
    position: relative;
    overflow: hidden;
    padding: clamp(56px, 5vw, 96px) 0;
    background: linear-gradient(180deg, #f6f9fe 0%, #eaf2fc 100%);
    color: #33446a;
    isolation: isolate;
}

/* The campus on the right, fading into the section under the table. */
.hiw-levels-media {
    position: absolute;
    z-index: -1;
    top: 0;
    right: 0;
    bottom: 0;
    width: 42%;
}

.hiw-levels-photo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 60% 50%;
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 34%);
    mask-image: linear-gradient(90deg, transparent 0%, #000 34%);
}

/* "More / Than a Dream / A Plan" in the sky, as in the design. */
.hiw-levels-handwritten {
    position: absolute;
    top: clamp(28px, 2.6vw, 52px);
    right: 6%;
    margin: 0;
    color: #0c1d45;
    font-family: 'Segoe Print', 'Bradley Hand', cursive;
    font-size: clamp(24px, 2vw, 40px);
    font-style: italic;
    line-height: 1.22;
    text-align: center;
    transform: rotate(-10deg);
}

.hiw-levels-handwritten::after {
    display: block;
    width: 78%;
    height: 3px;
    margin: 10px 0 0 auto;
    border-radius: 3px;
    background: var(--amh-pink);
    content: '';
    transform: rotate(-6deg);
}

.hiw-levels-inner {
    width: min(100% - 64px, 1510px);
    margin-inline: auto;
}

/* Up to where the student stands in the photo. */
.hiw-levels-content {
    width: min(69%, 1100px);
}

.hiw-levels-eyebrow {
    margin: 0 0 clamp(8px, .7vw, 12px);
    color: var(--amh-pink);
    font-size: clamp(13px, 1vw, 17px);
    font-weight: 800;
    letter-spacing: .16em;
    line-height: 1.3;
    text-transform: uppercase;
}

.hiw-levels-title {
    margin: 0;
    padding: 0;
    color: var(--amh-navy);
    font-family: inherit;
    font-size: clamp(30px, 2.6vw, 50px);
    font-weight: 800;
    letter-spacing: -.035em;
    line-height: 1.1;
}

.hiw-levels-description {
    max-width: 960px;
    margin: clamp(12px, 1vw, 18px) 0 0;
    font-size: clamp(16px, 1.15vw, 21px);
    line-height: 1.5;
}

.hiw-levels-table {
    position: relative;
    margin-top: clamp(24px, 2.2vw, 40px);
    overflow: hidden;
    border: 1px solid var(--hiw-levels-line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 18px 44px rgba(1, 33, 106, .1);
}

.hiw-levels-row {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 31fr) minmax(0, 31fr) minmax(0, 38fr);
    transition: background-color .2s ease;
}

.hiw-levels-row + .hiw-levels-row {
    border-top: 1px solid var(--hiw-levels-line);
}

.hiw-levels-cell {
    display: flex;
    min-width: 0;
    align-items: center;
    padding: clamp(14px, 1.1vw, 20px) clamp(16px, 1.4vw, 28px);
    font-size: clamp(15px, 1vw, 18px);
    line-height: 1.4;
}

.hiw-levels-row:not(.hiw-levels-head) .hiw-levels-cell + .hiw-levels-cell {
    border-left: 1px solid var(--hiw-levels-line);
}

.hiw-levels-head {
    background: #f3f7fc;
}

.hiw-levels-head .hiw-levels-cell {
    padding-block: clamp(12px, .9vw, 16px);
    color: #5a6b8c;
    font-size: clamp(12px, .78vw, 14px);
    font-weight: 700;
    letter-spacing: .12em;
    line-height: 1.3;
    text-transform: uppercase;
}

.hiw-levels-option {
    gap: clamp(12px, 1vw, 18px);
    padding-left: clamp(14px, 1.1vw, 22px);
}

.hiw-levels-icon {
    display: grid;
    width: clamp(50px, 3.4vw, 64px);
    flex: 0 0 auto;
    aspect-ratio: 1;
    place-items: center;
    border-radius: 50%;
    background: #fde8f1;
    color: var(--amh-pink);
}

.hiw-levels-icon svg {
    width: 54%;
    height: 54%;
}

.hiw-levels-name {
    min-width: 0;
    color: var(--amh-navy);
    font-size: clamp(17px, 1.2vw, 22px);
    font-weight: 800;
    letter-spacing: -.015em;
    line-height: 1.2;
}

/* Column labels of the phone cards. */
.hiw-levels-label {
    display: none;
}

.hiw-levels-role {
    justify-content: space-between;
    gap: 16px;
}

.hiw-levels-link {
    flex: 0 0 auto;
    color: var(--amh-pink);
    font-family: Arial, sans-serif;
    font-size: 26px;
    line-height: 1;
    text-decoration: none;
}

/* The arrow moves, not the link: a translated link would hold its ::after and the row would stop being clickable. */
.hiw-levels-link span {
    display: inline-block;
    transition: translate .2s ease;
}

/* The whole row is the link. */
.hiw-levels-link::after {
    position: absolute;
    inset: 0;
    content: '';
}

.hiw-levels-row-linked:hover,
.hiw-levels-row-linked:focus-within {
    background: #fff4f8;
}

.hiw-levels-link:hover,
.hiw-levels-link:focus-visible {
    color: var(--amh-pink);
}

.hiw-levels-link:focus-visible span,
.hiw-levels-row-linked:hover .hiw-levels-link span {
    translate: 4px 0;
}

.hiw-levels-link:focus-visible {
    outline: none;
}

.hiw-levels-link:focus-visible::after {
    outline: 3px solid var(--amh-blue);
    outline-offset: -3px;
}

.hiw-levels-actions {
    display: flex;
    justify-content: flex-end;
    margin: clamp(20px, 1.8vw, 30px) 4% 0 0;
    padding: 0;
}

/* Tablets: the photo in the top right corner beside the heading, the table over its faded bottom. */
@media (max-width: 1180px) {
    .hiw-levels-media {
        bottom: auto;
        width: 48%;
        height: clamp(420px, 52vw, 560px);
    }

    .hiw-levels-photo {
        object-position: 62% 30%;
        -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 30%), linear-gradient(180deg, #000 55%, transparent 100%);
        -webkit-mask-composite: source-in;
        mask-image: linear-gradient(90deg, transparent 0%, #000 30%), linear-gradient(180deg, #000 55%, transparent 100%);
        mask-composite: intersect;
    }

    .hiw-levels-handwritten {
        top: 5%;
        right: 4%;
        font-size: clamp(20px, 2.6vw, 30px);
    }

    .hiw-levels-content {
        width: auto;
    }

    /* Tall enough for the table to start under the student's face. */
    .hiw-levels-header {
        max-width: 54%;
        min-height: clamp(160px, 21vw, 240px);
    }

    .hiw-levels-table {
        margin-top: clamp(32px, 5vw, 56px);
    }

    .hiw-levels-actions {
        margin-right: 0;
    }
}

/* Phones: the photo as a strip above the heading. */
@media (max-width: 780px) {
    .hiw-levels {
        padding-top: 0;
    }

    .hiw-levels-media {
        position: relative;
        z-index: 0;
        width: 100%;
        height: clamp(260px, 62vw, 400px);
        margin-bottom: 8px;
    }

    .hiw-levels-photo {
        object-position: 58% 25%;
        -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent 100%);
        mask-image: linear-gradient(180deg, #000 70%, transparent 100%);
    }

    .hiw-levels-handwritten {
        top: 7%;
        right: 5%;
        font-size: clamp(17px, 4.4vw, 24px);
    }

    .hiw-levels-inner {
        width: min(100% - 36px, 660px);
    }

    .hiw-levels-header {
        max-width: none;
        min-height: 0;
    }

    .hiw-levels-table {
        margin-top: 24px;
    }
}

/* Small screens: each row as a card, with its own column labels. */
@media (max-width: 700px) {
    .hiw-levels-table {
        display: grid;
        gap: 14px;
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: none;
        box-shadow: none;
    }

    .hiw-levels-row {
        display: block;
        padding: 16px 16px 14px;
        border: 1px solid var(--hiw-levels-line);
        border-radius: 14px;
        background: rgba(255, 255, 255, .96);
        box-shadow: 0 10px 28px rgba(1, 33, 106, .08);
    }

    .hiw-levels-row + .hiw-levels-row {
        border-top: 1px solid var(--hiw-levels-line);
    }

    .hiw-levels-row.hiw-levels-head {
        display: none;
    }

    .hiw-levels-link::after {
        border-radius: 14px;
    }

    .hiw-levels-cell {
        display: block;
        padding: 0;
    }

    .hiw-levels-row:not(.hiw-levels-head) .hiw-levels-cell + .hiw-levels-cell {
        margin-top: 12px;
        border-left: 0;
    }

    .hiw-levels-option {
        display: flex;
        align-items: center;
    }

    .hiw-levels-icon {
        width: 50px;
    }

    .hiw-levels-label {
        display: block;
        margin-bottom: 2px;
        color: #5a6b8c;
        font-size: 12px;
        font-weight: 700;
        letter-spacing: .1em;
        line-height: 1.4;
        text-transform: uppercase;
    }

    .hiw-levels-role {
        display: flex;
        align-items: flex-end;
    }

    .hiw-levels-actions .amh-button {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hiw-levels-row,
    .hiw-levels-link span {
        transition: none;
    }
}
