:root {
  color-scheme: light;
  --cloth: #eef0eb;
  --chalk: #fafbf7;
  --ink: #20251f;
  --muted: #566057;
  --rule: #b9c0b6;
  --indigo: #293d5c;
  --indigo-dark: #1d2e47;
  --indigo-soft: #e2e7ed;
  --madder: #973f35;
  --madder-soft: #f5e5e1;
  --ochre: #e0b653;
  --sage: #dce5d9;
  --focus-color: #973f35;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
  scroll-behavior: smooth;
  scrollbar-color: var(--indigo) var(--cloth);
  scrollbar-width: thin;
}

body {
  margin: 0;
  min-width: 0;
  background: var(--cloth);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
}

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

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

button {
  cursor: pointer;
}

button:disabled,
fieldset:disabled input,
fieldset:disabled select,
fieldset:disabled label {
  cursor: not-allowed;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #7f897e;
  border-radius: 3px;
  background: var(--chalk);
  color: var(--ink);
  caret-color: var(--madder);
}

input,
select {
  min-height: 44px;
  padding: 9px 11px;
}

textarea {
  min-height: 104px;
  padding: 10px 11px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #667066;
  opacity: 1;
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border: 2px solid var(--madder);
  background: #fff8f6;
}

select {
  appearance: auto;
}

a {
  color: var(--indigo);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--madder);
}

::selection {
  background: var(--ochre);
  color: var(--ink);
}

:focus-visible {
  outline: 3px solid var(--focus-color);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

h2 {
  margin-bottom: 5px;
  font-size: clamp(1.3rem, 2vw, 1.55rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h3 {
  line-height: 1.25;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 10px;
  left: 12px;
  padding: 10px 14px;
  background: var(--chalk);
  color: var(--indigo);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.product-header {
  --focus-color: #f5c75f;
  border-bottom: 4px dashed var(--madder);
  background: var(--indigo);
  color: var(--chalk);
}

.product-header__inner,
#main-content,
.site-footer {
  width: min(100% - 40px, 1248px);
  margin-inline: auto;
}

.product-header__inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 28px;
  padding-block: 20px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 13px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  color: var(--ochre);
}

#product-name {
  margin-bottom: 0;
  font-size: 1.85rem;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

#product-tagline {
  margin: 3px 0 0;
  color: #e3e9f0;
  font-size: 0.92rem;
}

.header-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 14px;
}

#saved-count {
  min-width: 76px;
  margin: 0;
  color: var(--chalk);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.product-summary {
  max-width: 62ch;
  margin: 0;
  padding: 0;
  color: #e3e9f0;
  font-size: 0.88rem;
  line-height: 1.4;
}

@media (max-width: 900px) {
  .product-header__inner {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px 20px;
  }

  .product-summary {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 3px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.button svg {
  width: 18px;
  height: 18px;
  margin-right: 7px;
  flex: 0 0 auto;
}

.button--primary {
  border-color: var(--indigo);
  background: var(--indigo);
  color: #fff;
}

.button--primary:hover {
  border-color: var(--indigo-dark);
  background: var(--indigo-dark);
  color: #fff;
}

.button--secondary {
  border-color: #7f897e;
  background: var(--chalk);
  color: var(--ink);
}

.button--secondary:hover {
  background: var(--sage);
  color: var(--ink);
}

.button--ochre {
  border-color: var(--ochre);
  background: var(--ochre);
  color: #20251f;
}

.button--ochre:hover {
  border-color: #f0cb78;
  background: #f0cb78;
  color: #20251f;
}

.button:disabled {
  border-color: #89928b;
  background: #c8cdc6;
  color: #4e564e;
  opacity: 1;
}

#main-content {
  padding-block: 20px 48px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 13px;
}

.section-heading p:not(#result-count),
.section-copy p {
  max-width: 68ch;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

#result-count {
  flex: 0 0 auto;
  margin-bottom: 2px;
  padding: 4px 9px;
  border: 1px solid #9ba59a;
  border-radius: 3px;
  background: var(--sage);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

#storage-status {
  margin-bottom: 14px;
  padding: 11px 13px;
  border: 1px solid #8c6b25;
  border-radius: 3px;
  background: #fff2c9;
  color: #42320f;
  font-weight: 650;
}

.filter-band {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) minmax(170px, 0.85fr) auto auto;
  align-items: end;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 11px 12px 12px;
  border: 1px solid #9ba59a;
  border-radius: 4px;
  background: #e2e7de;
}

.filter-band:disabled {
  opacity: 0.68;
}

.field {
  min-width: 0;
}

.field label,
.form-field label {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 750;
}

.saved-control {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #7f897e;
  border-radius: 3px;
  background: var(--chalk);
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.saved-control:has(input:checked) {
  border-color: var(--indigo);
  background: var(--indigo-soft);
}

.saved-control input {
  width: 19px;
  height: 19px;
  min-height: 0;
  margin: 0 8px 0 0;
  padding: 0;
  accent-color: var(--indigo);
}

.loading-state,
.load-error,
.empty-state {
  margin-top: 18px;
  padding: 28px;
  border: 1px solid #9ba59a;
  border-radius: 4px;
  background: var(--chalk);
  text-align: center;
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  font-weight: 650;
}

.loading-seam {
  width: 50px;
  border-top: 3px dashed var(--madder);
}

.load-error h3,
.empty-state h3 {
  margin-bottom: 7px;
  font-size: 1.2rem;
}

.load-error p,
.empty-state p {
  margin-bottom: 18px;
  color: var(--muted);
}

.load-error {
  border-color: var(--madder);
  background: var(--madder-soft);
}

#tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.tool-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 282px;
  flex-direction: column;
  padding: 15px 16px 14px;
  overflow: hidden;
  border: 1px solid #a7afa5;
  border-radius: 4px;
  background: var(--chalk);
}

.tool-card.is-saved {
  border-color: var(--indigo);
  background: #f6f8f4;
}

.save-seam {
  position: absolute;
  top: 6px;
  right: 13px;
  left: 13px;
  border-top: 3px dashed var(--madder);
  opacity: 0;
  pointer-events: none;
  transform-origin: left center;
}

.tool-card.is-saved .save-seam {
  opacity: 1;
  animation: stitch-in 220ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes stitch-in {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.tool-card__heading {
  margin-bottom: 2px;
}

.tool-card__heading h3 {
  margin-bottom: 0;
  color: var(--indigo-dark);
  font-size: 1.08rem;
  letter-spacing: -0.015em;
}

.tool-category {
  display: inline-block;
  margin-bottom: 9px;
  padding: 2px 7px;
  border: 1px solid #a2ada1;
  border-radius: 2px;
  background: var(--sage);
  color: #2f3b31;
  font-size: 0.7rem;
  font-weight: 750;
}

.tool-summary {
  margin-bottom: 9px;
  color: #374138;
  font-size: 0.86rem;
  line-height: 1.42;
}

.tool-best-for {
  margin-bottom: 9px;
  color: #374138;
  font-size: 0.82rem;
  line-height: 1.4;
}

.tool-best-for strong {
  color: var(--ink);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: auto 0 10px;
  padding: 0;
  list-style: none;
}

.tag-list li {
  padding: 2px 6px;
  border: 1px solid #c0c7bd;
  border-radius: 2px;
  color: #4f594f;
  font-size: 0.68rem;
  line-height: 1.35;
}

.tool-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 9px;
  padding-top: 7px;
  border-top: 1px solid #d0d5cd;
  color: #4b554c;
  font-size: 0.73rem;
}

.tool-meta strong {
  color: var(--ink);
  font-weight: 700;
}

.tool-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 9px;
}

.visit-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--indigo);
  border-radius: 3px;
  color: var(--indigo);
  font-size: 0.85rem;
  font-weight: 750;
  text-decoration: none;
}

.visit-link:hover {
  background: var(--indigo-soft);
  color: var(--indigo-dark);
}

.save-button {
  min-width: 88px;
  border-color: var(--indigo);
  background: var(--indigo);
  color: #fff;
  font-size: 0.82rem;
}

.save-button:hover {
  border-color: var(--indigo-dark);
  background: var(--indigo-dark);
}

.save-button[aria-pressed="true"] {
  border-color: var(--madder);
  background: var(--madder);
  color: #fff;
}

.save-button[aria-pressed="true"]:hover {
  border-color: #783029;
  background: #783029;
}

.suggestions-section,
.faq-section {
  display: grid;
  grid-template-columns: minmax(210px, 0.72fr) minmax(0, 1.55fr);
  gap: 36px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 2px solid var(--indigo);
}

.section-copy h2 {
  margin-bottom: 8px;
}

#suggestion-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.suggestion-empty {
  padding: 18px 0;
  border-top: 1px dashed #8f998e;
  border-bottom: 1px dashed #8f998e;
  color: var(--muted);
}

.suggestion-item {
  padding: 15px 0;
  border-bottom: 1px solid #b9c0b6;
  overflow-wrap: anywhere;
}

.suggestion-item:first-child {
  padding-top: 0;
}

.suggestion-item h3 {
  margin-bottom: 4px;
  font-size: 1rem;
}

.suggestion-item p {
  margin-bottom: 4px;
  font-size: 0.85rem;
}

.suggestion-item .suggestion-category {
  color: var(--madder);
  font-weight: 700;
}

.suggestion-item .suggestion-notes {
  margin-top: 7px;
  margin-bottom: 0;
  color: #465047;
  white-space: pre-wrap;
}

.faq-list {
  border-top: 1px solid #8f998e;
}

.faq-item {
  border-bottom: 1px solid #8f998e;
}

.faq-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 52px;
  gap: 18px;
  padding: 12px 2px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 750;
  text-align: left;
}

.faq-trigger:hover {
  color: var(--madder);
}

.faq-trigger svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.faq-trigger[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.faq-panel {
  padding: 8px 36px 17px 2px;
  color: #465047;
  font-size: 0.92rem;
}

.faq-panel p {
  max-width: 72ch;
  margin-bottom: 0;
}

.site-footer {
  padding-block: 18px 28px;
  border-top: 1px dashed #8f998e;
  color: var(--muted);
  font-size: 0.82rem;
}

.site-footer p {
  margin-bottom: 0;
}

#suggestion-dialog {
  width: min(560px, calc(100% - 32px));
  max-width: 560px;
  max-height: min(94vh, 840px);
  max-height: min(94dvh, 840px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--indigo);
  border-radius: 5px;
  background: var(--cloth);
  color: var(--ink);
  box-shadow: 0 20px 60px rgba(20, 29, 38, 0.28);
}

#suggestion-dialog::backdrop {
  background: rgba(20, 29, 38, 0.62);
}

#suggestion-form {
  padding: 18px;
}

.dialog-heading {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed #8f998e;
}

.dialog-heading h2 {
  margin-bottom: 6px;
}

.dialog-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

#suggestion-errors {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--madder);
  border-radius: 3px;
  background: var(--madder-soft);
  color: #682a24;
  font-weight: 650;
}

.form-field {
  margin-bottom: 10px;
}

.form-field input,
.form-field select,
.form-field textarea {
  background: var(--chalk);
}

.form-field textarea {
  min-height: 82px;
}

.label-optional,
.field-hint {
  color: var(--muted);
  font-weight: 400;
}

.field-hint {
  margin: 4px 0 0;
  font-size: 0.76rem;
}

.field-error {
  margin: 4px 0 0;
  color: #7d2f27;
  font-size: 0.8rem;
  font-weight: 650;
}

.field-error:empty {
  display: none;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #b9c0b6;
}

#toast {
  position: fixed;
  z-index: 30;
  right: 18px;
  bottom: 18px;
  max-width: calc(100vw - 36px);
  padding: 13px 17px;
  border: 1px solid var(--indigo-dark);
  border-radius: 4px;
  background: var(--indigo);
  color: #fff;
  box-shadow: 0 10px 30px rgba(20, 29, 38, 0.24);
  font-weight: 700;
}

@media (max-width: 1100px) {
  #tool-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-band {
    grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.7fr);
  }

  .saved-control,
  #clear-filters {
    width: 100%;
  }
}

@media (max-width: 680px) {
  .product-header__inner,
  #main-content,
  .site-footer {
    width: min(100% - 28px, 1248px);
  }

  .product-header__inner {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    padding-block: 16px;
  }

  .brand-lockup {
    order: 0;
  }

  .header-actions {
    order: 1;
    justify-content: space-between;
    width: 100%;
  }

  .product-summary {
    order: 2;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  #main-content {
    padding-top: 22px;
  }

  .section-heading {
    align-items: flex-start;
  }

  .section-heading p:not(#result-count) {
    max-width: 38ch;
  }

  .filter-band {
    grid-template-columns: minmax(0, 1fr);
    gap: 11px;
  }

  #tool-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .tool-card {
    min-height: 0;
  }

  .suggestions-section,
  .faq-section {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    margin-top: 34px;
  }
}

@media (max-width: 420px) {
  .brand-mark {
    width: 36px;
    height: 36px;
  }

  #product-name {
    font-size: 1.65rem;
  }

  .header-actions {
    gap: 9px;
  }

  .section-heading {
    gap: 10px;
  }

  .section-heading p:not(#result-count) {
    font-size: 0.84rem;
  }

  .tool-actions {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  #suggestion-form {
    padding: 18px;
  }

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

  #toast {
    right: 14px;
    bottom: 14px;
    left: 14px;
    max-width: none;
    text-align: center;
  }
}

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

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