@font-face {
  font-display: swap;
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  src: url("/font/jetbrains-mono.woff2") format("woff2");
}

@property --background {
  inherits: true;
  initial-value: rgb(24 24 24);
  syntax: "<color>";
}

@property --text-background {
  inherits: true;
  initial-value: rgb(32 32 32);
  syntax: "<color>";
}

@property --line {
  inherits: true;
  initial-value: rgb(48 48 48);
  syntax: "<color>";
}

@property --edge {
  inherits: true;
  initial-value: rgb(106 106 106);
  syntax: "<color>";
}

@property --text-color {
  inherits: true;
  initial-value: rgb(240 240 240);
  syntax: "<color>";
}

@property --muted {
  inherits: true;
  initial-value: rgb(150 150 150);
  syntax: "<color>";
}

@property --faint {
  inherits: true;
  initial-value: rgb(135 135 135);
  syntax: "<color>";
}

@property --search-gutter {
  inherits: true;
  initial-value: 42px;
  syntax: "<length>";
}

@property --gold {
  inherits: true;
  initial-value: rgb(227 207 154);
  syntax: "<color>";
}

* {
  box-sizing: border-box;
}

body {
  background: var(--background);
  color: var(--text-color);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
  font-weight: normal;
  margin: 0;
  padding: 0 16px 80px;
}

.main-content {
  margin: 0 auto;
  max-width: 720px;
}

.header {
  padding: 36px 0 20px;
}

.header-title {
  align-items: center;
  display: flex;
  font-size: 13px;
  font-weight: 600;
  gap: 9px;
  letter-spacing: 0.08em;
  margin: 0;
  text-transform: uppercase;

  & img {
    opacity: 0.85;
  }
}

.header-info {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin-top: 8px;
  max-width: 45em;
}

.main-search-input {
  background: var(--text-background);
  border: 1px solid var(--edge);
  border-radius: 10px;
  color: inherit;
  font-family: inherit;
  font-size: 15px;
  font-weight: normal;
  line-height: 46px;
  padding: 0 64px 0 var(--search-gutter);
  width: 100%;

  &::placeholder {
    color: var(--faint);
    opacity: 1;
  }

  &::-webkit-search-cancel-button {
    display: none;
  }

  &:focus-visible {
    border-color: var(--gold);
    box-shadow: inset 0 0 0 1px var(--gold);
    outline: none;
  }
}

.main-search-clear {
  background: none;
  border: none;
  color: var(--faint);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  padding: 0;
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);

  &:hover {
    color: var(--text-color);
  }

  &:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
  }
}

.main-search {
  background: var(--background);
  box-shadow: 0 4px 0 var(--background);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 2;

  &::before {
    align-items: center;
    bottom: 0;
    color: var(--faint);
    content: "⌕";
    display: flex;
    font-size: 20px;
    justify-content: center;
    left: 0;
    pointer-events: none;
    position: absolute;
    top: 0;
    width: var(--search-gutter);
  }

  &:focus-within::before {
    color: var(--muted);
  }

  &:has(.main-search-input:not(:placeholder-shown))::before {
    color: var(--gold);
  }

  &:has(.main-search-input:placeholder-shown) .main-search-clear {
    display: none;
  }
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 2px;
  margin-top: 10px;
}

.chip-input {
  opacity: 0;
  pointer-events: none;
  position: absolute;

  .chips-sub-category & {
    display: none;
  }
}

.chip {
  background: var(--text-background);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  padding: 6px 14px;
  white-space: nowrap;

  .chips-sub-category & {
    border-style: dashed;
    display: none;
    font-size: 12px;
    padding: 5px 12px;
  }

  &:hover {
    border-color: var(--edge);
    color: var(--text-color);
  }

  .chip-input:disabled + & {
    cursor: default;
    opacity: 0.3;
  }

  .chip-input:checked + & {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--background);
    font-weight: 600;
  }

  .chip-input:focus-visible + & {
    border-color: var(--gold);
    box-shadow: inset 0 0 0 1px var(--gold);
  }

  .chip-input:checked:focus-visible + & {
    border-color: var(--gold);
    box-shadow: none;
    outline: 2px solid var(--gold);
    outline-offset: 2px;
  }

  .chip-input:checked + &:hover {
    background: color-mix(in srgb, var(--gold) 88%, var(--text-color));
  }
}

.chips-sub-category {
  margin-bottom: 12px;
  margin-top: 6px;
}

.chip-count {
  color: var(--faint);
  font-weight: normal;
  margin-left: 6px;

  .chip-input:checked + .chip > & {
    color: var(--background);
    opacity: 0.65;
  }
}

.controls {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-top: 10px;
  padding-bottom: 8px;
}

.count {
  color: var(--faint);
  font-size: 13px;
}

.toggle {
  align-items: center;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  font-size: 13px;
  gap: 7px;
  user-select: none;
}

.toggle-input {
  accent-color: var(--gold);
  border-radius: 3px;
  margin: 0;

  &:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
  }
}

.panel-header {
  background: var(--background);
  box-shadow: 0 6px 8px -6px rgb(0 0 0 / 70%);
  color: var(--faint);
  font-size: 12px;
  font-weight: normal;
  letter-spacing: 0.08em;
  margin: 0;
  padding: 24px 0 6px;
  position: sticky;
  text-transform: uppercase;
  top: 72px;
  z-index: 1;
}

.cell {
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  padding: 10px 2px;

  &[hidden] {
    display: none;
  }

  &:hover {
    background: var(--text-background);
  }
}

.cell-title {
  font-size: 13px;
  line-height: 1.4;
}

.cell-info {
  color: var(--faint);
  font-size: 11px;
  margin-top: 2px;
}

.cell-verdict {
  flex: none;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.verdict-exceptional {
  color: var(--gold);
  font-weight: 600;
}

.verdict-common {
  color: var(--faint);
}

.no-results {
  color: var(--text-color);
  font-size: 17px;
  overflow-wrap: anywhere;
  padding: 56px 0;
  text-align: center;
}

.main-content:has(.toggle-input:checked) .cell[data-rating="0"] {
  display: none;
}

.panel:not(:has(.cell:not([hidden]))),
.main-content:has(.toggle-input:checked)
  .panel:not(:has(.cell:not([hidden])[data-rating="1"])) {
  display: none;
}

.main-content:not(:has(.toggle-input:checked)):has(.cell:not([hidden]))
  .no-results,
.main-content:has(.toggle-input:checked):has(
    .cell:not([hidden])[data-rating="1"]
  )
  .no-results {
  display: none;
}

body:has(#category-champagne:checked) .panel:not([data-category="champagne"]) {
  display: none;
}

body:has(#category-wine:checked) .panel:not([data-category="wine"]) {
  display: none;
}

body:has(#category-vodka:checked) .panel:not([data-category="vodka"]) {
  display: none;
}

body:has(#category-gin:checked) .panel:not([data-category="gin"]) {
  display: none;
}

body:has(#category-rum:checked) .panel:not([data-category="rum"]) {
  display: none;
}

body:has(#category-tequila:checked) .panel:not([data-category="tequila"]) {
  display: none;
}

body:has(#category-whisky:checked) .panel:not([data-category="whisky"]) {
  display: none;
}

body:has(#category-cognac:checked) .panel:not([data-category="cognac"]) {
  display: none;
}

body:has(#category-armagnac:checked) .panel:not([data-category="armagnac"]) {
  display: none;
}

body:has(#category-calvados:checked) .panel:not([data-category="calvados"]) {
  display: none;
}

body:has(#category-wine:checked) .chip-sub-category-wine {
  display: inline-block;
}

body:has(#category-gin:checked) .chip-sub-category-gin {
  display: inline-block;
}

body:has(#category-rum:checked) .chip-sub-category-rum {
  display: inline-block;
}

body:has(#category-tequila:checked) .chip-sub-category-tequila {
  display: inline-block;
}

body:has(#category-whisky:checked) .chip-sub-category-whisky {
  display: inline-block;
}

body:has(#category-wine:checked):has(#sub-category-wine-0:checked)
  .panel:not([data-sub-category="Red Burgundy wine"]) {
  display: none;
}

body:has(#category-wine:checked):has(#sub-category-wine-1:checked)
  .panel:not([data-sub-category="Red Languedoc-Roussillon wine"]) {
  display: none;
}

body:has(#category-wine:checked):has(#sub-category-wine-2:checked)
  .panel:not([data-sub-category="Red Provence wine"]) {
  display: none;
}

body:has(#category-wine:checked):has(#sub-category-wine-3:checked)
  .panel:not([data-sub-category="Red Puglia wine"]) {
  display: none;
}

body:has(#category-wine:checked):has(#sub-category-wine-4:checked)
  .panel:not([data-sub-category="Red Rhône Valley wine"]) {
  display: none;
}

body:has(#category-wine:checked):has(#sub-category-wine-5:checked)
  .panel:not([data-sub-category="Red Veneto wine"]) {
  display: none;
}

body:has(#category-wine:checked):has(#sub-category-wine-6:checked)
  .panel:not([data-sub-category="Pink Languedoc-Roussillon wine"]) {
  display: none;
}

body:has(#category-wine:checked):has(#sub-category-wine-7:checked)
  .panel:not([data-sub-category="Pink Trentino-Alto Adige wine"]) {
  display: none;
}

body:has(#category-wine:checked):has(#sub-category-wine-8:checked)
  .panel:not([data-sub-category="Pink Piemonte wine"]) {
  display: none;
}

body:has(#category-wine:checked):has(#sub-category-wine-9:checked)
  .panel:not([data-sub-category="White Bordeaux wine"]) {
  display: none;
}

body:has(#category-wine:checked):has(#sub-category-wine-10:checked)
  .panel:not([data-sub-category="White Burgundy wine"]) {
  display: none;
}

body:has(#category-wine:checked):has(#sub-category-wine-11:checked)
  .panel:not([data-sub-category="White Corsica wine"]) {
  display: none;
}

body:has(#category-wine:checked):has(#sub-category-wine-12:checked)
  .panel:not([data-sub-category="White Languedoc-Roussillon wine"]) {
  display: none;
}

body:has(#category-wine:checked):has(#sub-category-wine-13:checked)
  .panel:not([data-sub-category="White Loire Valley wine"]) {
  display: none;
}

body:has(#category-wine:checked):has(#sub-category-wine-14:checked)
  .panel:not([data-sub-category="White Provence wine"]) {
  display: none;
}

body:has(#category-wine:checked):has(#sub-category-wine-15:checked)
  .panel:not([data-sub-category="White Rhône Valley wine"]) {
  display: none;
}

body:has(#category-wine:checked):has(#sub-category-wine-16:checked)
  .panel:not([data-sub-category="White South West wine"]) {
  display: none;
}

body:has(#category-gin:checked):has(#sub-category-gin-0:checked)
  .panel:not([data-sub-category="Gin"]) {
  display: none;
}

body:has(#category-gin:checked):has(#sub-category-gin-1:checked)
  .panel:not([data-sub-category="Genever"]) {
  display: none;
}

body:has(#category-rum:checked):has(#sub-category-rum-0:checked)
  .panel:not([data-sub-category="Traditional rum"]) {
  display: none;
}

body:has(#category-rum:checked):has(#sub-category-rum-1:checked)
  .panel:not([data-sub-category="Agricultural rum"]) {
  display: none;
}

body:has(#category-rum:checked):has(#sub-category-rum-2:checked)
  .panel:not([data-sub-category="Spiced or infused rum"]) {
  display: none;
}

body:has(#category-tequila:checked):has(#sub-category-tequila-0:checked)
  .panel:not([data-sub-category="Tequila"]) {
  display: none;
}

body:has(#category-tequila:checked):has(#sub-category-tequila-1:checked)
  .panel:not([data-sub-category="Sotol"]) {
  display: none;
}

body:has(#category-tequila:checked):has(#sub-category-tequila-2:checked)
  .panel:not([data-sub-category="Raicilla"]) {
  display: none;
}

body:has(#category-whisky:checked):has(#sub-category-whisky-0:checked)
  .panel:not([data-sub-category="Straight american whiskey"]) {
  display: none;
}

body:has(#category-whisky:checked):has(#sub-category-whisky-1:checked)
  .panel:not([data-sub-category="Australian whisky"]) {
  display: none;
}

body:has(#category-whisky:checked):has(#sub-category-whisky-2:checked)
  .panel:not([data-sub-category="Canadian whisky"]) {
  display: none;
}

body:has(#category-whisky:checked):has(#sub-category-whisky-3:checked)
  .panel:not([data-sub-category="Danish whisky"]) {
  display: none;
}

body:has(#category-whisky:checked):has(#sub-category-whisky-4:checked)
  .panel:not([data-sub-category="French whisky"]) {
  display: none;
}

body:has(#category-whisky:checked):has(#sub-category-whisky-5:checked)
  .panel:not([data-sub-category="Irish whiskey"]) {
  display: none;
}

body:has(#category-whisky:checked):has(#sub-category-whisky-6:checked)
  .panel:not([data-sub-category="Japanese whisky"]) {
  display: none;
}

body:has(#category-whisky:checked):has(#sub-category-whisky-7:checked)
  .panel:not([data-sub-category="Scotch whisky"]) {
  display: none;
}

body:has(#category-whisky:checked):has(#sub-category-whisky-8:checked)
  .panel:not([data-sub-category="Taiwanese whisky"]) {
  display: none;
}

@media (forced-colors: active) {
  .main-search-input:focus-visible,
  .chip-input:focus-visible + .chip {
    outline: 2px solid currentcolor;
    outline-offset: 2px;
  }
}
