@font-face {
  font-family: "ShellHeavy";
  src:
    url("../fonts/ShellHeavy.woff2") format("woff2"),
    url("../fonts/ShellHeavy.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "ShellBook";
  src:
    url("../fonts/ShellBook.woff2") format("woff2"),
    url("../fonts/ShellBook.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --color-bg: #f5f5f5;
  --color-text: #4a4a4a;
  --color-border: #d9d9d9;
  --color-divider: #e0e0e0;
  --color-surface: #ffffff;
  --color-cta: #dd1d21;
  --color-cta-hover: #c4181c;
  --color-cta-text: #ffffff;
  --color-focus: #0037ff;
  --radius-input: 10px;
  --radius-button: 8px;
  --radius-panel: 16px;
  --font-heavy: "ShellHeavy", Arial, Helvetica, sans-serif;
  --font-book: "ShellBook", Arial, Helvetica, sans-serif;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1.25rem;
  --space-lg: 1.75rem;
  --space-xl: 2.5rem;
  --space-2xl: 4.375rem;
  --input-height: 50px;
  --button-height: 48px;
  --field-width: 300px;
  --button-width: 230px;
  --results-max-height: 320px;
  --page-max-width: 1280px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--color-text);
  font-family: var(--font-book);
  font-size: 14px;
  line-height: 1.4;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.gas-stations {
  max-width: var(--page-max-width);
  min-height: 709px;
  background: var(--color-bg);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2xl);
}

.gas-stations__title {
  margin: 0;
  font-family: var(--font-heavy);
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 400;
  line-height: 1.1;
  text-align: center;
  color: var(--color-text);
}

.gas-stations__form {
  width: 100%;
}

.gas-stations__fields {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-md);
  width: 100%;
  max-width: 22.5rem;
  margin: 0 auto;
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  width: 100%;
}

.field__label {
  font-family: var(--font-heavy);
  font-size: 14px;
  line-height: 1.1;
  color: var(--color-text);
}

.field__control {
  position: relative;
  min-height: var(--input-height);
}

.field__control::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 19px;
  width: 10px;
  height: 6px;
  transform: translateY(-50%);
  background: url("../images/chevron.svg") center / contain no-repeat;
  pointer-events: none;
  z-index: 1;
}

.field__control:has(.field__select.is-expanded)::after {
  opacity: 0;
}

.field__select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: var(--input-height);
  padding: 0 2.5rem 0 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font-book);
  font-size: 14px;
  line-height: 1.8;
  cursor: pointer;
}

.field__select.is-expanded {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 20;
  height: auto;
  max-height: 10rem;
  overflow-y: auto;
  padding: 0.35rem 0;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  scrollbar-width: thin;
  scrollbar-color: #8b8b8b transparent;
}

.field__select.is-expanded::-webkit-scrollbar {
  width: 8px;
}

.field__select.is-expanded::-webkit-scrollbar-track {
  background: transparent;
}

.field__select.is-expanded::-webkit-scrollbar-thumb {
  background: #8b8b8b;
  border-radius: 8px;
}

.field__select.is-expanded option {
  padding: 0.45rem 1rem;
}

.field__select.is-expanded option:checked,
.field__select.is-expanded option:focus {
  background-color: #dd1d21;
  background: linear-gradient(#dd1d21, #dd1d21);
  color: #ffffff;
}

.field__select:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  background: #fafafa;
}

.field__select:focus-visible,
.btn-search:focus-visible,
.results-panel:focus-visible {
  outline: 3px solid var(--color-cta);
  outline-offset: 2px;
}

.gas-stations__actions {
  width: 100%;
  padding-top: var(--space-xs);
}

.btn-search {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--button-height);
  padding: 0.75rem 1rem;
  border: none;
  border-radius: var(--radius-button);
  background: var(--color-cta);
  color: var(--color-cta-text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  cursor: pointer;
}

.btn-search:hover:not(:disabled) {
  background: var(--color-cta-hover);
}

.btn-search:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn-search:disabled:focus-visible {
  outline-color: #666666;
}

.field__select:disabled:focus-visible {
  outline-color: #666666;
}

@media (prefers-reduced-motion: no-preference) {
  .btn-search {
    transition: background-color 0.15s ease;
  }
}

.gas-stations__helper {
  margin: 0;
  max-width: 66rem;
  font-family: var(--font-heavy);
  font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.1;
  text-align: center;
  color: var(--color-text);
}

.gas-stations__helper[hidden],
.gas-stations__results[hidden],
.results-empty[hidden] {
  display: none !important;
}

.gas-stations__results {
  width: 100%;
}

.results-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  max-height: var(--results-max-height);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #8b8b8b transparent;
}

.results-panel::-webkit-scrollbar {
  width: 8px;
}

.results-panel::-webkit-scrollbar-track {
  background: transparent;
  margin: 12px 0;
}

.results-panel::-webkit-scrollbar-thumb {
  background: #8b8b8b;
  border-radius: 8px;
}

.results-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem 1.25rem;
}

.results-list__item {
  padding: 1.1rem 0.25rem;
  border-bottom: 1px solid var(--color-divider);
}

.results-list__item:last-child {
  border-bottom: none;
}

.results-list__name {
  margin: 0 0 0.35rem;
  font-family: var(--font-heavy);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--color-text);
  text-transform: uppercase;
}

.results-list__address {
  margin: 0;
  font-family: var(--font-book);
  font-size: 14px;
  line-height: 1.4;
  color: var(--color-text);
  text-transform: uppercase;
}

.results-empty {
  margin: 0;
  padding: var(--space-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  font-family: var(--font-book);
  font-size: 16px;
  text-align: center;
  color: var(--color-text);
}

.gas-stations__status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 768px) {
  .gas-stations {
    padding: 120px var(--space-2xl) 60px;
    gap: var(--space-2xl);
  }

  .gas-stations__fields {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: center;
    gap: 1.25rem;
    max-width: none;
  }

  /* .field {
    width: var(--field-width);
    flex: 0 0 var(--field-width);
  } */

  .gas-stations__actions {
    width: var(--button-width);
    flex: 0 0 var(--button-width);
    padding-top: 0;
  }

  .btn-search {
    width: 100%;
  }

  .gas-stations__results {
    margin-top: 50px;
  }

  .results-panel {
    --results-max-height: 360px;
    max-height: var(--results-max-height);
  }

  .results-list {
    padding: 0.75rem 1.75rem;
  }
}

@media (min-width: 1100px) {
  .gas-stations__fields {
    flex-wrap: nowrap;
  }
}
