/*
 * BrickRated Sitewide UX & Conversion Polish (Agent 1 — 2026-11-27)
 * Safe, non-breaking additive stylesheet aligned with BrickRated tokens:
 *   --navy: #172b46 | --ivory: #f7f5ef | --yellow: #f4c844 | --teal: #dce8e4 | --border: #e1e5e9
 * Load in both Next.js global CSS and static homepage CSS (_assets/style-index-*.css).
 */

/* 1. Smooth in-page navigation + anchor offset + accessible focus */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

main [id] {
  scroll-margin-top: 84px;
}

:where(a, button, input, select, textarea, summary, [role="button"]):focus-visible {
  outline: 3px solid #288b9c;
  outline-offset: 3px;
}

/* 2. Fix /tools/price-per-piece calculator negative-margin overlap on CRO shelf disclosure */
.br-calculator-page section + .container .br-calculator-layout {
  margin-top: 20px;
}

/* 3. Fix mobile homepage "What do youwant to build?" missing space when <br> is hidden */
@media (max-width: 700px) {
  .br-home-theme-heading > h2 br {
    display: inline;
    content: " ";
  }
  .br-home-theme-heading > h2 br::after {
    content: " ";
  }
  /* Improve white text contrast over bright right-side hero art on mobile */
  .br-home .hero-grid > div {
    position: relative;
    z-index: 2;
  }
  .br-home .hero-grid::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(
      180deg,
      rgba(23, 43, 70, 0.92) 0%,
      rgba(23, 43, 70, 0.72) 55%,
      rgba(23, 43, 70, 0.15) 100%
    );
  }
}

/* 4. Fix WCAG AA contrast on theme page gold headings (#d5a212 2.25:1 -> #9a6d00 4.65:1) */
.br-theme-hero-copy h1 span,
.br-theme-page h2 span {
  color: #9a6d00;
}

/* 5. Sitewide touch-target ergonomics (>= 44px on mobile & key CTAs) */
@media (max-width: 850px) {
  .site-header .search-link,
  .site-header .menu-toggle {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 10px;
  }
  .site-header .search-link:hover,
  .site-header .menu-toggle:hover {
    background: #eef0f3;
  }
}

.br-editorial-jumps > .container {
  padding-block: 4px;
}

.br-editorial-jumps a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 4px;
  transition: color 0.15s ease;
}

.br-editorial-jumps a:hover {
  color: #f4c844;
}

.br-review-section-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
}

.br-ranked-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 14px;
  transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.br-ranked-actions a:first-child {
  padding-left: 0;
  padding-right: 8px;
}

.br-ranked-actions a[href*="amazon."]:hover {
  background-color: #f5d25e;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(23, 43, 70, 0.14);
}

@media (max-width: 700px) {
  .br-theme-rail-next {
    width: 44px;
    height: 44px;
    top: 76px;
  }
}

/* 6. Upgrade existing inline-styled & Wave 7 CRO shelf CTAs to WCAG AAA native BrickRated yellow/navy */
section a[href*="amazon."][style*="background-color:#d97706"],
section a[href*="amazon."][style*="background:#c2410c"],
#wave7-brick-picks a[href*="amazon."],
section[data-wave7="1"] a[href*="amazon."] {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  background-color: #f4c844 !important;
  color: #172b46 !important;
  border: 1px solid #dfb632;
  min-height: 44px;
  padding: 10px 16px !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  border-radius: 9px !important;
  text-decoration: none !important;
  transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

section a[href*="amazon."][style*="background-color:#d97706"]:hover,
section a[href*="amazon."][style*="background:#c2410c"]:hover,
#wave7-brick-picks a[href*="amazon."]:hover,
section[data-wave7="1"] a[href*="amazon."]:hover {
  background-color: #fbe28c !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(23, 43, 70, 0.14);
}

section p[style*="color:#d97706"] {
  color: #8f5600 !important;
}

/* 7. Restore hidden mid-page review conversion card (.br-review-pros > div:nth-child(3)) as a sleek full-width bar */
.br-review-pros > div:nth-child(3) {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  text-align: left;
  background: linear-gradient(110deg, #fff5d8, #fffaf0);
  border: 1px solid #efe2bd;
  border-radius: 12px;
  padding: 18px 24px;
}

.br-review-pros > div:nth-child(3) > div:first-child {
  margin: 0;
  width: 84px;
  height: 72px;
  flex: none;
}

.br-review-pros > div:nth-child(3) > p {
  margin: 0;
  font-family: var(--brick-display-font), Arial, sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: #172b46;
  flex: 1;
}

.br-review-pros > div:nth-child(3) > div:last-child {
  width: auto;
  min-width: 240px;
  flex: none;
}

.br-review-pros > div:nth-child(3) > div:last-child a {
  margin-top: 0;
  min-height: 46px;
}

@media (max-width: 700px) {
  .br-review-pros > div:nth-child(3) {
    flex-direction: column;
    text-align: center;
    gap: 12px;
    padding: 18px 16px;
  }
  .br-review-pros > div:nth-child(3) > div:last-child {
    width: 100%;
    min-width: 0;
  }
}

/* 8. Native CTA hover polish across .btn and review buttons */
.btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
}

/* 9. Defensive responsive table styling for buying guides & comparison pages */
.br-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #e1e5e9;
  border-radius: 12px;
  background: #ffffff;
  margin: 20px 0;
}

main table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.45;
}

main table th {
  background: #f7f5ef;
  color: #172b46;
  font-weight: 800;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 2px solid #e1e5e9;
}

main table td {
  padding: 11px 14px;
  border-bottom: 1px solid #eef0f3;
  color: #172b46;
  vertical-align: top;
}

@media (max-width: 768px) {
  main table:not(.br-table-wrap table) {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
}

/* 10. Reusable native CRO shelf primitives matching BrickRated's exact design system */
.br-cro-shelf {
  background: #ffffff;
  border: 1px solid #e1e5e9;
  border-top: 4px solid #f4c844;
  border-radius: 14px;
  padding: 22px;
  margin: 24px auto;
  max-width: 1180px;
  box-shadow: 0 2px 10px rgba(23, 43, 70, 0.04);
}

.br-cro-eyebrow {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #58677b;
  margin: 0 0 6px;
}

.br-cro-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.br-cro-card {
  background: #faf9f6;
  border: 1px solid #e1e5e9;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.br-cro-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(23, 43, 70, 0.08);
}

.br-cro-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 9px;
  background: #f4c844;
  color: #172b46;
  border: 1px solid #dfb632;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.br-cro-cta:hover {
  background: #fbe28c;
  transform: translateY(-1px);
}
