:root {
  color-scheme: light;
  --indigo: #182640;
  --indigo-soft: #2b3e5e;
  --ink: #1a273b;
  --muted: #536178;
  --paper: #f7f8f3;
  --canvas: #e9ede9;
  --white: #ffffff;
  --line: #cbd2cc;
  --line-strong: #9aa8b3;
  --acid: #c9f56f;
  --acid-dark: #466311;
  --focus: #235f9e;
  --error: #982b2b;
  --error-bg: #fff1f1;
  --warning-bg: #fff7e8;
  --shadow: 0 8px 24px rgba(20, 34, 54, 0.09);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

button,
input,
select,
textarea,
a {
  -webkit-tap-highlight-color: rgba(70, 99, 17, 0.16);
}

button {
  cursor: pointer;
}

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

input,
select,
textarea {
  caret-color: var(--indigo);
}

::selection {
  background: var(--acid);
  color: var(--indigo);
}

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

a {
  color: inherit;
  text-underline-offset: 4px;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 2000;
  top: 12px;
  left: 12px;
  transform: translateY(-180%);
  padding: 10px 16px;
  border-radius: 4px;
  background: var(--acid);
  color: var(--indigo);
  font-weight: 750;
  transition: transform 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

.product-header {
  --focus: var(--acid);
  padding: 24px 24px 54px;
  background: var(--indigo);
  color: var(--paper);
}

.header-inner,
.main-shell,
.footer-inner {
  width: 100%;
  margin-inline: auto;
}

.main-shell {
  max-width: 1296px;
}

.header-inner,
.footer-inner {
  max-width: 1248px;
}

.brand-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

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

.brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
}

.brand-lockup h1 {
  margin: 0;
  font-size: 1.75rem;
  line-height: 1.2;
  font-weight: 760;
  letter-spacing: -0.025em;
}

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

.saved-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 15px;
  border: 1px dashed #8390a6;
  border-radius: 4px;
  color: var(--paper);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  white-space: nowrap;
}

.product-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 560px);
  align-items: end;
  gap: 32px;
  margin-top: 18px;
}

.product-tagline {
  max-width: 26ch;
  margin: 0;
  font-size: 1.625rem;
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -0.025em;
}

.product-summary {
  max-width: 68ch;
  margin: 0;
  color: #c8d1df;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.main-shell {
  padding-inline: 24px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-weight: 720;
  line-height: 1.25;
  text-align: center;
  transition: background-color 160ms cubic-bezier(0.16, 1, 0.3, 1), border-color 160ms cubic-bezier(0.16, 1, 0.3, 1), color 160ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

.button-primary {
  border-color: var(--acid);
  background: var(--acid);
  color: #1b2b16;
  box-shadow: 0 4px 14px rgba(7, 18, 30, 0.15);
}

.button-primary:hover:not(:disabled) {
  border-color: #d8ff91;
  background: #d8ff91;
  box-shadow: 0 6px 18px rgba(7, 18, 30, 0.2);
}

.button-primary:active:not(:disabled) {
  background: #b6e451;
  box-shadow: 0 2px 8px rgba(7, 18, 30, 0.14);
}

.button-secondary {
  border-color: var(--line-strong);
  background: var(--white);
  color: var(--ink);
}

.button-secondary:hover:not(:disabled) {
  border-color: var(--indigo-soft);
  background: #eef2ed;
}

.button-secondary:active:not(:disabled) {
  background: #e2e8e1;
}

.library-section {
  margin-bottom: 72px;
}

.filter-panel {
  position: relative;
  margin-top: -40px;
  padding: 22px 24px 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

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

.filter-heading h2 {
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.35;
  font-weight: 760;
  letter-spacing: -0.012em;
}

#result-count {
  flex: 0 0 auto;
  margin: 0;
  color: var(--indigo-soft);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  font-weight: 760;
  white-space: nowrap;
}

.filter-controls {
  display: grid;
  grid-template-columns: minmax(240px, 1.6fr) minmax(180px, 0.9fr) auto auto;
  align-items: end;
  gap: 16px;
}

.form-field {
  min-width: 0;
}

.form-field > label {
  display: block;
  margin-bottom: 7px;
  color: #34435b;
  font-size: 0.8125rem;
  font-weight: 730;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--white);
  color: var(--ink);
  line-height: 1.4;
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: #647188;
  opacity: 1;
}

.form-field input:hover:not(:disabled),
.form-field select:hover:not(:disabled),
.form-field textarea:hover:not(:disabled) {
  border-color: var(--indigo-soft);
}

.form-field input[aria-invalid="true"],
.form-field select[aria-invalid="true"],
.form-field textarea[aria-invalid="true"] {
  border-color: var(--error);
  background: #fffafa;
}

.saved-control {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding-inline: 2px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  gap: 10px;
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 680;
  cursor: pointer;
  white-space: nowrap;
}

.checkbox-label input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--acid-dark);
}

.storage-status {
  margin: 20px 0 0;
  padding: 12px 16px;
  border: 1px solid #bd8a43;
  border-radius: 4px;
  background: var(--warning-bg);
  color: #6b430e;
  font-weight: 650;
}

.loading-state {
  margin-top: 24px;
  padding: 26px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  background: var(--paper);
}

.loading-state p {
  margin: 0 0 18px;
  font-weight: 680;
}

.loading-skeleton {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.loading-skeleton span {
  display: block;
  height: 88px;
  border: 1px solid #d5dcd6;
  border-radius: 4px;
  background: #e2e7e1;
}

.load-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 24px;
  padding: 20px;
  border: 1px solid #d5a1a1;
  border-radius: 6px;
  background: var(--error-bg);
}

.load-error h2 {
  margin: 0 0 6px;
  color: #7f2525;
  font-size: 1.125rem;
}

.load-error p {
  margin: 0;
  color: #7f2525;
}

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

.tool-card {
  display: flex;
  min-width: 0;
  min-height: 100%;
  flex-direction: column;
  padding: 22px;
  border: 1px solid #c7d0ca;
  border-radius: 6px;
  background: var(--white);
  box-shadow: 0 3px 12px rgba(20, 34, 54, 0.045);
  transition: border-color 170ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 170ms cubic-bezier(0.16, 1, 0.3, 1);
}

.tool-card:hover {
  border-color: #97a5b0;
  box-shadow: 0 8px 22px rgba(20, 34, 54, 0.08);
}

.tool-card[data-saved="true"] {
  border-color: #789642;
}

.tool-card-header {
  margin-bottom: 14px;
}

.tool-name {
  margin: 0;
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1.25;
  font-weight: 760;
  letter-spacing: -0.018em;
  overflow-wrap: anywhere;
}

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

.tool-summary {
  margin: 0 0 16px;
  color: #34435a;
  line-height: 1.55;
}

.tool-best-for {
  margin: 0 0 16px;
  padding-top: 14px;
  border-top: 1px dashed #bdc8bf;
}

.field-label {
  margin: 0 0 5px;
  color: #46566d;
  font-size: 0.75rem;
  font-weight: 760;
}

.tool-best-for p:last-child {
  margin: 0;
  color: #34435a;
  line-height: 1.5;
}

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

.tool-tags li {
  padding: 4px 8px;
  border-radius: 3px;
  background: #edf1ec;
  color: #405168;
  font-size: 0.75rem;
  line-height: 1.3;
}

.tool-details {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin: auto 0 14px;
  padding-top: 14px;
  border-top: 1px solid #e0e5df;
}

.tool-detail {
  display: flex;
  gap: 6px;
  margin: 0;
}

.tool-detail dt {
  color: var(--muted);
  font-size: 0.75rem;
}

.tool-detail dd {
  margin: 0;
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 730;
}

.tool-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}

.visit-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  color: #24547f;
  font-size: 0.9375rem;
  font-weight: 740;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

.visit-link:hover {
  color: #153b5e;
  text-decoration-thickness: 2px;
}

.save-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  min-height: 44px;
  flex: 0 0 auto;
  gap: 9px;
  padding: 9px 13px;
  border: 1px solid #94a2ad;
  border-radius: 4px;
  background: var(--white);
  color: #243950;
  font-weight: 740;
  line-height: 1.2;
  transition: background-color 170ms cubic-bezier(0.16, 1, 0.3, 1), border-color 170ms cubic-bezier(0.16, 1, 0.3, 1), color 170ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

.save-button[aria-pressed="true"],
.save-button[aria-pressed="true"]:hover {
  border-color: #719335;
  background: var(--acid);
  color: #1c2b15;
}

.save-marker {
  position: relative;
  display: block;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border: 1px dashed currentColor;
  border-radius: 50%;
}

.save-marker::before,
.save-marker::after {
  position: absolute;
  top: 9px;
  left: 4px;
  width: 12px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  content: "";
  transform: rotate(45deg) scaleX(0);
  transform-origin: center;
  transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.save-marker::after {
  transform: rotate(-45deg) scaleX(0);
}

.save-button[aria-pressed="true"] .save-marker::before {
  transform: rotate(45deg) scaleX(1);
}

.save-button[aria-pressed="true"] .save-marker::after {
  transform: rotate(-45deg) scaleX(1);
}

.save-label {
  min-width: 40px;
  text-align: left;
}

.empty-state {
  margin-top: 24px;
  padding: 34px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  background: var(--paper);
  text-align: center;
}

.empty-state h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
  line-height: 1.3;
}

.empty-state p {
  max-width: 55ch;
  margin: 0 auto 18px;
  color: var(--muted);
}

.suggestions-section,
.faq-section {
  margin-bottom: 64px;
}

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

.section-heading h2 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  line-height: 1.25;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.section-heading p {
  max-width: 68ch;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.local-note {
  flex: 0 0 auto;
  padding-bottom: 4px;
  border-bottom: 1px dashed #9ca9a1;
  color: #4a5d50;
  font-size: 0.8125rem;
  font-weight: 680;
  white-space: nowrap;
}

.suggestion-list {
  border-top: 1px solid var(--line);
}

.no-suggestions {
  margin: 0;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

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

.suggestion-item h3 {
  min-width: 0;
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.suggestion-category {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 680;
}

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

.suggestion-url {
  color: #2b506f;
  font-size: 0.875rem;
}

.suggestion-notes {
  max-width: 72ch;
  color: #3f4e61;
  white-space: pre-wrap;
}

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

.faq-item {
  border-bottom: 1px solid var(--line);
}

.faq-heading {
  margin: 0;
}

.faq-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 58px;
  gap: 18px;
  padding: 15px 2px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 730;
  line-height: 1.4;
  text-align: left;
}

.faq-trigger:hover {
  color: #315c3a;
}

.faq-indicator {
  display: block;
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  margin-right: 5px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transform-origin: center;
  transition: transform 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

.faq-trigger[aria-expanded="true"] .faq-indicator {
  transform: rotate(225deg) translate(-2px, -2px);
}

.faq-panel {
  padding: 0 42px 20px 2px;
}

.faq-panel p {
  max-width: 72ch;
  margin: 0;
  color: #46576d;
  line-height: 1.6;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--paper);
  padding: 26px 24px 32px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  color: var(--muted);
  font-size: 0.875rem;
}

.footer-inner p {
  margin: 0;
}

#suggestion-dialog {
  width: min(600px, calc(100vw - 32px));
  max-width: 600px;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid #9eabb6;
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(8, 18, 32, 0.28);
}

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

.suggestion-form {
  padding: 26px;
}

.dialog-header {
  margin-bottom: 22px;
}

.dialog-header h2 {
  margin: 0 0 7px;
  font-size: 1.5rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.dialog-header p {
  max-width: 60ch;
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.form-errors {
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid #c97e7e;
  border-radius: 4px;
  background: var(--error-bg);
  color: #7f2525;
  font-weight: 680;
}

.suggestion-form .form-field {
  margin-bottom: 16px;
}

.form-field textarea {
  min-height: 104px;
  max-height: 260px;
  resize: vertical;
}

.field-hint,
.field-error {
  margin: 6px 0 0;
  font-size: 0.75rem;
  line-height: 1.45;
}

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

.field-error {
  color: var(--error);
  font-size: 0.8125rem;
  font-weight: 680;
}

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

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

.toast {
  position: fixed;
  z-index: 1500;
  right: 24px;
  bottom: 24px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 14px 18px;
  border: 1px solid #66856b;
  border-radius: 6px;
  background: #1f3d2b;
  color: #f3fff0;
  box-shadow: 0 10px 28px rgba(13, 30, 21, 0.24);
  font-weight: 700;
}

@media (max-width: 1050px) {
  .filter-controls {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  }

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

  .loading-skeleton {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .product-header {
    padding: 20px 16px 44px;
  }

  .brand-line {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

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

  .product-copy {
    display: block;
    margin-top: 16px;
  }

  .product-tagline {
    font-size: 1.5rem;
  }

  .product-summary {
    display: none;
  }

  .main-shell {
    padding-inline: 16px;
  }

  .filter-panel {
    margin-top: -36px;
    padding: 18px 16px;
  }

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

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

  .search-control,
  #clear-filters {
    grid-column: 1 / -1;
  }

  .category-control {
    grid-column: 1;
  }

  .saved-control {
    grid-column: 2;
    align-self: end;
    min-height: 46px;
    padding: 0;
  }

  .form-field input,
  .form-field select {
    min-height: 44px;
  }

  #clear-filters {
    width: 100%;
  }

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

  .tool-grid {
    margin-top: 20px;
  }

  .library-section {
    margin-bottom: 56px;
  }

  .section-heading {
    display: block;
  }

  .local-note {
    display: inline-block;
    margin-top: 12px;
  }

  .suggestions-section,
  .faq-section {
    margin-bottom: 52px;
  }

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

  .toast {
    right: 16px;
    bottom: 16px;
  }
}

@media (max-width: 430px) {
  .brand-lockup h1 {
    font-size: 1.625rem;
  }

  #suggest-tool {
    flex: 1 1 auto;
  }

  .filter-heading {
    align-items: flex-start;
    gap: 12px;
  }

  .filter-heading h2 {
    max-width: 19ch;
  }

  .tool-card {
    padding: 20px;
  }

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

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

  .suggestion-form {
    padding: 22px 18px;
  }

  .dialog-actions .button {
    flex: 1 1 0;
    padding-inline: 12px;
  }
}

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

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
