:root {
  color-scheme: light;
  --paper: #F3F5F2;
  --card: #FFFFFF;
  --ink: #17221E;
  --pencil: #5D6963;
  --mint: #DFEAE3;
  --blue: #2855C7;
  --error: #9C3B32;
  --line: rgba(23, 34, 30, 0.17);
  --font-body: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

button,
select,
input[type="checkbox"] {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

[hidden] {
  display: none !important;
}

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

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

#app {
  min-height: 100vh;
}

.shell {
  width: min(1280px, calc(100% - 96px));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 12px;
  left: 12px;
  padding: 12px 16px;
  background: var(--ink);
  color: var(--card);
  text-decoration: none;
  transform: translateY(-180%);
}

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

.site-header {
  border-bottom: 1px solid var(--line);
}

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 48px;
  align-items: start;
  padding-block: 38px 32px;
}

.brand-line {
  display: flex;
  gap: 16px;
  align-items: center;
}

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

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

h1 {
  margin-bottom: 0;
  font-family: var(--font-display);
  font-size: clamp(46px, 4.6vw, 66px);
  font-weight: 700;
  letter-spacing: -0.052em;
  line-height: 0.98;
}

.tagline {
  margin: 17px 0 7px;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.018em;
}

.product-summary {
  max-width: 67ch;
  margin-bottom: 0;
  color: var(--pencil);
  font-size: 15px;
  line-height: 1.6;
}

.header-actions {
  display: flex;
  gap: 18px;
  align-items: center;
  padding-top: 5px;
}

#saved-count {
  min-width: 92px;
  margin-bottom: 0;
  padding: 12px 15px;
  border-left: 4px solid var(--blue);
  background: var(--mint);
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border: 1.5px solid transparent;
  border-radius: 2px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
}

.button-primary {
  border-color: var(--blue);
  background: var(--blue);
  color: var(--card);
}

.button-primary:hover:not(:disabled) {
  box-shadow: inset 0 0 0 999px rgba(0, 0, 0, 0.13);
}

.button-secondary {
  border-color: var(--ink);
  background: transparent;
  color: var(--ink);
}

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

.main-content {
  padding-block: 30px 72px;
}

.storage-status {
  margin-bottom: 22px;
  padding: 14px 18px;
  border-left: 4px solid var(--blue);
  background: var(--mint);
  font-weight: 600;
}

.loading-state,
.load-error {
  min-height: 280px;
  padding: 48px;
  border: 1px solid var(--line);
  background: var(--card);
}

.loading-state {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: center;
}

.loading-state p {
  margin-bottom: 0;
  font-size: 18px;
  font-weight: 600;
}

.loading-index {
  width: 34px;
  height: 42px;
  border: 2px solid var(--blue);
  border-top: 8px solid var(--blue);
}

.load-error {
  border-left: 5px solid var(--error);
}

.load-error h2 {
  margin-bottom: 12px;
  font-size: 28px;
}

.load-error p {
  margin-bottom: 24px;
}

.section-heading {
  display: flex;
  gap: 24px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-heading h2,
.suggestions-section h2,
.faq-section h2 {
  margin-bottom: 0;
  font-size: 29px;
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1.2;
}

#result-count {
  margin-bottom: 0;
  color: var(--pencil);
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

.filters {
  display: grid;
  grid-template-columns: minmax(250px, 1fr) 218px auto auto;
  gap: 14px;
  align-items: end;
  padding: 19px;
  border-left: 4px solid var(--blue);
  background: var(--mint);
}

.filter-group {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
}

.filter-group > label:not(.saved-toggle),
.form-field > label {
  font-size: 14px;
  font-weight: 700;
}

.search-control {
  position: relative;
}

.search-control svg {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 20px;
  height: 20px;
  color: var(--pencil);
  pointer-events: none;
  transform: translateY(-50%);
}

input,
select,
textarea {
  width: 100%;
  border: 1.5px solid rgba(23, 34, 30, 0.35);
  border-radius: 2px;
  background: var(--card);
}

input,
select {
  min-height: 48px;
  padding: 10px 13px;
}

textarea {
  min-height: 110px;
  padding: 12px 13px;
  line-height: 1.5;
  resize: vertical;
}

input[type="search"] {
  padding-left: 43px;
}

input::placeholder,
textarea::placeholder {
  color: var(--pencil);
  opacity: 1;
}

.saved-filter-group {
  align-self: end;
}

.saved-toggle {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1.5px solid rgba(23, 34, 30, 0.35);
  border-radius: 2px;
  background: var(--card);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.saved-toggle input {
  width: 20px;
  min-width: 20px;
  height: 20px;
  min-height: 20px;
  margin: 0;
  padding: 0;
  accent-color: var(--blue);
}

.clear-button {
  min-width: 116px;
  background: var(--card);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.tool-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 0 22px 22px;
  border: 1px solid var(--line);
  background: var(--card);
}

.tool-topline {
  display: flex;
  min-height: 58px;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  margin: 0 -22px 21px;
  border-bottom: 1px solid var(--line);
}

.tool-category {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  margin-left: 17px;
  padding: 5px 12px;
  border-left: 4px solid var(--blue);
  background: var(--mint);
  font-size: 13px;
  font-weight: 700;
}

.save-button {
  display: inline-flex;
  min-width: 88px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-right: 7px;
  padding: 8px 11px;
  border: 1.5px solid var(--blue);
  border-radius: 2px;
  background: var(--card);
  color: var(--blue);
  font-size: 14px;
  font-weight: 750;
}

.save-button:hover {
  background: var(--mint);
}

.save-button[aria-pressed="true"] {
  background: var(--blue);
  color: var(--card);
}

.save-icon {
  width: 15px;
  height: 18px;
  flex: 0 0 auto;
}

.save-icon path {
  fill: transparent;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linejoin: round;
}

.save-button[aria-pressed="true"] .save-icon path {
  fill: currentColor;
}

.tool-name {
  margin-bottom: 10px;
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.025em;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.tool-summary {
  margin-bottom: 17px;
  line-height: 1.55;
}

.tool-best-for {
  margin-bottom: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.tool-best-for h4 {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 750;
}

.tool-best-for p {
  margin-bottom: 0;
  color: var(--pencil);
  font-size: 14px;
  line-height: 1.55;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 13px;
  margin: 0 0 18px;
  padding: 0;
  color: var(--pencil);
  font-size: 13px;
  list-style: none;
}

.tag-list li {
  overflow-wrap: anywhere;
}

.tool-card-footer {
  margin-top: auto;
}

.tool-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 0 0 15px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.tool-meta dt {
  color: var(--pencil);
  font-size: 12px;
}

.tool-meta dd {
  margin: 2px 0 0;
  font-size: 14px;
  font-weight: 700;
}

.visit-link {
  display: inline-flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--blue);
  border-radius: 2px;
  color: var(--blue);
  font-weight: 750;
  text-decoration: none;
}

.visit-link:hover {
  background: var(--blue);
  color: var(--card);
}

.empty-state {
  margin-top: 24px;
  padding: 42px;
  border: 1.5px dashed var(--pencil);
  background: var(--card);
}

.empty-state h3 {
  margin-bottom: 8px;
  font-size: 23px;
}

.empty-state p {
  margin-bottom: 22px;
  color: var(--pencil);
}

.suggestions-section {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 52px;
  margin-top: 64px;
  padding: 34px;
  background: var(--mint);
}

.suggestions-intro p,
.faq-intro p {
  max-width: 49ch;
  margin: 13px 0 22px;
  color: var(--pencil);
  line-height: 1.65;
}

.suggestion-list {
  min-width: 0;
}

.suggestion-empty {
  margin-bottom: 0;
  padding: 28px;
  border: 1.5px dashed var(--pencil);
  background: var(--card);
  color: var(--pencil);
}

.suggestion-item {
  padding: 22px;
  border: 1px solid var(--line);
  background: var(--card);
}

.suggestion-item + .suggestion-item {
  margin-top: 12px;
}

.suggestion-item-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.suggestion-item h3 {
  margin-bottom: 0;
  font-size: 20px;
  overflow-wrap: anywhere;
}

.suggestion-item-category {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-left: 3px solid var(--blue);
  background: var(--mint);
  font-size: 12px;
  font-weight: 700;
}

.suggestion-detail {
  margin-bottom: 0;
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.suggestion-detail + .suggestion-detail {
  margin-top: 9px;
}

.suggestion-detail strong {
  display: inline-block;
  min-width: 58px;
  margin-right: 8px;
}

.faq-section {
  display: grid;
  grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr);
  gap: 64px;
  margin-top: 58px;
}

.faq-intro p {
  margin-bottom: 0;
}

.faq-list {
  border-top: 1px solid var(--ink);
}

.faq-trigger {
  display: flex;
  width: 100%;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 17px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  text-align: left;
}

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

.faq-symbol {
  flex: 0 0 auto;
  color: var(--blue);
  font-size: 26px;
  font-weight: 400;
  line-height: 1;
}

.faq-panel {
  padding: 20px 0 24px;
  border-bottom: 1px solid var(--line);
}

.faq-panel p {
  max-width: 67ch;
  margin-bottom: 0;
  color: var(--pencil);
  line-height: 1.65;
}

.site-footer {
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: flex;
  gap: 24px;
  justify-content: space-between;
  padding-block: 24px 32px;
  color: var(--pencil);
  font-size: 14px;
}

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

.footer-inner p:first-child {
  color: var(--ink);
  font-weight: 750;
}

#suggestion-dialog {
  width: min(600px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  overflow-y: auto;
  border: 1px solid var(--ink);
  border-top: 6px solid var(--blue);
  border-radius: 3px;
  background: var(--card);
  color: var(--ink);
}

#suggestion-dialog::backdrop {
  background: rgba(23, 34, 30, 0.58);
}

#suggestion-form {
  padding: 27px;
}

.dialog-heading {
  margin-bottom: 24px;
}

.dialog-heading h2 {
  margin-bottom: 6px;
  font-size: 29px;
  letter-spacing: -0.035em;
}

.dialog-heading p {
  margin-bottom: 0;
  color: var(--pencil);
}

#suggestion-errors {
  margin-bottom: 22px;
  padding: 13px 16px;
  border-left: 4px solid var(--error);
  background: rgba(156, 59, 50, 0.08);
}

#suggestion-errors p {
  margin-bottom: 0;
  color: var(--error);
  font-weight: 750;
}

.form-field {
  margin-top: 18px;
}

.form-field > label {
  display: block;
  margin-bottom: 7px;
}

.optional {
  margin-left: 6px;
  color: var(--pencil);
  font-size: 12px;
  font-weight: 400;
}

.field-hint,
.field-error {
  margin: 6px 0 0;
  font-size: 13px;
}

.field-hint {
  color: var(--pencil);
}

.field-error {
  color: var(--error);
  font-weight: 650;
}

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

[aria-invalid="true"] {
  border: 2px solid var(--error);
}

.dialog-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 26px;
  padding-top: 21px;
  border-top: 1px solid var(--line);
}

#toast {
  position: fixed;
  z-index: 30;
  bottom: 24px;
  left: 50%;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 14px 20px;
  border-left: 4px solid var(--blue);
  background: var(--ink);
  color: var(--card);
  font-weight: 700;
  transform: translateX(-50%);
}

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

  .filters {
    grid-template-columns: minmax(0, 1fr) 218px;
  }

  .saved-filter-group,
  .clear-button {
    align-self: end;
  }

  .saved-toggle,
  .clear-button {
    width: 100%;
  }

  .masthead {
    gap: 28px;
  }
}

@media (max-width: 700px) {
  .shell {
    width: calc(100% - 32px);
  }

  .masthead {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
    padding-block: 27px 25px;
  }

  .brand-line {
    gap: 10px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  h1 {
    font-size: 43px;
  }

  .tagline {
    margin-top: 15px;
    font-size: 19px;
  }

  .product-summary {
    font-size: 14px;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
    padding-top: 0;
  }

  .main-content {
    padding-block: 24px 48px;
  }

  .section-heading h2,
  .suggestions-section h2,
  .faq-section h2 {
    font-size: 26px;
  }

  .filters {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 16px;
  }

  .button,
  .save-button,
  .visit-link {
    min-height: 46px;
  }

  .tool-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    margin-top: 18px;
  }

  .tool-card {
    padding-inline: 18px;
  }

  .tool-topline {
    margin-inline: -18px;
  }

  .loading-state,
  .load-error,
  .empty-state {
    min-height: 0;
    padding: 28px 22px;
  }

  .loading-state {
    flex-direction: column;
    text-align: center;
  }

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

  .suggestions-section {
    margin-top: 42px;
    padding: 24px 20px;
  }

  .suggestions-intro p {
    margin-bottom: 18px;
  }

  .suggestion-item-header {
    flex-direction: column;
    gap: 10px;
  }

  .suggestion-detail strong {
    display: block;
    margin: 0 0 2px;
  }

  .faq-section {
    margin-top: 40px;
  }

  .faq-intro p {
    margin-bottom: 0;
  }

  .faq-trigger {
    font-size: 17px;
  }

  .footer-inner {
    flex-direction: column;
    gap: 7px;
  }

  #suggestion-form {
    padding: 22px 19px;
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .dialog-actions .button {
    width: 100%;
    min-height: 46px;
  }

  #toast {
    bottom: 16px;
  }
}

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

  *,
  *::before,
  *::after {
    animation: none !important;
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
