/*
 * Tea Lab styles (plan §2 "Front end"). Loaded after site.css and vf-net.css by the Tea Lab layouts only.
 * Every selector is prefixed tl-; colours come only from the site.css tokens (handbook ch. 06 §4, R2).
 * Focus: 3px plum outline, 3px offset on light surfaces; champagne plus a 2px white ring on the plum header (R5).
 * Targets: at least 44px (handbook §12.7). No animation (R9); the documented Tea Lab motion exceptions arrive later.
 */

.tl-surface :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--plum);
  outline-offset: 3px;
}

.tl-header :where(a, button):focus-visible {
  outline: 3px solid var(--champagne);
  outline-offset: 3px;
  box-shadow: 0 0 0 2px var(--primary-foreground);
}

.tl-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
}

.tl-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

.tl-nav__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 12px;
  border-radius: 5px;
  color: var(--primary-foreground);
  font-weight: 700;
  text-decoration: none;
}

.tl-nav__link[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--champagne);
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

.tl-signout {
  display: inline-flex;
}

.tl-signout__button {
  background: transparent;
  border: 1px solid var(--champagne);
  cursor: pointer;
  font: inherit;
}

.tl-page {
  max-width: 1040px;
}

.tl-page h1 {
  color: var(--plum-deep);
}

.tl-page > * + * {
  margin-top: 16px;
}

.tl-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.tl-actions .button,
.tl-landing .button,
.tl-error .button {
  min-height: 46px;
}

.tl-notice {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--plum);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
}

.tl-landing__steps {
  color: var(--muted-foreground);
  font-weight: 700;
}

.tl-landing__privacy,
.tl-empty {
  color: var(--muted-foreground);
}

.tl-landing__privacy a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--plum);
}

@media (max-width: 620px) {
  .tl-nav {
    width: 100%;
  }

  .tl-nav__link {
    padding: 0 8px;
  }
}

/* ---- Shared form pieces (S3: Start a tasting and the tasting editor) ---- */

.tl-visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.tl-card,
.tl-section,
.tl-review-section {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
}

.tl-field {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.tl-field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
}

.tl-label {
  color: var(--ink);
  font-weight: 700;
}

.tl-label--small {
  font-size: 0.95rem;
}

.tl-hint {
  margin: 0;
  color: var(--muted-foreground);
}

.tl-from-shop {
  color: var(--sage-text);
  font-weight: 700;
}

.tl-field-error {
  margin: 0;
  color: var(--destructive);
  font-weight: 700;
}

.tl-input {
  min-height: 44px;
  width: 100%;
  max-width: 32rem;
  padding: 8px 12px;
  border: 1px solid var(--muted-foreground);
  border-radius: 6px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
}

.tl-input--short {
  max-width: 9rem;
}

.tl-textarea {
  min-height: 88px;
  resize: vertical;
}

.tl-input[aria-invalid="true"] {
  border: 2px solid var(--destructive);
}

.tl-fieldset {
  margin: 16px 0 0;
  padding: 0;
  border: 0;
}

.tl-fieldset > legend {
  margin-bottom: 8px;
  padding: 0;
}

.tl-error-summary {
  padding: 12px 16px;
  border: 2px solid var(--destructive);
  border-radius: 8px;
  background: var(--card);
}

.tl-error-summary h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.tl-error-summary a {
  color: var(--destructive);
  font-weight: 700;
}

.tl-notice--warning {
  border-left-color: var(--destructive);
}

.tl-badge {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--plum);
  border-radius: 999px;
  color: var(--plum);
  font-size: 0.85rem;
  font-weight: 700;
}

.tl-button--small {
  min-height: 44px;
}

.tl-step-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

.tl-step-actions .button,
.tl-step-form .button,
.tl-start .button {
  min-height: 46px;
}

/* ---- Start a tasting ---- */

.tl-search__row {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tl-combobox__list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 5;
  width: min(32rem, 100%);
  max-height: 18rem;
  margin: 0;
  padding: 4px;
  overflow-y: auto;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
}

.tl-combobox__option {
  display: grid;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.tl-combobox__option[aria-selected="true"],
.tl-combobox__option:hover {
  outline: 2px solid var(--plum);
  outline-offset: -2px;
}

.tl-combobox__meta,
.tl-tea-option__meta {
  color: var(--muted-foreground);
  font-size: 0.95rem;
}

.tl-tea-list,
.tl-chip-list,
.tl-style-chips,
.tl-method-list,
.tl-descriptor-list,
.tl-selected-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tl-tea-list {
  display: grid;
  gap: 8px;
}

.tl-tea-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.tl-tea-option__image {
  flex: none;
  border-radius: 6px;
  object-fit: cover;
}

.tl-tea-option__text {
  display: grid;
  flex: 1;
}

.tl-tea-option__name {
  font-weight: 700;
}

.tl-tea-option__action {
  color: var(--plum);
  font-weight: 700;
}

.tl-chips__heading {
  margin: 16px 0 8px;
  font-size: 1rem;
}

.tl-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tl-chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--plum);
  border-radius: 999px;
  background: var(--card);
  color: var(--plum);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.tl-chip[aria-current="page"],
.tl-chip[aria-pressed="true"] {
  background: var(--plum);
  color: var(--primary-foreground);
}

.tl-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

/* ---- Editor ---- */

.tl-editor__bar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 8px 0;
  background: var(--background);
}

.tl-editor__tea {
  margin: 0;
}

.tl-editor__tea-name {
  font-weight: 700;
}

.tl-save-pill {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin: 0;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font-weight: 700;
}

.tl-save-pill[data-state="error"],
.tl-save-pill[data-state="conflict"] {
  border-color: var(--destructive);
  color: var(--destructive);
}

.tl-save-pill__action {
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.tl-steps ol {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.tl-steps__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--plum);
  font-weight: 700;
  text-decoration: none;
}

.tl-steps__link[aria-current="step"] {
  background: var(--plum);
  color: var(--primary-foreground);
}

.tl-steps__number {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 0.85rem;
}

.tl-step-of {
  margin: 12px 0 0;
  color: var(--muted-foreground);
}

.tl-tea-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.tl-tea-summary__image {
  border-radius: 8px;
  object-fit: cover;
}

.tl-tea-summary__name {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.tl-tea-summary__meta {
  margin: 4px 0 0;
  color: var(--muted-foreground);
}

.tl-style-chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
  gap: 8px;
  margin-top: 12px;
}

.tl-style-chip,
.tl-method {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 56px;
  padding: 10px 14px;
  border: 1px solid var(--plum);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.tl-method {
  min-height: 44px;
}

.tl-style-chip[aria-pressed="true"],
.tl-method[aria-pressed="true"] {
  border-width: 3px;
  background: var(--background);
}

.tl-style-chip__label {
  color: var(--plum);
  font-weight: 700;
}

.tl-style-chip__summary {
  color: var(--muted-foreground);
  font-size: 0.95rem;
}

.tl-more-methods {
  margin-top: 12px;
}

.tl-more-methods summary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--plum);
  font-weight: 700;
  cursor: pointer;
}

.tl-more-methods__group h3 {
  margin: 12px 0 6px;
  font-size: 1rem;
}

.tl-method-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
  gap: 6px;
}

.tl-current-style {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tl-ratio {
  margin: 8px 0 0;
  color: var(--sage-text);
  font-weight: 700;
}

.tl-chip-radios {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tl-chip-radio {
  position: relative;
  display: inline-flex;
}

.tl-chip-radio input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.tl-chip-radio span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 14px;
  border: 1px solid var(--plum);
  border-radius: 999px;
  background: var(--card);
  color: var(--plum);
  font-weight: 700;
}

.tl-chip-radio input:checked + span {
  background: var(--plum);
  color: var(--primary-foreground);
}

.tl-chip-radio input:focus-visible + span,
.tl-star input:focus-visible + .tl-star__glyph,
.tl-descriptor input:focus-visible + span {
  outline: 3px solid var(--plum);
  outline-offset: 3px;
}

.tl-stages {
  display: grid;
  gap: 12px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.tl-stage {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
}

.tl-stage__legend {
  color: var(--plum-deep);
  font-weight: 700;
}

.tl-stage__kind {
  color: var(--muted-foreground);
  font-weight: 400;
}

.tl-stage__remove {
  margin-top: 12px;
}

.tl-stars {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tl-star {
  position: relative;
  display: inline-grid;
  justify-items: center;
  min-width: 64px;
  min-height: 44px;
  padding: 4px 6px;
  cursor: pointer;
}

.tl-star input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

/* Stars: plum on light surfaces (well above 3:1, T57); unselected stars use the muted foreground. */
.tl-star__glyph {
  color: var(--muted-foreground);
  font-size: 2rem;
  line-height: 1;
}

.tl-star input:checked + .tl-star__glyph {
  color: var(--plum);
}

.tl-star__text {
  color: var(--ink);
  font-size: 0.85rem;
  text-align: center;
}

.tl-star input:checked ~ .tl-star__text {
  font-weight: 700;
}

.tl-descriptor-group__heading {
  margin: 12px 0 6px;
  font-size: 1rem;
}

.tl-descriptor-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tl-descriptor {
  position: relative;
  display: inline-flex;
}

.tl-descriptor input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.tl-descriptor span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--plum);
  border-radius: 999px;
  background: var(--card);
  color: var(--plum);
}

.tl-descriptor input:checked + span {
  background: var(--plum);
  color: var(--primary-foreground);
  font-weight: 700;
}

.tl-descriptor-chips {
  margin: 12px 0;
}

.tl-selected-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tl-selected-list__remove {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--plum);
  border-radius: 999px;
  background: var(--plum);
  color: var(--primary-foreground);
  font: inherit;
  cursor: pointer;
}

.tl-review-section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.tl-review-section__head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.tl-review-section__head a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--plum);
  font-weight: 700;
}

.tl-facts {
  display: grid;
  grid-template-columns: minmax(8rem, max-content) 1fr;
  gap: 6px 16px;
  margin: 12px 0 0;
}

.tl-facts dt {
  color: var(--muted-foreground);
  font-weight: 700;
}

.tl-facts dd {
  margin: 0;
}

.tl-pre {
  white-space: pre-line;
}

.tl-review-stages {
  margin: 12px 0 0;
  padding-left: 20px;
}

.tl-review-stages__notes {
  display: block;
  color: var(--muted-foreground);
}

.tl-saved {
  border-left: 4px solid var(--sage-text);
}

@media (max-width: 620px) {
  .tl-facts {
    grid-template-columns: 1fr;
  }

  .tl-editor__bar {
    padding: 8px 0;
  }

  .tl-step-actions {
    position: sticky;
    bottom: 0;
    padding: 8px 0;
    background: var(--background);
  }
}
