:root {
  --bg: #f5f1e8;
  --ink: #171513;
  --muted: #726b62;
  --line: #cfc7bb;
  --accent: #9b7a3f;
  --panel: #fbf8f2;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
}

body {
  min-height: 100vh;
}

body.modal-open {
  overflow: hidden;
}

button,
select {
  color: inherit;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 24px 60px;
}

header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: 6px;
  background: rgba(245, 241, 232, 0.96);
  backdrop-filter: blur(10px);
}

.logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0 12px;
}

.logo {
  display: block;
  width: min(210px, 50vw);
  height: auto;
}

.sub {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.28em;
  text-align: center;
  text-transform: uppercase;
}

.tools {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 10px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

select {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: var(--panel);
  font: inherit;
  font-size: 15px;
}

select:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.count {
  min-height: 16px;
  margin: 14px 0 2px;
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 12px;
}

.section {
  margin-top: 28px;
}

.section h2 {
  margin: 0 0 8px;
  color: var(--accent);
  font-family: Arial, sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.wine {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  padding: 15px 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: background-color 140ms ease;
  -webkit-tap-highlight-color: transparent;
}

.wine:first-of-type {
  border-top-color: var(--ink);
}

.wine:focus-visible {
  outline: none;
}

@media (hover: hover) {
  .wine:hover {
    background: rgba(38, 37, 32, 0.06);
  }
}

.wine-info,
.wine-name {
  display: block;
}

.wine-name {
  font-size: 19px;
  line-height: 1.2;
}

.meta {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.price {
  align-self: start;
  font-size: 18px;
  white-space: nowrap;
}

.empty,
.noscript {
  padding: 60px 0;
  color: var(--muted);
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.48);
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  width: min(620px, 94vw);
  max-height: 86vh;
  overflow: auto;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.modal-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.modal h2 {
  margin: 0;
  font-size: 28px;
  font-weight: normal;
  line-height: 1.15;
}

.modal-price {
  font-size: 22px;
  white-space: nowrap;
}

.modal-meta {
  margin: 8px 0 22px;
  color: var(--muted);
  font-size: 15px;
}

.modal-label {
  margin-bottom: 8px;
  color: var(--accent);
  font-family: Arial, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.modal-notes {
  font-size: 18px;
  line-height: 1.5;
}

.modal-placeholder {
  color: var(--muted);
  font-style: italic;
}

.close {
  margin-top: 24px;
  padding: 10px 18px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  cursor: pointer;
  font: inherit;
}

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

@media (max-width: 700px) {
  .wrap {
    padding: 16px 16px 40px;
  }

  .logo {
    width: min(165px, 55vw);
  }

  .tools {
    grid-template-columns: 1fr;
  }

  .wine {
    gap: 12px;
  }

  .wine-name {
    font-size: 17px;
  }

  .modal {
    padding: 22px;
  }

  .modal h2 {
    font-size: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
