:root {
  --paper: #f2f5f3;
  --ink: #18332f;
  --petrol: #17564f;
  --petrol-dark: #0f403a;
  --label: #f2c14e;
  --blueprint: #dce7f4;
  --porcelain: #ffffff;
  --muted: #4a605b;
  --rule: #b8c8c2;
  --soft-rule: #d9e2de;
  --error: #a11d2d;
  --error-wash: #fce8e8;
  --category-accessibility: #2b6cb0;
  --category-assets: #2f855a;
  --category-sketching: #b83280;
  --category-testing: #c05621;
  --category-typography: #805ad5;
  color-scheme: light;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-synthesis: none;
}

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

html {
  min-width: 0;
  background: var(--paper);
  color: var(--ink);
  scroll-behavior: auto;
}

body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

button,
select,
label[for="saved-filter"] {
  -webkit-tap-highlight-color: transparent;
}

button,
a,
input,
select,
textarea {
  scroll-margin: 24px;
}

button {
  color: inherit;
}

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

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

img,
svg {
  display: block;
  max-width: 100%;
}

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

[hidden] {
  display: none !important;
}

.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;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: -100px;
  left: 16px;
  padding: 12px 16px;
  background: var(--label);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  border: 2px solid var(--ink);
}

.skip-link:focus {
  top: 16px;
}

:focus-visible {
  outline: 3px solid #2e6fdb;
  outline-offset: 3px;
}

.masthead :focus-visible {
  outline-color: var(--label);
}

.masthead {
  background: var(--petrol);
  color: var(--porcelain);
  border-bottom: 7px solid var(--label);
}

.masthead-inner {
  width: min(1184px, 100%);
  margin: 0 auto;
  padding: 30px 32px 28px;
}

.masthead-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 40px;
}

.brand-block {
  min-width: 0;
}

.brand-block h1 {
  margin-bottom: 8px;
  font-size: clamp(2.9rem, 5vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
  font-weight: 700;
}

.tagline {
  margin-bottom: 0;
  color: #eef7f3;
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  line-height: 1.3;
}

.masthead-actions {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 16px;
  padding-top: 3px;
}

#saved-count {
  min-width: 112px;
  padding: 9px 18px;
  background: var(--label);
  color: var(--ink);
  clip-path: polygon(0 0, calc(100% - 11px) 0, 100% 11px, 100% 100%, 0 100%);
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
}

.suggest-button {
  min-height: 46px;
  padding: 9px 17px;
  border: 2px solid var(--porcelain);
  border-radius: 0;
  background: transparent;
  color: var(--porcelain);
  font-weight: 700;
}

.suggest-button:not(:disabled):hover {
  background: var(--porcelain);
  color: var(--petrol-dark);
}

.product-summary {
  max-width: 66ch;
  margin: 22px 0 0;
  color: #d6e7e1;
  font-size: 0.98rem;
  line-height: 1.55;
}

.main-content {
  width: min(1184px, 100%);
  margin: 0 auto;
  padding: 30px 32px 0;
}

.library {
  min-width: 0;
}

.loading-state,
.load-error {
  border: 1px solid var(--rule);
  border-left: 6px solid var(--petrol);
  background: var(--porcelain);
}

.loading-state {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 104px;
  padding: 24px;
  font-size: 1.05rem;
  font-weight: 700;
}

.loading-mark {
  width: 18px;
  height: 24px;
  border: 3px solid var(--petrol);
  border-bottom-color: var(--label);
}

.load-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px;
}

.load-error p {
  margin-bottom: 0;
  font-weight: 700;
}

#retry-load,
#empty-reset {
  min-height: 46px;
  padding: 9px 16px;
  border: 2px solid var(--petrol);
  border-radius: 0;
  background: var(--petrol);
  color: var(--porcelain);
  font-weight: 700;
}

.storage-status {
  margin-top: 18px;
  padding: 12px 16px;
  border-left: 5px solid #8b5e00;
  background: #fff3cd;
  color: var(--ink);
  font-weight: 700;
}

.catalog-controls {
  border: 1px solid var(--rule);
  border-left: 6px solid var(--petrol);
  background: var(--porcelain);
  padding: 20px 22px 0;
}

.controls-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(190px, 0.42fr) minmax(156px, auto);
  gap: 18px;
  align-items: end;
}

.search-control,
.category-control {
  min-width: 0;
}

.search-control label,
.category-control label,
.form-field > label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 700;
}

input[type="search"],
input[type="text"],
input[type="url"],
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1.5px solid #758d86;
  border-radius: 0;
  background: var(--porcelain);
  color: var(--ink);
  font-size: 1rem;
}

input[type="search"],
input[type="text"],
input[type="url"],
select {
  min-height: 50px;
  padding: 11px 13px;
}

input[type="search"] {
  appearance: none;
}

input[type="search"]::-webkit-search-cancel-button {
  cursor: pointer;
}

select {
  padding-right: 36px;
}

textarea {
  min-height: 100px;
  max-height: 240px;
  padding: 12px 13px;
  line-height: 1.45;
  resize: vertical;
}

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

input:hover,
select:hover,
textarea:hover {
  border-color: var(--petrol);
}

.saved-control {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 10px 14px;
  border: 1.5px solid #758d86;
  background: var(--porcelain);
  font-size: 0.96rem;
  font-weight: 700;
  user-select: none;
}

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

.saved-control input {
  flex: 0 0 auto;
  width: 21px;
  height: 21px;
  margin: 0;
  accent-color: var(--petrol);
}

.catalog-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 52px;
  margin-top: 12px;
  border-top: 1px solid var(--soft-rule);
}

#result-count {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.clear-button {
  min-height: 44px;
  padding: 7px 0 7px 16px;
  border: 0;
  background: transparent;
  color: var(--petrol);
  font-size: 0.94rem;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
}

.clear-button:hover {
  color: var(--petrol-dark);
  text-decoration-thickness: 2.5px;
}

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

.tool-card {
  --category-color: var(--petrol);
  display: flex;
  min-width: 0;
  min-height: 100%;
  flex-direction: column;
  padding: 18px 20px 15px;
  border: 1px solid var(--rule);
  border-top: 6px solid var(--category-color);
  border-bottom: 4px solid var(--ink);
  border-radius: 0;
  background: var(--porcelain);
}

.tool-card.category-accessibility {
  --category-color: var(--category-accessibility);
}

.tool-card.category-assets {
  --category-color: var(--category-assets);
}

.tool-card.category-sketching {
  --category-color: var(--category-sketching);
}

.tool-card.category-testing {
  --category-color: var(--category-testing);
}

.tool-card.category-typography {
  --category-color: var(--category-typography);
}

.tool-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tool-category {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.save-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 82px;
  min-height: 44px;
  padding: 7px 11px;
  border: 1.5px solid var(--ink);
  border-radius: 0;
  background: var(--porcelain);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 700;
}

.save-button:hover,
.save-button[aria-pressed="true"] {
  background: var(--label);
}

.save-button svg {
  width: 13px;
  height: 17px;
}

.tool-card h3 {
  margin: 17px 0 9px;
  font-size: 1.43rem;
  line-height: 1.16;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}

.tool-summary {
  margin-bottom: 16px;
  color: #3d544e;
  line-height: 1.52;
}

.tool-best {
  margin-bottom: 16px;
  line-height: 1.45;
}

.tool-best strong,
.tool-best span {
  display: block;
}

.tool-best strong {
  margin-bottom: 3px;
  font-size: 0.87rem;
}

.tool-best span {
  color: var(--muted);
  font-size: 0.94rem;
}

.tool-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.tool-tags li {
  padding: 3px 7px 4px;
  border-bottom: 2px solid var(--rule);
  background: var(--paper);
  color: #3d544e;
  font-size: 0.79rem;
  line-height: 1.35;
}

.tool-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: auto;
  padding-top: 13px;
  border-top: 1px solid var(--soft-rule);
}

.tool-facts {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.tool-facts span {
  display: inline-block;
}

.tool-facts span + span {
  margin-left: 9px;
  padding-left: 9px;
  border-left: 1px solid var(--rule);
}

.visit-link {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 44px;
  color: var(--petrol);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
}

.visit-link:hover {
  color: var(--petrol-dark);
  text-decoration-thickness: 2.5px;
}

.empty-state {
  margin-top: 24px;
  padding: 28px;
  border: 1px solid var(--ink);
  border-left: 7px solid var(--label);
  background: #fff9e8;
}

.empty-state h2 {
  margin-bottom: 6px;
  font-size: 1.65rem;
  line-height: 1.2;
}

.empty-state p {
  margin-bottom: 18px;
}

.suggestions-section {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(0, 1.3fr);
  gap: 32px;
  margin-top: 54px;
  padding: 26px 28px;
  border-left: 6px solid #3e63c4;
  background: var(--blueprint);
}

.section-heading h2 {
  margin-bottom: 7px;
  font-size: 1.8rem;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.section-heading p {
  max-width: 48ch;
  margin-bottom: 0;
  color: #415a66;
  font-size: 0.94rem;
}

.suggestion-list {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.suggestion-list > p {
  margin: 0;
  padding: 16px 18px;
  border: 1px dashed #8199ad;
  background: rgb(255 255 255 / 48%);
  color: #415a66;
}

.suggestion-item {
  min-width: 0;
  padding: 16px 18px;
  border: 1px solid #9db2c3;
  border-bottom: 3px solid var(--ink);
  background: var(--porcelain);
}

.suggestion-item h3 {
  margin-bottom: 3px;
  font-size: 1.15rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.suggestion-category {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.suggestion-url {
  margin-bottom: 9px;
  color: #31526b;
  font-size: 0.87rem;
  overflow-wrap: anywhere;
}

.suggestion-notes {
  margin-bottom: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.faq-section {
  margin-top: 52px;
  padding-bottom: 50px;
}

.faq-section > .section-heading {
  margin-bottom: 20px;
}

.faq-items {
  border-top: 3px solid var(--ink);
}

.faq-item h3 {
  margin: 0;
}

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

.faq-trigger::after {
  content: "+";
  flex: 0 0 auto;
  color: var(--petrol);
  font-size: 1.55rem;
  font-weight: 400;
  line-height: 1;
}

.faq-trigger[aria-expanded="true"]::after {
  content: "−";
}

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

.faq-panel {
  max-width: 76ch;
  padding: 16px 36px 20px 2px;
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
}

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

.site-footer {
  width: min(1184px, 100%);
  margin: 0 auto;
  padding: 22px 32px 34px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.88rem;
}

.site-footer p {
  margin: 0;
}

#suggestion-dialog {
  width: min(610px, calc(100% - 32px));
  max-width: 610px;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 2px solid var(--ink);
  border-top: 8px solid var(--petrol);
  border-radius: 0;
  background: var(--porcelain);
  color: var(--ink);
}

#suggestion-dialog::backdrop {
  background: rgb(15 37 33 / 72%);
}

.dialog-inner {
  padding: 25px 28px 27px;
}

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

.dialog-heading h2 {
  margin-bottom: 6px;
  font-size: 1.85rem;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.dialog-heading p {
  max-width: 58ch;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

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

.label-detail {
  color: var(--muted);
  font-weight: 400;
}

.field-hint,
.field-error {
  margin: 5px 0 0;
  font-size: 0.82rem;
  line-height: 1.4;
}

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

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

[aria-invalid="true"] {
  border-color: var(--error) !important;
  border-width: 2px !important;
}

.suggestion-errors {
  margin-bottom: 18px;
  padding: 11px 14px;
  border-left: 5px solid var(--error);
  background: var(--error-wash);
  color: var(--error);
  font-weight: 700;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 23px;
  padding-top: 18px;
  border-top: 1px solid var(--soft-rule);
}

.cancel-button,
.submit-button {
  min-height: 48px;
  padding: 10px 17px;
  border: 2px solid var(--petrol);
  border-radius: 0;
  font-weight: 700;
}

.cancel-button {
  background: var(--porcelain);
  color: var(--petrol);
}

.submit-button {
  background: var(--petrol);
  color: var(--porcelain);
}

.cancel-button:hover {
  background: var(--paper);
}

.submit-button:hover,
#retry-load:hover,
#empty-reset:hover {
  background: var(--petrol-dark);
}

.toast {
  position: fixed;
  z-index: 30;
  right: 24px;
  bottom: 24px;
  max-width: calc(100% - 48px);
  padding: 13px 19px;
  border-left: 6px solid var(--label);
  background: var(--ink);
  color: var(--porcelain);
  font-weight: 700;
}

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

  .controls-grid {
    grid-template-columns: minmax(240px, 1fr) minmax(190px, 0.6fr);
  }

  .saved-control {
    grid-column: 1 / -1;
    justify-self: start;
    min-width: 160px;
  }

  .suggestions-section {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

@media (max-width: 680px) {
  .masthead-inner {
    padding: 25px 20px 24px;
  }

  .masthead-main {
    flex-direction: column;
    gap: 22px;
  }

  .brand-block h1 {
    font-size: clamp(2.55rem, 12.4vw, 3.5rem);
  }

  .masthead-actions {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding-top: 0;
  }

  #saved-count {
    min-width: 100px;
    min-height: 46px;
    padding: 10px 14px;
  }

  .suggest-button {
    min-height: 48px;
  }

  .product-summary {
    margin-top: 19px;
    font-size: 0.94rem;
  }

  .main-content {
    padding: 22px 18px 0;
  }

  .catalog-controls {
    padding: 18px 16px 0;
  }

  .controls-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 15px;
  }

  .saved-control {
    grid-column: auto;
    width: 100%;
    min-height: 50px;
  }

  .catalog-meta {
    margin-top: 12px;
  }

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

  .tool-card {
    padding: 17px 18px 14px;
  }

  .save-button {
    min-width: 88px;
    min-height: 46px;
  }

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

  .load-error {
    align-items: stretch;
    flex-direction: column;
    gap: 16px;
  }

  .empty-state {
    padding: 23px 20px;
  }

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

  .faq-section {
    margin-top: 42px;
    padding-bottom: 36px;
  }

  .faq-trigger {
    min-height: 66px;
    padding: 16px 0;
  }

  .site-footer {
    padding: 20px 18px 28px;
  }

  .dialog-inner {
    padding: 22px 19px 23px;
  }

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

  .cancel-button,
  .submit-button {
    width: 100%;
    min-height: 50px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .toast {
    right: 18px;
    bottom: 18px;
    max-width: calc(100% - 36px);
  }
}

@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;
    transition-delay: 0ms !important;
  }
}
