/* Store pages: the store home, product pages, checkout results, receipts and the customer portal.
   Builds on ui.css; the store's brand color arrives as --pt-accent in an inline style. */

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--pt-bg);
    color: var(--pt-text);
    font: 400 1rem/1.6 var(--pt-font);
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}

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

.skip {
    position: absolute;
    left: -999px;
}

.skip:focus {
    left: 1rem;
    top: 1rem;
    z-index: 10;
}

.wrap {
    width: 100%;
    max-width: 72rem;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .wrap {
        padding: 0 1.5rem;
    }
}

/* ---------- Header and footer ---------- */

.store-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: color-mix(in oklab, var(--pt-bg) 82%, transparent);
    backdrop-filter: saturate(1.4) blur(14px);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
}

.store-header .wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    height: 4rem;
}

.store-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: -0.01em;
}

.store-brand img,
.store-brand .mark {
    width: 2rem;
    height: 2rem;
    border-radius: 0.625rem;
    object-fit: cover;
}

.store-brand .mark {
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 0.9375rem;
    background: linear-gradient(135deg, var(--pt-accent), color-mix(in oklab, var(--pt-accent) 55%, #ff7a59));
}

.store-header nav {
    margin-left: auto;
    display: flex;
    gap: 0.25rem;
}

.store-footer {
    margin-top: 5rem;
    padding: 2rem 0 3rem;
    color: var(--pt-text-3);
    font-size: 0.8125rem;
}

.store-footer .wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.store-footer a {
    text-decoration: none;
}

.store-footer a:hover {
    color: var(--pt-text);
}

.powered {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 999px;
    background: var(--pt-surface);
    box-shadow: 0 0 0 1px var(--pt-line), var(--pt-shadow-xs);
    color: var(--pt-text-2);
    font-weight: 500;
}

/* ---------- Banner ---------- */

/* A gradient that slowly drifts, with soft light blobs and a fine grain, so a banner with no
   image still feels alive. */
.banner {
    --from: var(--pt-accent);
    --to: #ff7a59;
    position: relative;
    overflow: hidden;
    border-radius: 1.75rem;
    background: linear-gradient(135deg, var(--from), var(--to));
    box-shadow: 0 30px 60px -30px color-mix(in oklab, var(--from) 60%, transparent), 0 0 0 1px rgba(0, 0, 0, 0.04);
    isolation: isolate;
}

.banner::before,
.banner::after {
    content: "";
    position: absolute;
    z-index: -1;
    width: 70%;
    aspect-ratio: 1;
    border-radius: 999px;
    filter: blur(60px);
    opacity: 0.65;
    animation: drift 18s ease-in-out infinite alternate;
}

.banner::before {
    top: -40%;
    left: -10%;
    background: color-mix(in oklab, var(--to) 70%, white);
}

.banner::after {
    bottom: -45%;
    right: -15%;
    background: color-mix(in oklab, var(--from) 60%, #22d3ee);
    animation-duration: 22s;
    animation-direction: alternate-reverse;
}

@keyframes drift {
    from {
        transform: translate(0, 0) scale(1);
    }
    to {
        transform: translate(18%, 12%) scale(1.15);
    }
}

.banner-grain {
    position: absolute;
    inset: 0;
    z-index: 0;
    opacity: 0.18;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    pointer-events: none;
}

.banner-media {
    position: relative;
    z-index: 1;
    width: 100%;
    aspect-ratio: 16 / 7;
    object-fit: cover;
}

.banner-title {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-height: 18rem;
    aspect-ratio: 16 / 7;
    padding: 2rem;
    text-align: center;
    color: #fff;
}

.banner-title span {
    font-size: clamp(2.25rem, 7vw, 5rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.04em;
    text-shadow: 0 2px 30px rgba(0, 0, 0, 0.18);
    text-wrap: balance;
}

.banner-title small {
    font-size: clamp(0.9375rem, 2vw, 1.125rem);
    font-weight: 500;
    opacity: 0.9;
    max-width: 36rem;
    text-wrap: balance;
}

.ribbon {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #111;
    font-size: 0.8125rem;
    font-weight: 600;
    box-shadow: 0 6px 20px -6px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
}

.ribbon .dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2);
    animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
    50% {
        box-shadow: 0 0 0 7px rgba(239, 68, 68, 0);
    }
}

@media (max-width: 640px) {
    .banner {
        border-radius: 1.25rem;
    }

    .banner-title {
        aspect-ratio: 4 / 3;
        min-height: 0;
    }
}

/* ---------- Product page ---------- */

.product {
    padding-top: 0.5rem;
}

.product-grid {
    display: grid;
    gap: 2.5rem;
    margin-top: 2.5rem;
}

@media (min-width: 900px) {
    .product-grid {
        grid-template-columns: minmax(0, 1fr) 24rem;
        gap: 3.5rem;
    }
}

.product-head {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.product-icon {
    width: 4.5rem;
    height: 4.5rem;
    flex-shrink: 0;
    border-radius: 1.25rem;
    object-fit: cover;
    box-shadow: var(--pt-shadow-md), 0 0 0 1px var(--pt-line);
}

.product-head h1 {
    margin: 0;
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    line-height: 1.1;
    letter-spacing: -0.03em;
    text-wrap: balance;
}

.product-head p {
    margin: 0.375rem 0 0;
    color: var(--pt-text-2);
    font-size: 1.0625rem;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

.prose {
    margin-top: 2rem;
    color: var(--pt-text);
    font-size: 1.0625rem;
    line-height: 1.7;
    max-width: 42rem;
}

.prose h2,
.prose h3,
.prose h4 {
    margin: 2rem 0 0.5rem;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.prose h2 {
    font-size: 1.5rem;
}

.prose h3 {
    font-size: 1.25rem;
}

.prose p,
.prose ul,
.prose ol {
    margin: 0 0 1rem;
}

.prose ul,
.prose ol {
    padding-left: 1.25rem;
}

.prose li {
    margin: 0.25rem 0;
}

.prose li::marker {
    color: var(--pt-accent);
}

.prose a {
    color: var(--pt-accent-text);
    text-underline-offset: 3px;
}

.prose code {
    font-family: var(--pt-font-mono);
    font-size: 0.875em;
    padding: 0.125rem 0.375rem;
    border-radius: 6px;
    background: var(--pt-surface-2);
}

/* The purchase card */
.buy {
    position: relative;
    padding: 1.5rem;
    border-radius: 1.5rem;
    background: var(--pt-surface);
    box-shadow: 0 0 0 1px var(--pt-line), var(--pt-shadow-lg);
}

@media (min-width: 900px) {
    .buy-col {
        position: sticky;
        top: 5.5rem;
        align-self: start;
        margin-top: -7rem;
    }
}

.price-row {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
}

.price {
    font-size: 2.5rem;
    font-weight: 750;
    line-height: 1;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
}

.price-interval {
    color: var(--pt-text-2);
    font-weight: 500;
}

.price-was {
    color: var(--pt-text-3);
    font-size: 1.125rem;
    text-decoration: line-through;
}

.sale-note {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.75rem;
    background: #fff1f2;
    color: #be123c;
    font-size: 0.875rem;
    font-weight: 600;
}

[data-theme="dark"] .sale-note {
    background: rgba(244, 63, 94, 0.14);
    color: #fda4af;
}

.meter {
    margin-top: 1rem;
    padding: 0.875rem 1rem;
    border-radius: 0.875rem;
    background: var(--pt-accent-soft);
    color: var(--pt-accent-text);
    font-size: 0.875rem;
}

.meter strong {
    font-weight: 700;
}

.meter-bar {
    height: 0.5rem;
    margin-top: 0.625rem;
    border-radius: 999px;
    background: color-mix(in oklab, var(--pt-accent) 18%, transparent);
    overflow: hidden;
}

.meter-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--pt-accent), color-mix(in oklab, var(--pt-accent) 50%, #ff7a59));
}

.buy-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.25rem;
}

.variants {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.variants .option-tile {
    justify-content: space-between;
}

.variants .option-tile .v-name {
    font-weight: 600;
    font-size: 0.9375rem;
}

.variants .option-tile .v-meta {
    display: block;
    font-size: 0.8125rem;
    opacity: 0.75;
}

.variants .option-tile .v-price {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.code-toggle {
    border: 0;
    background: none;
    padding: 0;
    color: var(--pt-text-2);
    font: 500 0.875rem var(--pt-font);
    text-align: left;
    cursor: pointer;
}

.code-toggle:hover {
    color: var(--pt-text);
}

.check-row {
    display: flex;
    gap: 0.625rem;
    align-items: flex-start;
    color: var(--pt-text-2);
    font-size: 0.875rem;
    cursor: pointer;
}

.pay {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-paypal {
    --btn-bg: #ffc439;
    --btn-fg: #111;
    --btn-hover: #f2b52a;

    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), var(--pt-shadow-sm);
}

.btn-paypal b {
    font-style: italic;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.btn-paypal b span {
    color: #009cde;
}

.btn-paypal b em {
    color: #003087;
    font-style: italic;
}

.trust {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem 1rem;
    margin-top: 1rem;
    color: var(--pt-text-3);
    font-size: 0.8125rem;
}

.trust span {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.trust svg {
    width: 0.875rem;
    height: 0.875rem;
}

.form-error {
    padding: 0.625rem 0.875rem;
    border-radius: 0.75rem;
    background: var(--pt-danger-soft);
    color: var(--pt-danger);
    font-size: 0.875rem;
    font-weight: 500;
}

.countdown {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-top: 1rem;
}

.countdown div {
    padding: 0.625rem 0;
    border-radius: 0.75rem;
    background: var(--pt-surface-2);
    text-align: center;
}

.countdown b {
    display: block;
    font-size: 1.375rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.countdown small {
    color: var(--pt-text-3);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ---------- Store home ---------- */

.store-hero {
    padding: 3.5rem 0 2.5rem;
    text-align: center;
}

.store-hero h1 {
    margin: 0;
    font-size: clamp(2.25rem, 6vw, 3.75rem);
    line-height: 1.05;
    letter-spacing: -0.04em;
    text-wrap: balance;
}

.store-hero p {
    max-width: 36rem;
    margin: 0.75rem auto 0;
    color: var(--pt-text-2);
    font-size: 1.125rem;
}

.cards {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
}

.product-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 1.25rem;
    background: var(--pt-surface);
    box-shadow: 0 0 0 1px var(--pt-line), var(--pt-shadow-sm);
    text-decoration: none;
    transition: transform 200ms var(--pt-ease), box-shadow 200ms var(--pt-ease);
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 0 1px var(--pt-line), var(--pt-shadow-lg);
}

.product-card .banner {
    border-radius: 0;
    box-shadow: none;
}

.product-card .banner-title {
    aspect-ratio: 16 / 9;
    min-height: 0;
}

.product-card .banner-title span {
    font-size: 1.75rem;
}

.product-card .banner-media {
    aspect-ratio: 16 / 9;
}

.product-card-body {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1rem 1.125rem 1.125rem;
}

.product-card-body h2 {
    margin: 0;
    font-size: 1.0625rem;
    letter-spacing: -0.01em;
}

.product-card-body p {
    margin: 0.125rem 0 0;
    color: var(--pt-text-2);
    font-size: 0.875rem;
    line-height: 1.45;
}

.product-card-price {
    flex-shrink: 0;
    text-align: right;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.product-card-price s {
    display: block;
    color: var(--pt-text-3);
    font-size: 0.8125rem;
    font-weight: 500;
}

/* ---------- Simple centered pages: receipts, checkout results, portal ---------- */

.center-page {
    max-width: 40rem;
    margin: 3rem auto 0;
    padding: 0 1rem;
}

.panel {
    padding: 2rem;
    border-radius: 1.5rem;
    background: var(--pt-surface);
    box-shadow: 0 0 0 1px var(--pt-line), var(--pt-shadow-md);
}

.panel h1 {
    margin: 0;
    font-size: 1.75rem;
    letter-spacing: -0.03em;
    line-height: 1.15;
}

.panel .lead {
    margin: 0.5rem 0 0;
    color: var(--pt-text-2);
}

.success-mark {
    display: grid;
    place-items: center;
    width: 3.5rem;
    height: 3.5rem;
    margin-bottom: 1.25rem;
    border-radius: 999px;
    background: var(--pt-success-soft);
    color: var(--pt-success);
}

.success-mark svg {
    width: 1.75rem;
    height: 1.75rem;
}

.list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    border-radius: 1rem;
    background: var(--pt-surface-2);
}

.item-main {
    flex: 1;
    min-width: 0;
}

.item-title {
    font-weight: 600;
    font-size: 0.9375rem;
}

.item-sub {
    color: var(--pt-text-2);
    font-size: 0.8125rem;
    overflow-wrap: anywhere;
}

.key {
    font-family: var(--pt-font-mono);
    font-size: 0.9375rem;
    letter-spacing: 0.02em;
    font-weight: 600;
}

.summary-table {
    width: 100%;
    margin-top: 1.5rem;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.summary-table td {
    padding: 0.375rem 0;
}

.summary-table td:last-child {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.summary-table tr.total td {
    padding-top: 0.75rem;
    border-top: 1px solid var(--pt-line);
    font-weight: 700;
}

.spinner {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 999px;
    border: 2px solid var(--pt-line-strong);
    border-right-color: var(--pt-accent);
    animation: pt-spin 0.8s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
    .banner::before,
    .banner::after,
    .ribbon .dot,
    .spinner {
        animation: none;
    }

    .product-card,
    .product-card:hover {
        transition: none;
        transform: none;
    }
}
