/* Ginator: dark, high-contrast, large touch targets for a tablet in a dim bar. */

:root {
  --bg: #121212;
  --surface: #1e1e1e;
  --border: #3a3a3a;
  --text: #f2f2f2;
  --muted: #a8a8a8;
  --accent: #f5b942;
  --accent-text: #121212;
  --danger: #ff7a6b;
  --touch: 56px;
}

* { box-sizing: border-box; }

html { font-size: 20px; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.4;
}

a { color: var(--accent); }

button, input { font: inherit; }

/* Top bar with the small menu */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--touch);
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}

.brand { font-weight: 700; letter-spacing: 0.04em; }

.menu { position: relative; }

.menu summary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--touch);
  height: var(--touch);
  font-size: 1.5rem;
  cursor: pointer;
  list-style: none;
}

.menu summary::-webkit-details-marker { display: none; }

.menu-items {
  position: absolute;
  right: 0;
  z-index: 10;
  min-width: 220px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.menu-items > * {
  display: block;
  width: 100%;
  min-height: var(--touch);
  padding: 0 16px;
  line-height: var(--touch);
  text-align: left;
}

.menu-user { color: var(--muted); }

.menu-items a { text-decoration: none; }

.menu-items button {
  background: none;
  border: 0;
  color: var(--text);
  cursor: pointer;
}

/* Simple centred pages: login, placeholder, errors */

.page {
  max-width: 480px;
  margin: 10vh auto 0;
  padding: 0 16px;
}

.page h1 { margin-top: 0; }

.muted { color: var(--muted); }

.field { margin-bottom: 20px; }

.field label { display: block; margin-bottom: 6px; }

.field input {
  width: 100%;
  min-height: var(--touch);
  padding: 0 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.field input:focus { outline: 2px solid var(--accent); border-color: transparent; }

.button {
  width: 100%;
  min-height: var(--touch);
  background: var(--accent);
  color: var(--accent-text);
  border: 0;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

.error {
  padding: 12px 16px;
  margin-bottom: 20px;
  border: 1px solid var(--danger);
  border-radius: 8px;
  color: var(--danger);
}

[hidden] { display: none !important; }

/* Bartender page */

.search {
  flex: 1;
  min-width: 0;
  height: 44px;
  margin: 6px 16px;
  padding: 0 16px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 22px;
  font-size: 1.1rem;
}

.search:focus { outline: 2px solid var(--accent); border-color: transparent; }

/* The bartender page is one screen tall; only the results (or a long
   recipe) scroll. Screen minus the top bar (56px + border). */
#app {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 57px);
  padding: 16px;
}

#app > .banner { flex: none; }

.banner {
  margin: 0 0 16px;
  padding: 16px 20px;
  background: var(--danger);
  color: var(--accent-text);
  border-radius: 8px;
  font-size: 1.3rem;
  font-weight: 700;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  min-height: 48px;
  padding: 0 20px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 24px;
  cursor: pointer;
}

.chip[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  font-weight: 700;
}

.chip-clear { color: var(--muted); }

.list-view {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

/* Flavour wheel: the bar's printed wheel unrolled, one column per group */

.wheel {
  display: grid;
  flex: none;
  gap: 8px;
  align-items: start;
  overflow-x: auto;
}

.results-bar {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin: 8px 0;
}

.results-bar .status { margin: 0; }

.results-bar .chip { min-height: 40px; padding: 0 14px; }

.chip-picked { display: inline-flex; align-items: center; gap: 4px; }

.results-bar .wheel-toggle { margin-left: auto; color: var(--muted); }

.chip-group { font-weight: 700; }

.wheel-column { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.wheel-group,
.wheel-flavour {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
}

.wheel-group {
  min-height: 40px;
  margin-bottom: 2px;
  border: 0;
  font-weight: 700;
}

.wheel-group[aria-pressed="true"] { box-shadow: inset 0 0 0 3px var(--text); }

.wheel-other { background: var(--surface); color: var(--muted); cursor: default; }

.wheel-flavour {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-left: 5px solid var(--border);
  font-size: 0.8rem;
}

.wheel-flavour[aria-pressed="true"] { font-weight: 700; }

.wheel-group .count,
.wheel-flavour .count { flex: none; font-size: 0.75rem; opacity: 0.75; }

.wheel-group:disabled,
.wheel-flavour:disabled { opacity: 0.3; cursor: default; }

.status { margin: 12px 0; }

/* Gin list: compact text rows, several columns on a tablet */

.rows {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
}

.row {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: var(--touch);
  padding: 6px 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
}

.row-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; }

.row-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.row-producer {
  flex: 1;
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-flavours {
  display: flex;
  flex-wrap: wrap;
  gap: 0 12px;
  color: var(--muted);
  font-size: 0.8rem;
}

/* A flavour name with a dot in its group colour */

.flavour { display: inline-flex; align-items: center; gap: 5px; }

.dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
}

.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--border);
  color: var(--muted);
  font-size: 3rem;
  font-weight: 700;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.tag {
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.8rem;
}

.tag-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  border-radius: 22px;
  cursor: pointer;
}

.back {
  min-width: 160px;
  min-height: var(--touch);
  padding: 0 24px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}

/* Recipe fits one tablet screen: back and a tall photo (bottles are
   portrait) on the left, the recipe and similar gins on the right. */
.detail-view {
  display: grid;
  grid-template-columns: minmax(200px, 24%) 1fr;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "back body"
    "photo body"
    "photo similar";
  flex: 1;
  column-gap: 32px;
  row-gap: 12px;
  min-height: 0;
}

.detail-view .back { grid-area: back; justify-self: start; }

/* The article's children sit directly in the grid. */
.detail { display: contents; }

.detail-photo {
  grid-area: photo;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  border-radius: 12px;
}

.detail-body {
  grid-area: body;
  min-height: 0;
  overflow-y: auto;  /* only if a recipe is too long for the screen */
}

.detail-body h1 { margin: 0; font-size: 2rem; line-height: 1.2; }

.meta { margin: 4px 0 8px; color: var(--muted); }

.primary-tonic {
  margin: 16px 0 12px;
  padding: 16px 20px;
  border: 2px solid var(--accent);
  border-radius: 12px;
}

.primary-tonic .value { display: block; font-size: 1.6rem; font-weight: 700; }

.label {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.fact { margin-bottom: 12px; }

.fact .value { font-size: 1.15rem; white-space: pre-line; }

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0 32px;
  margin-top: 8px;
}

.facts .fact { flex: 1 1 120px; }

.facts .fact:has(.garnishes) { flex: 2 1 280px; }

.garnishes { margin: 0; padding-left: 1.2em; font-size: 1.15rem; }

.description { color: var(--muted); white-space: pre-line; }

.similar {
  grid-area: similar;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.similar .label { grid-column: 1 / -1; }

.similar-gin {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  min-height: var(--touch);
  padding: 6px 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
}

.similar-gin .muted { font-size: 0.85rem; }

.similar-name { font-size: 0.9rem; font-weight: 700; }

@media (max-width: 700px) {
  #app { height: auto; }
  .rows { overflow: visible; }
  .detail-view {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-template-areas: "back" "photo" "body" "similar";
    height: auto;
  }
  .similar { grid-template-columns: 1fr; }
  .detail-photo { height: 40vh; }
  .detail-body { overflow: visible; }
}
