/*
 * The light page hero of the templates, pricing and features pages
 * (.hm.ph.solo: centred headline, lead and a row of chips, a search or the
 * month/year toggle), and the templates page: search, the example sites as
 * cards with their preview and the AI card.
 */
@layer marketing {
    .mk {
        /* light page hero */
        & .hm {
            padding-top: calc(clamp(128px, 18vh, 200px) + env(safe-area-inset-top, 0px));
            padding-bottom: clamp(24px, 4vh, 48px);
        }
        & .hm-top {
            display: grid;
            grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
            gap: 32px clamp(48px, 7vw, 112px);
            align-items: stretch;
        }
        & .hm h1,
        & .hm-side .lead {
            text-box: cap alphabetic;
        }
        & .hm h1 {
            align-self: end;
            font-size: clamp(40px, min(6.4vw, 9vh), 96px);
            letter-spacing: -0.055em;
            line-height: 0.92;
            max-width: 11ch;
        }
        & .hm-side {
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            align-items: flex-start;
            gap: 24px;
        }
        & .hm-side .lead {
            font-size: 18px;
            max-width: 40ch;
        }
        & .hm.ph h1 {
            font-size: clamp(38px, min(5.4vw, 8.4vh), 84px);
            max-width: 14ch;
        }
        & .ph-extra {
            margin-top: clamp(36px, 6vh, 64px);
        }
        & .ph-extra .chips,
        & .ph-extra .toggle {
            margin-top: 0;
            justify-content: flex-start;
        }
        & .hm.ph.solo {
            padding-bottom: clamp(40px, 6vh, 72px);
        }
        & .hm.ph.solo .hm-top {
            grid-template-columns: minmax(0, 1fr);
            justify-items: center;
            text-align: center;
        }
        & .hm.ph.solo h1 {
            font-size: clamp(42px, 6vw, 84px);
            font-weight: 500;
            max-width: 16ch;
        }
        & .hm.ph.solo .hm-side .lead {
            max-width: 52ch;
            margin: 0 auto;
        }
        & .hm.ph.solo .ph-extra {
            display: flex;
            justify-content: center;
        }
        & .hm.ph.solo .ph-extra .chips,
        & .hm.ph.solo .ph-extra .toggle {
            justify-content: center;
        }
        /* the section right under the hero starts at once */
        & .sec.sec-flush {
            padding-top: 0;
        }

        /* search */
        & .hm.ph.solo .ph-extra.tpl-filter {
            display: grid;
            grid-template-columns: minmax(0, 1fr);
            justify-items: center;
        }
        & .tpl-search {
            display: flex;
            align-items: center;
            gap: 12px;
            width: 560px;
            max-width: 100%;
            height: 56px;
            margin: 0 auto 24px;
            padding: 0 20px;
            border-radius: 12px;
            background: #fff;
            box-shadow:
                0 16px 40px -20px rgb(14 17 23 / 0.3),
                0 0 0 1px var(--line);
        }
        & .tpl-search input {
            flex: 1 1 0%;
            min-width: 0;
            border: 0;
            outline: 0;
            background: none;
            font: inherit;
            font-size: 16px;
            color: var(--text);
        }
        & .tpl-search input::-webkit-search-cancel-button {
            appearance: none;
        }
        & .tpl-search svg {
            width: 18px;
            height: 18px;
            fill: none;
            stroke: var(--faint);
            stroke-width: 2;
        }
        & .tpl-empty {
            display: none;
            text-align: center;
            color: var(--muted);
            padding: 40px 0;
        }
        & .tpl-empty.on {
            display: block;
        }

        /* the example sites */
        & .tgrid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 48px 24px;
        }
        /* a card is a link: a click opens the whole site in the dialog */
        & .tcard {
            display: grid;
            gap: 16px;
            color: inherit;
            text-decoration: none;
            cursor: zoom-in;
            transition: opacity 0.4s;
        }
        & .tcard.ai-card {
            cursor: pointer;
        }
        & .tcard:focus-visible .im {
            outline: 2px solid var(--text);
            outline-offset: 3px;
        }
        & .tcard.hide {
            display: none;
        }
        & .tcard .im {
            position: relative;
            aspect-ratio: 16 / 10;
            border-radius: 14px;
            overflow: hidden;
            border: 1px solid var(--line);
            background: var(--bg-2);
        }
        & .tcard .im > img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            object-position: center top;
            transition: transform 1.4s var(--out);
        }
        & .tcard:hover .im > img {
            transform: scale(1.025);
        }
        & .tcard .meta {
            display: flex;
            justify-content: space-between;
            align-items: baseline;
            gap: 12px;
        }
        & .tcard b {
            font-weight: 500;
            font-size: 18px;
            letter-spacing: -0.015em;
        }
        & .tcard span {
            color: var(--faint);
            font-size: 14px;
        }

        /* the AI card at the end */
        & .tcard.ai-card {
            text-decoration: none;
            color: inherit;
        }
        & .tcard.ai-card .im > img {
            position: absolute;
            inset: 0;
        }
        & .tcard.ai-card .im::after {
            content: "";
            position: absolute;
            inset: 0;
            background: linear-gradient(rgb(20 14 10 / 0) 35%, rgb(20 14 10 / 0.6) 100%);
        }
        & .tcard.ai-card .ai-copy {
            position: absolute;
            z-index: 1;
            left: 0;
            right: 0;
            bottom: 0;
            padding: 24px;
            color: #fff;
            display: grid;
            gap: 10px;
            justify-items: start;
        }
        & .tcard.ai-card .ai-copy b {
            font-size: 22px;
            letter-spacing: -0.02em;
            color: #fff;
        }
        & .tcard.ai-card .ai-copy span {
            color: rgb(255 255 255 / 0.85);
        }
        & .tcard.ai-card .ai-copy .btn {
            color: var(--text);
        }

        /* nothing that fits: AI or a blank canvas */
        & .alt {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 16px;
        }
        & .alt a {
            text-decoration: none;
            color: inherit;
            padding: 32px;
            border-radius: 16px;
            border: 1px solid var(--line);
            background: #fff;
            display: grid;
            gap: 10px;
            transition: border-color 0.3s;
        }
        & .alt a:hover {
            border-color: var(--faint);
        }
        & .alt h3 {
            font-size: 22px;
            letter-spacing: -0.025em;
        }
        & .alt p {
            color: var(--muted);
            font-size: 15px;
        }

        /* the preview: the whole example site, scrollable */
        & .tpl-preview {
            width: min(1000px, calc(100vw - 32px));
            max-height: calc(100dvh - 48px);
            padding: 0;
            border: 0;
            border-radius: 14px;
            overflow: auto;
            overscroll-behavior: contain;
            background: var(--bg-2);
            box-shadow: 0 40px 100px -30px rgb(0 0 0 / 0.6);
        }
        & .tpl-preview::backdrop {
            background: rgb(14 17 23 / 0.6);
            backdrop-filter: blur(4px);
        }
        & .tpl-preview img {
            display: block;
            width: 100%;
            height: auto;
        }
        & .tpl-close {
            position: sticky;
            top: 12px;
            float: right;
            margin: 12px 12px -52px 0;
            z-index: 1;
            width: 40px;
            height: 40px;
            border: 0;
            border-radius: 999px;
            background: var(--text);
            cursor: pointer;
        }
        & .tpl-close::before,
        & .tpl-close::after {
            content: "";
            position: absolute;
            left: 13px;
            right: 13px;
            top: 19px;
            height: 1.5px;
            background: #fff;
            transform: rotate(45deg);
        }
        & .tpl-close::after {
            transform: rotate(-45deg);
        }
    }

    @media (max-width: 900px) {
        .mk .hm-top {
            grid-template-columns: minmax(0, 1fr);
        }
    }

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

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