:root {
  --page-max-width: 800px;
  --page-background: #fff;
  --surface-background: #fff;
  --text-color: #111;
  --muted-text-color: #555;
  --border-color: #111;
  --divider-color: #ccc;
  --hover-background: #f2f2f2;
  --inverse-background: #111;
  --inverse-text-color: #fff;
  color-scheme: light;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  color: var(--text-color);
  background: var(--page-background);
  font-synthesis: none;
}

:root[data-theme="dark"] {
  --page-background: #17191c;
  --surface-background: #202328;
  --text-color: #f1f3f5;
  --muted-text-color: #b6bbc1;
  --border-color: #d6d9dd;
  --divider-color: #3b4046;
  --hover-background: #2a2e34;
  --inverse-background: #f1f3f5;
  --inverse-text-color: #17191c;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]),
  :root[data-theme="system"] {
    --page-background: #17191c;
    --surface-background: #202328;
    --text-color: #f1f3f5;
    --muted-text-color: #b6bbc1;
    --border-color: #d6d9dd;
    --divider-color: #3b4046;
    --hover-background: #2a2e34;
    --inverse-background: #f1f3f5;
    --inverse-text-color: #17191c;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--text-color);
  background: var(--page-background);
  font-size: 14px;
  line-height: 1.55;
}

h1,
h2,
h3,
p,
ul {
  margin: 0;
  font-size: inherit;
}

h1,
.company-name {
  font-weight: 700;
}

a {
  color: var(--text-color);
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--border-color);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  padding: 8px;
  background: var(--surface-background);
  transform: translateY(-110%);
}

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

.list-page,
.about-page {
  width: min(100% - 48px, var(--page-max-width));
  margin: 0 auto;
  padding: 0 0 80px;
}

.page-header {
  display: flex;
  gap: 24px;
  min-height: 63px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-color);
}

.list-page .page-header {
  display: grid;
  grid-template-columns: auto minmax(80px, 420px) auto;
  gap: 24px;
  align-items: center;
}

.page-title-control {
  justify-self: start;
  min-width: 0;
}

.theme-toggle {
  min-height: 34px;
  padding: 6px 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  font-weight: inherit;
  cursor: pointer;
}

.search {
  position: relative;
  min-width: 0;
}

.search-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 8px;
}

.search-input {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 5px 9px;
  border: 1px solid var(--border-color);
  border-radius: 0;
  color: var(--text-color);
  background: var(--surface-background);
  font: inherit;
}

.search-input::placeholder {
  color: var(--text-color);
  opacity: 1;
}

.industry-filter-button {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 7px;
  place-items: center;
  border: 1px solid var(--border-color);
  border-radius: 0;
  color: var(--text-color);
  background: var(--surface-background);
  cursor: pointer;
}

.industry-filter-button:hover,
.industry-filter-button[data-active="true"] {
  color: var(--inverse-text-color);
  background: var(--inverse-background);
}

.industry-filter-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-width: 1.5;
}

.industry-filter-menu {
  width: min(300px, calc(100vw - 28px));
  padding: 6px;
  border: 1px solid var(--border-color);
  color: var(--text-color);
  background: var(--surface-background);
}

@supports (left: anchor(right)) {
  .industry-filter-menu {
    position: fixed;
    inset: auto;
    top: calc(anchor(bottom) + 8px);
    left: anchor(right);
    margin: 0;
    transform: translateX(-100%);
  }
}

.industry-filter-menu fieldset {
  padding: 0;
  margin: 0;
  border: 0;
}

.industry-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  padding: 5px 6px;
  cursor: pointer;
}

.industry-option:hover {
  background: var(--hover-background);
}

.industry-option input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--border-color);
}

.industry-option-name {
  justify-self: start;
  font-size: 12px;
  line-height: 1.45;
  white-space: nowrap;
}

.industry-count {
  color: var(--muted-text-color);
}

.company-results:focus,
.about-content:focus {
  outline: 2px solid var(--border-color);
  outline-offset: 6px;
}

.result-status {
  padding-top: 16px;
  color: var(--muted-text-color);
  font-size: 12px;
}

.company-list {
  padding: 0;
  list-style: none;
}

.company-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "name industry"
    "description description";
  gap: 6px 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--divider-color);
}

.company-card[hidden] {
  display: none;
}

.company-name {
  grid-area: name;
  font-weight: 700;
  white-space: normal;
  overflow-wrap: anywhere;
}

.company-description {
  grid-area: description;
}

.company-industry {
  grid-area: industry;
  align-self: start;
  justify-self: end;
  padding: 4px 9px;
  font-size: 12px;
  text-align: right;
  line-height: 1.45;
  white-space: nowrap;
}

.about-content > p {
  padding-top: 40px;
  line-height: 1.8;
}

.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;
}

@media (max-width: 740px) {
  body {
    font-size: 15px;
  }

  .list-page,
  .about-page {
    width: min(100% - 28px, var(--page-max-width));
  }

  .page-header {
    min-height: 73px;
  }

  .theme-toggle {
    min-height: 44px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .list-page .page-header {
    gap: 8px;
  }

  .search-controls {
    grid-template-columns: minmax(0, 1fr) 44px;
  }

  .search-input,
  .industry-filter-button {
    height: 44px;
  }

  .search-input {
    font-size: 16px;
  }

  .industry-filter-button {
    width: 44px;
    padding: 11px;
  }

  .industry-filter-menu {
    width: calc(100vw - 28px);
  }

  .industry-option {
    min-height: 44px;
    padding: 6px 8px;
  }

}

@media (max-width: 520px) {
  .about-page .page-header {
    align-items: flex-start;
  }

  .list-page .page-header {
    min-height: 109px;
    grid-template-columns: 1fr auto;
    column-gap: 16px;
    row-gap: 12px;
  }

  .list-page .search {
    grid-row: 2;
    grid-column: 1 / -1;
  }
}
