/* === Reset and base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary:       #1a3c34;
  --primary-hover: #234f45;
  --accent:        #ff0090;
  --accent-hover:  #d1007a;
  --bg:            #ffffff;
  --text:          #1a1a2e;
  --text-muted:    #5a6474;
  --divider:       #e3e6ea;
  --green:         #27ae60;
  --amber:         #e67e22;
  --red:           #c0392b;
  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover,
a:focus {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* === Header === */
header {
  background: var(--bg);
  padding: 3.5rem 1.5rem 2rem;
  border-bottom: 1px solid var(--divider);
}

.header-inner {
  max-width: 880px;
  margin: 0 auto;
}

h1 {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--primary);
  margin-bottom: 0.6rem;
}

.tagline {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 62ch;
}

/* === Controls === */
.controls {
  background: var(--bg);
  border-bottom: 1px solid var(--divider);
  padding: 1.5rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.controls-inner {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.75rem;
}

.search-wrap input {
  width: 100%;
  padding: 0.55rem 0;
  border: none;
  border-bottom: 1.5px solid var(--divider);
  border-radius: 0;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: transparent;
  transition: border-color 0.15s;
}

.search-wrap input::placeholder {
  color: var(--text-muted);
}

.search-wrap input:focus {
  outline: none;
  border-bottom-color: var(--accent);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 2.5rem;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.filter-group label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-group select {
  padding: 0.4rem 0;
  border: none;
  border-bottom: 1.5px solid var(--divider);
  border-radius: 0;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  transition: border-color 0.15s;
}

.filter-group select:focus {
  outline: none;
  border-bottom-color: var(--accent);
}

/* === Legend === */
.legend {
  max-width: 880px;
  margin: 1rem auto 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.9rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.legend-title {
  font-weight: 700;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* === Results === */
.results-section {
  flex: 1;
  padding: 2rem 1.5rem 3rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.results-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  min-height: 1.25rem;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
}

@media (max-width: 860px) {
  .results-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .results-grid { grid-template-columns: 1fr; }
}

/* === Tool card === */
.tool-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background: white;
  border-radius: 16px;
  box-shadow: 0 2px 14px rgba(26, 26, 46, 0.07);
  padding: 1.75rem;
  transition: box-shadow 0.2s, transform 0.2s;
}

.tool-card:hover {
  box-shadow: 0 8px 24px rgba(26, 26, 46, 0.11);
  transform: translateY(-2px);
}

.tool-logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #f4f6f9;
  object-fit: contain;
  padding: 6px;
}

.card-header {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.tool-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.3;
}

.category-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  white-space: nowrap;
}

.tool-description {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.6;
  flex: 1;
}

/* === Traffic lights === */
.traffic-lights {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 0.75rem;
}

.traffic-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: default;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-green { background: var(--green); }
.dot-amber { background: var(--amber); }
.dot-red   { background: var(--red); }

/* === Card footer === */
.card-footer {
  margin-top: auto;
  padding-top: 0.3rem;
}

.visit-link {
  display: inline-block;
  padding: 0.5rem 1.35rem;
  background: var(--accent);
  color: white;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  transition: background 0.15s;
}

.visit-link:hover,
.visit-link:focus {
  background: var(--accent-hover);
  color: white;
  outline: none;
  text-decoration: none;
}

/* === Utility === */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.hidden { display: none; }

.no-results {
  color: var(--text-muted);
  padding: 3rem 0;
  font-size: 0.95rem;
}

/* === Footer === */
footer {
  background: var(--bg);
  color: var(--text-muted);
  padding: 2rem 1.5rem;
  font-size: 0.85rem;
  line-height: 1.6;
  border-top: 1px solid var(--divider);
}

footer p {
  max-width: 880px;
  margin: 0 auto;
}

/* === Responsive === */
@media (max-width: 400px) {
  h1 { font-size: 1.7rem; }
}
