@import "./section-common.css";

/* Security is now the last section before the CTA, which sits over the
   fixed 3D scene and starts its own scrim fully transparent (see
   #injpw::before in theme.css). Fade this section's solid --bg out to
   transparent over the same distance Features used to, when it held this
   spot, so the handoff into the scene stays seamless instead of a hard
   line. */
/* This section's own background fades to transparent to reveal the fixed
   3D scene behind the CTA below it (see the comment above), so its content
   can't follow the light-mode override - it would go dark-on-dark. Re-pin
   the whole token subtree back to the dark values regardless of theme. */
#security {
    --bg: #0A0A0A;
    --text: #ffffff;
    --text-3: #a9a9b1;
    --line: #ffffff1f;
    --brand-tint: #4088481f;
    --brand-line: #40884859;
    --brand-bright: #5fb56c;

    --sec-fade: clamp(120px, 14vw, 200px);
    padding-bottom: var(--sec-fade);
    background: linear-gradient(
        to bottom,
        var(--bg) 0,
        var(--bg) calc(100% - var(--sec-fade)),
        transparent 100%
    );
}

.sec-headline {
    max-width: min(100%, 640px);
}

/* .wwd-header-row is a grid, so the aside is the grid item that has to
   right-align; the copy inside it then resets to normal flow. */
.sec-aside {
    justify-self: end;
    max-width: 46ch;
    padding-top: 6px;
}

.sec-aside .wwd-body {
    justify-self: start;
    max-width: none;
    padding-top: 0;
}

.sec-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 18px 0 0;
    font-family: DM Sans;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--brand-bright);
}

.sec-badge-icon {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    color: var(--brand-bright);
}

.sec-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Inner cells are inset from the divider on BOTH sides; only the cells against
   the section gutter go flush, so a rule never crowds the next cell's icon. */
.sec-cell {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 36px 32px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.sec-cell:nth-child(3n + 1) {
    padding-left: 0;
}

.sec-cell:nth-child(3n) {
    border-right: none;
    padding-right: 0;
}

.sec-cell:nth-child(n + 4) {
    border-bottom: none;
}

.sec-icon {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--brand-line);
    background: var(--brand-tint);
    color: var(--brand-bright);
    display: grid;
    place-items: center;
}

.sec-title {
    font-family: DM Sans;
    font-size: 20px;
    line-height: 1.25em;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--text);
    margin: 0 0 6px;
}

.sec-desc {
    font-family: DM Sans;
    font-size: 16px;
    line-height: 1.4em;
    font-weight: 300;
    letter-spacing: -0.02em;
    color: var(--text-3);
    margin: 0;
}

@media (max-width: 992px) {
    .sec-aside {
        justify-self: start;
        max-width: none;
    }

    .sec-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* Reset the 3-column pattern before laying down the 2-column one. */
    .sec-cell,
    .sec-cell:nth-child(3n),
    .sec-cell:nth-child(3n + 1) {
        padding: 28px 24px;
        border-right: 1px solid var(--line);
        border-bottom: 1px solid var(--line);
    }

    .sec-cell:nth-child(odd) {
        padding-left: 0;
    }

    .sec-cell:nth-child(even) {
        padding-right: 0;
        border-right: none;
    }

    .sec-cell:nth-child(n + 5) {
        border-bottom: none;
    }
}

@media (max-width: 600px) {
    .sec-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .sec-cell,
    .sec-cell:nth-child(3n),
    .sec-cell:nth-child(3n + 1),
    .sec-cell:nth-child(odd),
    .sec-cell:nth-child(even) {
        border-right: none;
        padding: 24px 0;
        border-bottom: 1px solid var(--line);
    }

    .sec-cell:last-child {
        border-bottom: none;
    }

    .sec-headline {
        max-width: none;
    }
}
