/* Sheet (detalhe e filtros), menu lateral e seletor de idiomas. */

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim-sheet);
  opacity: 0;
  transition: opacity var(--duration-normal);
}

.modal-root[data-variant="drawer"] .scrim {
  background: var(--scrim-drawer);
}

.modal-root.open .scrim {
  opacity: 1;
}

/* ---------- bottom sheet ---------- */

.sheet {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  flex-direction: column;
  height: max(66dvh, 420px);
  max-height: calc(100dvh - 16px);
  margin-inline: auto;
  border-radius: var(--radius-l) var(--radius-l) 0 0;
  background: var(--surface);
  box-shadow: var(--shadow-sheet);
  transform: translateY(100%);
  transition: transform var(--duration-normal) var(--ease-out);
  overscroll-behavior: contain;
  outline: none;
}

.modal-root.open .sheet {
  transform: translateY(var(--drag, 0px));
}

.modal-root.dragging .sheet {
  transition: none;
}

.sheet-grab {
  position: absolute;
  z-index: 2;
  inset: -30px 0 auto;
  display: flex;
  justify-content: center;
  height: 30px; /* termina na borda da sheet: nunca cobre o conteúdo */
  padding-top: 12px;
  touch-action: none;
  cursor: grab;
}

/* alça branca flutuando sobre o overlay, como na referência; serve para arrastar */
.sheet-handle {
  width: 48px;
  height: 6px;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.35);
}

.sheet-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 2px 10px rgb(28 42 36 / 0.3);
}

.sheet-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 var(--gutter) max(24px, var(--safe-bottom));
}

.sheet-foot {
  flex: none;
  display: flex;
  gap: 8px;
  padding: 12px var(--gutter) max(12px, var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.sheet-foot .btn-primary {
  flex: 1;
}

/* ---------- detalhe do vinho ---------- */

.detail-photo {
  position: relative;
  aspect-ratio: 4 / 3;
  max-height: 300px;
  margin-inline: calc(-1 * var(--gutter));
  overflow: hidden;
  border-radius: var(--radius-l) var(--radius-l) 0 0;
  background: var(--surface-2);
}

.detail-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-photo .photo-ph svg {
  width: 96px;
  height: auto;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 16px;
}

.detail-heading {
  flex: 1;
  min-width: 0;
}

.detail-title {
  font: 600 1.5rem / 1.25 var(--font-display);
  letter-spacing: -0.01em;
}

.detail-price {
  margin-top: 4px;
  color: var(--accent-ink);
  font-size: var(--text-lg);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.detail-sub {
  margin-top: 2px;
  color: var(--ink-muted);
  font-size: var(--text-sm);
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: var(--text-sm);
  font-weight: 500;
}

.pill--soft {
  background: var(--accent-tint);
  color: var(--ink);
}

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 20px;
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: var(--text-sm);
}

.facts dt {
  color: var(--ink-muted);
}

.facts dd {
  margin: 0;
  font-weight: 500;
}

.detail-label {
  margin-top: 20px;
  color: var(--ink-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.detail-label + .pills {
  margin-top: 8px;
}

.detail-desc {
  margin-top: 20px;
  color: var(--ink-muted);
  line-height: 1.65;
}

/* ---------- filtros e ordenação ---------- */

.sheet-title {
  padding-top: 28px;
  font: 600 var(--text-xl) / 1.3 var(--font-display);
}

.field {
  margin-top: 20px;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: var(--text-sm);
  font-weight: 600;
}

.type-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: background-color var(--duration-fast);
}

.toggle[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.toggle[aria-pressed="true"] .dot {
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.7);
}

.control {
  width: 100%;
  height: var(--tap);
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-m);
  background: var(--paper);
}

select.control {
  appearance: none;
  padding-right: 36px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231c2a24' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right 12px center / 16px no-repeat,
    var(--paper);
}

.control:focus-visible {
  outline-offset: 0;
  border-color: var(--accent-ink);
}

.price-range {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.price-range label {
  display: grid;
  gap: 4px;
  color: var(--ink-muted);
  font-size: var(--text-xs);
}

.radio-list {
  display: grid;
  gap: 2px;
}

.radio-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--tap);
  padding: 0 12px;
  border-radius: var(--radius-m);
  cursor: pointer;
}

.radio-row:hover {
  background: var(--surface-2);
}

.radio-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-row .icon {
  opacity: 0;
  color: var(--accent-ink);
}

.radio-row:has(input:checked) {
  background: var(--accent-tint);
  font-weight: 600;
}

.radio-row:has(input:checked) .icon {
  opacity: 1;
}

.radio-row:has(input:focus-visible) {
  outline: 2px solid var(--accent-ink);
  outline-offset: -2px;
}

/* ---------- menu lateral ---------- */

.drawer {
  position: absolute;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: min(75vw, 320px);
  padding: 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  box-shadow: 16px 0 40px -16px rgb(28 42 36 / 0.45);
  transform: translateX(-100%);
  transition: transform var(--duration-normal) var(--ease-out);
  outline: none;
}

.modal-root.open .drawer {
  transform: none;
}

.drawer-close {
  position: absolute;
  top: 12px;
  right: 12px;
}

.drawer-id {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding-top: 24px;
  text-align: center;
}

.drawer-id .venue-logo {
  width: 56px;
  height: 56px;
}

.drawer-name {
  font: 600 var(--text-xl) / 1.25 var(--font-display);
}

.drawer-label {
  margin-bottom: 8px;
  color: var(--ink-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.contact-list {
  display: grid;
  gap: 12px;
  font-size: var(--text-sm);
}

.contact-list li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.contact-list .icon {
  margin-top: 2px;
  color: var(--accent-ink);
}

.contact-list small {
  display: block;
  color: var(--ink-muted);
  font-size: var(--text-xs);
}

.lang-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-m);
  text-align: left;
}

.lang-trigger span {
  flex: 1;
}

.lang-trigger .icon-chevron {
  transition: rotate var(--duration-fast);
}

.lang-trigger[aria-expanded="true"] .icon-chevron {
  rotate: 180deg;
}

.lang-list {
  display: grid;
  margin-top: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--paper);
}

.lang-list[hidden] {
  display: none;
}

.lang-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--tap);
  padding: 0 12px;
  border-radius: var(--radius-s);
  color: inherit;
  text-decoration: none;
}

.lang-list a:hover {
  background: var(--surface-2);
}

.lang-list a[aria-current="true"] {
  font-weight: 600;
  color: var(--accent-ink);
}

.drawer-lang {
  margin-top: auto;
}

.drawer-foot {
  display: grid;
  gap: 8px;
  margin: 0 -24px -24px;
  padding: 16px 24px max(16px, var(--safe-bottom));
  background: var(--surface-2);
  color: var(--ink-muted);
  font-size: var(--text-xs);
}

.drawer-foot a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 500;
}

/* ---------- telas maiores ---------- */

@media (min-width: 640px) {
  .sheet {
    width: min(640px, 100%);
  }
}

@media (min-width: 1024px) {
  .sheet {
    width: min(var(--main-max), calc(100% - 32px));
    height: 400px;
  }

  .detail {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 32px;
    align-items: start;
  }

  .detail {
    padding-top: 24px;
  }

  .detail .detail-photo {
    height: 100%;
    max-height: none;
    margin: 0;
    border-radius: 12px;
    aspect-ratio: 1;
  }

  .detail-head {
    margin-top: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sheet,
  .drawer {
    transition: none;
  }
}
