/*
 * The tasting night, in the editorial tokens.
 *
 * Everything here dresses `public/js/screens/tasting.js`. It borrows the app's own
 * vocabulary wherever one exists — `.page-width .inner-page` for the rhythm,
 * `.page-heading` for the top of a screen, `.button`, `.chip`, `.chips`, `.empty-state`,
 * `.structure-row`, `.palate-banner`, `.dialog-padding` — and only adds what a room full
 * of sealed bottles needs: a code tile, a flight row, a meter, a status chip, and the
 * host's controls.
 *
 * Not one colour is written down. Every value is a token from app.css, so all three
 * appearances — morning, evening and dark — move this file with them, and a glass tile or
 * a reveal card is drawn on its style's `--style-ground` (one of `--tint-1`, `--tint-2`,
 * `--tint-3`, set by the style rules in app.css), exactly as `.wine-art` is. The plum
 * cards' inks are the palette's `--on-slab` family, not literals of their own.
 *
 * Loaded after app.css, so the few rules that widen a shared component — the intent strip
 * gaining a fourth door — sit at the bottom of the cascade on purpose.
 */

/* ---------------------------------------------------------------------------
 * Focus, on the three plum cards
 *
 * app.css draws one ring for the whole app, --orange offset 5px, and it is measured
 * against every light ground there. These three surfaces are --slab — a bordeaux deep
 * enough in all three appearances that a burnt orange ring on it is invisible — so on
 * them the ring takes the near-white the card already brings, exactly as .palate-banner
 * does in app.css.
 * ------------------------------------------------------------------------- */

.unmasked-card :is(a, button, input, select, textarea):focus-visible,
.winner-card :is(a, button, input, select, textarea):focus-visible,
.host-code-card :is(a, button, input, select, textarea):focus-visible {
  outline-color: var(--on-slab);
}

/* ---------------------------------------------------------------------------
 * Fields
 *
 * app.css styles the email box and the textarea it needed. A tasting is typed into: a
 * code, a name, a region guess, five fields of a bottle nobody has listed.
 * ------------------------------------------------------------------------- */

.tasting-lobby input,
.tasting-screen input[type="text"],
.bring-dialog input[type="text"],
.bring-dialog input[type="search"] {
  width: 100%;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 14px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.6;
}
.tasting-lobby label:not(.sr-only),
.tasting-screen .rate-form label,
.bring-dialog label:not(.upload-zone) {
  display: block;
  font-size: 12px;
  margin: 20px 0 9px;
}
.tasting-lobby #join-code {
  font-family: var(--mono);
  font-size: 20px;
  letter-spacing: 4px;
  text-transform: uppercase;
}

/* ---------------------------------------------------------------------------
 * The front door
 * ------------------------------------------------------------------------- */

.lobby-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}
.lobby-card {
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 34px;
  background: var(--white);
}
.lobby-card > .eyebrow {
  color: var(--muted);
}
.lobby-card h2 {
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: -1px;
  margin-top: 14px;
}
.lobby-card h2 em {
  color: var(--accent);
}
.lobby-card > p:not(.eyebrow) {
  font-size: 13px;
  color: var(--muted);
  margin-top: 14px;
}
.lobby-card .button {
  margin-top: 22px;
  width: 100%;
}
.lobby-card .fine-print {
  margin-top: 14px;
}
.lobby-host {
  background: var(--surface);
}
.lobby-note {
  margin-top: 40px;
  text-align: center;
  font-size: var(--t-fine);
  color: var(--muted);
}
/* The room's one footnote leads with the small rosette, filled at 12px (app.css). */
.lobby-note .mark-slot {
  color: var(--accent);
  margin-right: 6px;
  vertical-align: -2px;
}
.lobby-note .mark-slot > .icon {
  width: 12px;
  height: 12px;
  fill: currentColor;
  stroke-width: 1;
}

/* ---------------------------------------------------------------------------
 * The top of a live screen
 * ------------------------------------------------------------------------- */

.tasting-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  flex-wrap: wrap;
}
.tasting-heading .eyebrow {
  color: var(--accent);
  font-family: var(--mono);
}
.tasting-heading h1 {
  font-size: 60px;
  letter-spacing: -2.8px;
  line-height: 1.02;
}
.tasting-heading h1 em {
  color: var(--accent);
}
.tasting-heading-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.tasting-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 30px;
}
.tasting-tabs > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  gap: 9px;
  padding: 13px 18px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s;
}
.tasting-tabs > a .icon {
  width: 17px;
  height: 17px;
}
.tasting-tabs > a:hover {
  color: var(--accent);
}
.tasting-tabs > a[aria-current] {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------------------------------------------------------------------------
 * Cards, sections and rows
 * ------------------------------------------------------------------------- */

.tasting-card {
  display: block;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 24px;
  background: var(--white);
  margin-bottom: 26px;
}
.tasting-card > .eyebrow {
  color: var(--muted);
  margin-bottom: 12px;
}
.tasting-card p {
  font-size: 13px;
}
.tasting-section {
  margin-bottom: 34px;
}
.tasting-section > .eyebrow {
  color: var(--muted);
  margin-bottom: 14px;
}
.tasting-section > .fine-print {
  margin-bottom: 14px;
}
.tasting-section > .button {
  margin-top: 4px;
}

.flight-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.flight-row {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  text-align: left;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--white);
  color: inherit;
  transition:
    border-color 0.2s,
    transform 0.2s;
}
a.flight-row:hover,
button.flight-row:hover {
  border-color: var(--accent);
  transform: translateX(3px);
}
.flight-row.is-quiet {
  background: var(--surface);
}
.flight-row-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
/* A bottle's name and its note wrap to a second line rather than being cut off at one:
   on a phone, "Château de Something 2019 Grand Cru" was ellipsed to its château. */
.flight-row-name {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
}
.flight-row-note {
  font-size: var(--t-fine);
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
}
.flight-row > .icon {
  width: 17px;
  height: 17px;
  color: var(--muted);
}
.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.row-score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: var(--serif);
  font-size: 25px;
  line-height: 1;
  color: var(--accent);
  flex-shrink: 0;
}
.row-score > small {
  font: var(--t-fine) var(--mono);
  letter-spacing: 0.15em;
  color: var(--muted);
  margin-top: 5px;
}
.rank-tile {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 4px;
  background: var(--surface);
  color: var(--muted);
  font: 13px var(--mono);
  flex-shrink: 0;
}
.rank-tile.is-first {
  background: var(--accent);
  color: var(--button-text);
}

/* ---------------------------------------------------------------------------
 * A sealed bottle: a colour, a code, and nothing else
 * ------------------------------------------------------------------------- */

.glass-tile {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 13px;
  min-width: 74px;
  border-radius: 4px;
  --style-ground: var(--surface);
  background: var(--style-ground);
  font: 14px var(--mono);
  letter-spacing: 1px;
  color: var(--ink);
  flex-shrink: 0;
}
.glass-tile.is-large {
  font-size: 27px;
  letter-spacing: 3px;
  padding: 22px 26px;
  min-width: 0;
}
.glass-tile.is-large .wine-dot {
  width: 10px;
  height: 10px;
}
.glass-tile.is-mono {
  min-width: 0;
  padding: 14px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 30px;
  font: var(--t-fine) var(--mono);
  letter-spacing: 0.111em;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--surface);
  color: var(--muted);
  flex-shrink: 0;
}
.status-chip.is-wine {
  background: var(--accent);
  color: var(--button-text);
}
.status-chip.is-good {
  background: var(--tint-2);
  color: var(--ink);
}
.status-chip.is-amber {
  background: var(--tint-3);
  color: var(--ink);
}

/* ---------------------------------------------------------------------------
 * The flight
 * ------------------------------------------------------------------------- */

.progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.progress-head > .eyebrow {
  color: var(--muted);
  margin: 0;
}
.live-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--t-fine);
  color: var(--muted);
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: tasting-pulse 1.8s ease-in-out infinite;
}
@keyframes tasting-pulse {
  50% {
    opacity: 0.25;
  }
}
.meter {
  height: 6px;
  border-radius: 30px;
  background: var(--surface);
  overflow: hidden;
}
.meter > span {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width 0.4s var(--ease);
}
.progress-card .fine-print {
  margin-top: 12px;
}
.unmasked-card {
  background: var(--slab);
  border-color: transparent;
  color: var(--on-slab);
}
.unmasked-card > .eyebrow {
  color: var(--on-slab-quiet);
}
.unmasked-card .icon {
  width: 16px;
  height: 16px;
}
.name-card p:not(.eyebrow) {
  color: var(--muted);
  margin-bottom: 14px;
}
.name-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.name-row input {
  flex: 1;
}

/* ---------------------------------------------------------------------------
 * Scoring a glass
 * ------------------------------------------------------------------------- */

.glass-hero {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 26px;
  border-radius: 5px;
  background: var(--surface);
  margin-bottom: 30px;
}
.glass-hero .eyebrow {
  color: var(--ink);
  font-size: 12px;
  letter-spacing: 1px;
}
.glass-hero .fine-print {
  margin-top: 8px;
}
.rate-form {
  max-width: 620px;
}
.rate-block {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0 0 10px;
  padding: 26px 0 6px;
}
/*
 * A `<legend>` sits *in* the border it names, which reads as a rule struck through the
 * words, and every way of moving it out — floating it, absolute positioning — moves it
 * out of the flow with it, which is what shoved the star row off the right of a phone.
 * So the legend stays, unseen, as the thing that names this group of controls to a screen
 * reader, and the line above it is an ordinary paragraph. The eyebrow is the same words,
 * so it is hidden from the reader who already has the legend.
 */
.rate-block > .eyebrow {
  color: var(--muted);
  margin-bottom: 14px;
}
.guess-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 22px;
}
.rate-block .fine-print {
  margin-top: 12px;
}
.rate-block .rating-stars {
  margin-top: 16px;
}
.rate-form > .button {
  margin-top: 24px;
}
.struct-row {
  margin-top: 20px;
}
.struct-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.struct-head label {
  margin: 0;
  font-size: 13px;
}
.struct-head > span {
  font: var(--t-fine) var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
/* The five structure sliders are the rate screen's main control. The track stays exactly
   where it was — the box grows around it and the top margin gives back what it took, so
   the ink does not move and the thumb has 44px to be caught in. */
.struct-row input[type="range"] {
  width: 100%;
  margin: 2px 0 0;
  accent-color: var(--accent);
  min-height: 44px;
}
.struct-labels {
  display: flex;
  justify-content: space-between;
  font-size: var(--t-fine);
  color: var(--muted);
}
.closed-note {
  margin-top: 24px;
  padding: 18px;
  border-radius: 5px;
  background: var(--surface);
  font-size: 13px;
}

/* ---------------------------------------------------------------------------
 * The reveal
 * ------------------------------------------------------------------------- */

.reveal-card {
  text-align: center;
  padding: 44px 30px;
  border-radius: 5px;
  --style-ground: var(--surface);
  background: var(--style-ground);
  margin-bottom: 28px;
}
.reveal-card > .eyebrow {
  margin-top: 24px;
  color: var(--muted);
}
.reveal-name {
  font-family: var(--serif);
  font-size: 46px;
  line-height: 1.08;
  letter-spacing: -1.6px;
  margin-top: 10px;
}
.reveal-card .fine-print {
  margin-top: 12px;
}
.room-said .room-score {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-family: var(--serif);
  font-size: 46px;
  line-height: 1;
  color: var(--accent);
}
.room-said .room-score > small {
  font: var(--t-fine) var(--sans);
  color: var(--muted);
}
.room-said .fine-print {
  margin-top: 12px;
}
.verdict-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.verdict-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--white);
}
.verdict-row > .eyebrow {
  color: var(--muted);
  width: 80px;
  flex-shrink: 0;
}
.verdict-guess {
  flex: 1;
  min-width: 0;
  font-family: var(--serif);
  font-size: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reveal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 34px;
}

/* ---------------------------------------------------------------------------
 * Standings
 * ------------------------------------------------------------------------- */

.winner-card {
  background: var(--slab);
  color: var(--on-slab);
  border-radius: 5px;
  padding: 40px;
  margin-bottom: 34px;
}
.winner-card > .eyebrow {
  color: var(--on-slab-quiet);
}
.winner-card h2 {
  font-family: var(--serif);
  font-size: 44px;
  line-height: 1.06;
  letter-spacing: -1.6px;
  margin-top: 16px;
}
.winner-card > p:not(.eyebrow) {
  font-size: 12px;
  color: var(--on-slab-soft);
  margin-top: 10px;
}
.winner-score {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-family: var(--serif);
  font-size: 40px;
  margin-top: 22px;
}
.winner-score > small {
  font: var(--t-fine) var(--sans);
  color: var(--on-slab-soft);
}

/* ---------------------------------------------------------------------------
 * You against the room
 * ------------------------------------------------------------------------- */

.tasting-structure {
  margin-bottom: 30px;
}
.tasting-structure > .eyebrow {
  color: var(--muted);
  margin-bottom: 22px;
}
/* The room's average, as a mark on your own bar: two readings of one glass. */
.structure-track.has-room {
  position: relative;
}
.structure-track.has-room > i {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  margin-left: -1px;
  background: var(--muted);
}
.legend-swatch,
.legend-tick {
  display: inline-block;
  vertical-align: middle;
  margin-right: 5px;
}
.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--accent);
}
.legend-tick {
  width: 2px;
  height: 12px;
  background: var(--muted);
}
.tasting-banner {
  margin-top: 34px;
}

/* ---------------------------------------------------------------------------
 * The host's controls
 * ------------------------------------------------------------------------- */

.host-code-card {
  background: var(--slab);
  color: var(--on-slab);
  border-radius: 5px;
  padding: 36px;
  margin-bottom: 34px;
}
.host-code-card > .eyebrow {
  color: var(--on-slab-quiet);
}
.host-code {
  font-family: var(--mono);
  font-size: 44px;
  letter-spacing: 8px;
  line-height: 1.1;
  margin-top: 14px;
}
.host-code-card > p:not(.eyebrow):not(.host-code) {
  font-size: 12px;
  color: var(--on-slab-soft);
  margin-top: 12px;
}
.host-code-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}
.host-code-card .button-light {
  background: var(--on-slab);
  color: var(--slab-button-ink-strong);
}
.host-code-card .button-light:hover {
  background: var(--slab-button-hover);
}
.button-light-outline {
  background: none;
  border-color: var(--on-slab-line);
  color: var(--on-slab);
}
.button-light-outline:hover {
  background: var(--on-slab-wash);
}
.host-round {
  border-top: 1px solid var(--line);
  padding-top: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

/* ---------------------------------------------------------------------------
 * Bringing a bottle, and the host's two confirmations
 * ------------------------------------------------------------------------- */

.bring-dialog textarea {
  margin-bottom: 16px;
}
.bring-results:not(:empty) {
  margin-top: 16px;
}
.bring-results .flight-row-name {
  font-size: 16px;
}
.bring-dialog .or-divider {
  margin: 30px 0 20px;
}
.bring-dialog .upload-zone {
  margin: 0;
}
.bring-dialog #bring-progress:not(:empty) {
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
}
.bring-dialog form {
  border-top: 1px solid var(--line);
  margin-top: 30px;
  padding-top: 8px;
}
.bring-form-title {
  color: var(--muted);
  margin: 22px 0 14px;
}
.bring-dialog .chips {
  margin-bottom: 6px;
}
.bring-dialog .form-error:not(:empty) {
  margin-top: 14px;
  color: var(--accent);
  font-size: 12px;
}
.confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

/* ---------------------------------------------------------------------------
 * Discover's fourth door
 *
 * The intent strip is three ways into the catalog; the tasting night is the fourth, and
 * it is the app's first product surface rather than a footnote. Widening the grid lives
 * here because the link does: app.css laid the strip out for what the fork shipped with.
 * ------------------------------------------------------------------------- */

.intent-strip {
  grid-template-columns: 0.72fr repeat(4, minmax(0, 1fr));
}
@media (max-width: 960px) {
  .intent-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  /* Two per row now, so the rule between them belongs to the second of each pair.
     Counted by child rather than by type since three of the four are buttons: the
     heading is child one, so the left-hand item of each pair is an even child. */
  .intent-strip > :nth-child(even) {
    border-left: 0;
    padding-left: 0;
  }
}
@media (max-width: 700px) {
  .intent-strip {
    grid-template-columns: 1fr;
  }
  /*
   * One per row, so every item but the last is followed by a rule. app.css clears every
   * border on the first item for the row layouts above, at a specificity the phone block
   * underneath it cannot undo — which left the first of four with no line under it.
   */
  .intent-strip > :nth-child(2) {
    border-bottom: 1px solid var(--line);
  }
}

/* ---------------------------------------------------------------------------
 * Narrower rooms
 * ------------------------------------------------------------------------- */

@media (max-width: 960px) {
  .tasting-heading h1 {
    font-size: 46px;
    letter-spacing: -2px;
  }
  .lobby-layout {
    grid-template-columns: 1fr;
    gap: 22px;
  }
  .reveal-name,
  .winner-card h2 {
    font-size: 36px;
  }
}

@media (max-width: 700px) {
  .tasting-heading {
    display: block;
  }
  .tasting-heading h1 {
    font-size: clamp(38px, 10vw, 52px);
  }
  .tasting-heading-actions {
    margin-top: 22px;
  }
  .tasting-tabs {
    gap: 0;
  }
  .tasting-tabs > a {
    flex: 1;
    justify-content: center;
    padding: 12px 6px;
    font-size: var(--t-fine);
  }
  .tasting-tabs > a .icon {
    display: none;
  }
  .lobby-card,
  .tasting-card,
  .host-code-card,
  .winner-card {
    padding: 22px;
  }
  .flight-row {
    padding: 12px 14px;
    gap: 12px;
    flex-wrap: wrap;
  }
  .flight-row-body {
    flex-basis: 0;
  }
  .flight-row > .icon {
    display: none;
  }
  .row-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .glass-tile {
    min-width: 66px;
    font-size: 13px;
    padding: 9px 11px;
  }
  .glass-tile.is-large {
    font-size: 22px;
    padding: 18px 20px;
  }
  .glass-hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
  }
  .host-code {
    font-size: 34px;
    letter-spacing: 5px;
  }
  .host-code-actions .button,
  .reveal-actions .button {
    width: 100%;
  }
  .reveal-name {
    font-size: 32px;
  }
  .reveal-card {
    padding: 30px 20px;
  }
  .verdict-row {
    flex-wrap: wrap;
    gap: 10px;
  }
  .verdict-row > .eyebrow {
    width: auto;
  }
  .verdict-guess {
    flex-basis: 100%;
  }
  .winner-card h2 {
    font-size: 32px;
  }
  .name-row {
    flex-wrap: wrap;
  }
  .name-row input {
    flex-basis: 100%;
  }
  .guess-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot {
    animation: none;
  }
  a.flight-row:hover,
  button.flight-row:hover {
    transform: none;
  }
}

/*
 * Forced colours. app.css explains the mode; this is the same repair for the surfaces a
 * tasting night adds. A sealed bottle *is* a wash — that is the whole tile — so in this
 * mode it needs an edge, and the meter that says how much of the room has scored needs a
 * filled length the system will actually paint.
 */
@media (forced-colors: active) {
  .lobby-card,
  .tasting-card,
  .flight-row,
  .glass-tile,
  .rank-tile,
  .status-chip,
  .reveal-card,
  .winner-card,
  .unmasked-card,
  .host-code-card,
  .progress-card {
    border: 1px solid CanvasText;
  }
  .rank-tile.is-first,
  .status-chip.is-wine {
    background: Highlight;
    color: HighlightText;
    border-color: Highlight;
  }
  .tasting-tabs > a[aria-current] {
    border-bottom-color: Highlight;
    color: Highlight;
  }
  .meter {
    border: 1px solid CanvasText;
  }
  .meter > span,
  .live-dot,
  .legend-swatch {
    background: CanvasText;
  }
}
