/*
|--------------------------------------------------------------------------
| Template Forge — Public Template Detail
|--------------------------------------------------------------------------
| Page-specific styles for template.php. Shared navigation, footer, branding,
| typography, and global components remain in site.css.
|--------------------------------------------------------------------------
*/

.template-page {
    --detail-ink: #101114;
    --detail-cream: #f1eee5;
    --detail-paper: #fbfaf6;
    --detail-orange: #ff6534;
    --detail-muted: #737479;
    --detail-line: rgba(16, 17, 20, 0.12);
}

.template-page, .template-page * {
    box-sizing: border-box;
}

.template-page {
    min-height: 100vh;
    margin: 0;
    color: var(--detail-ink);
    background:
        radial-gradient(
            circle at 88% 12%,
            rgba(255, 101, 52, 0.11),
            transparent 27rem
        ),
        var(--detail-cream);
    font-family: "Inter", sans-serif;
}

.template-page a {
    color: inherit;
    text-decoration: none;
}

.template-page button {
    font: inherit;
}

.template-page .template-shell {
    width: min(calc(100% - 64px), 1380px);
    margin-inline: auto;
}

.template-page .detail-main {
    padding-block: 38px 80px;
}

.template-page .back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #6f7074;
    font-size: 0.78rem;
    font-weight: 700;
}

.template-page .back-link:hover {
    color: var(--detail-orange);
}

.template-page .back-link svg,
.template-page .external-link svg,
.template-page .primary-action svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.template-page .product-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(340px, 0.7fr);
    align-items: start;
    gap: 24px;
    margin-top: 25px;
}

.template-page .preview-card {
    overflow: hidden;
    border: 1px solid var(--detail-line);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.66);
}

.template-page .preview-media {
    position: relative;
    display: grid;
    overflow: hidden;
    aspect-ratio: 16 / 10;
    place-items: center;
    background:
        radial-gradient(
            circle at 80% 20%,
            rgba(255, 101, 52, 0.32),
            transparent 35%
        ),
        #111216;
}

.template-page .preview-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.template-page .preview-placeholder {
    color: #ffffff;
    font-family: "Space Grotesk", sans-serif;
    font-size: clamp(4rem, 13vw, 9rem);
    font-weight: 700;
}

.template-page .preview-badges {
    position: absolute;
    inset: 16px 16px auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.template-page .badge {
    padding: 7px 10px;
    border-radius: 999px;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.56rem;
    font-weight: 600;
    text-transform: uppercase;
    backdrop-filter: blur(12px);
}

.template-page .badge-type {
    color: #ffffff;
    background: rgba(16, 17, 20, 0.8);
}

.template-page .badge-featured {
    color: #6d2a15;
    background: rgba(255, 199, 111, 0.94);
}

.template-page .preview-caption {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 19px;
    color: #7f8085;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.58rem;
    text-transform: uppercase;
}

.template-page .product-summary {
    position: sticky;
    top: 103px;
    padding: 29px;
    border-radius: 22px;
    color: #ffffff;
    background:
        radial-gradient(
            circle at 92% 5%,
            rgba(255, 101, 52, 0.28),
            transparent 38%
        ),
        var(--detail-ink);
    box-shadow: 0 24px 70px rgba(16, 17, 20, 0.16);
}

.template-page .summary-eyebrow {
    color: var(--detail-orange);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.template-page .product-summary h1 {
    margin: 14px 0 0;
    font-family: "Space Grotesk", sans-serif;
    font-size: clamp(2.1rem, 4vw, 3.75rem);
    line-height: 0.98;
    letter-spacing: -0.065em;
}

.template-page .summary-description {
    margin: 16px 0 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.95rem;
    line-height: 1.7;
}

.template-page .summary-price {
    margin-top: 24px;
    font-family: "Space Grotesk", sans-serif;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.05em;
}

.template-page .summary-price.free {
    color: #63dfa5;
}

.template-page .action-errors {
    display: grid;
    gap: 6px;
    margin-top: 18px;
    padding: 13px 15px;
    border: 1px solid rgba(255, 120, 83, 0.38);
    border-radius: 10px;
    color: #ffd1c3;
    background: rgba(255, 101, 52, 0.12);
    font-size: 0.72rem;
    line-height: 1.55;
}

.template-page .purchase-area {
    display: grid;
    gap: 10px;
    margin-top: 23px;
}

.template-page .purchase-area form {
    margin: 0;
}

.template-page .primary-action,
.template-page .external-link {
    display: flex;
    width: 100%;
    min-height: 51px;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 0 17px;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.76rem;
    font-weight: 700;
}

.template-page .primary-action {
    color: #ffffff;
    background: var(--detail-orange);
}

.template-page .primary-action:hover {
    background: #ed5425;
}

.template-page .primary-action.pending {
    cursor: not-allowed;
    color: rgba(255, 255, 255, 0.58);
    background: rgba(255, 255, 255, 0.11);
}

.template-page .external-link {
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.82);
    background: transparent;
}

.template-page .external-link:hover {
    border-color: var(--detail-orange);
    color: #ffffff;
}

.template-page .checkout-note {
    color: rgba(255, 255, 255, 0.38);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.56rem;
    line-height: 1.6;
    text-align: center;
}

.template-page .paypal-button-container {
    min-height: 45px;
    overflow: hidden;
    border-radius: 10px;
    background: var(--detail-ink);
    font-size: 0;
    line-height: 0;
    isolation: isolate;
}

/*
|--------------------------------------------------------------------------
| PayPal SDK seam cleanup
|--------------------------------------------------------------------------
|
| PayPal injects its own nested wrappers/iframes. Keep those rendering boxes
| block-level and transparent so baseline whitespace or wrapper backgrounds do
| not show as bright seams between stacked funding buttons.
|--------------------------------------------------------------------------
*/

.template-page .paypal-button-container > div,
.template-page .paypal-button-container > span {
    margin: 0 !important;
    background: transparent !important;
}

.template-page .paypal-button-container iframe {
    display: block !important;
    margin: 0 !important;
    border: 0 !important;
    vertical-align: top !important;
}

.template-page .checkout-status {
    display: none;
    padding: 11px 13px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 9px;
    color: rgba(255, 255, 255, 0.76);
    background: rgba(255, 255, 255, 0.07);
    font-size: 0.72rem;
    line-height: 1.55;
    text-align: center;
}

.template-page .checkout-status.visible {
    display: block;
}

.template-page .checkout-status.success {
    border-color: rgba(99, 223, 165, 0.35);
    color: #b9f6d9;
    background: rgba(99, 223, 165, 0.1);
}

.template-page .checkout-status.error {
    border-color: rgba(255, 120, 83, 0.38);
    color: #ffd1c3;
    background: rgba(255, 101, 52, 0.12);
}

.template-page .content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 0.42fr);
    align-items: start;
    gap: 24px;
    margin-top: 24px;
}

.template-page .content-card {
    overflow: hidden;
    border: 1px solid var(--detail-line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.67);
}

.template-page .content-card + .content-card {
    margin-top: 20px;
}

.template-page .card-header {
    padding: 21px 23px;
    border-bottom: 1px solid rgba(16, 17, 20, 0.09);
}

.template-page .card-header h2 {
    margin: 0;
    font-family: "Space Grotesk", sans-serif;
    font-size: 1.05rem;
    letter-spacing: -0.035em;
}

.template-page .card-body {
    padding: 23px;
    color: #4f5055;
    font-size: 0.95rem;
    line-height: 1.75;
}

.template-page .card-body p {
    margin: 0;
}

.template-page .spec-list {
    display: grid;
    gap: 0;
    margin: 0;
}

.template-page .spec-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 25px;
    padding-block: 13px;
    border-bottom: 1px solid rgba(16, 17, 20, 0.08);
}

.template-page .spec-row:first-child {
    padding-top: 0;
}

.template-page .spec-row:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.template-page .spec-row dt {
    color: #85868a;
    font-size: 0.72rem;
}

.template-page .spec-row dd {
    margin: 0;
    color: var(--detail-ink);
    font-size: 0.76rem;
    font-weight: 700;
    text-align: right;
}

.template-page .related-section {
    margin-top: 55px;
}

.template-page .related-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 25px;
    margin-bottom: 20px;
}

.template-page .related-heading h2 {
    margin: 0;
    font-family: "Space Grotesk", sans-serif;
    font-size: 2rem;
    letter-spacing: -0.055em;
}

.template-page .related-heading a {
    color: #707176;
    font-size: 0.72rem;
    font-weight: 700;
}

.template-page .related-heading a:hover {
    color: var(--detail-orange);
}

.template-page .related-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 17px;
}

.template-page .related-card {
    overflow: hidden;
    border: 1px solid var(--detail-line);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.67);
}

.template-page .related-media {
    display: grid;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    place-items: center;
    color: #ffffff;
    background: var(--detail-ink);
    font-family: "Space Grotesk", sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
}

.template-page .related-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.template-page .related-body {
    padding: 16px;
}

.template-page .related-meta {
    color: #898a8f;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.56rem;
    text-transform: uppercase;
}

.template-page .related-title {
    margin: 9px 0 0;
    font-family: "Space Grotesk", sans-serif;
    font-size: 1rem;
    letter-spacing: -0.035em;
}

.template-page .related-price {
    margin-top: 12px;
    color: var(--detail-orange);
    font-size: 0.76rem;
    font-weight: 700;
}

.template-page .state-card {
    margin-top: 25px;
    padding: 85px 28px;
    border: 1px solid var(--detail-line);
    border-radius: 20px;
    text-align: center;
    background: rgba(255, 255, 255, 0.65);
}

.template-page .state-card h1 {
    margin: 0;
    font-family: "Space Grotesk", sans-serif;
    font-size: 2rem;
    letter-spacing: -0.05em;
}

.template-page .state-card p {
    max-width: 560px;
    margin: 11px auto 0;
    color: #737479;
    font-size: 0.72rem;
    line-height: 1.7;
}

.template-page .state-card .back-link {
    margin-top: 22px;
    padding: 12px 16px;
    border-radius: 9px;
    color: #ffffff;
    background: var(--detail-ink);
}


/*
|--------------------------------------------------------------------------
| Product detail structural columns
|--------------------------------------------------------------------------
| Keep the preview/content and checkout/details as independent columns on
| desktop so a tall PayPal card cannot create a dead row beneath the preview.
| On tablet/mobile, display: contents restores the intended reading order:
| preview -> checkout -> product information -> details/resources.
|--------------------------------------------------------------------------
*/

.template-page .product-column {
    min-width: 0;
}

.template-page .product-column-secondary .product-summary {
    position: static;
}

.template-page .product-content-stack {
    margin-top: 24px;
}

@media (max-width: 1050px) {
    .template-page .product-layout {
        display: flex;
        flex-direction: column;
        gap: 24px;
    }

    .template-page .product-column {
        display: contents;
    }

    .template-page .preview-card {
        order: 1;
    }

    .template-page .product-summary {
        order: 2;
    }

    .template-page .product-content-stack-primary {
        order: 3;
    }

    .template-page .product-content-stack-secondary {
        order: 4;
    }

    .template-page .product-content-stack {
        margin-top: 0;
    }
}

@media (max-width: 1050px) {
    .template-page .product-layout,
    .template-page .content-grid {
        grid-template-columns: 1fr;
    }

    .template-page .product-summary {
        position: static;
    }
}

@media (max-width: 760px) {
    .template-page .template-shell {
        width: min(calc(100% - 30px), 1380px);
    }

    .template-page .related-grid {
        grid-template-columns: 1fr;
    }

    .template-page .related-heading {
        align-items: start;
        flex-direction: column;
    }
}

@media (max-width: 440px) {

    .template-page .product-summary,
    .template-page .card-header,
    .template-page .card-body {
        padding-inline: 18px;
    }
}
