.strain-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.strain-summary-card {
  display: grid;
  align-content: start;
  gap: 16px;
  min-height: 0;
  padding: 18px;
  cursor: default;
}

.strain-summary-card:hover {
  transform: none;
}

.strain-summary-card .strain-card-head {
  align-items: flex-start;
}

.strain-summary-card .strain-card-head h3 {
  margin-bottom: 6px;
  font-size: 21px;
}

.strain-summary-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel-border);
}

.strain-summary-metrics > span {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px 10px;
  background: var(--panel-strong);
}

.strain-summary-metrics small,
.strain-summary-freshness {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.42;
}

.strain-summary-metrics strong {
  font-size: 16px;
}

.strain-summary-freshness {
  margin: 0;
}

.chip.is-unknown {
  color: var(--muted);
}

@media (max-width: 1080px) {
  .strain-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  body {
    padding-bottom: calc(78px + env(safe-area-inset-bottom));
  }

  .app-mode-toggle {
    position: fixed;
    top: auto;
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    left: max(10px, env(safe-area-inset-left));
    justify-content: stretch;
    border-radius: 18px;
  }

  .app-mode-toggle a {
    flex: 1 1 0;
    min-width: 0;
    min-height: 48px;
    padding: 0 8px;
    font-size: 12px;
    text-align: center;
  }

  .strain-grid {
    grid-template-columns: 1fr;
  }

  .strain-summary-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .database-quick-chips button,
  .result-toolbar-actions button,
  .jump-top-btn {
    min-height: 44px;
  }

  .range-stack input[type="range"] {
    min-height: 44px;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Final cascade for the simplified search-first shell. */
body .page-shell {
  width: min(1040px, calc(100% - 32px));
  padding-top: clamp(24px, 5vw, 64px);
  padding-bottom: 112px;
}

body .topbar {
  display: block;
  width: min(880px, 100%);
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body .topbar .brand {
  max-width: 720px;
}

body .topbar .brand h1 {
  margin-top: 8px;
  font-size: clamp(36px, 6vw, 68px);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

body .topbar .intro-copy {
  display: block;
  max-width: 620px;
  margin-top: 16px;
  font-size: clamp(15px, 2vw, 18px);
  line-height: 1.55;
}

body .database-search-panel {
  position: static;
  top: auto;
  z-index: auto;
  display: block;
  width: min(880px, 100%);
  margin: clamp(22px, 4vw, 38px) auto 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  transform: none;
}

body .database-search-panel:focus-within {
  border-color: transparent;
  box-shadow: none;
  transform: none;
}

body .database-search-head {
  display: block;
  margin-bottom: 12px;
}

body .database-search-title {
  display: block;
  text-align: left;
}

body .database-search-title strong {
  display: block;
  font-size: 14px;
  letter-spacing: 0.01em;
}

body .database-search-title span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

body .database-search-field {
  position: relative;
  display: block;
  padding: 0;
}

body .database-search-field #search-label {
  display: block;
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body .database-search-field input {
  width: 100%;
  min-height: 68px;
  padding: 0 58px 0 24px;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--line));
  border-radius: 22px;
  background: color-mix(in srgb, var(--panel) 96%, white);
  color: var(--ink);
  font-size: clamp(17px, 2.2vw, 21px);
  box-shadow: 0 18px 50px rgba(26, 43, 34, 0.1);
}

body .database-search-field input:focus {
  border-color: var(--accent);
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--accent) 17%, transparent),
    0 20px 54px rgba(26, 43, 34, 0.13);
}

body .database-quick-chips,
body .database-search-field > .field-note,
body #database-layout,
body .result-toolbar,
body .workflow-strip,
body #jump-top {
  display: none !important;
}

body .database-detail {
  width: min(920px, 100%);
  margin: 24px auto 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body.database-detail-open .topbar,
body.database-detail-open .database-search-panel {
  display: none !important;
}

@media (max-width: 680px) {
  body .page-shell {
    width: min(100% - 24px, 1040px);
    padding-top: 18px;
    padding-bottom: calc(104px + env(safe-area-inset-bottom));
  }

  body .topbar .brand h1 {
    margin-top: 6px;
    font-size: clamp(34px, 9.5vw, 40px);
    line-height: 1.02;
  }

  body .topbar .intro-copy {
    display: none;
  }

  body .database-search-panel {
    margin-top: 16px;
  }

  body .database-search-head {
    margin-bottom: 9px;
  }

  body .database-search-field input {
    min-height: 58px;
    padding: 0 50px 0 18px;
    border-radius: 18px;
    font-size: 17px;
  }

  body .database-detail {
    margin-top: 0;
  }

  body.database-detail-open .page-shell {
    padding-top: 18px;
  }
}

/* Long product, grower, and shop names should expand cards, never escape them. */
body .database-search-panel {
  padding: clamp(14px, 2vw, 20px);
  border: 1px solid var(--line);
  border-radius: 24px;
}

.page-shell,
.layout,
.main-stack,
.panel,
.database-detail,
.database-search-panel,
.discovery-card,
.discovery-card-copy,
.strain-card,
.strain-card-copy,
.shop-card,
.shop-card-copy,
.fresh-shop-row,
.fresh-shop-copy,
.listing-card,
.menu-listing-card,
.menu-listing-main,
.comparison-card,
.comparison-card-copy,
.selected-pill,
.selected-pill-main,
.common-shop-card,
.quick-answer-row {
  min-width: 0;
  max-width: 100%;
}

.page-shell,
.database-detail,
.panel {
  overflow-x: clip;
}

.discovery-card-copy strong,
.fresh-shop-name,
.fresh-shop-meta,
.fresh-shop-date strong,
.fresh-shop-date span,
.fresh-shop-menu-preview strong,
.fresh-shop-menu-preview span,
.shop-card-copy strong,
.shop-card-meta,
.strain-card h3,
.menu-listing-title,
.listing-card strong,
.menu-listing-card strong,
.listing-card-meta,
.menu-listing-meta,
.selected-pill-main,
.selected-pill-main > span,
.comparison-card h3 {
  max-width: 100%;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

.listing-card-price,
.menu-listing-price,
.price-judgement,
.average-comparison,
.strain-menu-chip,
.shop-card-metrics span {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.card-actions,
.listing-card-actions,
.shop-card-actions,
.quick-answer-actions,
.common-shop-card-actions,
.side-action-row {
  min-width: 0;
}

.card-actions > *,
.listing-card-actions > *,
.shop-card-actions > *,
.quick-answer-actions > *,
.common-shop-card-actions > *,
.side-action-row > * {
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}

.search-scope-row {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr);
  align-items: center;
  gap: 10px;
}

body .search-scope-row label {
  display: block;
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.search-scope-row select {
  width: 100%;
  min-height: 44px;
  padding: 9px 38px 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background-color: var(--panel-alt);
  color: var(--ink);
  font-weight: 800;
}

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

@media (max-width: 680px) {
  body .database-search-panel {
    padding: 12px;
    border-radius: 18px;
  }

  .search-scope-row {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 7px;
  }

  .search-scope-row select {
    min-height: 46px;
    border-radius: 14px;
  }

  .discovery-card {
    align-items: center;
    height: auto;
    min-height: 76px;
  }

  .discovery-card-copy strong {
    line-height: 1.25;
  }

  .listing-card-head,
  .shop-card-head,
  .strain-card-head,
  .price-guide-head,
  .shop-menu-hero-head {
    min-width: 0;
  }

  .listing-card-price,
  .menu-listing-price {
    align-self: flex-start;
    line-height: 1.35;
  }

  .availability-tags,
  .listing-card-actions,
  .shop-card-actions,
  .common-shop-card-actions,
  .quick-answer-actions {
    width: 100%;
  }

  .availability-tags .strain-menu-chip {
    flex: 1 1 auto;
    min-width: 0;
  }

  .database-search-field input {
    min-width: 0;
  }
}

/* Keep the search and menu content ahead of decorative atmosphere. */
body .topbar .brand h1 {
  max-width: 760px;
  font-size: clamp(30px, 4.2vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

body .topbar .intro-copy {
  margin-top: 12px;
  font-size: 16px;
}

body .database-search-panel {
  margin-top: 24px;
  box-shadow: none;
}

body .database-search-field input {
  min-height: 58px;
  border-radius: 16px;
  font-size: 18px;
  box-shadow: 0 4px 14px rgba(26, 43, 34, 0.06);
}

body .database-search-field input:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

body .discovery-card {
  border-radius: 14px;
  box-shadow: none;
}

body .discovery-card:hover,
body .discovery-card:focus-visible {
  transform: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent);
}

body .discovery-card-copy strong {
  font-size: 15px;
  line-height: 1.4;
}

body .discovery-card-copy small {
  font-size: 12px;
  line-height: 1.5;
}

body .detail-header-copy h2 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.12;
}

body .age-badge,
body .listing-card .chip,
body .menu-listing-card .chip {
  max-width: 100%;
  white-space: normal;
  line-height: 1.45;
}

body .database-data-note {
  width: min(880px, 100%);
  margin: 12px auto 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

body.database-detail-open .database-data-note {
  width: min(920px, 100%);
  margin-bottom: 16px;
}

body::before,
body::after {
  opacity: 0.28;
}

body .smoke-plume {
  opacity: 0.06;
}

@media (max-width: 680px) {
  body .topbar .brand h1 {
    font-size: clamp(27px, 7.4vw, 34px);
    line-height: 1.1;
  }

  body .database-search-panel {
    margin-top: 16px;
  }

  body .database-search-field input {
    font-size: 17px;
  }

  body .discovery-card {
    padding: 13px;
  }
}
