/*
 * TuniGamers product detail presentation.
 *
 * Business rules remain server-owned by ProductPurchasePresentation,
 * ProductRepository, the Bagisto product types and the cart endpoint. This
 * stylesheet only controls the active theme's responsive presentation.
 */

.tg-product-detail {
    max-width: 1440px;
    padding-inline: clamp(1rem, 3vw, 2.5rem);
}

.tg-product-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(430px, .92fr);
    align-items: start;
    gap: clamp(1.25rem, 2.4vw, 2.25rem);
    overflow: visible;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.tg-product-hero::before {
    display: none;
}

.tg-product-gallery-shell {
    min-width: 0;
    align-self: start;
    padding: clamp(.75rem, 1.5vw, 1.25rem);
    border: 1px solid var(--tg-border);
    border-radius: 20px;
    background:
        radial-gradient(circle at 50% 15%, rgb(124 58 237 / 7%), transparent 38%),
        var(--tg-bg-card);
    box-shadow: 0 18px 48px rgb(15 23 42 / 7%);
    overflow: hidden;
}

.tg-product-gallery-shell > .flex {
    align-items: flex-start;
}

.tg-product-gallery-shell img[role="button"],
.tg-crawlable-product-summary .tg-product-gallery-shell > img {
    width: 100%;
    object-fit: contain;
    background: transparent;
}

.tg-product-gallery-shell img[role="button"] {
    max-height: min(590px, 66vh);
}

.tg-product-buybox {
    position: relative;
    z-index: 1;
    display: grid;
    gap: .72rem;
    min-width: 0;
    padding: clamp(1rem, 1.7vw, 1.5rem);
    border: 1px solid var(--tg-border);
    border-radius: 20px;
    background: var(--tg-bg-card);
    box-shadow: 0 18px 48px rgb(15 23 42 / 8%);
}

.tg-info-header {
    gap: .45rem;
    margin: 0;
}

.tg-type-badge,
.tg-platform-badge,
.tg-region-badge {
    min-height: 30px;
    padding: .36rem .72rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 750;
    line-height: 1.1;
}

.tg-platform-badge img,
.tg-region-badge img {
    width: 16px;
    height: 16px;
}

.tg-product-name {
    margin: 0;
    font-size: clamp(1.4rem, 1.85vw, 1.95rem);
    line-height: 1.2;
    letter-spacing: -.025em;
    text-wrap: balance;
}

.tg-rating-row {
    width: fit-content;
    margin: -.15rem 0;
}

.tg-price-block {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .5rem 1rem;
    margin: 0;
    padding: .75rem .9rem;
    border: 1px solid color-mix(in srgb, var(--tg-accent-green) 23%, var(--tg-border));
    border-radius: 14px;
    background: color-mix(in srgb, var(--tg-accent-green) 5%, var(--tg-bg-secondary));
}

.tg-price-row {
    margin: 0;
}

.tg-price-block .price-label,
.tg-price-block .final-price {
    font-size: clamp(1.4rem, 1.75vw, 1.85rem);
}

.tg-stock-state {
    display: inline-flex;
    align-items: center;
    gap: .42rem;
    margin: 0;
    font-size: .8rem;
    font-weight: 750;
}

.tg-stock-state > span {
    width: .48rem;
    height: .48rem;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 15%, transparent);
}

.tg-stock-state--available {
    color: var(--tg-accent-green);
}

.tg-stock-state--unavailable {
    color: var(--tg-text-muted);
}

.tg-tax-note {
    flex-basis: 100%;
    margin: -.2rem 0 0;
}

.tg-short-desc {
    display: -webkit-box;
    max-width: 65ch;
    margin: 0;
    overflow: hidden;
    color: var(--tg-text-secondary);
    font-size: .9rem;
    line-height: 1.55;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.tg-short-desc :is(p, ul, ol) {
    margin: 0;
}

.tg-purchase-summary {
    padding: .78rem;
    border: 1px solid var(--tg-border);
    border-radius: 14px;
    background: var(--tg-bg-secondary);
}

.tg-purchase-summary-title {
    margin: 0 0 .65rem;
    color: var(--tg-text-primary);
    font-size: .82rem;
    font-weight: 800;
    letter-spacing: .01em;
}

.tg-purchase-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .55rem;
    margin: 0;
    padding: 0;
}

.tg-purchase-fact {
    min-width: 0;
    padding: .55rem .62rem;
    border: 1px solid var(--tg-border);
    border-radius: 10px;
    background: var(--tg-bg-card);
}

.tg-purchase-fact-label,
.tg-purchase-fact-value {
    display: block;
}

.tg-purchase-fact-label {
    margin-bottom: .18rem;
    color: var(--tg-text-muted);
    font-size: .68rem;
    font-weight: 700;
    line-height: 1.25;
    text-transform: uppercase;
    letter-spacing: .035em;
}

.tg-purchase-fact-value {
    color: var(--tg-text-primary);
    font-size: .82rem;
    font-weight: 750;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.tg-secondary-facts {
    margin-top: .55rem;
}

.tg-secondary-facts > summary,
.tg-purchase-guidance > summary {
    display: flex;
    align-items: center;
    gap: .45rem;
    width: fit-content;
    cursor: pointer;
    color: var(--tg-accent-blue);
    font-size: .78rem;
    font-weight: 750;
    list-style: none;
}

.tg-secondary-facts > summary::-webkit-details-marker,
.tg-purchase-guidance > summary::-webkit-details-marker {
    display: none;
}

.tg-secondary-facts > summary::after,
.tg-purchase-guidance > summary::after {
    content: "+";
    display: grid;
    width: 1.25rem;
    height: 1.25rem;
    place-items: center;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: .8rem;
}

.tg-secondary-facts[open] > summary::after,
.tg-purchase-guidance[open] > summary::after {
    content: "−";
}

.tg-purchase-facts--secondary {
    margin-top: .55rem;
}

.tg-action-row {
    display: grid;
    grid-template-columns: auto minmax(180px, 1fr);
    gap: .65rem;
    margin: 0;
}

.tg-action-row .tg-btn-cart,
.tg-btn-buy-now {
    min-height: 48px;
    border-radius: 12px;
    font-size: .92rem;
    font-weight: 800;
}

.tg-action-row .tg-btn-cart {
    box-shadow: 0 12px 28px rgb(109 40 217 / 20%);
}

.tg-btn-buy-now {
    margin-top: -.15rem;
}

.tg-secondary-actions {
    display: flex;
    min-height: 30px;
    justify-content: flex-end;
    margin-top: -.2rem;
}

.tg-secondary-actions:empty {
    display: none;
}

.tg-secondary-actions .tg-sec-action-btn {
    padding: .35rem .65rem;
    border-color: transparent;
    background: transparent;
}

.tg-critical-warnings,
.tg-purchase-guidance,
.tg-digital-delivery,
.tg-trust-row {
    margin-top: .15rem;
}

.tg-critical-warning {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    padding: .78rem .85rem;
    border: 1px solid rgb(245 158 11 / 35%);
    border-inline-start: 4px solid #f59e0b;
    border-radius: 11px;
    background: rgb(245 158 11 / 8%);
    color: var(--tg-text-primary);
    font-size: .78rem;
    font-weight: 650;
    line-height: 1.45;
}

.tg-critical-warning svg {
    flex: 0 0 auto;
    color: #d97706;
}

.tg-purchase-guidance {
    padding: .62rem .72rem;
    border: 1px solid var(--tg-border);
    border-radius: 11px;
}

.tg-purchase-guidance > summary {
    width: 100%;
    color: var(--tg-text-primary);
}

.tg-purchase-guidance > summary::after {
    margin-inline-start: auto;
}

.tg-purchase-warnings {
    display: grid;
    gap: .55rem;
    margin-top: .7rem;
}

.tg-purchase-warning {
    padding: .6rem .7rem;
    border: 0;
    border-radius: 9px;
    background: var(--tg-bg-secondary);
    color: var(--tg-text-secondary);
    font-size: .76rem;
    line-height: 1.5;
}

.tg-digital-delivery {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    padding: .62rem .72rem;
    border: 1px solid color-mix(in srgb, var(--tg-accent-blue) 22%, var(--tg-border));
    border-radius: 11px;
    background: color-mix(in srgb, var(--tg-accent-blue) 5%, var(--tg-bg-secondary));
}

.tg-delivery-icon {
    flex: 0 0 auto;
    color: var(--tg-accent-blue);
}

.tg-delivery-title {
    font-size: .78rem;
    font-weight: 800;
}

.tg-delivery-desc {
    font-size: .74rem;
    line-height: 1.45;
}

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

.tg-trust-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .38rem;
    min-width: 0;
    min-height: 38px;
    padding: .42rem;
    border: 1px solid var(--tg-border);
    border-radius: 10px;
    background: var(--tg-bg-secondary);
}

.tg-trust-item svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    color: var(--tg-accent-green);
}

.tg-trust-label {
    color: var(--tg-text-secondary);
    font-size: .68rem;
    font-weight: 700;
    line-height: 1.2;
}

.tg-details-panel {
    margin-top: clamp(1rem, 2.2vw, 1.65rem);
    padding: clamp(.85rem, 1.5vw, 1.15rem);
    border-radius: 16px;
}

.tg-details-title {
    margin: 0 0 .75rem;
    padding-bottom: .55rem;
    font-size: .78rem;
}

.tg-details-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .55rem;
}

.tg-detail-item {
    min-height: 0;
    padding: .62rem .68rem;
    border: 1px solid var(--tg-border);
    border-radius: 10px;
    background: var(--tg-bg-secondary);
}

.tg-detail-icon {
    display: none;
}

.tg-detail-item::before {
    display: none;
}

.tg-detail-item--wide {
    grid-column: 1 / -1;
}

.tg-detail-label {
    font-size: .62rem;
}

.tg-detail-value,
.tg-genre-tag,
.tg-lang-tag {
    font-size: .75rem;
}

.tg-tabs-section {
    margin-top: clamp(1.5rem, 3vw, 2.75rem);
}

.tg-tabs-nav {
    position: sticky;
    top: 68px;
    z-index: 8;
    display: flex;
    gap: .25rem;
    padding: .35rem;
    overflow-x: auto;
    border: 1px solid var(--tg-border);
    border-radius: 14px;
    background: color-mix(in srgb, var(--tg-bg-card) 97%, transparent);
    box-shadow: 0 8px 24px rgb(15 23 42 / 8%);
    backdrop-filter: blur(12px);
}

.tg-tab-btn {
    position: relative;
    min-height: 42px;
    flex: 0 0 auto;
    padding: .65rem .9rem;
    border-radius: 10px;
    font-size: .82rem;
}

.tg-tab-btn.tg-tab-active {
    color: #fff !important;
    background-color: #6d28d9 !important;
    background-image: var(--tg-gradient) !important;
    box-shadow: 0 6px 18px rgb(82 17 129 / 25%);
}

.tg-tab-panel {
    margin-top: .9rem;
}

.tg-tab-content-card,
.tg-activation-box,
.tg-sysreq-box {
    width: 100%;
    max-width: 1080px;
    margin-inline: auto;
    padding: clamp(1rem, 2.25vw, 1.75rem);
    border-radius: 18px;
}

.tg-editorial-copy {
    max-width: 1080px;
    color: var(--tg-text-secondary);
    font-size: .96rem;
    line-height: 1.78;
}

.tg-editorial-copy > * {
    max-width: 82ch;
}

.tg-editorial-copy h2,
.tg-editorial-copy h3,
.tg-editorial-copy h4 {
    margin: 1.65em 0 .65em;
    color: var(--tg-text-primary);
    line-height: 1.25;
    text-wrap: balance;
}

.tg-editorial-copy > h2:first-child {
    margin-top: 0;
    font-size: clamp(1.35rem, 2.3vw, 1.8rem);
}

.tg-editorial-copy p,
.tg-editorial-copy ul,
.tg-editorial-copy ol,
.tg-editorial-copy table {
    margin: 0 0 1rem;
}

.tg-editorial-copy ul,
.tg-editorial-copy ol {
    padding-inline-start: 1.35rem;
}

.tg-editorial-copy li + li {
    margin-top: .4rem;
}

.tg-editorial-copy a {
    color: var(--tg-accent-blue);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.tg-editorial-copy table,
.tg-info-table {
    width: 100%;
    overflow: hidden;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--tg-border);
    border-radius: 12px;
}

.tg-editorial-copy :is(th, td),
.tg-info-table :is(th, td) {
    padding: .75rem .85rem;
    border-bottom: 1px solid var(--tg-border);
    text-align: start;
    vertical-align: top;
}

.tg-editorial-copy tr:last-child :is(th, td),
.tg-info-table tr:last-child :is(th, td) {
    border-bottom: 0;
}

.tg-info-table th {
    width: 32%;
    color: var(--tg-text-muted);
    font-size: .78rem;
    font-weight: 750;
}

.tg-info-table td {
    color: var(--tg-text-primary);
    font-size: .84rem;
}

.tg-product-detail .tg-product-recommendations,
.tg-product-detail > section[aria-labelledby^="product-family"],
.tg-product-detail > section[aria-labelledby^="similar-products"] {
    width: 100%;
    max-width: none;
    margin-top: clamp(2rem, 4vw, 3.25rem);
    padding-inline: 0;
}

.tg-recommendation-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
}

.tg-recommendation-heading > div:first-child {
    max-width: 56rem;
}

.tg-recommendation-controls {
    display: flex;
    flex: 0 0 auto;
    gap: .5rem;
}

.tg-recommendation-control {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid var(--tg-border);
    border-radius: 999px;
    background: var(--tg-bg-card);
    color: var(--tg-text-primary);
    box-shadow: 0 6px 16px rgb(15 23 42 / 7%);
    cursor: pointer;
    transition: border-color .18s ease, color .18s ease, transform .18s ease;
}

.tg-recommendation-control:hover {
    border-color: var(--tg-accent-purple);
    color: var(--tg-accent-purple);
    transform: translateY(-1px);
}

[dir="rtl"] .tg-recommendation-control span {
    display: inline-block;
    transform: scaleX(-1);
}

.tg-recommendation-rail {
    display: grid;
    grid-auto-columns: calc((100% - 3rem) / 4);
    grid-auto-flow: column;
    gap: 1rem;
    margin-top: 1.25rem;
    padding: .15rem .15rem .5rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    scroll-behavior: smooth;
    overscroll-behavior-inline: contain;
}

.tg-recommendation-rail::-webkit-scrollbar {
    display: none;
}

.tg-recommendation-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--tg-border);
    border-radius: 16px;
    background: var(--tg-bg-card);
    box-shadow: 0 10px 28px rgb(15 23 42 / 7%);
    scroll-snap-align: start;
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.tg-recommendation-card:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--tg-accent-purple) 55%, var(--tg-border));
    box-shadow: 0 18px 34px rgb(15 23 42 / 12%);
}

.tg-recommendation-image {
    aspect-ratio: 4 / 3;
    width: 100%;
    object-fit: contain;
    background: var(--tg-bg-secondary);
}

.tg-recommendation-body {
    display: flex;
    min-height: 170px;
    flex-direction: column;
    padding: .9rem;
}

.tg-recommendation-title {
    display: -webkit-box;
    overflow: hidden;
    color: var(--tg-text-primary);
    font-size: .88rem;
    font-weight: 800;
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.tg-recommendation-facts {
    display: -webkit-box;
    margin-top: .45rem;
    overflow: hidden;
    color: var(--tg-text-muted);
    font-size: .7rem;
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.tg-recommendation-price {
    margin-top: auto;
    padding-top: .75rem;
}

.tg-recommendation-status {
    display: inline-flex;
    width: fit-content;
    margin-top: .55rem;
    padding: .28rem .55rem;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 750;
}

.tg-crawlable-product-summary .tg-product-gallery-shell {
    padding: clamp(.75rem, 1.5vw, 1.25rem);
}

.tg-crawlable-product-summary .tg-product-buybox {
    padding: clamp(1rem, 1.7vw, 1.5rem);
}

.tg-mobile-sticky-bar {
    display: none;
}

html.tg-product-page-active .tcai-greeting {
    display: none !important;
}

@media (max-width: 1279px) {
    .tg-product-hero {
        grid-template-columns: minmax(0, 1fr);
    }

    .tg-product-gallery-shell {
        width: min(100%, 680px);
        margin-inline: auto;
    }

    .tg-recommendation-rail {
        grid-auto-columns: calc((100% - 2rem) / 3);
    }
}

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

    .tg-recommendation-heading {
        align-items: center;
    }
}

@media (max-width: 768px) {
    .tg-product-detail {
        padding-inline: .85rem;
        padding-bottom: 4.5rem;
    }

    .tg-product-hero {
        gap: 1rem;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .tg-product-gallery-shell {
        width: calc(100% + 1.7rem);
        margin-inline: -.85rem;
        border-inline: 0;
        border-radius: 0 0 18px 18px;
    }

    .tg-product-mobile-media {
        aspect-ratio: 4 / 3;
        max-height: min(430px, 58vh);
        padding: .75rem;
        object-fit: contain;
        background: var(--tg-bg-secondary);
    }

    .tg-product-buybox {
        gap: .72rem;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .tg-product-name {
        font-size: clamp(1.35rem, 6vw, 1.7rem);
    }

    .tg-short-desc {
        -webkit-line-clamp: 2;
    }

    .tg-purchase-summary {
        padding: .75rem;
    }

    .tg-purchase-facts {
        gap: .45rem;
    }

    .tg-purchase-fact {
        padding: .55rem .6rem;
    }

    .tg-action-row {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .tg-trust-row {
        gap: .35rem;
    }

    .tg-trust-item {
        flex-direction: column;
        gap: .25rem;
        min-height: 58px;
        text-align: center;
    }

    .tg-details-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tg-tabs-nav {
        top: 58px;
        margin-inline: -.85rem;
        padding-inline: .85rem;
        border-inline: 0;
        border-radius: 0;
    }

    .tg-tab-content-card,
    .tg-activation-box,
    .tg-sysreq-box {
        padding: 1rem;
        border-radius: 14px;
    }

    .tg-editorial-copy {
        font-size: .9rem;
        line-height: 1.7;
    }

    .tg-recommendation-rail {
        grid-auto-columns: minmax(210px, 76%);
        margin-inline: -.85rem;
        padding-inline: .85rem;
    }

    .tg-recommendation-controls {
        display: none;
    }

    .tg-mobile-sticky-bar {
        position: fixed;
        right: 0;
        bottom: 56px;
        left: 0;
        z-index: 48;
        display: flex;
        align-items: center;
        gap: .75rem;
        min-height: 68px;
        padding: .65rem max(.85rem, env(safe-area-inset-right)) .65rem max(.85rem, env(safe-area-inset-left));
        border-top: 1px solid var(--tg-border);
        background: color-mix(in srgb, var(--tg-bg-card) 96%, transparent);
        box-shadow: 0 -12px 28px rgb(15 23 42 / 16%);
        opacity: 1;
        transform: translateY(0);
        backdrop-filter: blur(14px);
        transition: opacity .18s ease, transform .18s ease;
    }

    .tg-mobile-sticky-bar.is-concealed,
    html:not(.tg-product-sticky-visible) .tg-mobile-sticky-bar {
        pointer-events: none;
        visibility: hidden;
        opacity: 0;
        transform: translateY(110%);
    }

    .tg-mobile-sticky-price {
        min-width: 0;
        flex: 0 1 auto;
    }

    .tg-mobile-sticky-price .price-label,
    .tg-mobile-sticky-price .final-price {
        font-size: 1rem;
        white-space: nowrap;
    }

    .tg-mobile-sticky-bar .tg-btn-cart {
        min-height: 44px;
        flex: 1 1 180px;
        border-radius: 11px;
        font-size: .82rem;
    }

    html.tg-product-sticky-visible body {
        padding-bottom: 130px !important;
    }

    html.tg-product-sticky-visible .tcai-bubble-btn {
        bottom: 138px !important;
    }

    html.tg-product-sticky-visible .tcai-greeting {
        bottom: 200px !important;
    }
}

@media (max-width: 420px) {
    .tg-purchase-fact-label {
        font-size: .62rem;
    }

    .tg-purchase-fact-value {
        font-size: .76rem;
    }

    .tg-details-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .tg-trust-label {
        font-size: .62rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tg-recommendation-card,
    .tg-mobile-sticky-bar {
        transition: none;
    }
}
