/* Components: buttons, chips, switches, cards, labels, forms, messages.
   Bright shapes always get a dark outline, so their edges stay clear on white. */

/* Buttons */
.btn {
  --btn-bg: var(--primary);
  --btn-text: var(--on-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap);
  margin-bottom: 4px; /* room for the pressable edge */
  padding: .55rem 1.3rem;
  color: var(--btn-text);
  background: var(--btn-bg);
  border: var(--outline-w) solid var(--outline);
  border-radius: var(--radius-pill);
  box-shadow:
    inset 0 3px 0 rgb(255 255 255 / .45),
    inset 0 -4px 0 rgb(0 0 0 / .12),
    0 4px 0 var(--outline);
  font: 600 var(--fs-lg) / 1.1 var(--font-display);
  letter-spacing: .01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}

.btn:hover { filter: brightness(1.05); }

.btn:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 3px 0 rgb(255 255 255 / .35),
    inset 0 -2px 0 rgb(0 0 0 / .12),
    0 1px 0 var(--outline);
}

.btn svg { width: 1.2em; height: 1.2em; flex: none; }

.btn--secondary { --btn-bg: var(--secondary); --btn-text: var(--on-secondary); }
.btn--sunny { --btn-bg: var(--accent-yellow); --btn-text: var(--ink-900); }

.btn--quiet {
  --btn-bg: var(--surface);
  --btn-text: var(--text);
  border-color: var(--border);
  box-shadow: 0 3px 0 var(--border);
}

.btn--big { min-height: 56px; padding-inline: 1.6rem; font-size: var(--fs-xl); }
.btn--block { display: flex; width: 100%; }

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: .55;
  cursor: not-allowed;
  filter: none;
  transform: none;
}

/* Chips (cuisine filters). Selected chips show a tick as well as colour. */
.chip-row {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding: var(--space-1) var(--space-1) var(--space-2);
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}

.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: var(--tap);
  padding: .4rem 1rem;
  color: var(--text);
  background: var(--chip-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-pill);
  font: 700 var(--fs-sm) / 1 var(--font-body);
  scroll-snap-align: start;
  cursor: pointer;
}

.chip[aria-pressed="true"] {
  color: var(--on-chip-on);
  background: var(--chip-on-bg);
  border-color: var(--outline);
  box-shadow: 0 2px 0 var(--outline);
}

.chip__tick { display: none; width: 1em; height: 1em; }
.chip[aria-pressed="true"] .chip__tick { display: block; }

/* Switch (on/off). The state is also written in words. */
.switch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--tap);
  padding: .25rem .5rem .25rem .25rem;
  color: var(--text);
  background: none;
  border: 0;
  font: 700 var(--fs-base) / 1.2 var(--font-body);
  text-align: left;
  cursor: pointer;
}

.switch__track {
  position: relative;
  flex: none;
  width: 52px;
  height: 30px;
  background: var(--surface-sunk);
  border: 2px solid var(--border);
  border-radius: var(--radius-pill);
  transition: background var(--dur);
}

.switch__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  background: var(--white);
  border: 2px solid var(--ink-900);
  border-radius: 50%;
  transition: transform var(--dur) var(--ease-bounce);
}

.switch[aria-checked="true"] .switch__track { background: var(--leaf-400); border-color: var(--outline); }
.switch[aria-checked="true"] .switch__thumb { transform: translateX(22px); }

.switch__state {
  min-width: 2.2em;
  color: var(--text-muted);
  font-size: var(--fs-sm);
}

.switch small {
  display: block;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 600;
}

/* Segmented choice (for example Auto / Light / Dark) */
.segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-sunk);
  border: 2px solid var(--border);
  border-radius: var(--radius-pill);
}

.segmented button {
  min-height: 38px;
  padding: .3rem .9rem;
  color: var(--text);
  background: none;
  border: 0;
  border-radius: var(--radius-pill);
  font: 700 var(--fs-sm) / 1 var(--font-body);
  cursor: pointer;
}

.segmented button[aria-pressed="true"] {
  color: var(--on-chip-on);
  background: var(--chip-on-bg);
  box-shadow: 0 0 0 2px var(--outline);
}

/* Cards */
.card {
  background: var(--surface);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.card__body { padding: var(--space-4); }

/* Stall card */
.stall-card__photo { position: relative; }

.stall-card__avatar {
  position: absolute;
  left: var(--space-3);
  bottom: -28px;
}

.stall-card__body { padding: var(--space-6) var(--space-4) var(--space-4); }

.stall-card__name {
  margin: 0;
  font: 600 var(--fs-xl) / 1.15 var(--font-display);
}

.stall-card__area {
  margin: 0 0 var(--space-3);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 700;
}

/* Where a seller's real photo goes. We never use AI pictures as food photos. */
.photo-placeholder {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--space-1);
  aspect-ratio: 4 / 3;
  padding: var(--space-4);
  color: var(--text-muted);
  background: repeating-linear-gradient(45deg, var(--surface-sunk) 0 12px, var(--surface) 12px 24px);
  font-size: var(--fs-sm);
  font-weight: 700;
  text-align: center;
}

.photo-placeholder svg { width: 32px; height: 32px; }

/* Character avatar: white ring plus dark outline, so it shows on light and dark. */
.avatar {
  --size: 64px;
  flex: none;
  width: var(--size);
  height: var(--size);
  overflow: hidden;
  background: var(--sky-100);
  border: 3px solid var(--white);
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--outline), 0 4px 0 2px var(--outline);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 6%;
}

.avatar--lg { --size: 96px; }

/* Food information labels: always an icon and words, never colour alone. */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.food-label {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .7rem;
  color: var(--text);
  background: var(--surface-sunk);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-weight: 700;
  line-height: 1.25;
}

.food-label svg { width: 1.05em; height: 1.05em; flex: none; }
.food-label--declared { background: var(--info-bg); }
.food-label--veg { color: var(--success-text); background: var(--success-bg); }
.food-label--caution { color: var(--warning-text); background: var(--warning-bg); }
.food-label small { color: inherit; font-size: var(--fs-xs); font-weight: 600; opacity: .9; }

/* Ribbon banner (for "Sold out!", "Featured Stall") */
.ribbon {
  position: relative;
  isolation: isolate;
  display: inline-block;
  margin: 0 1.6rem;
  padding: .45rem 1.4rem .55rem;
  color: var(--ink-900);
  background: var(--sunshine-400);
  border: var(--outline-w) solid var(--outline);
  border-radius: 10px;
  box-shadow: inset 0 4px 0 rgb(255 255 255 / .5), inset 0 -4px 0 rgb(0 0 0 / .08);
  font: 600 var(--fs-2xl) / 1.1 var(--font-display);
}

.ribbon::before,
.ribbon::after {
  content: "";
  position: absolute;
  z-index: -1;
  bottom: -12px;
  width: 2.4rem;
  height: 80%;
  background: var(--sunshine-600);
  border: var(--outline-w) solid var(--outline);
}

.ribbon::before { left: -1.6rem; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 38% 50%); }
.ribbon::after { right: -1.6rem; clip-path: polygon(0 0, 100% 0, 62% 50%, 100% 100%, 0 100%); }

/* Badges */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-4);
}

.badge {
  display: grid;
  justify-items: center;
  gap: var(--space-2);
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
}

.badge img { width: 88px; height: 88px; }

/* Messages */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius);
  font-weight: 600;
}

.alert svg { flex: none; width: 1.5em; height: 1.5em; }
.alert p { margin: 0; }
.alert strong { display: block; font: 600 var(--fs-lg) / 1.2 var(--font-display); }
.alert--success { color: var(--success-text); background: var(--success-bg); }
.alert--warning { color: var(--warning-text); background: var(--warning-bg); }
.alert--error { color: var(--danger-text); background: var(--danger-bg); }
.alert--info { color: var(--text); background: var(--info-bg); }

.empty-state {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-4);
  text-align: center;
}

/* Forms */
.field {
  display: grid;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
}

.field__label { font-weight: 800; }
.field__hint { color: var(--text-muted); font-size: var(--fs-sm); }

.input,
.select {
  width: 100%;
  min-height: var(--tap);
  padding: .6rem .85rem;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
}

.input:focus-visible,
.select:focus-visible { border-color: var(--focus); }
.input[aria-invalid="true"],
.select[aria-invalid="true"] { border-color: var(--danger-text); }

.field__error {
  display: flex;
  align-items: center;
  gap: .4rem;
  color: var(--danger-text);
  font-size: var(--fs-sm);
  font-weight: 700;
}

.field__error svg { width: 1.1em; height: 1.1em; flex: none; }

.check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  min-height: var(--tap);
  cursor: pointer;
}

.check input {
  flex: none;
  width: 26px;
  height: 26px;
  margin: .1rem 0 0;
  accent-color: var(--leaf-700);
}

textarea.input { min-height: 6rem; resize: vertical; }

/* The Turnstile bot check, and the message box under a form's button. */
.bot-check { max-width: 100%; }
.form-status { margin-top: var(--space-3); }
.form-status:empty { display: none; }

.fieldset {
  min-width: 0;
  margin: 0 0 var(--space-4);
  padding: 0;
  border: 0;
}

.fieldset legend { padding: 0; }
.fieldset .field__hint { margin: var(--space-1) 0 var(--space-2); }

/* Chips that are really checkboxes (for forms). They wrap instead of scrolling. */
.chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.chip--check { position: relative; }

.chip--check input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.chip--check:has(input:checked) {
  color: var(--on-chip-on);
  background: var(--chip-on-bg);
  border-color: var(--outline);
  box-shadow: 0 2px 0 var(--outline);
}

.chip--check:has(input:checked) .chip__tick { display: block; }

.chip--check:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

[data-field][aria-invalid="true"] .chip { border-color: var(--danger-text); }

/* Progress (setup checklist) */
.progress { display: grid; gap: var(--space-2); }

.progress__bar {
  height: 20px;
  overflow: hidden;
  background: var(--surface-sunk);
  border: 2px solid var(--outline);
  border-radius: var(--radius-pill);
}

.progress__fill {
  height: 100%;
  background: linear-gradient(var(--leaf-300), var(--leaf-400));
  border-right: 2px solid var(--outline);
  box-shadow: inset 0 3px 0 rgb(255 255 255 / .45);
}

.progress__fill[data-step="0"] { width: 0; border-right: 0; }
.progress__fill[data-step="1"] { width: calc(100% / 6 * 1); }
.progress__fill[data-step="2"] { width: calc(100% / 6 * 2); }
.progress__fill[data-step="3"] { width: calc(100% / 6 * 3); }
.progress__fill[data-step="4"] { width: calc(100% / 6 * 4); }
.progress__fill[data-step="5"] { width: calc(100% / 6 * 5); }
.progress__fill[data-step="6"] { width: 100%; border-right: 0; }

.progress__text { font-weight: 800; }

/* Name tag: the app's name on a yellow label, until there's a logo. */
/* The app's name with its logo (the happy stall). White, so the logo's yellow counter
   stands out. The logo file is public/assets/brand/sg-home-food-logo.svg. */
.name-tag {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin: 0;
  padding: .2rem 1.1rem .2rem .45rem;
  color: var(--ink-900);
  background: var(--white);
  border: var(--outline-w) solid var(--outline);
  border-radius: var(--radius-pill);
  font: 600 var(--fs-lg) / 1.2 var(--font-display);
  text-decoration: none;
}

.name-tag__logo { flex: none; width: 2.5rem; height: 2.5rem; }

/* Page footer, with the Privacy, Terms and Contact links. */
.site-footer {
  padding-block: var(--space-6) var(--space-8);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 700;
  text-align: center;
}

.site-footer p { margin: 0; }

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 var(--space-5);
  margin: 0 0 var(--space-2);
  padding: 0;
  list-style: none;
}

.site-footer__links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
}

/* A gap Trina still needs to fill in. Easy to spot on the page, and easy to find in the code. */
.todo {
  padding: 0 .35em;
  color: var(--ink-900);
  background: var(--sunshine-100);
  border: 1.5px dashed var(--ink-700);
  border-radius: 6px;
  font-weight: 700;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* The footer's Light / Dark and Simple mode switches (every page). */
.site-footer__look {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-2) var(--space-4);
  margin-bottom: var(--space-4);
  font-weight: 400;
}

/* The "!" bubble for an open drop (Phase 2, step 5), like a quest marker. Decoration only:
   the words "Drop open" are always beside it. */
.bang {
  display: inline-grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  color: var(--outline);
  background: var(--accent-yellow);
  border: var(--outline-w) solid var(--outline);
  border-radius: 50%;
  box-shadow: 0 2px 0 var(--outline);
  font: 800 1rem / 1 var(--font-display);
}
