.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.grid {
  display: grid;
  /* slightly smaller min width to fit four items in category views */
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-lg);
  margin-top: var(--space-lg);
}

.card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);

  background: var(--color-surface);
  padding: var(--space-md);
  border-radius: var(--radius-md);

  border: 1px solid var(--color-border);

  box-shadow: var(--shadow-sm);

  text-decoration: none;
  color: var(--color-text);

  cursor: pointer;

  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    border-color 0.15s ease;
}

.card-icon {
  font-size: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
}

.card-content {
  flex: 1;
  min-width: 0;
}

.card-content h3 {
  margin: 0 0 4px 0;
  font-size: 16px;
}

.card-content p {
  margin: 0;
  font-size: 14px;
}

h2 {
  margin-top: var(--space-md);
}

.card:hover {
  transform: translateY(-4px);

  box-shadow: 0 10px 24px rgba(0,0,0,0.08);

  border-color: var(--color-primary);
}

.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);

  /* reduce bottom padding to almost none for small gap after subtitle */
  padding: calc(var(--space-md)/3) 0 var(--space-xs) 0;
}

.site-header h1 {
  /* tighten header text spacing as well */
  margin-bottom: 2px;
}

.site-header p {
  margin-bottom: 0; /* remove extra gap below subtitle */
}

.tool-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
}

.tool-icon {
  font-size: 64px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
}

.tool-header-content {
  flex: 1;
}

.site-header h1 {
  font-size: 32px;
  margin-bottom: 6px;
}

.site-header p {
  color: var(--color-text-muted);
}

.navbar {
  background: var(--color-primary);
}

.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 14px 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;

  font-weight: bold;
  font-size: 18px;
  color: white;

  text-decoration: none;
}

.logo-img {
  height: 32px;
  width: auto;
  display: block;
}

.nav-links a {
  margin-left: var(--space-md);
  color: white;

  opacity: 0.9;

  transition: opacity 0.15s ease;
}

.nav-links a:hover {
  opacity: 1;
  text-decoration: underline;
}

.lang-selector {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: var(--space-md);
}

.lang-selector button {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: white;
  opacity: 0.9;
}

.lang-selector button:hover {
  opacity: 1;
}

.search-container {
  flex: 1;
  max-width: 300px;
  position: relative;
  margin: 0 var(--space-lg);
}

.search-input {
  width: 100%;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-sm);
  color: white;
  font-size: 14px;
  transition: all 0.15s ease;
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.search-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  max-height: 400px;
  overflow-y: auto;
  margin-top: 8px;
  z-index: 1000;
}

.search-result-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background-color 0.15s ease;
  text-decoration: none;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background-color: var(--color-surface);
}

.search-result-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.search-result-info {
  flex: 1;
  min-width: 0;
}

.search-result-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.search-result-description {
  font-size: 12px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-no-results {
  padding: 16px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 14px;
}

main {
  flex: 1;
}

.page-content {
  flex: 1;
  /* reduce vertical padding for tighter layout */
  padding: var(--space-sm) 0;
}