:root {
  --drawer: #E8EEF0;
  --label: #FFFEFA;
  --ink: #172827;
  --pine: #205849;
  --cobalt: #3155C6;
  --pencil: #647471;
  --rule: rgba(23, 40, 39, 0.2);
  --error: #9E3531;
  --error-bg: #FCECE8;
  --display: "Trebuchet MS", "Segoe UI", sans-serif;
  --body: "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  scroll-behavior: auto;
}

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

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

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

button,
select {
  cursor: pointer;
}

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

button {
  border: 0;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

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

::selection {
  background: var(--cobalt);
  color: var(--label);
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 12px;
  left: 12px;
  padding: 12px 18px;
  background: var(--ink);
  color: var(--label);
  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;
}

.masthead {
  width: 100%;
  max-width: 1328px;
  margin: 0 auto;
  padding: 30px 32px 22px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
}

.brand-lockup {
  min-width: 0;
  max-width: 720px;
}

#product-name {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(44px, 5.4vw, 68px);
  font-weight: 800;
  letter-spacing: -0.065em;
  line-height: 0.98;
}

.shelf-drawing {
  width: min(100%, 390px);
  height: 25px;
  margin-top: 5px;
  color: var(--cobalt);
}

.tagline {
  margin: 3px 0 0;
  color: var(--pine);
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  flex: 0 0 auto;
  padding-bottom: 4px;
}

#saved-count {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 8px 15px;
  border: 1px solid var(--rule);
  background: rgba(255, 254, 250, 0.45);
  color: var(--pine);
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

.button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 18px;
  border: 1.5px solid transparent;
  border-radius: 3px;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}

.button svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.button-primary {
  background: var(--cobalt);
  border-color: var(--cobalt);
  color: #FFFFFF;
}

.button-primary:hover:not(:disabled) {
  background: var(--ink);
  border-color: var(--ink);
}

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

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

.app-main {
  width: 100%;
  max-width: 1328px;
  margin: 0 auto;
  padding: 0 32px 64px;
  flex: 1;
}

.control-deck {
  padding: 20px;
  border: 1px solid var(--rule);
  border-left: 5px solid var(--pine);
  background: var(--label);
}

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

.search-field {
  position: relative;
}

.search-field > svg {
  position: absolute;
  top: 50%;
  left: 16px;
  width: 23px;
  height: 23px;
  color: var(--pencil);
  transform: translateY(-50%);
  pointer-events: none;
}

#tool-search {
  width: 100%;
  height: 56px;
  padding: 10px 44px 10px 50px;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  background: #FFFFFF;
  font-size: 18px;
  appearance: none;
}

#tool-search::-webkit-search-cancel-button {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

#tool-search::placeholder,
textarea::placeholder,
input::placeholder {
  color: #6A7774;
  opacity: 1;
}

.filter-row {
  display: grid;
  grid-template-columns: minmax(190px, 280px) auto 1fr;
  align-items: end;
  gap: 20px;
  margin-top: 16px;
}

.category-control select {
  width: 100%;
  min-height: 48px;
  padding: 9px 38px 9px 12px;
  border: 1.5px solid var(--rule);
  border-radius: 2px;
  background-color: #FFFFFF;
}

.saved-toggle {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid transparent;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.saved-toggle:hover {
  border-color: var(--rule);
}

#saved-filter {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--cobalt);
  flex: 0 0 auto;
}

#result-count {
  justify-self: end;
  margin: 0 0 12px;
  color: var(--pencil);
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
}

.storage-status {
  margin-top: 16px;
  padding: 13px 16px;
  border-left: 4px solid var(--cobalt);
  background: var(--label);
  color: var(--ink);
}

.state-panel {
  margin-top: 20px;
  padding: 34px 24px;
  border: 1px dashed var(--pencil);
  background: rgba(255, 254, 250, 0.65);
  text-align: center;
}

.state-panel h2 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: 24px;
}

.state-panel p {
  margin: 0 auto 18px;
  max-width: 56ch;
}

#loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--pine);
  font-family: var(--display);
  font-weight: 700;
}

.loading-mark {
  width: 20px;
  height: 20px;
  border: 2px solid var(--rule);
  border-top-color: var(--cobalt);
  border-radius: 50%;
  animation: loading-turn 900ms linear infinite;
}

@keyframes loading-turn {
  to { transform: rotate(360deg); }
}

.state-error {
  border-style: solid;
  border-color: var(--error);
  background: var(--error-bg);
}

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

.tool-card {
  --binding: var(--pine);
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-top: 6px solid var(--binding);
  border-radius: 3px;
  background: var(--label);
}

.category-accessibility { --binding: var(--cobalt); }
.category-typography { --binding: var(--pine); }
.category-assets { --binding: var(--ink); }
.category-testing { --binding: var(--pencil); }
.category-sketching { --binding: var(--pine); }

.tool-card-body {
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 19px 20px 20px;
}

.tool-card-head {
  min-width: 0;
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  margin-bottom: 16px;
}

.tool-glyph {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule);
  background: var(--drawer);
  color: var(--binding);
}

.tool-glyph svg {
  width: 43px;
  height: 43px;
}

.tool-heading {
  min-width: 0;
}

.tool-category {
  margin: 0 0 4px;
  color: var(--pine);
  font-size: 13px;
  font-weight: 700;
}

.tool-card h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.tool-summary {
  margin: 0 0 16px;
  font-size: 16px;
  line-height: 1.55;
}

.best-for {
  margin: 0 0 16px;
  padding: 11px 13px;
  border-left: 3px solid var(--binding);
  background: var(--drawer);
  font-size: 14px;
  line-height: 1.5;
}

.best-for strong {
  display: block;
  margin-bottom: 2px;
  color: var(--pine);
  font-family: var(--display);
  font-size: 13px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.tag-list li {
  padding: 2px 7px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  color: var(--pencil);
  font-size: 12px;
  line-height: 1.5;
}

.tool-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: auto 0 17px;
  padding-top: 13px;
  border-top: 1px solid var(--rule);
}

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

.tool-meta dd {
  margin: 1px 0 0;
  font-family: var(--display);
  font-size: 14px;
  font-weight: 700;
}

.tool-actions {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 10px;
}

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

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

.suggestions,
.faq {
  margin-top: 58px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--ink);
}

.section-heading h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 26px;
  letter-spacing: -0.03em;
}

.section-heading p {
  margin: 0;
  max-width: 58ch;
  color: var(--pencil);
  font-size: 14px;
  text-align: right;
}

.no-suggestions {
  margin: 0;
  padding: 22px 0;
  color: var(--pencil);
}

.suggestion-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--rule);
}

.suggestion-item h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: var(--display);
  font-size: 20px;
}

.suggestion-category {
  align-self: start;
  padding: 3px 8px;
  border: 1px solid var(--pine);
  color: var(--pine);
  font-size: 13px;
  font-weight: 700;
}

.suggestion-url,
.suggestion-notes {
  grid-column: 1 / -1;
  margin: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.suggestion-url {
  color: var(--cobalt);
  font-size: 14px;
}

.suggestion-notes {
  max-width: 75ch;
  margin-top: 6px;
}

.faq-items {
  border-bottom: 1px solid var(--rule);
}

.faq-item {
  border-top: 1px solid var(--rule);
}

.faq-item:first-child {
  border-top: 0;
}

.faq-heading {
  margin: 0;
}

.faq-trigger {
  position: relative;
  width: 100%;
  min-height: 58px;
  padding: 15px 52px 15px 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  text-align: left;
}

.faq-trigger::after {
  content: "+";
  position: absolute;
  top: 50%;
  right: 8px;
  color: var(--cobalt);
  font-size: 27px;
  font-weight: 400;
  transform: translateY(-50%);
}

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

.faq-panel {
  max-width: 78ch;
  padding: 0 48px 20px 0;
  color: #344542;
}

.faq-panel p {
  margin: 0;
}

.app-footer {
  width: 100%;
  max-width: 1328px;
  margin: 0 auto;
  padding: 22px 32px 28px;
  display: flex;
  justify-content: space-between;
  gap: 32px;
  border-top: 1px solid var(--rule);
  color: var(--pencil);
  font-size: 13px;
}

.app-footer p {
  margin: 0;
  max-width: 72ch;
}

.app-footer p:last-child {
  flex: 0 0 auto;
}

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

#suggestion-dialog::backdrop {
  background: rgba(23, 40, 39, 0.66);
}

#suggestion-form {
  padding: 26px 28px 28px;
}

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

.dialog-heading h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 32px;
  letter-spacing: -0.04em;
}

.dialog-heading p:last-child {
  margin: 6px 0 0;
  max-width: 52ch;
  color: var(--pencil);
  font-size: 14px;
}

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

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

.form-field > label span {
  color: var(--pencil);
  font-weight: 400;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1.5px solid var(--pencil);
  border-radius: 2px;
  background: #FFFFFF;
}

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

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

.field-error {
  min-height: 0;
  margin: 5px 0 0;
  color: var(--error);
  font-size: 13px;
  font-weight: 600;
}

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

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

.toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 22px;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 13px 20px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--label);
  font-family: var(--display);
  font-weight: 700;
  transform: translateX(-50%);
}

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

  .masthead {
    align-items: center;
  }

  .app-footer {
    flex-direction: column;
    gap: 10px;
  }

  .app-footer p:last-child {
    flex: initial;
  }
}

@media (max-width: 720px) {
  .masthead {
    padding: 24px 20px 18px;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 18px;
  }

  .brand-lockup {
    width: 100%;
  }

  .shelf-drawing {
    max-width: 330px;
  }

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

  .app-main {
    padding: 0 20px 48px;
  }

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

  #result-count {
    grid-column: 1 / -1;
    justify-self: start;
    margin: -6px 0 0;
  }

  .section-heading {
    display: block;
  }

  .section-heading p {
    margin-top: 4px;
    text-align: left;
  }

  .app-footer {
    padding-right: 20px;
    padding-left: 20px;
  }
}

@media (max-width: 640px) {
  .tool-grid {
    grid-template-columns: minmax(0, 1fr);
    margin-top: 16px;
  }

  .control-deck {
    padding: 16px;
  }

  .filter-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-top: 12px;
  }

  .saved-toggle {
    justify-self: start;
    margin-left: 0;
    padding-right: 8px;
    padding-left: 8px;
  }

  #result-count {
    grid-column: 1 / -1;
    margin: 2px 0 0;
  }

  .tool-card-body {
    padding: 16px;
  }

  .tool-card-head,
  .tool-summary,
  .best-for {
    margin-bottom: 12px;
  }

  .tag-list,
  .tool-meta {
    margin-bottom: 14px;
  }

  .tool-meta {
    padding-top: 11px;
  }

  .suggestions,
  .faq {
    margin-top: 44px;
  }

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

  .suggestion-category {
    justify-self: start;
  }
}

@media (max-width: 420px) {
  .masthead {
    padding: 18px 16px 12px;
    gap: 12px;
  }

  #product-name {
    font-size: 40px;
  }

  .shelf-drawing {
    height: 18px;
    margin-top: 2px;
  }

  .tagline {
    margin-top: 0;
    font-size: 14px;
    line-height: 1.4;
  }

  .header-actions {
    gap: 10px;
  }

  #saved-count {
    padding-right: 11px;
    padding-left: 11px;
  }

  .app-main {
    padding-right: 16px;
    padding-left: 16px;
  }

  .control-deck {
    padding: 12px;
  }

  #tool-search {
    height: 50px;
    font-size: 16px;
  }

  .saved-toggle {
    gap: 7px;
    font-size: 14px;
  }

  .tool-actions .button {
    padding-right: 10px;
    padding-left: 10px;
  }

  #suggestion-dialog {
    width: calc(100% - 24px);
    max-height: calc(100dvh - 24px);
  }

  #suggestion-form {
    padding: 18px 18px 16px;
  }

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

  .dialog-heading h2 {
    font-size: 29px;
  }

  .dialog-heading p:last-child {
    margin-top: 4px;
    font-size: 13px;
    line-height: 1.45;
  }

  .suggestion-errors {
    margin-bottom: 12px;
    padding: 10px 12px;
    font-size: 14px;
  }

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

  .form-field > label {
    margin-bottom: 5px;
  }

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

  .field-error {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.4;
  }

  .dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1.35fr;
    gap: 10px;
    margin-top: 16px;
    padding-top: 14px;
  }

  .dialog-actions .button {
    padding-right: 10px;
    padding-left: 10px;
  }
}

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

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