/* Build Your Box / Research Panel */
:root {
  --badge: #081e4c;
  --bone: #f4f2ee;
}

body.page-box {
  padding-top: 0;
  background: var(--bone);
}

main:has([data-box-page]) {
  overflow-x: clip;
  overflow-y: visible;
}

.box-page {
  position: relative;
  width: 100%;
  background: var(--bone);
  padding-bottom: 4rem;
}

/* Hero */
.box-hero {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 0 0 1.75rem 1.75rem;
}

.box-hero-media {
  position: relative;
  height: 72svh;
  width: 100%;
}

.box-hero-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  color: transparent;
}

.box-hero-mobile {
  object-position: center 28%;
}

.box-hero-desktop {
  display: none;
  object-position: right 38%;
}

.box-hero-copy {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: 2.5rem;
}

.box-hero-copy-inner {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.box-hero-text {
  width: 100%;
}

.box-hero-text h1 {
  margin: 0;
  font-size: 11vw;
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.025em;
  color: #111;
}

.box-hero-text p {
  margin: 1.25rem 0 0;
  max-width: 28rem;
  font-size: 1rem;
  font-weight: 300;
  line-height: 1.625;
  color: rgba(17, 17, 17, 0.7);
}

.box-hero-perk {
  margin-top: 0.5rem !important;
  font-weight: 500 !important;
  color: rgba(17, 17, 17, 0.8) !important;
}

/* Stats */
.box-stats {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 2.5rem 1rem 0;
}

.box-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: stretch;
}

.box-stat {
  display: flex;
  flex-direction: column;
  border-radius: 1rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #fff;
  padding: 1rem;
}

.box-stat--discount {
  position: relative;
  overflow: hidden;
  border: 0;
  background: linear-gradient(to bottom, var(--badge), #111);
  justify-content: space-between;
  color: #fff;
}

.box-stat-watermark {
  position: absolute;
  right: -0.75rem;
  bottom: -2rem;
  pointer-events: none;
  font-size: 130px;
  font-weight: 700;
  line-height: 1;
  color: rgba(255, 255, 255, 0.08);
}

.box-stat-kicker {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

.box-stat-big {
  position: relative;
  z-index: 1;
  margin: 0.5rem 0 0;
  font-size: 3rem;
  font-weight: 500;
  line-height: 0.85;
  letter-spacing: -0.05em;
  color: #fff;
}

.box-stat-foot {
  position: relative;
  z-index: 1;
  margin: 0.75rem 0 0;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
  color: #fff;
}

.box-stat-metric {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 4rem;
}

.box-stat-num {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--badge);
}

.box-stat-label {
  margin-top: 0.375rem;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.4);
}

.box-stat-title {
  margin: 0.75rem 0 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--badge);
}

.box-stat-desc {
  margin: 0.25rem 0 0;
  font-size: 11.5px;
  line-height: 1.3;
  color: rgba(0, 0, 0, 0.55);
}

/* Builder */
.box-builder {
  width: 100%;
  max-width: 1600px;
  margin: 2.5rem auto 0;
  padding: 0 1rem 8rem;
}

.box-builder-layout {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.box-catalog {
  min-width: 0;
  flex: 1;
}

.box-search {
  position: relative;
  width: 100%;
  max-width: 24rem;
  margin-bottom: 1.25rem;
}

.box-search svg {
  position: absolute;
  left: 1.25rem;
  top: 50%;
  width: 1rem;
  height: 1rem;
  transform: translateY(-50%);
  color: rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.box-search input {
  width: 100%;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.02);
  padding: 0.75rem 1.25rem 0.75rem 3rem;
  font-size: 14px;
  color: #111;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.box-search input::placeholder {
  color: rgba(0, 0, 0, 0.4);
}

.box-search input:focus {
  border-color: rgba(0, 0, 0, 0.3);
  background: #fff;
}

.box-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.box-empty {
  grid-column: 1 / -1;
  padding: 3rem 1rem;
  text-align: center;
  color: rgba(0, 0, 0, 0.45);
  font-size: 0.95rem;
}

/* Product card */
.box-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 1rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #fff;
}

.box-card-head {
  padding: 0.75rem 0.75rem 0.25rem;
}

.box-card-head h3 {
  margin: 0;
  min-height: 2.5em;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  color: #000;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.box-card-media {
  position: relative;
  display: flex;
  aspect-ratio: 1;
  width: 100%;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #fff;
}

.box-card-media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  mix-blend-mode: darken;
}

.box-card-variants {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem 0;
}

.box-variant {
  flex: 1;
  border: 0;
  border-radius: 999px;
  padding: 0.375rem 0.25rem;
  text-align: center;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(223, 233, 249, 0.7);
  color: var(--badge);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.box-variant:hover {
  background: #dfe9f9;
}

.box-variant.is-active,
.box-variant.is-static {
  background: var(--badge);
  color: #fff;
  cursor: default;
}

.box-card-price {
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
  margin-top: 0.5rem;
  padding: 0 0.75rem;
}

.box-card-price .was {
  font-size: 12px;
  color: rgba(0, 0, 0, 0.4);
  text-decoration: line-through;
}

.box-card-price .now {
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--badge);
}

.box-card-add {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(100% - 1.5rem);
  height: 2.75rem;
  margin: 0.625rem 0.75rem 0.75rem;
  border: 0;
  border-radius: 1rem;
  background: var(--badge);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.box-card-add:hover:not(:disabled) {
  opacity: 0.9;
}

.box-card-add:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Desktop sidebar */
.box-sidebar {
  display: none;
}

.box-sidebar-inner {
  position: relative;
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

.box-sidebar-scroll {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.5rem 0.75rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(8, 30, 76, 0.35) transparent;
}

.box-sidebar-fade {
  pointer-events: none;
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 2rem;
  background: linear-gradient(to top, #fff, transparent);
  opacity: 0;
}

.box-slots {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.box-slot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 2.75rem;
  padding: 0 0.625rem;
  border-radius: 0.75rem;
  border: 1px dashed rgba(0, 0, 0, 0.2);
  background: rgba(0, 0, 0, 0.02);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.box-slot.is-filled {
  border-style: solid;
  border-color: rgba(0, 0, 0, 0.1);
  background: #fff;
}

.box-slot-num {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  border: 1px solid var(--badge);
  font-size: 10px;
  font-weight: 700;
  color: var(--badge);
}

.box-slot-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.4);
}

.box-slot.is-filled .box-slot-label {
  color: var(--badge);
}

.box-slot-thumb {
  position: relative;
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  overflow: hidden;
  border-radius: 0.5rem;
  border: 1px solid rgba(0, 0, 0, 0.05);
  background: #fff;
}

.box-slot-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 2px;
  mix-blend-mode: darken;
}

.box-slot-meta {
  min-width: 0;
  flex: 1;
}

.box-slot-meta strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--badge);
}

.box-slot-meta span {
  display: block;
  font-size: 11px;
  color: rgba(0, 0, 0, 0.45);
}

.box-slot-remove {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: rgba(0, 0, 0, 0.35);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem;
}

.box-slot-remove:hover {
  color: #111;
}

.box-free-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-top: 0.25rem;
  padding: 0.375rem 0.625rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #fff;
}

.box-free-item .box-slot-thumb {
  width: 2.25rem;
  height: 2.25rem;
}

.box-free-item p {
  margin: 0;
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--badge);
}

.box-free-item .free {
  color: #209b42;
}

.box-panel-note {
  margin: 0.5rem 0 0;
  font-size: 10.5px;
  line-height: 1.25;
  color: rgba(0, 0, 0, 0.45);
}

.box-sidebar-cta {
  flex-shrink: 0;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  background: #fff;
  padding: 0.75rem 1rem;
}

.box-checkout {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 1rem;
  border: 2px solid var(--badge);
  background: var(--badge);
  padding: 1rem;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.box-checkout:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(8, 30, 76, 0.22);
}

.box-checkout:disabled {
  cursor: not-allowed;
  border-color: rgba(8, 30, 76, 0.3);
  background: rgba(8, 30, 76, 0.3);
  transform: none;
  box-shadow: none;
}

/* Mobile bottom bar + sheet */
.box-mobile-bar {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 0.75rem 1rem;
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
}

.box-mobile-summary {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  padding: 0;
}

.box-mobile-count {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.4);
}

.box-mobile-hint {
  font-size: 15px;
  font-weight: 600;
  color: var(--badge);
}

.box-mobile-cta {
  flex-shrink: 0;
  white-space: nowrap;
  border-radius: 999px;
  border: 2px solid var(--badge);
  background: var(--badge);
  padding: 0.75rem 1.25rem;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  cursor: pointer;
}

.box-mobile-cta:disabled {
  cursor: not-allowed;
  border-color: rgba(8, 30, 76, 0.3);
  background: rgba(8, 30, 76, 0.3);
}

.box-sheet {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
}

.box-sheet.is-open {
  display: block;
}

.box-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
}

.box-sheet-panel {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  display: flex;
  max-height: 85vh;
  flex-direction: column;
  border-radius: 1.5rem 1.5rem 0 0;
  background: #fff;
}

.box-sheet-head {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 0;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--badge);
}

.box-sheet-head button {
  border: 0;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: rgba(0, 0, 0, 0.45);
  cursor: pointer;
}

.box-sheet-body {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
}

.box-sheet-cta {
  flex-shrink: 0;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  padding: 1rem 1.25rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}

@media (min-width: 640px) {
  .box-hero-media {
    height: 62svh;
  }

  .box-hero-mobile {
    display: none;
  }

  .box-hero-desktop {
    display: block;
  }

  .box-hero-copy {
    justify-content: center;
    padding-bottom: 0;
  }

  .box-hero-copy-inner {
    padding: 0 2rem;
  }

  .box-hero-text {
    max-width: 32rem;
  }

  .box-hero-text h1 {
    margin-top: 1rem;
    font-size: 3rem;
  }

  .box-hero-text p {
    font-size: 1.125rem;
  }

  .box-stats {
    padding: 3rem 2rem 0;
  }

  .box-stat {
    padding: 1.5rem;
  }

  .box-stat-big {
    margin-top: 0.75rem;
    font-size: 6rem;
  }

  .box-stat-foot {
    margin-top: 1.5rem;
    font-size: 1.125rem;
  }

  .box-stat-metric {
    height: 6rem;
  }

  .box-stat-num {
    font-size: 3rem;
  }

  .box-stat-label {
    margin-top: 0.5rem;
    font-size: 10px;
  }

  .box-stat-title {
    margin-top: 1rem;
    font-size: 19px;
  }

  .box-stat-desc {
    margin-top: 0.375rem;
    font-size: 14px;
  }

  .box-stat-watermark {
    right: -1rem;
    bottom: -2.5rem;
    font-size: 280px;
  }

  .box-builder {
    padding: 0 2rem 8rem;
  }

  .box-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
  }

  .box-card-head {
    padding: 1rem 1rem 0.25rem;
  }

  .box-card-head h3 {
    min-height: 2.6em;
    font-size: 17px;
  }

  .box-card-variants,
  .box-card-price {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .box-card-add {
    width: calc(100% - 2rem);
    margin-left: 1rem;
    margin-right: 1rem;
    margin-bottom: 1rem;
  }
}

@media (min-width: 768px) {
  .box-hero {
    border-radius: 0 0 2.5rem 2.5rem;
  }

  .box-hero-media {
    height: 68svh;
  }

  .box-stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
  }

  .box-stat--discount {
    grid-column: span 3;
    padding: 2rem;
  }
}

@media (min-width: 1024px) {
  .box-hero-desktop {
    object-position: right 32%;
  }

  .box-hero-text {
    max-width: 36rem;
  }

  .box-hero-text h1 {
    font-size: 3.75rem;
  }

  .box-stats-grid {
    grid-template-columns: 2fr 1fr 1fr 1fr;
  }

  .box-stat--discount {
    grid-column: span 1;
  }

  .box-builder {
    padding-bottom: 4rem;
  }

  .box-builder-layout {
    flex-direction: row;
    align-items: flex-start;
    gap: 2.5rem;
  }

  .box-sidebar {
    position: sticky;
    top: calc(8rem + var(--sale-h, 0px) + var(--promo-h, 0px));
    display: flex;
    width: 380px;
    max-height: calc(100dvh - 9rem - var(--sale-h, 0px) - var(--promo-h, 0px));
    flex-shrink: 0;
    flex-direction: column;
    overflow: hidden;
    border-radius: 1rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #fff;
  }

  .box-mobile-bar,
  .box-sheet {
    display: none !important;
  }

  .box-slot {
    min-height: 4rem;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 1rem;
  }

  .box-slot-num {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 12px;
  }

  .box-slot-label,
  .box-slot-meta strong,
  .box-free-item p {
    font-size: 13px;
  }

  .box-slots {
    gap: 0.625rem;
  }

  .box-sidebar-scroll {
    padding: 1.25rem 1.25rem 0.75rem;
  }

  .box-sidebar-cta {
    padding: 0.75rem 1.25rem 1.25rem;
  }
}

@media (min-width: 1280px) {
  .box-hero-copy-inner,
  .box-stats,
  .box-builder {
    padding-left: 3rem;
    padding-right: 3rem;
  }

  .box-hero-desktop {
    object-position: right 28%;
  }

  .box-hero-text {
    max-width: 42rem;
  }

  .box-hero-text h1 {
    font-size: 4.5rem;
  }

  .box-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
