/*
 * The AI page (.pg-ai): the dark list of what it does, the demo stage (a prompt
 * that types itself, the generation steps, the made site), the assistant's
 * chat, the grid of what AI helps with and the credits table.
 */

/* how far a generation step's line is filled (animated, so registered) */
@property --ai-fill {
    syntax: "<percentage>";
    inherits: false;
    initial-value: 0%;
}

@layer marketing {
    .mk .pg-ai {
        /* the dark numbered list under the hero */
        & .sp-list {
            padding-block: clamp(56px, 7vw, 96px) clamp(80px, 10vw, 130px);
        }
        & .sp-list .box {
            border-radius: 22px;
            padding: clamp(28px, 4vw, 56px);
            border: 1px solid #1f1f1f;
            background: #0d0d0d;
        }
        & .sp-list .top {
            display: grid;
            grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
            gap: 24px 64px;
            margin-bottom: clamp(36px, 5vw, 64px);
        }
        & .sp-list .top .h2 {
            font-size: clamp(32px, 4vw, 52px);
            color: #f3ede6;
        }
        & .sp-list .top p {
            color: rgb(243 237 230 / 0.7);
        }
        & .sp-list ol {
            list-style: none;
            margin: 0;
            padding: 0;
            counter-reset: n;
        }
        & .sp-list li {
            counter-increment: n;
            display: grid;
            grid-template-columns: 64px minmax(0, 0.9fr) minmax(0, 1.1fr);
            gap: 16px 32px;
            align-items: baseline;
            padding: 24px 0;
            border-top: 1px solid rgb(255 255 255 / 0.1);
        }
        & .sp-list li::before {
            content: counter(n, decimal-leading-zero);
            font-size: 18px;
            color: #f3ede6;
        }
        & .sp-list li b {
            font-size: clamp(18px, 1.8vw, 22px);
            font-weight: 500;
            color: #f3ede6;
            letter-spacing: -0.02em;
        }
        & .sp-list li span {
            font-size: 15px;
            color: rgb(243 237 230 / 0.68);
        }

        /* the demo: a prompt over a photo, the steps, the made site */
        & .ai-stage {
            position: relative;
            margin-top: clamp(48px, 8vh, 96px);
            border-radius: 22px;
            overflow: hidden;
            padding: clamp(36px, 6vh, 64px) 20px 0;
            min-height: clamp(520px, 70vh, 720px);
            background: #2a2420;
        }
        & .ai-stage > img.bg {
            position: absolute;
            inset: 0;
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        & .ai-stage::before {
            content: "";
            position: absolute;
            inset: 0;
            background: linear-gradient(rgb(22 16 12 / 0.62), rgb(22 16 12 / 0.4) 60%, rgb(22 16 12 / 0.2));
        }
        & .ai-stage > .in {
            position: relative;
            z-index: 1;
        }
        & .prompt {
            max-width: 760px;
            margin: 0 auto;
            border-radius: 16px;
            border: 0;
            background: #fff;
            box-shadow: 0 30px 80px -30px rgb(0 0 0 / 0.5);
            text-align: left;
            overflow: hidden;
        }
        & .prompt-in {
            padding: 22px 24px 8px;
            font-size: 18px;
            min-height: 92px;
            line-height: 1.5;
        }
        & .prompt-in .caret {
            display: inline-block;
            width: 1.5px;
            height: 20px;
            background: var(--text);
            vertical-align: -4px;
            margin-left: 1px;
            animation: mk-ai-blink 1s steps(1) infinite;
        }
        & .prompt-foot {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px 14px 14px 24px;
            gap: 12px;
        }
        & .prompt-foot span {
            font-size: 13px;
            color: var(--faint);
        }
        & .prompt-foot .btn {
            height: 40px;
        }
        & .gen-steps {
            max-width: 760px;
            margin: 18px auto 0;
            display: grid;
            grid-template-columns: repeat(4, minmax(0, 1fr));
            gap: 12px;
            text-align: left;
        }
        & .gen-steps div {
            font-size: 13px;
            color: rgb(255 255 255 / 0.6);
            display: grid;
            gap: 8px;
            transition: color 0.4s;
        }
        & .gen-steps div::before {
            content: "";
            height: 2px;
            border-radius: 1px;
            background: linear-gradient(90deg, #fff var(--ai-fill), rgb(255 255 255 / 0.25) 0);
            transition: --ai-fill 0.8s;
        }
        & .gen-steps div.done {
            color: #fff;
            --ai-fill: 100%;
        }
        & .gen-result {
            max-width: 900px;
            margin: 36px auto 0;
            transition:
                opacity 1s var(--out),
                transform 1.2s var(--out);
        }
        & .gen-result.wait {
            opacity: 0;
            transform: translateY(24px);
        }
        & .gen-result .frame {
            border-radius: 14px 14px 0 0;
        }

        /* the assistant's conversation */
        & .chat {
            max-width: 720px;
            margin: 0 auto;
            display: grid;
            gap: 14px;
            min-height: 360px;
            align-content: start;
        }
        & .msg {
            max-width: 82%;
            padding: 14px 18px;
            border-radius: 16px;
            font-size: 16px;
            line-height: 1.5;
            animation: mk-up 0.7s var(--out) both;
        }
        & .msg.me {
            justify-self: end;
            background: var(--text);
            color: #fff;
            border-bottom-right-radius: 6px;
        }
        & .msg.ai {
            background: var(--bg-2);
            border-bottom-left-radius: 6px;
        }
        & .msg.ai ul {
            margin: 8px 0 0;
            padding-left: 18px;
            color: var(--muted);
        }
        & .msg .chg {
            display: flex;
            gap: 8px;
            margin-top: 12px;
        }
        & .msg .chg span {
            font-size: 12px;
            padding: 5px 9px;
            border-radius: 6px;
            background: #fff;
            border: 1px solid var(--line);
            color: var(--muted);
        }
        & .msg.typing {
            display: flex;
            gap: 5px;
            padding: 18px;
        }
        & .msg.typing i {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: var(--faint);
            animation: mk-ai-dots 1s infinite;
        }
        & .msg.typing i:nth-child(2) {
            animation-delay: 0.15s;
        }
        & .msg.typing i:nth-child(3) {
            animation-delay: 0.3s;
        }

        /* what AI does for you */
        & .grid3 {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 48px 40px;
        }
        & .grid3 div {
            display: grid;
            gap: 8px;
            align-content: start;
        }
        & .grid3 b {
            font-size: 18px;
            font-weight: 500;
            letter-spacing: -0.015em;
        }
        & .grid3 span {
            color: var(--muted);
            font-size: 15px;
        }

        /* the credits per plan */
        & .ctable {
            max-width: 760px;
            margin: 0 auto;
            border-collapse: collapse;
            width: 100%;
            font-size: 16px;
        }
        & .ctable td {
            padding: 18px 0;
            border-top: 1px solid var(--line);
        }
        & .ctable tr:last-child td {
            border-bottom: 1px solid var(--line);
        }
        & .ctable td:last-child {
            text-align: right;
            font-variant-numeric: tabular-nums;
            color: var(--muted);
        }

        /* the closing call to action */
        & .final {
            text-align: center;
        }
        & .final .h2 {
            font-size: clamp(40px, 6vw, 76px);
            letter-spacing: -0.045em;
            max-width: 14ch;
            margin: 0 auto;
        }
        & .final .ctas {
            margin-top: 36px;
        }
        & .final .note {
            margin-top: 18px;
        }
    }

    @keyframes mk-ai-blink {
        50% {
            opacity: 0;
        }
    }
    @keyframes mk-ai-dots {
        50% {
            opacity: 0.25;
        }
    }

    @media (max-width: 900px) {
        .mk .pg-ai .grid3 {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }
    }
    @media (max-width: 800px) {
        .mk .pg-ai .sp-list .top {
            grid-template-columns: minmax(0, 1fr);
        }
        .mk .pg-ai .sp-list li {
            grid-template-columns: 48px minmax(0, 1fr);
        }
        .mk .pg-ai .sp-list li span {
            grid-column: 2;
        }
    }
    @media (max-width: 600px) {
        .mk .pg-ai .gen-steps {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }
    }
    @media (max-width: 560px) {
        .mk .pg-ai .grid3 {
            grid-template-columns: minmax(0, 1fr);
        }
    }
}
