:root {
  color-scheme: light;
  --page: #ffffff;
  --surface: #f7f7f8;
  --surface-strong: #f1f2f4;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #dedee3;
  --line-soft: #ededf0;
  --accent: #1473e6;
  --accent-dark: #0d5fc2;
  --success: #1b7f4b;
  --warning: #8a5a00;
  --shadow-search: 0 1px 2px rgba(0, 0, 0, 0.08), 0 8px 24px rgba(0, 0, 0, 0.08);
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(20, 115, 230, 0.22);
  outline-offset: 2px;
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  display: flex;
  width: 100%;
  height: 68px;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(18px, 3vw, 42px);
  pointer-events: none;
}

.site-header > * {
  pointer-events: auto;
}

.wordmark {
  display: inline-block;
  text-decoration: none;
}

.wordmark img {
  display: block;
  width: 100%;
  height: auto;
}

.wordmark-small {
  width: 96px;
  visibility: hidden;
}

.wordmark-hero {
  width: clamp(195px, 30vw, 285px);
  margin-bottom: 34px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mode-label {
  padding: 6px 9px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.icon-button,
.search-tool,
.search-submit {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface);
  font-size: 21px;
}

.icon-button:hover {
  background: var(--surface-strong);
}

.search-home {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: calc(100vh - 78px);
  place-items: center;
  padding: 110px 20px 130px;
  overflow-x: hidden;
}

.home-inner {
  width: min(760px, calc(100vw - 40px));
  min-width: 0;
  max-width: 100%;
  margin-top: -3vh;
  text-align: center;
}

.search-form {
  position: relative;
  display: flex;
  width: 100%;
  align-items: center;
  border: 1px solid #d2d2d7;
  border-radius: 28px;
  background: var(--page);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.search-form:hover,
.search-form:focus-within {
  border-color: transparent;
  box-shadow: var(--shadow-search);
}

.search-form-hero {
  min-height: 58px;
  padding: 7px 8px 7px 18px;
}

.search-form-compact {
  min-height: 50px;
  padding: 5px 7px 5px 16px;
}

.search-leading {
  flex: 0 0 auto;
  margin-right: 12px;
  color: #85858a;
  font-size: 20px;
}

.search-form textarea {
  display: block;
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  max-height: 120px;
  min-height: 26px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  line-height: 26px;
}

.search-form textarea::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.search-form textarea::placeholder {
  color: #929298;
  opacity: 1;
}

.search-tools {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 2px;
  margin-left: 8px;
}

.search-tool,
.search-submit {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 20px;
}

.search-tool {
  color: #55555a;
}

.search-tool:hover,
.search-tool.is-active {
  background: var(--surface);
  color: var(--accent);
}

.search-submit {
  margin-left: 3px;
  background: var(--ink);
  color: #fff;
}

.search-submit:hover {
  background: #353537;
}

.search-submit:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.search-feedback {
  min-height: 24px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.search-feedback.is-error {
  color: #b42318;
}

.example-links {
  display: flex;
  max-width: 650px;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 14px auto 0;
}

.example-link {
  min-height: 36px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--surface);
  color: #3a3a3c;
  font-size: 13px;
  line-height: 1.35;
  cursor: pointer;
}

.example-link:hover {
  border-color: var(--line);
  background: var(--page);
}

.results-view {
  min-height: calc(100vh - 78px);
  padding-top: 88px;
}

body.has-results .site-header {
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
}

body.has-results .wordmark-small {
  visibility: visible;
}

.compact-search-wrap {
  width: min(100% - 40px, 780px);
  margin: 0 auto 30px;
}

.results-container {
  width: min(100% - 40px, 1280px);
  margin: 0 auto;
}

.loading-state {
  min-height: 320px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.loading-state:not([hidden]) {
  display: flex;
}

.analysis-block {
  max-width: 800px;
  padding: 0 0 30px;
  border-bottom: 1px solid var(--line-soft);
}

.analysis-kicker,
.section-eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
}

.analysis-kicker i {
  font-size: 16px;
}

.analysis-block h2 {
  margin: 0 0 12px;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 620;
  line-height: 1.15;
  letter-spacing: 0;
}

.possible-cause {
  margin: 0 0 10px;
  color: #49494d;
  font-size: 17px;
  line-height: 1.6;
}

.recommendation-summary {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.solutions-block,
.products-block {
  padding: 32px 0;
  border-bottom: 1px solid var(--line-soft);
}

.section-title-row,
.products-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.section-title-row h3,
.products-heading h2 {
  margin: 0;
  font-size: 23px;
  font-weight: 620;
  line-height: 1.25;
}

.filter-toggle {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.filter-toggle {
  padding: 0 13px;
}

.filter-toggle:hover {
  background: var(--surface-strong);
}

.filters label {
  display: grid;
  gap: 8px;
  color: #55555a;
  font-size: 13px;
  font-weight: 550;
}

.solution-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.solution-item {
  min-width: 0;
  padding: 20px;
  background: var(--page);
}

.solution-item + .solution-item {
  border-left: 1px solid var(--line);
}

.solution-item.is-best {
  background: #f4f8fd;
}

.solution-label {
  display: block;
  min-height: 34px;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
}

.solution-item strong {
  display: block;
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: 650;
}

.solution-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.filters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 24px;
  padding: 18px;
  border-radius: 8px;
  background: var(--surface);
}

.form-select,
.form-control,
.input-group-text {
  min-height: 42px;
  border-color: var(--line);
  border-radius: 7px;
  font-size: 14px;
}

.form-select:focus,
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 115, 230, 0.12);
}

.input-group-text {
  color: var(--muted);
  background: var(--page);
}

.product-list {
  display: grid;
}

.product-item {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 148px;
  gap: 22px;
  align-items: start;
  padding: 24px 0;
  border-bottom: 1px solid var(--line-soft);
}

.product-list .product-item:last-child {
  border-bottom: 0;
}

.product-image {
  display: grid;
  width: 170px;
  aspect-ratio: 1 / 1;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface);
}

.product-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-marketplace {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

.product-marketplace .sponsored-label {
  color: var(--warning);
}

.product-main h4 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 620;
  line-height: 1.35;
}

.product-rating {
  margin: 0 0 11px;
  color: var(--muted);
  font-size: 13px;
}

.product-rating i {
  margin-right: 3px;
  color: #e5a000;
}

.product-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.product-specs li {
  padding: 5px 8px;
  border-radius: 5px;
  background: var(--surface);
  color: #55555a;
  font-size: 12px;
}

.product-reason {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.product-reason strong {
  color: #49494d;
  font-weight: 650;
}

.product-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 16px;
  margin: 10px 0 0;
  color: #69696e;
  font-size: 12px;
  line-height: 1.45;
}

.product-notes span {
  display: inline-flex;
  align-items: flex-start;
  gap: 5px;
}

.product-notes i {
  margin-top: 2px;
  color: #85858a;
}

.product-side {
  display: grid;
  justify-items: end;
  text-align: right;
}

.score-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 14px;
  color: var(--success);
  font-size: 12px;
  font-weight: 650;
}

.product-price {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
}

.old-price {
  margin-top: 3px;
  color: #8a8a8f;
  font-size: 12px;
  text-decoration: line-through;
}

.product-link {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 14px;
  padding: 0 15px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.product-link:hover {
  background: #353537;
  color: #fff;
}

.product-count {
  color: var(--muted);
  font-size: 13px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  grid-template-columns: none;
  gap: 10px;
  margin-bottom: 28px;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
  background: transparent;
}

.filter-field {
  width: min(190px, 100%);
}

.filter-field > span {
  color: #85858a;
  font-size: 11px;
  font-weight: 600;
}

.product-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.product-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border: 0;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.055);
  transition: box-shadow 180ms ease, transform 180ms ease;
}

.product-card:hover {
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.09);
  transform: translateY(-3px);
}

.product-card .product-image {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 20px 20px 0 0;
  background: #f6f6f7;
}

.product-card .product-image img {
  padding: 18px;
  object-fit: contain;
}

.product-card-body {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  padding: 15px;
}

.product-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  color: #85858a;
  font-size: 11px;
  line-height: 1.3;
}

.product-card h4 {
  display: -webkit-box;
  min-height: 44px;
  margin: 0 0 9px;
  overflow: hidden;
  font-size: 16px;
  font-weight: 620;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.product-card .product-rating {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-bottom: 18px;
  color: #6e6e73;
  font-size: 12px;
}

.product-card .product-rating-empty {
  min-height: 17px;
}

.product-card-footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 0;
}

.product-price-wrap {
  min-width: 0;
}

.product-card .product-price {
  font-size: 17px;
  line-height: 1.25;
}

.product-card .old-price {
  display: block;
}

.product-card .product-link {
  width: 40px;
  height: 40px;
  min-height: 40px;
  flex: 0 0 40px;
  margin: 0;
  padding: 0;
  font-size: 18px;
}

.no-products,
.error-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  align-content: center;
  gap: 7px;
  color: var(--muted);
  text-align: center;
}

.result-message {
  display: grid;
  min-height: 420px;
  place-items: center;
  padding: 48px 20px;
  text-align: center;
}

.result-message strong {
  max-width: 560px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.45;
}

.no-products i,
.error-state i {
  margin-bottom: 4px;
  color: #8a8a8f;
  font-size: 30px;
}

.no-products strong,
.error-state strong {
  color: var(--ink);
  font-size: 16px;
}

.transparency-note {
  display: flex;
  gap: 12px;
  max-width: 800px;
  padding: 28px 0 60px;
  color: #7b7b80;
  font-size: 12px;
  line-height: 1.6;
}

.transparency-note i {
  flex: 0 0 auto;
  margin-top: 2px;
  font-size: 17px;
}

.transparency-note p {
  margin: 0;
}

.site-footer {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 clamp(20px, 4vw, 48px);
  border-top: 1px solid var(--line-soft);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--ink);
}

[hidden] {
  display: none !important;
}

.modal-backdrop.show {
  opacity: 0.28;
}

.followup-modal .modal-dialog {
  width: min(calc(100% - 28px), 520px);
  margin-right: auto;
  margin-left: auto;
}

.followup-modal .modal-content {
  border: 1px solid rgba(29, 29, 31, 0.1);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.16);
}

.followup-modal .modal-header {
  align-items: center;
  padding: 24px 24px 8px;
  border: 0;
}

.followup-modal .modal-title {
  font-size: 22px;
  font-weight: 620;
  line-height: 1.25;
}

.followup-modal .btn-close {
  width: 32px;
  height: 32px;
  margin: -5px -7px -5px auto;
  padding: 0;
  border-radius: 50%;
  background-size: 11px;
  opacity: 0.62;
}

.followup-modal .modal-body {
  padding: 18px 24px 8px;
}

.followup-modal-fields {
  display: grid;
  gap: 20px;
}

.followup-modal-field {
  display: grid;
  gap: 9px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 560;
  line-height: 1.45;
}

.followup-modal-field .form-control {
  min-height: 48px;
  border-color: var(--line);
  border-radius: 8px;
  color: var(--ink);
  box-shadow: none;
}

.followup-modal-field .form-control:focus {
  border-color: #8f8f94;
  box-shadow: 0 0 0 3px rgba(29, 29, 31, 0.08);
}

.followup-modal .modal-footer {
  padding: 20px 24px 24px;
  border: 0;
}

.followup-submit {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: var(--page);
  font-size: 14px;
  font-weight: 620;
}

.followup-submit:hover {
  background: #000000;
}

@media (max-width: 1100px) {
  .product-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .solution-list,
  .filters {
    grid-template-columns: 1fr;
  }

  .solution-item + .solution-item {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .solution-label {
    min-height: auto;
  }

  .product-item {
    grid-template-columns: 128px minmax(0, 1fr);
  }

  .product-image {
    width: 128px;
  }

  .product-side {
    grid-column: 2;
    justify-items: start;
    text-align: left;
  }

  .product-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-card .product-image {
    width: 100%;
  }
}

@media (max-width: 600px) {
  .site-header {
    height: 60px;
    padding: 0 14px;
  }

  .wordmark-small {
    width: 82px;
  }

  .mode-label {
    display: none;
  }

  .search-home {
    min-height: calc(100vh - 68px);
    padding: 90px 14px 110px;
  }

  .home-inner {
    width: calc(100vw - 28px);
    max-width: calc(100vw - 28px);
    margin-top: -1vh;
  }

  .wordmark-hero {
    width: min(220px, 60vw);
    margin-bottom: 30px;
  }

  .search-form-hero {
    min-height: 54px;
    padding-left: 14px;
  }

  .search-form-hero .search-tools {
    margin-left: 2px;
  }

  .search-leading {
    display: none;
  }

  .search-form textarea {
    font-size: 14px;
  }

  .search-tool,
  .search-submit {
    width: 35px;
    height: 35px;
  }

  .example-links {
    flex-wrap: nowrap;
    justify-content: flex-start;
    margin-right: -14px;
    margin-left: -14px;
    padding: 0 14px 5px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .example-links::-webkit-scrollbar {
    display: none;
  }

  .example-link {
    flex: 0 0 auto;
    max-width: 260px;
    text-align: left;
  }

  .results-view {
    padding-top: 72px;
  }

  .compact-search-wrap,
  .results-container {
    width: calc(100% - 28px);
  }

  .compact-search-wrap {
    margin-bottom: 30px;
  }

  .compact-search-wrap .search-tool {
    display: none;
  }

  .analysis-block h2 {
    font-size: 29px;
  }

  .possible-cause {
    font-size: 15px;
  }

  .section-title-row,
  .products-heading {
    align-items: flex-start;
  }

  .section-title-row h3,
  .products-heading h2 {
    font-size: 20px;
  }

  .solutions-block,
  .products-block {
    padding: 32px 0;
  }

  .followup-modal .modal-header {
    padding: 21px 20px 7px;
  }

  .followup-modal .modal-body {
    padding: 16px 20px 7px;
  }

  .followup-modal .modal-footer {
    padding: 18px 20px 20px;
  }

  .followup-submit {
    width: 100%;
  }

  .filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .filter-field {
    width: 100%;
  }

  .filter-field:first-child {
    grid-column: 1 / -1;
  }

  .product-list {
    grid-template-columns: 1fr;
  }

  .product-card .product-image {
    width: 100%;
  }

  .product-item {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 14px;
    padding: 20px 0;
  }

  .product-image {
    width: 88px;
  }

  .product-main h4 {
    font-size: 16px;
  }

  .product-specs {
    display: none;
  }

  .product-side {
    grid-column: 1 / -1;
    grid-template-columns: 1fr auto;
    width: 100%;
    align-items: end;
  }

  .score-pill {
    grid-column: 1;
    margin-bottom: 9px;
  }

  .product-price,
  .old-price {
    grid-column: 1;
  }

  .product-link {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: center;
    margin: 0;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    padding-top: 20px;
    padding-bottom: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition: none !important;
  }
}
