/*
 * The template blocks of the pSEO pages: template_showcase, artifact_document, mockup_preview, feature_catalog and
 * artifact_nav (templates/pseo/blocks). pseo/page.ftl links this sheet only on a page that carries one of them.
 * Everything here is ours: the theme CSS is purged, so a utility class a block might reach for may not exist
 * (ToolTemplateCssCoverageTest reads every class of these blocks against what page.ftl links).
 */

/* --- template_showcase --- */

/* The theme sizes every h2 and h3 with !important, through its --sizes-heading-* variables: a heading here is sized by
   setting those variables on it, which the theme's own rule then reads. */

.template-showcase {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.25rem;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    background: #fff;
    color: #111827;
}

@media (min-width: 900px) {
    .template-showcase {
        padding: 2rem;
    }
}

.template-showcase__intro {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 48rem;
}

.template-showcase__title {
    --sizes-heading-h2-size: 1.5rem;
    --sizes-heading-h2-lh: 1.3;
    --sizes-heading-h2-lp: 0;
    margin: 0;
}

.template-showcase__description {
    margin: 0;
    line-height: 1.6;
    color: #374151;
}

.template-showcase__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
}

@media (min-width: 900px) {
    .template-showcase__body {
        grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
        align-items: start;
    }
}

/* On a phone the offer comes first, right under the pictures; beside the list from 900px. */
.template-showcase__offer {
    order: -1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

@media (min-width: 900px) {
    .template-showcase__offer {
        order: 0;
    }

    .template-showcase__offer:only-child {
        grid-column: 1 / -1;
    }
}

.template-showcase__included-block {
    min-width: 0;
}

.template-showcase__included {
    margin: 0 0 0.5rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1.4;
    text-transform: uppercase;
    color: #4b5563;
}

.template-showcase__features {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.35rem 1.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.95rem;
    line-height: 1.5;
}

@media (min-width: 640px) {
    .template-showcase__features {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.template-showcase__features li {
    position: relative;
    padding-left: 1.5rem;
}

.template-showcase__features li::before {
    content: "";
    position: absolute;
    left: 0.15rem;
    top: 0.3rem;
    width: 0.45rem;
    height: 0.8rem;
    border: solid #0f766e;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.template-showcase__value {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.5;
    color: #4b5563;
}

.template-showcase__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.25rem;
}

.template-showcase__cta {
    display: inline-block;
    padding: 0.8rem 1.6rem;
    border-radius: 999px;
    background: #16404b;
    color: #fff;
    font-weight: 700;
    text-decoration: none;
}

.template-showcase__cta:hover,
.template-showcase__cta:focus-visible {
    background: #0e2c34;
    color: #fff;
}

.template-showcase__details {
    color: #16404b;
    font-weight: 600;
}

/* The documents, as small pills under the card: what the app type's other pages are, in one line. */
.template-showcase__links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0;
    padding: 1rem 0 0;
    border-top: 1px solid #f1f5f9;
    list-style: none;
}

.template-showcase__links a {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    color: #16404b;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
}

.template-showcase__links a:hover,
.template-showcase__links a:focus-visible {
    border-color: #16404b;
}

/* The compact variant, a document page's strip: the title and the CTA on one line, four shots under them. */
.template-showcase--compact {
    gap: 1rem;
}

.template-showcase__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
}

.template-showcase--compact .template-showcase__title {
    --sizes-heading-h2-size: 1.25rem;
}

/* --- the gallery: template_showcase's tiles, mockup_preview's picture; template-blocks.js enlarges them --- */

.template-gallery {
    display: block;
    min-width: 0;
}

.template-gallery__grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.template-gallery__tile {
    flex: 1 1 0;
    min-width: 0;
    margin: 0;
    padding: 0;
}

/* On a phone the first shot is full width and the others share the row under it. */
.template-gallery--tiles .template-gallery__grid > .template-gallery__tile:first-child {
    flex-basis: 100%;
}

.template-gallery__link {
    position: relative;
    display: block;
    height: 100%;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f8fafc;
    cursor: zoom-in;
}

.template-gallery__link:focus-visible {
    outline: 3px solid #0f766e;
    outline-offset: 2px;
}

.template-gallery__image {
    display: block;
    width: 100%;
    height: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    object-position: top left;
    transition: transform 0.25s ease;
}

.template-gallery__link:hover .template-gallery__image {
    transform: scale(1.02);
}

@media (prefers-reduced-motion: reduce) {
    .template-gallery__image {
        transition: none;
    }

    .template-gallery__link:hover .template-gallery__image {
        transform: none;
    }
}

.template-gallery__caption {
    position: absolute;
    left: 0.5rem;
    bottom: 0.5rem;
    max-width: calc(100% - 1rem);
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.78);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Too narrow for a caption on a phone, except the large shot: the enlarged view shows every one. */
.template-gallery--tiles .template-gallery__grid > .template-gallery__tile:not(:first-child) .template-gallery__caption,
.template-gallery--strip .template-gallery__caption {
    display: none;
}

.template-gallery__more {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    background: rgba(15, 23, 42, 0.62);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
}

@media (min-width: 900px) {
    .template-gallery--tiles .template-gallery__grid {
        display: grid;
        gap: 0.75rem;
    }

    /* One large shot beside the small ones: the column ratios keep every tile at 16:10. */
    .template-gallery--tiles .template-gallery__grid[data-count="2"] {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .template-gallery--tiles .template-gallery__grid[data-count="3"] {
        grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    }

    .template-gallery--tiles .template-gallery__grid[data-count="4"] {
        grid-template-columns: minmax(0, 3fr) minmax(0, 1fr);
    }

    .template-gallery--tiles .template-gallery__grid[data-count="5"] {
        grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
    }

    .template-gallery--tiles .template-gallery__grid[data-count="3"] > .template-gallery__tile:first-child,
    .template-gallery--tiles .template-gallery__grid[data-count="5"] > .template-gallery__tile:first-child {
        grid-row: span 2;
    }

    .template-gallery--tiles .template-gallery__grid[data-count="4"] > .template-gallery__tile:first-child {
        grid-row: span 3;
    }

    .template-gallery--tiles .template-gallery__grid > .template-gallery__tile:not(:first-child) .template-gallery__caption {
        display: block;
    }

    .template-gallery--tiles .template-gallery__grid > .template-gallery__tile:first-child .template-gallery__caption {
        left: 0.75rem;
        bottom: 0.75rem;
        font-size: 0.85rem;
    }
}

/* The large shot fills the rows beside it; the small ones keep their ratio. */
.template-gallery--tiles .template-gallery__grid > .template-gallery__tile:first-child .template-gallery__image {
    aspect-ratio: auto;
    min-height: 100%;
}

@media (max-width: 899px) {
    .template-gallery--tiles .template-gallery__grid > .template-gallery__tile:first-child .template-gallery__image {
        aspect-ratio: 16 / 10;
    }
}

/* The strip: four shots in a row, two by two on a phone. */
.template-gallery--strip .template-gallery__tile {
    flex: 1 1 calc(50% - 0.5rem);
}

@media (min-width: 640px) {
    .template-gallery--strip .template-gallery__tile {
        flex: 1 1 0;
    }
}

/* One picture, shown whole: a legacy template's card, a mockup. */
.template-gallery--single .template-gallery__image {
    aspect-ratio: auto;
    height: auto;
    object-fit: contain;
}

.template-gallery__phones {
    margin-top: 1.25rem;
}

.template-gallery__phones-title {
    margin: 0 0 0.6rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1.4;
    text-transform: uppercase;
    color: #4b5563;
}

.template-gallery__phone-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

@media (min-width: 900px) {
    .template-gallery__phone-row {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

.template-gallery__tile--phone .template-gallery__link {
    border-radius: 18px;
}

.template-gallery__tile--phone .template-gallery__image {
    aspect-ratio: 390 / 844;
}

/* The phone row repeats the screens tiled above it: their captions would say the same again. */
.template-gallery__phone-row .template-gallery__caption {
    display: none;
}

/* The enlarged view (a <dialog> template-blocks.js adds to the page): one shot at a time, its caption, the way on. */

html.template-lightbox-open {
    overflow: hidden;
}

.template-lightbox {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(10, 18, 22, 0.94);
    color: #f8fafc;
}

.template-lightbox[open] {
    display: flex;
    align-items: center;
    justify-content: center;
}

.template-lightbox::backdrop {
    background: rgba(10, 18, 22, 0.6);
}

.template-lightbox__figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    max-width: calc(100vw - 2rem);
    margin: 0;
    touch-action: pan-y;
}

@media (min-width: 700px) {
    .template-lightbox__figure {
        max-width: calc(100vw - 9rem);
    }
}

.template-lightbox__image {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 9rem);
    max-height: calc(100dvh - 9rem);
    width: auto;
    height: auto;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
}

.template-lightbox__image--phone {
    border-radius: 24px;
}

.template-lightbox__caption {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem 0.75rem;
    max-width: 48rem;
    font-size: 0.95rem;
    line-height: 1.5;
    text-align: center;
    color: #f8fafc;
}

.template-lightbox__count {
    color: #94a3b8;
    font-variant-numeric: tabular-nums;
}

.template-lightbox__button {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    cursor: pointer;
}

.template-lightbox__button:hover,
.template-lightbox__button:focus-visible {
    background: rgba(255, 255, 255, 0.28);
}

.template-lightbox__button:focus-visible {
    outline: 3px solid #5eead4;
    outline-offset: 2px;
}

.template-lightbox__button[hidden] {
    display: none;
}

.template-lightbox__button svg {
    width: 1.5rem;
    height: 1.5rem;
}

.template-lightbox__close {
    top: 1rem;
    right: 1rem;
}

.template-lightbox__previous,
.template-lightbox__next {
    bottom: 1rem;
}

.template-lightbox__previous {
    left: 1rem;
}

.template-lightbox__next {
    right: 1rem;
}

@media (min-width: 700px) {
    .template-lightbox__previous,
    .template-lightbox__next {
        top: 50%;
        bottom: auto;
        transform: translateY(-50%);
    }

    .template-lightbox__previous {
        left: 1.5rem;
    }

    .template-lightbox__next {
        right: 1.5rem;
    }
}

/* --- artifact_document --- */

.artifact-document__title,
.mockup-preview__title,
.feature-catalog__title,
.artifact-nav__title {
    margin: 0 0 0.75rem;
    font-size: 1.6rem;
    line-height: 1.25;
}

.artifact-document__lead,
.mockup-preview__lead,
.feature-catalog__lead {
    margin: 0 0 1.5rem;
    line-height: 1.6;
    color: #374151;
}

.artifact-document {
    line-height: 1.7;
    color: #111827;
    overflow-wrap: anywhere;
}

.artifact-document table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
}

.artifact-document th,
.artifact-document td {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: top;
}

/* The theme paints every pre light and every pre code as inline code: say what a document's code block looks like. */
.artifact-document pre {
    padding: 1rem;
    border-radius: 12px;
    background: #f8fafc !important;
    color: #111827 !important;
    overflow-x: auto;
    white-space: pre;
}

.artifact-document pre code {
    background: none !important;
    padding: 0 !important;
    color: inherit !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.artifact-diagram {
    margin: 1rem 0;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    overflow-x: auto;
}

.artifact-diagram svg {
    max-width: 100%;
    height: auto;
}

/* --- mockup_preview --- */

.mockup-preview__shot {
    display: block;
}

.mockup-preview__whole {
    margin-top: 1.25rem;
}

.mockup-preview__summary {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    color: #16404b;
    font-weight: 600;
    cursor: pointer;
}

.mockup-preview__summary:hover,
.mockup-preview__summary:focus-visible {
    border-color: #16404b;
}

.mockup-preview__frame {
    margin-top: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

.mockup-preview__frame iframe {
    display: block;
    width: 100%;
    height: 640px;
    border: 0;
}

.mockup-preview__sections-title {
    margin: 1.5rem 0 0.5rem;
    font-size: 1.1rem;
}

.mockup-preview__sections {
    margin: 0;
    padding-left: 1.25rem;
    line-height: 1.7;
}

/* --- feature_catalog --- */

.feature-catalog {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 900px) {
    .feature-catalog {
        grid-template-columns: repeat(3, 1fr);
    }
}

.feature-catalog__tier {
    padding: 1.25rem;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #fff;
}

.feature-catalog__tier-title {
    margin: 0 0 1rem;
    font-size: 1.15rem;
}

.feature-catalog__list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.feature-catalog__item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.feature-catalog__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.feature-catalog__name {
    font-weight: 700;
}

.feature-catalog__badge {
    padding: 0.1rem 0.6rem;
    border-radius: 999px;
    background: #dcfce7;
    color: #14532d;
    font-size: 0.8rem;
    font-weight: 600;
}

.feature-catalog__description {
    margin: 0;
    line-height: 1.5;
    color: #374151;
}

.feature-catalog__prompt {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.75rem;
    border-radius: 12px;
    background: #f8fafc;
}

.feature-catalog__prompt-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #4b5563;
}

.feature-catalog__prompt-text {
    margin: 0;
    line-height: 1.5;
}

.feature-catalog__copy {
    align-self: flex-start;
    padding: 0.35rem 0.9rem;
    border: 1px solid #16404b;
    border-radius: 999px;
    background: #fff;
    color: #16404b;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

/* --- artifact_nav --- */

.artifact-nav {
    display: block;
}

.artifact-nav__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.artifact-nav__link,
.artifact-nav__current {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    text-decoration: none;
    color: #16404b;
    font-weight: 600;
}

.artifact-nav__current {
    background: #16404b;
    border-color: #16404b;
    color: #fff;
}
