/* Styles for /products and /products/<product-slug>/ only.
   Loaded after /styles.css, so it reuses its colour tokens, header, footer and buttons.
   Owned by www.bernallabs.com — a product never edits this file. */

/* Products list page — top spacing matches the home page's .hero */
.products-hero {
    position: relative;
    z-index: 5;
    padding: 120px 0 48px;
}

.products-headline {
    margin-bottom: 0;
}

.products-list {
    position: relative;
    z-index: 5;
    padding: 0 0 120px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 28px;
}

.products-grid--empty {
    display: block;
}

.products-empty {
    color: var(--fg-muted);
    font-size: 17px;
    padding: 48px 0;
    border-top: 1px solid var(--border);
}

.product-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover,
.product-card:focus-visible {
    border-color: var(--border-strong);
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    outline: none;
}

.product-card-image {
    aspect-ratio: 16 / 10;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    overflow: hidden;
}

.product-card-image img,
.product-hero-image img,
.product-hero-image video,
.product-figure img,
.product-figure video {
    display: block;
    width: 100%;
    height: auto;
}

.product-card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 22px 24px 24px;
    flex: 1;
}

.product-card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.product-card-name {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.product-card-description {
    color: var(--fg-muted);
    font-size: 15px;
    line-height: 1.55;
    flex: 1;
}

.product-card-more {
    font-size: 14px;
    font-weight: 500;
    color: var(--accent);
    margin-top: 6px;
}

/* Status chip — shared by the card and the detail page */
.product-status {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: none;
    white-space: nowrap;
    color: var(--fg-muted);
}

.product-status--live {
    color: #4ade80;
    border-color: rgba(74, 222, 128, 0.35);
}

.product-status--beta {
    color: var(--accent-2);
    border-color: rgba(249, 181, 49, 0.35);
}

/* Product detail page */
.product-hero {
    position: relative;
    z-index: 5;
    padding: 56px 0 40px;
}

.back-link {
    display: inline-block;
    font-size: 14px;
    color: var(--fg-muted);
    margin-bottom: 40px;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--fg);
}

.product-hero .eyebrow {
    margin-bottom: 20px;
}

.product-headline {
    font-size: clamp(36px, 5vw, 60px);
    margin-bottom: 20px;
}

.product-hero .subhead {
    margin-bottom: 32px;
}

/* Same width and position as the text column below (.product-details-inner: 760px minus its 32px side padding). */
.product-hero-image {
    max-width: calc(760px - 64px);
    margin-left: auto;
    margin-right: auto;
    margin-top: 48px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

.product-details {
    position: relative;
    z-index: 5;
    padding: 40px 0 120px;
}

.product-details-inner {
    max-width: 760px;
}

.product-section {
    margin-top: 48px;
}

.product-section h2 {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 500;
    letter-spacing: -0.01em;
    margin-bottom: 14px;
}

.product-section p {
    color: var(--fg-muted);
    font-size: 17px;
    line-height: 1.65;
    margin-bottom: 14px;
}

.product-section ul {
    list-style: none;
    display: grid;
    gap: 10px;
}

.product-section li {
    position: relative;
    padding-left: 22px;
    color: var(--fg-muted);
    font-size: 16px;
    line-height: 1.55;
}

.product-section li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 0.62em;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
}

.product-gallery {
    display: grid;
    gap: 36px;
    margin-top: 8px;
}

.product-figure {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-elev);
}

.product-figure figcaption {
    padding: 14px 18px;
    font-size: 14px;
    color: var(--fg-muted);
    border-top: 1px solid var(--border);
}

.product-updated {
    margin-top: 64px;
    font-size: 13px;
    color: var(--fg-dim);
}

/* Screenshot viewer (products.js) — copied from financial-planner's homepage viewer,
   recoloured with this site's tokens. Each screenshot is a button that opens it large. */
.product-screenshot-button {
    display: block;
    width: 100%;
    padding: 0;
    margin: 0;
    border: 0;
    background: none;
    cursor: zoom-in;
    line-height: 0;
}

.product-screenshot-button:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: -3px;
}

/* The open screenshot: a native <dialog> that fills the window, transparent, so a
   click outside the image lands on the dialog (the backdrop). The image is 95% of the
   width or the height, whichever the image's shape reaches first; the X sits in the
   window's top-right corner, above the image. */
.product-screenshot-modal {
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.product-screenshot-modal[open] {
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-screenshot-modal::backdrop {
    background: rgba(5, 5, 7, 0.88);
}

.product-screenshot-modal-frame {
    position: relative;
    line-height: 0;
}

.product-screenshot-modal-image {
    display: block;
    width: min(95vw, calc(95vh * var(--screenshot-width-over-height)));
    height: auto;
    aspect-ratio: var(--screenshot-width-over-height);
    border-radius: 8px;
    background: var(--bg-elev);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    cursor: default;
}

.product-screenshot-modal-close {
    position: fixed;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
    background: var(--bg-elev);
    color: var(--fg);
    font: 600 20px/1 var(--font-sans);
    cursor: pointer;
}

/* Previous / Next — arrows in circles just inside the image's left and right edges,
   vertically centred; 44px tap targets at every width. */
.product-screenshot-modal-step {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    padding: 0 0 4px;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
    background: var(--bg-elev);
    color: var(--fg);
    font: 600 30px/1 var(--font-sans);
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-screenshot-modal-close:hover,
.product-screenshot-modal-step:hover {
    background: #1c1c21;
}

.product-screenshot-modal-close:focus-visible,
.product-screenshot-modal-step:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.product-screenshot-modal-previous {
    left: 8px;
}

.product-screenshot-modal-next {
    right: 8px;
}

html.product-screenshot-modal-open {
    overflow: hidden;
}

@media (max-width: 720px) {
    .products-hero {
        padding: 80px 0 36px;
    }

    .products-grid {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .product-hero {
        padding: 36px 0 24px;
    }

    .back-link {
        margin-bottom: 28px;
    }

    .product-hero-image {
        margin-top: 36px;
    }
}
