/* Closely matches v1 hackergrep.com homepage */

body {
  font-family: system-ui, -apple-system, Segoe UI, sans-serif;
  background: #f8f9fa;
  color: #222;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

main {
  max-width: 700px;
  margin: 2rem auto 0 auto;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  padding: 2rem 2rem 1rem 2rem;
  background: #fff;
  color: #232c3b;
}

.logo-link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  margin: 0 auto 1.2rem;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  container-type: inline-size;
  container-name: logo;
}

.logo-link:hover .ascii-logo {
  border-color: #0074d9;
}

/*
 * Full 73-char ASCII wordmark must fit without horizontal scroll.
 * Monospace glyph width ≈ 0.6em → use ~44–48 divisor of container width.
 * iPhone SE (375px) content ≈ 320–340px → font-size ≈ 7px still readable.
 */
.ascii-logo {
  font-family: 'Fira Mono', Menlo, Consolas, ui-monospace, monospace;
  font-size: min(0.93rem, calc(100cqi / 46));
  margin: 0;
  background: #23252b;
  color: #fff;
  border: 1px solid #292c31;
  padding: 0.35em 0.4em;
  white-space: pre;
  line-height: 1.12;
  text-align: center;
  border-radius: 6px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  display: block;
  box-sizing: border-box;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  /* Slight tighten helps fit on narrow screens without looking broken */
  letter-spacing: -0.01em;
}

/* Fallback when container queries unsupported */
@supports not (font-size: 1cqi) {
  .ascii-logo {
    font-size: clamp(0.4rem, 2.15vw, 0.93rem);
  }
}

#search-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

#q,
#search-input {
  flex: 1;
  min-width: 0;
  padding: 0.65rem 0.85rem;
  border: 1px solid #d0d7e2;
  border-radius: 7px;
  background: #fff;
  color: #222;
  font: inherit;
  font-size: 1rem;
}

button {
  border: 1px solid transparent;
  background: #0074d9;
  color: #fff;
  border-radius: 7px;
  padding: 0.55rem 1rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.95rem;
}

button:hover,
button.active {
  background: #005fa3;
}

#syntax-toggle {
  font-size: 0.97rem;
  color: #0074d9;
  cursor: pointer;
  margin-bottom: 0.3rem;
  user-select: none;
}

#syntax-toggle:hover {
  text-decoration: underline;
}

#syntax-help {
  background: #f4f7fa;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  font-size: 0.97rem;
}

#syntax-help ul {
  margin: 0.5em 0 0 1.2em;
  padding: 0;
}

#syntax-help code,
code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.syntax-examples {
  margin-top: 0.7em;
  color: #666;
}

.syntax-examples code.ex-q {
  cursor: pointer;
  color: #0074d9;
  border-bottom: 1px dotted #0074d9;
}

.syntax-examples code.ex-q:hover {
  background: rgba(0, 116, 217, 0.1);
}

.filters {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0.85rem 0 1rem;
  padding: 0.15rem 1rem;
  background: #f7fafd;
  border: 1px solid #e0e7ef;
  border-radius: 10px;
}

.filter-group {
  display: grid;
  grid-template-columns: 5.25rem minmax(0, 1fr);
  gap: 0.35rem 0.65rem;
  align-items: start;
  padding: 0.7rem 0;
  border-bottom: 1px solid #e4eaf1;
}

.filter-group:last-child {
  border-bottom: none;
}

.filter-label {
  color: #6a7a8c;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.9;
  padding-top: 0.05rem;
  white-space: nowrap;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-width: 0;
  align-items: center;
}

.filter-salary-stack {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.filter-sublabel {
  font-size: 0.75rem;
  font-weight: 600;
  color: #8a9aab;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 0.15rem;
  min-width: 3.25rem;
}

.filter-chips button {
  background: #fff;
  color: #232c3b;
  border: 1px solid #d0d7e2;
  padding: 0.28rem 0.65rem;
  font-size: 0.84rem;
  border-radius: 999px;
  line-height: 1.35;
}

.filter-chips button:hover,
.filter-chips button.active {
  background: #0074d9;
  color: #fff;
  border-color: #0074d9;
}

.meta {
  color: #6a7a8c;
  font-size: 0.95rem;
  margin: 0.4rem 0 0.8rem;
}

.meta.empty {
  margin-top: 0.75rem;
}

.company-banner {
  font-size: 0.9rem;
  color: #6a7a8c;
  margin-bottom: 0.75rem;
}

#job-alert-bar {
  margin: 0.4rem 0 1rem;
}

.alert-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  padding: 0.7rem 0.9rem;
  background: #f7fafd;
  border: 1px solid #e0e7ef;
  border-radius: 8px;
  font-size: 0.92rem;
}

.alert-inline input[type='email'] {
  flex: 1;
  min-width: 11rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid #d0d7e2;
  border-radius: 6px;
  font: inherit;
}

.alert-inline .status {
  width: 100%;
  color: #6a7a8c;
  font-size: 0.88rem;
  min-height: 1.1rem;
}

.job {
  background: #fff;
  border: 1px solid #e0e7ef;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.55rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.job h3 {
  margin: 0 0 0.3rem;
  font-size: 1.02rem;
  font-weight: 600;
}

.job h3 a,
.job-link {
  color: #0b57d0;
  text-decoration: none;
}

.job h3 a:hover,
.job-link:hover {
  text-decoration: underline;
}

.job p {
  margin: 0;
  color: #6a7a8c;
  font-size: 0.9rem;
}

.company-link {
  color: #232c3b;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.company-link:hover {
  color: #0074d9;
}

.pagination {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
  margin: 1.5rem 0 1rem;
}

.pagination button {
  background: #f4f7fa;
  color: #232c3b;
  border: 1px solid #d0d7e2;
}

.page-indicator {
  color: #6a7a8c;
  font-size: 0.9rem;
}

footer {
  text-align: center;
  margin-top: 2.5rem;
  padding-bottom: 2.5rem;
  color: #6a7a8c;
  font-size: 0.97rem;
}

.footer-by {
  margin-top: 0.7em;
  font-size: 0.98rem;
}

.footer-by a {
  color: #0074d9;
  text-decoration: underline;
}

.footer-links {
  font-size: 0.86em;
  color: #6a7a8c;
  margin-top: 0.3em;
}

.footer-links a {
  color: #0074d9;
  text-decoration: underline;
}

/* Secondary pages */
.page-title {
  margin: 0 0 1rem;
  font-size: 1.45rem;
  font-weight: 650;
}

.tagline {
  color: #6a7a8c;
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

.prose h2 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.05rem;
}

.prose p,
.prose li {
  font-size: 0.98rem;
  max-width: 40rem;
}

.prose ul {
  padding-left: 1.2rem;
  color: #6a7a8c;
}

.brand-line {
  margin: 0 0 1rem;
}

.brand-line a {
  color: #0074d9;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: flex-end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.field.grow {
  flex: 1;
  min-width: 10rem;
}

.field label {
  font-size: 0.8rem;
  color: #6a7a8c;
}

.field input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #d0d7e2;
  border-radius: 6px;
  background: #fff;
  color: #222;
  font: inherit;
}

.optional {
  opacity: 0.7;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.table-wrap {
  overflow-x: auto;
  margin: 0.75rem 0;
  border: 1px solid #e0e7ef;
  border-radius: 8px;
  background: #fff;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid #e0e7ef;
}

.data-table th {
  color: #6a7a8c;
  font-weight: 600;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.site-header {
  border-bottom: 1px solid #e0e7ef;
  background: #fff;
}

.site-header-inner {
  max-width: 700px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.site-header .ascii-logo,
.site-header pre.ascii-logo {
  margin: 0;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: none;
  font-size: 1rem;
  font-family: system-ui, sans-serif;
  font-weight: 650;
  color: #0074d9;
  white-space: normal;
  overflow: visible;
}

.site-nav {
  display: flex;
  gap: 1rem;
  font-size: 0.9rem;
}

.site-nav a {
  color: #6a7a8c;
  text-decoration: none;
}

.site-nav a:hover {
  color: #0074d9;
}

.brand {
  text-decoration: none;
  color: inherit;
}

.site-footer {
  text-align: center;
  margin-top: 2rem;
  padding-bottom: 2rem;
  color: #6a7a8c;
}

/* Dark mode (prefers-color-scheme + class) */
@media (prefers-color-scheme: dark) {
  body {
    background: #16181c;
    color: #e7e9ea;
  }
  main {
    background: #181a20;
    color: #f3f6fa;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.18);
    border: 1px solid #23262b;
  }
  .ascii-logo {
    background: #23252b;
    color: #fff;
    border: 1px solid #292c31;
    box-shadow: 0 1px 7px rgba(0, 0, 0, 0.23);
  }
  #q,
  #search-input,
  .field input,
  .alert-inline input[type='email'] {
    background: #23252b;
    color: #e7e9ea;
    border: 1px solid #444851;
  }
  button {
    background: #0074d9;
    color: #fff;
  }
  button:hover,
  button.active {
    background: #005fa3;
  }
  .filters {
    background: #23252b;
    border-color: #363a42;
  }
  .filter-group {
    border-bottom-color: #2f3540;
  }
  .filter-label {
    color: #9aabbc;
  }
  .filter-sublabel {
    color: #7a8a9a;
  }
  .filter-chips button {
    background: #1c1f26;
    color: #e7e9ea;
    border: 1px solid #444851;
  }
  .filter-chips button:hover,
  .filter-chips button.active {
    background: #0074d9;
    color: #fff;
    border-color: #0074d9;
  }
  #syntax-help {
    background: #23262b !important;
    color: #e7e9ea !important;
    border: 1px solid #292c31;
  }
  #syntax-help code,
  code {
    color: #b7e1ff;
  }
  .syntax-examples,
  .meta,
  .job p,
  .filter-group > span,
  footer,
  .footer-links {
    color: #9aabbc;
  }
  .job {
    background: #23262b;
    color: #e7e9ea;
    border-color: #2a3038;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  }
  .job h3 a,
  .job-link {
    color: #66b3ff;
  }
  .company-link {
    color: #e7e9ea;
  }
  .alert-inline {
    background: #23252b;
    border-color: #292c31;
  }
  .site-header {
    background: #181a20;
    border-color: #23262b;
  }
  .table-wrap,
  .data-table th,
  .data-table td {
    border-color: #2a3038;
  }
  .table-wrap {
    background: #23262b;
  }
  ::placeholder {
    color: #aaa;
    opacity: 1;
  }
}

@media (max-width: 560px) {
  main {
    margin: 0.5rem;
    padding: 1rem 0.75rem 0.75rem;
  }
  #search-form {
    flex-direction: column;
  }
  .filter-group {
    grid-template-columns: 1fr;
    gap: 0.3rem;
  }
  .filter-label {
    line-height: 1.3;
  }
}

/* iPhone SE (375) and similar: ensure logo never forces page scroll */
@media (max-width: 400px) {
  main {
    margin: 0.4rem;
    padding: 0.85rem 0.6rem 0.65rem;
  }
  .ascii-logo {
    font-size: min(0.93rem, calc(100cqi / 47.5));
  }
}
