/* ============================================================================
   DC Kids — full product page (product.html). Builds on store.css. Class
   names are the ones product.js renders (sizes, thumbnails, reviews, related
   cards, cart drawer). Square edges, hairlines, Jost — the storefront look.
   ============================================================================ */

.product-page { min-height: 100vh; display: flex; flex-direction: column; }
.product-main { flex: 1 0 auto; width: 100%; max-width: var(--maxw); margin: 0 auto; padding: calc(var(--nav-h) + clamp(20px, 3vw, 40px)) var(--gutter) clamp(56px, 8vw, 110px); }

.product-skip-link { position: fixed; z-index: 200; top: 10px; left: 10px; padding: 10px 16px; background: var(--green); color: #fff; transform: translateY(-160%); }
.product-skip-link:focus { transform: none; }

.product-nav-save svg { width: 18px; height: 18px; }
.product-nav-save.is-active svg, .product-save.is-active svg { fill: var(--green); stroke: var(--green); }
.product-cart-count { font-weight: 500; }

/* ------------------------------------------------------- loading / error --- */
.product-state { min-height: 60vh; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 12px; }
/* While loading, the page holds a full screen, so the footer starts below the
   fold and the product taking its place moves nothing a shopper can see. At
   60vh the footer showed on a phone and jumped down when the product arrived. */
#productLoading { min-height: 100vh; min-height: 100svh; }
.product-state h1 { margin: 0; font-weight: 300; font-size: clamp(36px, 5vw, 64px); line-height: 1.05; }
.product-state p { margin: 0; color: var(--ink-soft); font-size: 17px; }
.product-state .btn { width: auto; margin-top: 12px; }
#productLoading { align-items: center; }
.product-spinner { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--green); animation: product-spin .9s linear infinite; }
@keyframes product-spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- hero ---- */
.product-hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 80px); align-items: start; }

.product-gallery { position: sticky; top: calc(var(--nav-h) + 20px); }
.product-gallery__main { position: relative; aspect-ratio: 4 / 5; background: var(--panel); display: grid; place-items: center; overflow: hidden; }
.product-gallery__main img { width: 100%; height: 100%; object-fit: cover; }
.product-thumbnails { display: flex; gap: 10px; margin-top: 12px; overflow-x: auto; }
.product-thumbnail { flex: 0 0 auto; width: 72px; height: 72px; padding: 0; background: var(--panel); border: 1px solid var(--line); cursor: pointer; transition: border-color .25s; }
.product-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.product-thumbnail.is-active, .product-thumbnail:hover { border-color: var(--green); }

.product-purchase { display: flex; flex-direction: column; padding-top: clamp(0px, 2vw, 24px); }
.product-breadcrumb { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--label); margin-bottom: 16px; }
.product-breadcrumb a { color: var(--label); transition: color .25s; }
.product-breadcrumb a:hover { color: var(--green); }
.product-purchase h1 { margin: 0; font-weight: 300; font-size: clamp(34px, 3.8vw, 54px); line-height: 1.05; letter-spacing: -0.015em; }
.product-rating-link { align-self: flex-start; display: inline-flex; align-items: center; gap: 10px; min-height: 44px; margin-top: 6px; padding: 0; font: inherit; font-size: 14px; color: var(--ink-soft); background: none; border: 0; cursor: pointer; }
.product-rating-link:hover { color: var(--green); }
.product-stars { color: #C8A13A; letter-spacing: 2px; }
.product-price { margin-top: 10px; font-size: 24px; color: var(--green); }
.product-price small { display: block; margin-top: 4px; font-size: 14px; color: var(--muted); }
.product-stock { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.product-stock.is-low { color: #8A5F00; } /* 5.4:1 on the page; #9A6B00 fell just short of 4.5 */
.product-stock.is-out { color: #B42318; }

.product-option-block { margin-top: 26px; }
.product-option-heading { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--label); }
.product-option-heading #selectedSizeText { letter-spacing: .04em; text-transform: none; font-size: 14px; color: var(--ink); }
.product-sizes { display: flex; flex-wrap: wrap; gap: 10px; }
.product-size-button { min-width: 56px; min-height: 44px; padding: 0 16px; font: inherit; font-size: 14px; color: var(--ink); background: none; border: 1px solid var(--line); cursor: pointer; transition: border-color .25s var(--ease), background .25s var(--ease), color .25s var(--ease); }
.product-size-button:hover { border-color: var(--ink); }
.product-size-button.is-active { background: var(--dark); border-color: var(--dark); color: #fff; }

.product-quantity { display: inline-flex; align-items: center; border: 1px solid var(--line); }
.product-quantity button { width: 46px; height: 46px; font-size: 18px; color: var(--ink); background: none; border: 0; cursor: pointer; }
.product-quantity input { width: 64px; height: 46px; font: inherit; font-size: 16px; text-align: center; color: var(--ink); background: none; border: 0; -moz-appearance: textfield; appearance: textfield; }
.product-quantity input::-webkit-outer-spin-button, .product-quantity input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.product-quantity input:focus { outline: none; }
.product-quantity:focus-within { border-color: var(--green); }
.product-quantity-hint { display: block; margin-top: 8px; font-size: 13px; color: var(--muted); }
.product-quantity-hint:empty { display: none; }

.product-add { margin-top: 28px; }
.product-ask { margin-top: 10px; }
.product-save {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 9px; min-height: 44px; margin-top: 10px; padding: 0;
  font: inherit; font-size: 15px; color: var(--green); background: none; border: 0; cursor: pointer;
}
.product-save svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.product-save span { border-bottom: 1px solid currentColor; padding-bottom: 1px; }

.product-assurances { list-style: none; margin: 22px 0 0; padding: 0; border-top: 1px solid var(--line); }
.product-assurances li { padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--ink-soft); }

/* ---------------------------------------------------------- information --- */
.product-information { margin-top: clamp(56px, 8vw, 110px); }
.product-info-row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: clamp(18px, 5vw, 72px);
  padding: clamp(28px, 4vw, 48px) 0; border-top: 1px solid var(--line); scroll-margin-top: calc(var(--nav-h) + 12px);
}
.product-info-row h2 { margin: 0; font-weight: 300; font-size: clamp(28px, 3vw, 40px); line-height: 1.1; }
#productDescription { margin: 0; color: var(--ink-soft); font-size: 17px; line-height: 1.7; white-space: pre-line; }
.product-detail-list { display: grid; grid-template-columns: max-content 1fr; margin: 0; border-top: 1px solid var(--line); }
.product-detail-list dt, .product-detail-list dd { padding: 13px 0; border-bottom: 1px solid var(--line); }
.product-detail-list dt { padding-right: 32px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--label); }
.product-detail-list dd { margin: 0; font-size: 15px; }

.product-reviews { display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr); gap: clamp(20px, 4vw, 48px); align-items: start; }
.product-review-summary { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.product-review-summary strong { font-weight: 300; font-size: 56px; line-height: 1; }
.product-review-summary #reviewCount { font-size: 14px; color: var(--muted); }
.product-text-button { margin-top: 10px; padding: 0 0 2px; font: inherit; font-size: 15px; color: var(--green); background: none; border: 0; border-bottom: 1px solid currentColor; cursor: pointer; }
.product-review-list { border-top: 1px solid var(--line); }
.product-review { padding: 18px 0; border-bottom: 1px solid var(--line); }
.product-review__header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.product-review__header strong { font-weight: 500; }
.product-review__header time { font-size: 13px; color: var(--muted); }
.product-review h3 { margin: 10px 0 4px; font-weight: 400; font-size: 17px; }
.product-review p { margin: 6px 0 0; color: var(--ink-soft); font-size: 15px; line-height: 1.6; }
.product-review-empty { margin: 0; padding: 18px 0; color: var(--muted); border-bottom: 1px solid var(--line); }

.product-review-form h3 { margin: 0 0 16px; font-weight: 300; font-size: 26px; }
.product-review-form__rating { margin-bottom: 18px; }
.product-review-form__rating > span { display: block; margin-bottom: 6px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--label); }
#reviewRatingButtons button { width: 44px; height: 44px; padding: 0; font-size: 26px; line-height: 1; color: #C8A13A; background: none; border: 0; cursor: pointer; }
.product-review-form__actions { display: flex; align-items: center; justify-content: flex-end; gap: 22px; }
.product-review-form__actions .product-text-button { margin-top: 0; }
.product-review-submit { width: auto; }
.product-form-message { margin: 14px 0 0; font-size: 14px; color: var(--muted); }
.product-form-message:empty { display: none; }
.product-form-message.is-error { color: #B42318; }
.product-form-message.is-success { color: var(--green); }

/* -------------------------------------------------------------- related --- */
.product-related { margin-top: clamp(40px, 6vw, 80px); }
.product-related__header { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 22px; }
.product-related__header h2 { margin: 0; font-weight: 300; font-size: clamp(30px, 3.6vw, 48px); }
.product-related__rail { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.product-related-card { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--bg); }
.product-related-card a { display: block; }
.product-related-card__image { aspect-ratio: 1 / 1; overflow: hidden; background: var(--panel); }
.product-related-card__image img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.1s var(--ease-slow); }
.product-related-card a:hover img { transform: scale(1.045); }
.product-related-card__body { padding: 16px 18px 20px; }
.product-related-card__body h3 { margin: 0; font-weight: 400; font-size: 16px; }
.product-related-card__body p { margin: 4px 0 0; font-size: 14px; color: var(--green); }

/* ----------------------------------------------------------- cart drawer --- */
.product-cart-overlay { position: fixed; inset: 0; z-index: 98; background: rgba(20,20,18,.34); opacity: 0; transition: opacity .3s var(--ease); }
.product-cart-overlay.is-open { opacity: 1; }
.product-cart-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 99; width: min(440px, 100vw);
  display: flex; flex-direction: column; background: var(--bg);
  transform: translateX(100%); visibility: hidden; transition: transform .5s var(--ease-slow), visibility 0s linear .5s;
}
.product-cart-drawer.is-open { transform: none; visibility: visible; transition: transform .5s var(--ease-slow), visibility 0s; }
.product-cart-drawer__header { display: flex; justify-content: space-between; align-items: center; padding: 18px 26px; border-bottom: 1px solid var(--line); }
.product-cart-drawer__header h2 { margin: 0; font-weight: 400; font-size: 18px; }
#closeProductCart { width: 44px; height: 44px; font-size: 24px; line-height: 1; color: var(--ink); background: none; border: 0; cursor: pointer; }
.product-cart-items { flex: 1; overflow-y: auto; padding: 4px 26px; }
.product-cart-empty { padding: 50px 0; text-align: center; color: var(--muted); }
.product-cart-item { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 6px 14px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.product-cart-item img { width: 64px; height: 64px; object-fit: cover; background: var(--panel); grid-row: span 2; }
.product-cart-item h3 { margin: 0; font-weight: 400; font-size: 15px; }
.product-cart-item p { margin: 2px 0 4px; font-size: 13px; color: var(--muted); }
.product-cart-item strong { font-weight: 500; font-size: 15px; }
.product-cart-item__controls { display: flex; align-items: center; gap: 4px; }
.product-cart-item__controls button { min-width: 36px; height: 36px; font: inherit; color: var(--ink); background: none; border: 1px solid var(--line); cursor: pointer; }
.product-cart-item__controls span { min-width: 30px; text-align: center; font-size: 15px; }
.product-cart-item__controls .product-cart-item__remove { margin-left: auto; border: 0; font-size: 13px; color: var(--muted); text-decoration: underline; }
.product-cart-drawer__footer { padding: 20px 26px calc(20px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.product-cart-subtotal { display: flex; justify-content: space-between; margin-bottom: 14px; font-size: 16px; }
.product-cart-subtotal strong { font-weight: 500; }
.product-cart-drawer__footer p { margin: 10px 0 0; font-size: 13px; color: var(--muted); text-align: center; }
#productCheckoutLink[aria-disabled="true"] { opacity: .5; pointer-events: none; }

/* --------------------------------------------------- toast + quick add ---- */
.product-toast { position: fixed; left: 50%; bottom: 28px; z-index: 200; max-width: 90vw; padding: 13px 22px; font-size: 14px; color: #fff; background: var(--dark); transform: translateX(-50%); }
.product-toast.is-error { background: #B42318; }
/* phones only: price + add to cart stay in reach while scrolling the page */
.product-mobile-buybar { display: none; }

/* ----------------------------------------------------------- responsive --- */
@media (max-width: 900px) {
  .product-hero { grid-template-columns: 1fr; }
  .product-gallery { position: static; }
  .product-related__rail { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .product-nav-save__label { display: none; }
  .product-info-row { grid-template-columns: 1fr; gap: 14px; }
  .product-reviews { grid-template-columns: 1fr; }
  .product-mobile-buybar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 85;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
    background: rgba(250,250,248,.96); border-top: 1px solid var(--line);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  }
  .product-mobile-buybar small { display: block; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--label); }
  .product-mobile-buybar strong { font-weight: 400; font-size: 18px; color: var(--green); }
  .product-mobile-buybar .btn { width: auto; padding: 13px 22px; }
  .product-page .page-footer { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .product-toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  .product-spinner { animation-duration: 2.4s; }
  .product-related-card__image img, .product-cart-drawer, .product-cart-overlay { transition: none; }
}
