/**
 * P03 / Product2 PDP — Desktop editorial layout (≥1024px)
 *
 * LAYOUT CONTRACT (do not override elsewhere):
 *   • Sidebar rail lives in grid column 1; main content in column 2.
 *   • No negative margins / absolute left on .p03-section-rail.
 *   • Tune spacing ONLY via --p03-sidebar-w and --p03-rail-gap below.
 *   • Run: python3 scripts/pdp_automation/verify_p03_rail_layout.py
 */

@media (min-width: 1024px) {
  .product2-detail-body .content-section {
    contain-intrinsic-size: auto 480px;
  }

  .product2-detail-body .content-section--visual,
  .product2-detail-body .content-section:has(.product-img),
  .product2-detail-body .product-hero,
  .p03-simple-shell.product2-detail-body .content-section {
    content-visibility: visible !important;
    contain-intrinsic-size: auto !important;
  }

  .product2-detail-body {
    --p03-canvas: #f3efe6;
    --p03-canvas-deep: #ebe6dc;
    --p03-content-max: 90rem;
    --p03-sidebar-w: clamp(5.75rem, 6.25vw, 7.25rem);
    --p03-rail-gap: clamp(2rem, 3vw, 3.25rem);
    --p03-inquiry-reserve: clamp(3.75rem, 4vw, 4.75rem);
    background-color: var(--p03-canvas);
    background-image:
      radial-gradient(ellipse 130% 75% at 50% -18%, rgba(255, 252, 247, 0.92) 0%, transparent 52%),
      radial-gradient(ellipse 70% 50% at 100% 12%, rgba(245, 237, 222, 0.45) 0%, transparent 48%),
      linear-gradient(175deg, #f7f3eb 0%, var(--p03-canvas) 42%, var(--p03-canvas-deep) 100%);
    scroll-padding-top: 5.25rem;
  }

  .product2-detail-body::before,
  .product2-detail-body::after {
    opacity: 0.045;
  }

  .product2-detail-body .archive-header--pdp-lux {
    background: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.94) 0%,
      rgba(247, 243, 235, 0.88) 100%
    );
    border-bottom-color: rgba(201, 162, 39, 0.12);
  }

  .product2-detail-body .wrap {
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
  }

  /* Rail column + content column — structurally separated, no overlap */
  .product2-detail-body .detail-main {
    display: grid;
    grid-template-columns: var(--p03-sidebar-w) minmax(0, 1fr);
    column-gap: var(--p03-rail-gap);
    align-items: start;
    position: relative;
    max-width: var(--p03-content-max) !important;
    width: min(
      var(--p03-content-max),
      calc(100vw - 2rem - var(--p03-inquiry-reserve))
    );
    margin: 0 auto;
    padding: 0 clamp(0.75rem, 1.5vw, 1.5rem) 4rem;
  }

  .product2-detail-body .detail-breadcrumb {
    grid-column: 1 / -1;
    display: inline-flex !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    margin: 1.1rem 0 0.25rem !important;
    padding: 0 !important;
    font-size: 0.68rem;
    letter-spacing: 0.05em;
    color: #8a847a;
  }

  .product2-detail-body .detail-breadcrumb strong {
    display: inline !important;
    height: auto !important;
    color: #5c574f;
    font-weight: 600;
  }

  .product2-detail-body .detail-main > .detail-breadcrumb,
  .product2-detail-body .detail-main > :not(.detail-breadcrumb):not(.section-nav) {
    grid-column: 2;
  }

  .product2-detail-body .section-nav.p03-section-rail {
    display: block !important;
    position: sticky;
    top: 5.1rem;
    align-self: start;
    justify-self: start;
    grid-column: 1;
    grid-row: 2 / span 20;
    left: auto;
    width: 100%;
    max-width: var(--p03-sidebar-w);
    margin: 0.35rem 0 0;
    z-index: 4;
    height: auto;
    min-height: 0;
    padding: 0.15rem 0 1.5rem;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    box-shadow: none;
  }

  .product2-detail-body .section-nav.p03-section-rail .wrap {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    height: auto;
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .product2-detail-body .section-nav.p03-section-rail ul {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    margin: 0;
    padding: 0 0 0 2px;
    list-style: none;
    border-left: 1px solid rgba(154, 123, 16, 0.18);
  }

  .product2-detail-body .section-nav.p03-section-rail li {
    position: relative;
    margin: 0;
    padding: 0.38rem 0 0.38rem 0.72rem;
  }

  .product2-detail-body .section-nav.p03-section-rail li::before {
    content: "";
    position: absolute;
    left: -1px;
    top: 50%;
    width: 5px;
    height: 5px;
    margin-top: -2.5px;
    margin-left: -2.5px;
    border-radius: 50%;
    background: var(--p03-canvas);
    border: 1.5px solid rgba(201, 162, 39, 0.34);
    transition:
      background 0.28s ease,
      border-color 0.28s ease,
      transform 0.28s ease,
      box-shadow 0.28s ease;
  }

  .product2-detail-body .section-nav.p03-section-rail li.is-active::before {
    background: #c9a227;
    border-color: #b8942a;
    box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.12);
    transform: scale(1.08);
  }

  .product2-detail-body .section-nav.p03-section-rail a {
    display: block;
    font-size: 0.54rem;
    font-weight: 600;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: #9a9590;
    text-decoration: none;
    line-height: 1.25;
    transition: color 0.25s ease;
  }

  .product2-detail-body .section-nav.p03-section-rail li.is-active a,
  .product2-detail-body .section-nav.p03-section-rail a.is-active {
    color: #3d3d3d;
  }

  .product2-detail-body .section-nav.p03-section-rail a:hover {
    color: #9a7b10;
  }

  .product2-detail-body .section-nav.p03-section-rail .nav-cta {
    display: none !important;
  }

  .product2-detail-body .hero-grid {
    grid-template-columns: minmax(0, 1.18fr) minmax(0, 0.82fr);
    gap: clamp(2rem, 4vw, 3.5rem);
    align-items: start;
  }

  .p03-simple-shell .hero-grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: clamp(2rem, 4vw, 3.25rem);
    align-items: start;
  }

  .p03-simple-shell .hero-grid .gallery {
    grid-column: 1;
    align-self: start;
    min-width: 0;
  }

  .p03-simple-shell .hero-grid .buy-box {
    grid-column: 2;
    align-self: start;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  /* Inline purchase — full SEO/GEO hero copy stays in column 2 */
  .p03-simple-shell .buy-box .price-row {
    position: static;
    width: auto;
    margin: 0.15rem 0 0.85rem;
    padding: 0;
  }

  .p03-simple-shell .buy-box .price-row::before {
    content: none;
    display: none;
  }

  .p03-simple-shell .buy-box .price {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--graphite, #3a3a35);
  }

  .p03-simple-shell .buy-box .product2-checkout-stack {
    position: static;
    width: auto;
    margin: 0 0 0.75rem;
    padding: 0;
  }

  .p03-simple-shell .buy-box .product2-qty-bar {
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(31, 61, 46, 0.14);
    border-radius: 12px;
    margin-bottom: 0.65rem;
  }

  .p03-simple-shell .buy-box .product2-add-cart-btn {
    min-height: 48px;
    border-radius: 999px;
    background: linear-gradient(175deg, #3d8060 0%, #1f3d2e 100%);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.14),
      0 6px 18px rgba(31, 61, 46, 0.22);
  }

  .p03-simple-shell .buy-box .product2-add-cart-btn:hover {
    background: linear-gradient(175deg, #448f6a 0%, #254a38 100%);
  }

  .p03-simple-shell .buy-box .cta-secondary--inquiry {
    position: static;
    width: auto;
    margin-top: 0.65rem;
    opacity: 1;
  }

  .p03-simple-shell .buy-box::before {
    content: none;
    display: none;
  }

  .p03-simple-shell .buy-box .cta-secondary:not(.cta-secondary--inquiry) {
    justify-self: auto;
    text-align: left;
    margin-bottom: 0.35rem;
  }

  .p03-simple-shell .buy-box .badges {
    margin-bottom: 0.85rem;
  }

  .p03-simple-shell .buy-box .geo-snippet {
    margin-top: 1rem;
  }

  .p03-simple-shell.product2-detail-body {
    padding-bottom: calc(92px + env(safe-area-inset-bottom, 0));
  }

  .product2-detail-body .product-hero {
    padding: 1rem 0 1.35rem;
  }

  .product2-detail-body h2 {
    margin-bottom: 0.6rem;
    padding-left: 0.6rem;
  }

  .product2-detail-body .content-section {
    padding: 1.65rem 0;
  }

  .p03-simple-shell #overview.content-section {
    padding-top: clamp(2rem, 4vw, 3rem);
    padding-bottom: clamp(2rem, 4vw, 3rem);
  }

  .p03-simple-shell #overview .wrap {
    padding: 0;
    border-radius: 0;
  }

  .p03-simple-shell .citation {
    padding: 1rem 1.1rem 1rem 1.25rem;
  }

  .p03-simple-shell .feature-card {
    padding: 0.95rem 1rem;
    border-radius: 14px;
  }

  .p03-simple-shell .visual-block--engineering {
    max-width: 620px;
  }

  .p03-simple-shell .section-bridge {
    padding: 1.45rem 0.85rem;
  }

  .product2-detail-body .product-hero::before {
    opacity: 0.72;
    width: 100%;
    max-width: 100%;
    margin: 0 0 1rem;
  }

  .product2-detail-body .detail-main > .content-section,
  .product2-detail-body .detail-main > .mobile-visual-river,
  .product2-detail-body .detail-main > .product-hero {
    scroll-margin-top: 5.75rem;
  }

  .product2-detail-body .buy-box .model-tag {
    margin-bottom: 0.5rem;
    padding-bottom: 0.35rem;
  }

  .product2-detail-body .buy-box .tagline {
    margin-bottom: 0.7rem;
  }

  .product2-detail-body .badge {
    padding: 0.26rem 0.65rem;
  }

  .product2-detail-body .buy-box .geo-snippet {
    margin-top: 1rem;
    padding-left: 0.85rem;
  }

  .product2-detail-body .gallery-thumbs button {
    width: 60px;
    height: 60px;
  }

  .product2-detail-body .product2-sticky-cart {
    gap: 10px;
    padding: 7px 14px calc(7px + env(safe-area-inset-bottom, 0px));
  }

  .product2-detail-body .product2-sticky-add {
    min-height: 36px;
    max-width: min(240px, 58vw);
    padding: 8px 14px;
    letter-spacing: 0.06em;
  }

  .product2-detail-body .product2-sticky-add .material-symbols-outlined {
    font-size: 16px;
  }

  .product2-detail-body .product2-sticky-cart {
    z-index: 130;
  }

  .product2-detail-body .buy-box {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 0;
  }

  .product2-detail-body .buy-box .badge {
    background: transparent;
    border-color: rgba(154, 149, 144, 0.38);
  }

  .product2-detail-body .buy-box .geo-snippet {
    background: transparent !important;
    border-radius: 0;
  }

  .product2-detail-body .buy-box .product2-qty-bar {
    background: rgba(255, 255, 255, 0.42);
    border: 1px solid rgba(154, 149, 144, 0.22);
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .product2-detail-body .gallery-main {
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .product2-detail-body .gallery-main img {
    transform: none;
  }

  .product2-detail-body .gallery-main .zoom-wrap:hover img {
    transform: scale(1.04);
  }

  .product2-detail-body .gallery-thumbs button {
    background: rgba(255, 255, 255, 0.55);
    border-color: rgba(154, 149, 144, 0.2);
  }

  .product2-detail-body .content-section--tone-white {
    background: rgba(255, 255, 255, 0.55);
  }

  .product2-detail-body .content-section--tone-canvas {
    background: transparent;
  }

  .product2-detail-body .content-section--editorial {
    background: transparent !important;
  }

  .p03-simple-shell .content-section--editorial .citation {
    background: rgba(232, 228, 223, 0.42);
    border: 1px solid rgba(201, 162, 39, 0.14);
    box-shadow: none;
  }

  .product2-detail-body .creamypaw-contact-dock__btn,
  .product2-detail-body .creamypaw-contact-dock__btn--inquiry {
    --inq-btn-w: 68px;
    --inq-btn-h: 34px;
    --inq-btn-pad: 10px;
    --inq-label-size: 10px;
    min-width: 68px;
    height: 34px;
  }

  .product2-detail-body .creamypaw-contact-dock__btn--inquiry .creamypaw-contact-dock__label {
    font-size: 10px;
  }

  .product2-detail-body #catbot-custom-launcher {
    width: 50px;
    height: 50px;
  }
}

@media (min-width: 1024px) and (max-width: 1320px) {
  .product2-detail-body .product2-sticky-cart {
    padding-right: calc(14px + var(--p03-inquiry-reserve, 4rem));
  }
}

@media (min-width: 1024px) and (max-width: 1180px) {
  .product2-detail-body {
    --p03-content-max: min(90rem, calc(100vw - 2rem - var(--p03-inquiry-reserve, 4.5rem)));
    --p03-sidebar-w: clamp(5.25rem, 5.75vw, 6.5rem);
    --p03-rail-gap: clamp(1.65rem, 2.5vw, 2.5rem);
  }

  .product2-detail-body .section-nav.p03-section-rail a {
    font-size: 0.5rem;
    letter-spacing: 0.08em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .product2-detail-body .section-nav.p03-section-rail li::before {
    transition: none;
  }
}

/* ═══ LAYOUT LOCK — rail position owned ONLY by this file (≥1024px) ═══ */
@media (min-width: 1024px) {
  .product2-detail-body .section-nav.p03-section-rail,
  .p03-simple-shell.product2-detail-body .section-nav.p03-section-rail {
    grid-column: 1 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
  }

  .product2-detail-body .detail-main > :not(.detail-breadcrumb):not(.section-nav) {
    grid-column: 2 !important;
    min-width: 0;
  }
}
