/* The list or grid: a dark wine list on a black page, each bottle in the colour of its glass. */
:root {
  --page: #000000;          /* the page */
  --card: #15151a;          /* a wine */
  --edge: #22222a;
  --ink: #f3f1ec;
  --muted: #8e8c94;
  --accent: #e9c46a;        /* the view chosen */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Commissioner Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* the list starts from the top, not from the middle: switching view changes its height, and a block kept in the
   middle would make the heading jump */
.stage {
  min-height: 100svh;
  display: grid;
  justify-items: center;
  align-content: start;
  padding: max(28px, 9vh) 14px 28px;
}

.cellar {
  width: min(460px, 100%);
}

.cellar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.cellar__title {
  margin: 0;
  font-size: 24px;
  font-weight: 750;
  letter-spacing: -0.015em;
}

.cellar__meta {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 14px;
}

/* ---------------------------------------------------------------- the switch */
.views {
  position: relative;
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--edge);
  border-radius: 14px;
  background: #0d0d11;
}

.views__pill {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 40px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent);
}

.views__btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.3s;
  -webkit-tap-highlight-color: transparent;
}

.views__btn[aria-checked='true'] {
  color: #1f1706;
}

.views__btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.views__btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

html[data-using='pointer'] .views__btn:focus-visible {
  outline: none;
}

/* ---------------------------------------------------------------- the wines, as a list */
.wines {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.wine {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 10px 18px 10px 14px;
  border: 1px solid var(--edge);
  border-radius: 18px;
  background: var(--card);
}

.wine__bottle {
  display: block;
  width: 24px;
  height: 58px;
  overflow: visible;
}

.wine__text {
  min-width: 0;
}

/* the words keep their width in both views, so they travel without wrapping again on the way */
.wine__name,
.wine__kind,
.wine__price {
  display: block;
  width: max-content;
  max-width: 100%;
  margin: 0;
}

.wine__name {
  font-size: 16px;
  font-weight: 700;
}

.wine__kind {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13.5px;
}

.wine__price {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- the wines, as a grid */
.wines.is-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.is-grid .wine {
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  gap: 10px;
  padding: 18px 12px 16px;
  text-align: center;
}

.is-grid .wine__bottle {
  width: 46px;
  height: 116px;
}

.is-grid .wine__text {
  display: grid;
  justify-items: center;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
