/* PambaKali - product page: gallery, buy box and details */

.product-page {
    padding-top: 1.25rem;
}

.product-page .breadcrumb {
    margin-bottom: 1.25rem;
}

.product-layout {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: clamp(24px, 4vw, 56px);
    align-items: start;
}

/* ============================================ */
/* GALLERY */
/* ============================================ */
.gallery {
    position: sticky;
    top: 96px;
}

.gallery-main {
    position: relative;
    aspect-ratio: 4 / 5;
    border-radius: var(--radius-lg);
    background: var(--surface-alt);
    overflow: hidden;
}

.gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.25s;
}

.gallery-main img.switching {
    opacity: 0;
}

.gallery-main .product-tags {
    top: 1rem;
    left: 1rem;
}

.gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.6rem;
    margin-top: 0.75rem;
}

.gallery-thumb {
    aspect-ratio: 1;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 14px;
    background: var(--surface-alt);
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s, opacity 0.2s;
    opacity: 0.65;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-thumb:hover,
.gallery-thumb.active {
    opacity: 1;
}

.gallery-thumb.active {
    border-color: var(--brand);
}

/* ============================================ */
/* BUY BOX */
/* ============================================ */
.buy-box > .shop-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.35rem 0.9rem 0.35rem 0.35rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.2s;
}

.shop-pill:hover {
    border-color: var(--brand);
}

.shop-pill .mini-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--brand-gradient);
    color: white;
    display: grid;
    place-items: center;
    font-size: 0.7rem;
    font-weight: 700;
}

.shop-pill small {
    color: var(--muted);
    font-weight: 500;
}

.buy-box h1 {
    margin: 1rem 0 0.6rem;
    font-family: var(--font-display);
    font-size: clamp(2rem, 3.6vw, 2.8rem);
    font-weight: 600;
    line-height: 1.08;
    letter-spacing: -0.025em;
}

.buy-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 1rem;
    color: var(--ink-soft);
    font-size: 0.9rem;
}

.buy-meta .stars {
    font-size: 0.95rem;
}

.buy-meta .dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--line);
}

.price-block {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.4rem 0.85rem;
    margin: 1.5rem 0 0.4rem;
}

.price-block .price {
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.price-block s {
    color: var(--muted);
    font-size: 1.1rem;
}

.price-block .save {
    align-self: center;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    background: rgba(229, 72, 77, 0.12);
    color: var(--danger);
    font-size: 0.8rem;
    font-weight: 700;
}

.save-note {
    color: var(--success);
    font-size: 0.85rem;
    font-weight: 600;
}

.buy-description {
    margin: 1.5rem 0;
    padding: 1.5rem 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    color: var(--ink-soft);
    line-height: 1.75;
}

.stock {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 1rem;
    font-size: 0.88rem;
    font-weight: 600;
}

.stock::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 18%, transparent);
}

.stock.in { color: var(--success); }
.stock.low { color: var(--kids); }
.stock.out { color: var(--danger); }

.buy-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.qty {
    display: inline-flex;
    align-items: center;
    height: 54px;
    padding: 4px;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
}

.qty button {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: var(--surface-alt);
    color: var(--ink);
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.qty button:hover {
    background: var(--brand);
    color: white;
}

.qty input {
    width: 48px;
    border: none;
    background: none;
    color: var(--ink);
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    text-align: center;
    -moz-appearance: textfield;
}

.qty input::-webkit-outer-spin-button,
.qty input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

.qty input:focus {
    outline: none;
}

.btn-buy {
    flex: 1;
    min-width: 200px;
    height: 54px;
    font-size: 1rem;
}

.btn-heart {
    width: 54px;
    height: 54px;
    flex-shrink: 0;
    border: 1.5px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    color: var(--ink);
    font-size: 1.15rem;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.btn-heart:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-heart.active {
    border-color: var(--accent);
    background: var(--accent);
    color: white;
}

.buy-perks {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.buy-perks div {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem;
    border-radius: 14px;
    background: var(--surface-alt);
    color: var(--ink-soft);
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.3;
}

.buy-perks i {
    color: var(--brand);
    font-size: 1rem;
}

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

.details-table th,
.details-table td {
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.details-table th {
    width: 40%;
    color: var(--muted);
    font-weight: 600;
}

.details-table a {
    color: var(--brand);
    font-weight: 600;
    text-decoration: none;
}

@media (max-width: 991px) {
    .product-layout { grid-template-columns: 1fr; }
    .gallery { position: static; }
}

@media (max-width: 767px) {
    .product-page { padding-top: 0.75rem; }
    .gallery-main { border-radius: 22px; }
    .buy-perks { grid-template-columns: 1fr; }
    .btn-buy { min-width: 0; }
}

.btn-share:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.buy-meta a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ============================================ */
/* REVIEWS */
/* ============================================ */
.reviews-layout {
    display: grid;
    grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
    gap: clamp(20px, 3vw, 36px);
    align-items: start;
}

.reviews-summary {
    position: sticky;
    top: 100px;
    padding: 1.4rem;
}

.reviews-score {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.1rem;
}

.reviews-score strong {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 600;
    line-height: 1;
}

.reviews-score div {
    display: grid;
    gap: 0.2rem;
    color: var(--muted);
    font-size: 0.86rem;
}

.reviews-score .stars,
.review .stars {
    color: #f5a524;
    letter-spacing: 2px;
}

.reviews-bars {
    display: grid;
    gap: 0.45rem;
    margin: 0 0 1.25rem;
    padding: 0;
    list-style: none;
    font-size: 0.82rem;
}

.reviews-bars li {
    display: grid;
    grid-template-columns: 36px 1fr 36px;
    align-items: center;
    gap: 0.6rem;
    color: var(--ink-soft);
}

.reviews-bars li i {
    color: #f5a524;
    font-size: 0.7rem;
}

.reviews-bars li > span:last-child {
    color: var(--muted);
    text-align: right;
}

.reviews-bars .bar {
    height: 8px;
    border-radius: 999px;
    background: var(--surface-alt);
    overflow: hidden;
}

.reviews-bars .bar span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: #f5a524;
}

.review-write {
    padding-top: 1.1rem;
    border-top: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: 0.9rem;
    scroll-margin-top: 110px;
}

.review-write a {
    color: var(--brand);
    font-weight: 700;
}

.review-write .fa-circle-check {
    color: var(--success);
}

.review-form {
    display: grid;
    gap: 0.75rem;
}

.review-form textarea {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    background: var(--surface-alt);
    color: var(--ink);
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
}

.review-form textarea:focus {
    outline: none;
    border-color: var(--brand);
}

/* Stars: radios in reverse order so hovering a star lights it and the ones before it */
.star-input {
    display: inline-flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 0.2rem;
}

.star-input input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.star-input label {
    color: var(--line);
    font-size: 1.7rem;
    cursor: pointer;
    transition: color 0.15s, transform 0.15s;
}

.star-input label:hover,
.star-input label:hover ~ label,
.star-input input:checked ~ label {
    color: #f5a524;
}

.star-input input:focus-visible + label {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 4px;
}

.reviews-list {
    display: grid;
    gap: 0.9rem;
    min-width: 0;
}

.review {
    padding: 1.1rem 1.25rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.review header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.review header > div {
    flex: 1;
    min-width: 0;
}

.review header strong {
    display: block;
}

.review-avatar {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--brand-light);
    color: var(--brand);
    display: grid;
    place-items: center;
    font-weight: 800;
}

.review-verified {
    color: var(--success);
    font-size: 0.76rem;
    font-weight: 600;
}

.review p {
    margin: 0 0 0.4rem;
    color: var(--ink-soft);
    overflow-wrap: anywhere;
}

.review time {
    color: var(--muted);
    font-size: 0.78rem;
}

.reviews-more {
    justify-self: center;
}

.empty-state.compact {
    padding: 2rem 1rem;
}

@media (max-width: 860px) {
    .reviews-layout { grid-template-columns: 1fr; }
    .reviews-summary { position: static; }
}

/* ============================================ */
/* SIZE AND COLOUR */
/* ============================================ */
.buy-options {
    display: grid;
    gap: 1rem;
    margin: 0 0 1.25rem;
    scroll-margin-top: 120px;
}

.option-group {
    margin: 0;
    padding: 0;
    border: 0;
}

.option-group legend {
    margin-bottom: 0.5rem;
    padding: 0;
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 700;
}

.option-chosen {
    color: var(--muted);
    font-weight: 500;
}

.option-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.option-chip {
    position: relative;
    cursor: pointer;
}

.option-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.option-chip span {
    display: inline-grid;
    place-items: center;
    min-width: 48px;
    height: 42px;
    padding: 0 0.9rem;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink);
    font-size: 0.88rem;
    font-weight: 600;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.option-chip:hover span {
    border-color: var(--brand);
}

.option-chip input:checked + span {
    border-color: var(--brand);
    background: var(--brand);
    color: white;
}

.option-chip input:focus-visible + span {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* A size that is sold out: crossed out and not selectable (the title says "Sold out") */
.option-chip.is-out span {
    border-style: dashed;
    color: var(--ink-soft);
    text-decoration: line-through;
    opacity: 0.55;
    cursor: not-allowed;
}

.option-chip.is-out:hover span {
    border-color: var(--line);
}

.option-error {
    margin: 0;
    color: var(--danger);
    font-size: 0.86rem;
    font-weight: 600;
}

/* ============================================ */
/* QUESTIONS AND ANSWERS */
/* ============================================ */
.qa-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
    gap: clamp(20px, 3vw, 36px);
    align-items: start;
}

.qa-list {
    display: grid;
    gap: 0.9rem;
    min-width: 0;
}

.qa-item {
    padding: 1rem 1.2rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.qa-question,
.qa-answer {
    display: flex;
    gap: 0.6rem;
    margin: 0 0 0.5rem;
    overflow-wrap: anywhere;
}

.qa-question {
    color: var(--ink);
    font-weight: 700;
}

.qa-answer {
    color: var(--ink-soft);
}

.qa-mark {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: var(--surface-alt);
    color: var(--ink);
    display: grid;
    place-items: center;
    font-size: 0.75rem;
    font-weight: 800;
}

.qa-mark.answer {
    background: var(--brand-light);
    color: var(--brand);
}

.qa-meta {
    color: var(--muted);
    font-size: 0.78rem;
}

.qa-ask {
    padding: 1.25rem;
}

.question-form {
    display: grid;
    gap: 0.6rem;
}

.question-form textarea {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    background: var(--surface-alt);
    color: var(--ink);
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
}

.question-form textarea:focus {
    outline: none;
    border-color: var(--brand);
}

.question-form .hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.78rem;
}

.question-form button {
    justify-self: start;
}

.qa-ask a {
    color: var(--brand);
    font-weight: 700;
}

@media (max-width: 860px) {
    .qa-layout { grid-template-columns: 1fr; }
    .qa-ask { order: -1; }
}

/* Quantity, add to cart, share and wishlist stay on one row (they wrap only on narrow phones) */
@media (min-width: 480px) {
    .buy-actions { flex-wrap: nowrap; }
    .buy-actions .btn-buy { flex: 1 1 auto; min-width: 0; }
}

/* Narrow phones: quantity, share and wishlist on top, the add button across the full width below */
@media (max-width: 479px) {
    .buy-actions .btn-buy { order: 1; flex: 1 1 100%; }
    .buy-actions .btn-share { margin-left: auto; }
}

.btn-buy { white-space: nowrap; }
