/* Product page. Values come from store.css tokens; structure from the three shots named in product.php. */

.pd { padding-top: 24px; }
.pd-grid { display: grid; gap: 32px; }
/* Design Monks shot: photo and info split half and half; 32px seam on tablet, 48px on desktop */
@media (min-width: 768px) {
    .pd-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start; }
    .pd-thumbs { gap: 8px; }
}
@media (min-width: 1024px) {
    .pd { padding-top: 32px; }
    .pd-grid { gap: 48px; }
    .pd-thumbs { gap: 12px; }
    .pd-info { position: sticky; top: 96px; }
}

/* Gallery: square photo, five equal thumbnails on its width */
.pd-gallery { display: grid; gap: 12px; }
.pd-main { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 16px; background: var(--n-50); }
.pd-main img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.pd-badge { position: absolute; z-index: 1; top: 16px; right: 16px; padding: 4px 12px; border-radius: 9999px; background: var(--accent-600); color: #fff; font-size: 13px; font-weight: 500; }
.pd-thumbs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.product-thumbnail { aspect-ratio: 1 / 0.84; overflow: hidden; border-radius: 8px; background: var(--n-50); outline: 1px solid var(--n-100); outline-offset: -1px; transition: outline-color 150ms ease-out; }
.product-thumbnail img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }
.product-thumbnail[aria-current="true"] { outline: 2px solid var(--n-950); outline-offset: -2px; }

/* Info */
.pd-info { display: grid; gap: 24px; align-content: start; }
.pd-head { display: grid; justify-items: start; gap: 12px; }
.pd-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pd-chip { padding: 4px 12px; border-radius: 9999px; background: var(--n-50); color: var(--n-900); font-size: 13px; font-weight: 500; transition: background-color 150ms ease-out; }
.pd-chip-dark { background: var(--n-950); color: var(--n-0); }
.store .pd-title { font-size: clamp(32px, 3.6vw, 56px) !important; font-weight: 500; letter-spacing: -0.03em; line-height: 1.08; text-wrap: balance; }
.pd-rating { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--n-500); transition: color 150ms ease-out; }
.pd-price-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; }
.pd-price { font-size: 24px; font-weight: 500; font-variant-numeric: tabular-nums; }
.pd-was { font-size: 16px; color: var(--n-500); }
.pd-desc { font-size: 16px; line-height: 1.5; color: var(--n-700); max-width: 60ch; }
.pd-stock { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--n-900); }
.pd-stock span { width: 8px; height: 8px; border-radius: 9999px; background: #16A34A; }
.pd-stock.is-out span { background: var(--n-400); }

/* Options panel: colour dots over size pills, a hairline between */
.pd-panel { display: grid; gap: 24px; padding: 24px; border-radius: 16px; background: var(--n-50); }
.pd-panel .pd-option + .pd-option { padding-top: 24px; border-top: 1px solid var(--n-100); }
@media (min-width: 768px) { .pd-panel { padding: 32px; } }
.pd-option { border: 0; padding: 0; margin: 0; min-width: 0; }
.pd-option legend { float: left; width: 100%; margin-bottom: 12px; font-size: 14px; font-weight: 500; color: var(--n-900); }
.pd-option legend + * { clear: both; }
.pd-picked { margin-left: 8px; font-weight: 400; color: var(--n-500); }
.pd-sizes { display: flex; flex-wrap: wrap; gap: 8px; }
.pd-size input, .pd-swatch input, .pd-stars-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pd-size span {
    display: grid; place-items: center; min-width: 56px; min-height: 44px; padding: 8px 16px; border-radius: 9999px; cursor: pointer;
    background: var(--n-0); box-shadow: inset 0 0 0 1px var(--n-100); color: var(--n-700); font-size: 14px; font-weight: 500;
    transition: box-shadow 150ms ease-out, color 150ms ease-out;
}
.pd-size input:checked + span { box-shadow: inset 0 0 0 2px var(--n-950); color: var(--n-950); }
.pd-size input:focus-visible + span, .pd-swatch input:focus-visible + span, .pd-stars-input input:focus-visible + svg { outline: 2px solid var(--accent-600); outline-offset: 2px; }
.pd-swatches { display: flex; flex-wrap: wrap; gap: 4px; margin-left: -6px; }
.pd-swatch { display: grid; place-items: center; width: 44px; height: 44px; cursor: pointer; }
.pd-swatch span { width: 32px; height: 32px; border-radius: 9999px; box-shadow: inset 0 0 0 1px oklch(0 0 0 / 0.12); transition: box-shadow 150ms ease-out; }
.pd-swatch input:checked + span { box-shadow: inset 0 0 0 1px oklch(0 0 0 / 0.12), 0 0 0 2px var(--n-50), 0 0 0 4px var(--n-950); }

/* Buy row: quantity stepper beside the button, buy now after them */
.pd-buy { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; }
.pd-qty { display: inline-flex; align-items: center; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--n-100); }
.pd-qty button { width: 44px; height: 48px; display: grid; place-items: center; color: var(--n-700); border-radius: 8px; transition: color 150ms ease-out; }
.pd-qty button:disabled { opacity: 0.4; }
.pd-qty svg { width: 16px; height: 16px; }
.pd-qty input { width: 32px; border: 0; background: transparent; text-align: center; font-size: 16px; font-weight: 500; font-variant-numeric: tabular-nums; appearance: textfield; -moz-appearance: textfield; }
.pd-qty input::-webkit-inner-spin-button, .pd-qty input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.pd-qty input:focus { outline: none; }
.pd-add:disabled { background: var(--n-100); color: var(--n-500); cursor: not-allowed; }
.pd-now {
    grid-column: 1 / -1; min-height: 48px; padding: 12px 24px; border-radius: 8px; background: var(--n-950); color: var(--n-0);
    font-size: 16px; font-weight: 500; transition-property: background-color, scale; transition-duration: 150ms; transition-timing-function: ease-out;
}
.pd-now:active { scale: 0.96; }

/* Fact rows with an icon each */
.pd-facts { display: grid; gap: 12px; }
.pd-facts li { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--n-700); }
.pd-facts strong { font-weight: 500; color: var(--n-900); }
.pd-facts svg { width: 20px; height: 20px; flex: none; color: var(--n-900); }

/* Accordions: closed rows on hairlines */
.pd-acc { border-top: 1px solid var(--n-100); }
.pd-acc details { border-bottom: 1px solid var(--n-100); }
.pd-acc summary {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; cursor: pointer; list-style: none;
    font-size: 16px; font-weight: 500; color: var(--n-900);
}
.pd-acc summary::-webkit-details-marker { display: none; }
.pd-acc summary::after {
    content: ''; width: 10px; height: 10px; margin-right: 4px; flex: none;
    border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-3px) rotate(45deg);
    transition: transform 200ms var(--ease);
}
.pd-acc details[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.pd-acc details > p { padding-bottom: 24px; font-size: 14px; line-height: 1.6; color: var(--n-700); max-width: 60ch; }
.pd-acc summary:focus-visible { outline: 2px solid var(--accent-600); outline-offset: 2px; border-radius: 4px; }
.pd-specs { display: grid; padding-bottom: 16px; }
.pd-specs div { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 16px; padding-block: 8px; font-size: 14px; }
.pd-specs dt { color: var(--n-500); }
.pd-specs dd { color: var(--n-900); }

/* Reviews: summary row, then grey cards (avatar top, review large, name and details at the foot), then the form */
.pd-reviews { display: grid; gap: 48px; }
.pd-reviews-side { display: grid; gap: 24px; }
@media (min-width: 1024px) { .pd-reviews-side { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: end; } }
.pd-score { display: flex; align-items: center; gap: 16px; }
.pd-score-num { font-size: 64px; font-weight: 500; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.pd-score p { margin-top: 4px; font-size: 14px; color: var(--n-500); }
.pd-reviews-side .pd-score { grid-row: 2; }
.pd-bars { display: grid; gap: 8px; width: 100%; }
@media (min-width: 1024px) { .pd-bars { grid-column: 2; grid-row: 1 / 3; } }
.pd-bars li { display: grid; grid-template-columns: 48px minmax(0, 1fr) 24px; align-items: center; gap: 12px; font-size: 14px; color: var(--n-500); font-variant-numeric: tabular-nums; }
.pd-bar { height: 4px; border-radius: 9999px; background: var(--n-100); overflow: hidden; }
.pd-bar span { display: block; height: 100%; border-radius: inherit; background: var(--n-950); }
.pd-bar-count { text-align: right; }

.pd-reviews-main { display: grid; gap: 48px; }
.pd-empty { font-size: 16px; color: var(--n-500); }
.pd-review-list { display: grid; gap: 24px; }
@media (min-width: 768px) { .pd-review-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .pd-review-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pd-review { display: grid; grid-template-rows: auto 1fr auto; gap: 24px; padding: 24px; border-radius: 16px; background: var(--n-50); }
@media (min-width: 768px) { .pd-review { padding: 32px; } }
.pd-avatar { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 9999px; background: var(--n-950); color: var(--n-0); font-size: 24px; font-weight: 500; }
.pd-review-text { font-size: 18px; line-height: 1.6; color: var(--n-900); }
.pd-review-foot h3 { font-size: 20px; font-weight: 500; letter-spacing: -0.01em; }
.pd-review-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 4px; font-size: 13px; color: var(--n-500); }
.pd-verified { color: #15803D; }

.pd-form { padding: 24px; border-radius: 16px; background: var(--n-50); }
@media (min-width: 768px) { .pd-form { padding: 32px; } }
.pd-form h3 { margin-bottom: 24px; font-size: 24px; font-weight: 500; letter-spacing: -0.02em; }
.pd-form form { display: grid; gap: 16px; }
.pd-form .field input, .pd-form .field textarea { background: var(--n-0); padding-right: 16px; }
.pd-form .field textarea {
    width: 100%; min-height: 120px; padding: 12px 16px; border: 0; border-radius: 8px; resize: vertical;
    color: var(--n-900); font-size: 16px; line-height: 1.5; transition: box-shadow 150ms ease-out;
}
.pd-form .field textarea:focus { outline: none; box-shadow: 0 0 0 2px var(--accent-600); }
.pd-form .btn { justify-self: start; }
.pd-fields { display: grid; gap: 16px; }
@media (min-width: 768px) { .pd-fields { grid-template-columns: 1fr 1fr; } }
.pd-label { display: grid; gap: 8px; font-size: 14px; font-weight: 500; }
.pd-stars-input { border: 0; padding: 0; margin: 0; }
.pd-stars-input legend { margin-bottom: 8px; font-size: 14px; font-weight: 500; }
/* Reversed DOM (5 to 1) so ~ lights every lower star; flex row-reverse shows them 1 to 5. -6px puts the first star's ink on the edge. */
.pd-stars-input div { display: inline-flex; flex-direction: row-reverse; gap: 4px; margin-left: -6px; }
.pd-stars-input label { cursor: pointer; display: grid; place-items: center; width: 44px; height: 44px; }
.pd-stars-input svg { width: 32px; height: 32px; color: var(--n-100); border-radius: 4px; transition: color 150ms ease-out; }
.pd-stars-input input:checked + svg,
.pd-stars-input label:has(input:checked) ~ label svg { color: #FACC15; }
.pd-form-message { font-size: 14px; font-weight: 500; color: #15803D; }
.pd-form-message.is-error { color: var(--accent-700); }

.pd-related { padding-bottom: var(--section); }
.pd-missing { padding-block: 96px; display: grid; justify-items: start; gap: 16px; }
.pd-missing p { font-size: 16px; line-height: 1.5; color: var(--n-700); max-width: 48ch; }
.store > section:last-child { padding-bottom: var(--section); }

@media (hover: hover) and (pointer: fine) {
    .product-thumbnail:hover { outline-color: var(--n-400); }
    .product-thumbnail[aria-current="true"]:hover { outline-color: var(--n-950); }
    .pd-chip-dark:hover { background: var(--n-700); }
    .pd-rating:hover { color: var(--n-900); }
    .pd-size input:not(:checked) + span:hover { box-shadow: inset 0 0 0 1px var(--n-400); color: var(--n-900); }
    .pd-qty button:not(:disabled):hover { color: var(--accent-600); }
    .pd-now:hover { background: var(--n-700); }
    .pd-acc summary:hover { color: var(--accent-600); }
    .pd-stars-input div:hover svg { color: var(--n-100); }
    .pd-stars-input label:hover svg, .pd-stars-input label:hover ~ label svg { color: #FACC15; }
}
@media (prefers-reduced-motion: reduce) {
    .pd-acc summary::after { transition: none; }
}
