/* Try Yesper: the grid at /try and the recorded threads at /try/<slug>.
   The thread pages borrow the look of the assistant view: one column, the
   prompt as a bubble, Yesper's answer with the page it handed back, and a
   composer at the bottom. */

/* ---------- the grid ---------- */

.ex-wrap {
    max-width: 1184px;
    margin: 0 auto;
}

.ex-hero {
    padding-top: 176px;
    text-align: center;
}

.ex-hero h1 {
    font-family: 'Instrument Serif', serif;
    font-weight: 300;
    font-size: clamp(48px, 6vw, 72px);
    line-height: 1.05;
    letter-spacing: -1px;
}

.ex-hero p {
    max-width: 600px;
    margin: 16px auto 0;
    font-size: 19px;
    line-height: 28px;
    color: rgb(90, 90, 86);
}

.ex-hero p.ex-hero-note {
    margin-top: 12px;
    font-size: 13px;
    line-height: 20px;
    color: rgb(105, 105, 100);
}

.ex-filter {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    margin-top: 24px;
}

.ex-filter-btn {
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 20px;
    padding: 6px 14px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: rgb(90, 90, 86);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.ex-filter-btn:hover {
    color: rgb(10, 10, 10);
}

.ex-filter-btn.is-active {
    background: var(--sand);
    color: rgb(10, 10, 10);
}

.ex-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 40px 20px;
    margin-top: 48px;
}

/* A card is the cover with the category and a short title below. On hover
   the cover turns into the prompt, styled like the composer, with the send
   button in the corner. */
.ex-card {
    display: block;
    color: rgb(10, 10, 10);
    text-decoration: none;
    outline: none;
}

.ex-card.is-hidden {
    display: none;
}

.ex-card-media {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1px solid rgba(10, 10, 10, 0.08);
    border-radius: 16px;
    background: var(--sand);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ex-card-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ex-card:hover .ex-card-media,
.ex-card:focus-visible .ex-card-media {
    border-color: rgba(10, 10, 10, 0.12);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 32px -16px rgba(30, 40, 80, 0.25);
}

/* The text sits close under its cover, a row's gap away from the next, and
   rests a little lighter until the card is hovered. */
.ex-card-summary {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 4px 0;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.ex-card:hover .ex-card-summary,
.ex-card:focus-visible .ex-card-summary {
    opacity: 1;
}

.ex-card-kicker {
    font-size: 13px;
    font-weight: 500;
    color: rgb(80, 80, 76);
}

.ex-card-title {
    font-size: 17px;
    line-height: 24px;
    font-weight: 500;
    letter-spacing: -0.1px;
}

.ex-card-prompt {
    position: absolute;
    inset: 0;
    padding: 20px 24px 0;
    background: #ffffff;
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* The prompt fades out towards the send button instead of being cut mid-line;
   the whole prompt is on the thread page. */
.ex-card-prompt-text {
    display: block;
    height: 100%;
    overflow: hidden;
    font-size: 14px;
    line-height: 21px;
    -webkit-mask-image: linear-gradient(to bottom, #000 50%, transparent 90%);
    mask-image: linear-gradient(to bottom, #000 50%, transparent 90%);
}

.ex-card-send {
    position: absolute;
    right: 16px;
    bottom: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: rgb(10, 10, 10);
    color: #ffffff;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.ex-card-send svg {
    width: 18px;
    height: 18px;
}

.ex-card:hover .ex-card-prompt,
.ex-card:focus-visible .ex-card-prompt {
    opacity: 1;
}

.ex-card:hover .ex-card-send,
.ex-card:focus-visible .ex-card-send {
    opacity: 1;
    transform: none;
}

/* The challenge card closes the grid: black, with the send button always
   showing, and it opens the demo booking. */
.ex-card--challenge .ex-card-media {
    display: flex;
    flex-direction: column;
    padding: 28px;
    border-color: transparent;
    background: rgb(10, 10, 10);
    color: #ffffff;
}

.ex-card-challenge-text {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 48px;
}

.ex-card-challenge-title {
    font-size: 22px;
    line-height: 28px;
    font-weight: 500;
    letter-spacing: -0.2px;
}

.ex-card-challenge-body {
    font-size: 14px;
    line-height: 21px;
    color: rgba(255, 255, 255, 0.72);
}

.ex-card--challenge .ex-card-send {
    opacity: 1;
    transform: none;
    background: #ffffff;
    color: rgb(10, 10, 10);
}

.ex-cta {
    margin: 96px 0 96px;
    text-align: center;
    font-size: 17px;
    line-height: 26px;
    color: rgb(90, 90, 86);
}

.ex-cta a {
    font-weight: 500;
    color: rgb(10, 10, 10);
    text-decoration: none;
}

@media (max-width: 900px) {
    .ex-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .ex-hero {
        padding-top: 128px;
    }
    .ex-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ---------- the thread ---------- */

.ex-thread-page {
    background: rgb(254, 254, 252);
}

.ex-view {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

.ex-view[hidden] {
    display: none;
}

.ex-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Top bar: back, the wordmark, demo. On the result view: back, title, new tab. */
.ex-bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 24px;
    width: 100%;
    max-width: 1232px;
    margin: 0 auto;
    padding: 22px 24px;
}

.ex-bar-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    justify-self: start;
    font-size: 14px;
    color: rgb(90, 90, 86);
    text-decoration: none;
    white-space: nowrap;
}

.ex-bar-back:hover {
    color: rgb(10, 10, 10);
}

.ex-bar-back svg {
    width: 16px;
    height: 16px;
}

.ex-bar .logo {
    justify-self: center;
}

.ex-bar-cta {
    justify-self: end;
}

/* The result bar's middle: the page's title, and under it the line that says
   the result is real and the project is sample data. */
.ex-bar-heading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    justify-self: center;
    min-width: 0;
    max-width: 100%;
    text-align: center;
}

.ex-bar-title {
    max-width: 100%;
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ex-bar-note {
    max-width: 100%;
    font-size: 12px;
    line-height: 16px;
    color: rgb(105, 105, 100);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Share: copies the link to the result. The site's black primary button. */
.ex-bar-share {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    justify-self: end;
    padding: 7px 16px;
    border: 0;
    border-radius: 6px;
    background: rgb(10, 10, 10);
    font: inherit;
    font-size: 13px;
    line-height: 18px;
    font-weight: 500;
    color: #ffffff;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.3s;
}

.ex-bar-share:hover {
    opacity: 0.85;
}

.ex-bar-share svg {
    width: 14px;
    height: 14px;
}

.ex-thread {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 768px;
    margin: 0 auto;
    padding: 32px 24px 0;
}

.ex-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.ex-user {
    display: flex;
    justify-content: flex-end;
}

.ex-bubble {
    max-width: 580px;
    padding: 12px 20px;
    border-radius: 24px;
    background: var(--sand);
    font-size: 15px;
    line-height: 24px;
}

.ex-thinking {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgb(90, 90, 86);
    animation: ex-pulse 1.6s ease-in-out infinite;
}

.ex-thinking[hidden] {
    display: none;
}

.ex-thinking svg {
    width: 16px;
    height: 16px;
}

@keyframes ex-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

.ex-answer {
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: ex-rise 0.35s ease-out;
}

.ex-answer[hidden] {
    display: none;
}

@keyframes ex-rise {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

.ex-answer p {
    max-width: 640px;
    font-size: 15px;
    line-height: 24px;
}

/* The page Yesper handed back: the title row, and under it a live preview of
   the page's top that fades out, as the artifact card does in the app. The
   whole card opens the result view. */
.ex-artifact {
    display: block;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid rgba(10, 10, 10, 0.1);
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    color: rgb(10, 10, 10);
    text-decoration: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ex-artifact:hover {
    border-color: rgba(10, 10, 10, 0.2);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 32px -16px rgba(30, 40, 80, 0.2);
}

.ex-artifact-head {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px 12px 12px;
}

.ex-artifact-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--sand);
}

.ex-artifact-icon svg {
    width: 18px;
    height: 18px;
}

.ex-artifact-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 15px;
    line-height: 22px;
    font-weight: 500;
}

.ex-artifact-chevron {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: rgb(140, 140, 135);
}

.ex-artifact-preview {
    position: relative;
    display: block;
    height: 300px;
    overflow: hidden;
    border-top: 1px solid rgba(10, 10, 10, 0.06);
    background: #fbfbfc;
}

.ex-artifact-preview::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 100px;
    background: linear-gradient(to bottom, rgba(251, 251, 252, 0), #fbfbfc);
    pointer-events: none;
}

.ex-artifact-preview iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    pointer-events: none;
}

/* Follow-ups after the answer, as the app suggests them: outlined pills
   with the reply arrow. They open the demo dialog. */
.ex-followups {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ex-followup {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid rgba(10, 10, 10, 0.12);
    border-radius: 999px;
    background: transparent;
    font: inherit;
    font-size: 14px;
    line-height: 20px;
    color: rgb(60, 60, 56);
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.ex-followup:hover {
    border-color: rgba(10, 10, 10, 0.3);
    color: rgb(10, 10, 10);
}

.ex-followup svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    color: rgb(140, 140, 135);
}

.ex-composer-wrap {
    position: sticky;
    bottom: 0;
    padding: 32px 0 28px;
    background: rgb(254, 254, 252);
}

.ex-composer {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 8px 8px 8px 20px;
    background: #ffffff;
    border: 1px solid rgba(10, 10, 10, 0.1);
    border-radius: 24px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 32px -16px rgba(30, 40, 80, 0.2);
}

.ex-composer:focus-within {
    box-shadow: 0 0 0 2px rgb(10, 10, 10);
}

.ex-composer textarea {
    flex: 1;
    min-width: 0;
    max-height: 160px;
    padding: 8px 0;
    border: 0;
    outline: 0;
    resize: none;
    background: transparent;
    font: inherit;
    font-size: 15px;
    line-height: 24px;
    color: rgb(10, 10, 10);
}

.ex-composer textarea::placeholder {
    color: rgb(140, 140, 135);
}

.ex-send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 999px;
    background: rgb(10, 10, 10);
    color: #ffffff;
    cursor: pointer;
    transition: background 0.2s ease;
}

.ex-send:disabled {
    background: rgba(10, 10, 10, 0.2);
    cursor: default;
}

.ex-send svg {
    width: 18px;
    height: 18px;
}

/* The page Yesper handed back, inside the result view. examples.js puts the
   iframe in when the view opens. */
.ex-frame {
    position: relative;
    flex: 1;
    width: calc(100% - 48px);
    min-height: 70vh;
    margin: 0 24px 24px;
    overflow: hidden;
    border: 1px solid rgba(10, 10, 10, 0.08);
    border-radius: 16px;
    background: #ffffff;
}

/* Positioned, not height: 100%. Safari does not resolve a percentage height
   against a flexed box and gave the frame its default 150 px. */
.ex-frame iframe {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Sending a follow-up opens this. */
.ex-dialog {
    /* styles.css zeroes every margin; the dialog needs margin: auto to sit centred. */
    margin: auto;
    width: calc(100% - 48px);
    max-width: 440px;
    padding: 48px 40px 40px;
    border: 0;
    border-radius: 24px;
    background: #ffffff;
    box-shadow: 0 24px 64px -24px rgba(10, 10, 10, 0.3), 0 0 0 1px rgba(10, 10, 10, 0.06);
    color: rgb(10, 10, 10);
    text-align: center;
}

.ex-dialog::backdrop {
    background: rgba(254, 254, 252, 0.75);
    backdrop-filter: blur(3px);
}

.ex-dialog h2 {
    margin-bottom: 16px;
    font-size: 24px;
    line-height: 30px;
    font-weight: 500;
    letter-spacing: -0.3px;
}

.ex-dialog p {
    max-width: 320px;
    margin: 0 auto;
    line-height: 24px;
    color: rgb(90, 90, 86);
}

.ex-dialog-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 28px;
}

.ex-dialog-actions .cta-btn {
    padding: 11px 18px;
    border-radius: 10px;
    font-size: 14px;
}

.ex-dialog-contact {
    padding: 11px 18px;
    font-size: 14px;
    font-weight: 500;
    color: rgb(90, 90, 86);
    text-decoration: none;
}

.ex-dialog-contact:hover {
    color: rgb(10, 10, 10);
}

.ex-dialog-close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: rgb(140, 140, 135);
    cursor: pointer;
}

.ex-dialog-close:hover {
    color: rgb(10, 10, 10);
}

.ex-dialog-close svg {
    width: 18px;
    height: 18px;
}

@media (max-width: 600px) {
    .ex-bar {
        gap: 12px;
        padding: 16px;
    }
    .ex-bar-title {
        font-size: 13px;
    }
    .ex-bar-note {
        white-space: normal;
    }
    .ex-thread {
        padding-top: 16px;
    }
    .ex-bubble {
        max-width: 100%;
    }
    .ex-artifact-preview {
        height: 220px;
    }
    .ex-frame {
        width: calc(100% - 24px);
        margin: 0 12px 12px;
    }
    .ex-dialog {
        padding: 40px 24px 28px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ex-thinking,
    .ex-answer {
        animation: none;
    }
}
