/* Booths Market: the shared look of every stall. Striped awnings, warm boards, the BOOTHS
   violet. Each stall adds its own colours on top (--stall, --stall-ink). */
:root {
  --bg: #fbf6ee; --board: #fffdf8; --ink: #2b2433; --muted: #6b6276; --line: #eadfce;
  --violet: #6653e8; --violet-soft: #ece8fd;
  --stall: #6653e8; --stall-ink: #fff; --stripe: #fff;
  --r: 16px; --shadow: 0 6px 24px -10px rgba(43, 36, 51, .25);
  --sans: ui-rounded, "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--sans); }
a { color: var(--violet); }
img, svg, canvas { max-width: 100%; }
button { font: inherit; }
code { font-family: var(--mono); font-size: .9em; background: var(--violet-soft); padding: .1em .4em; border-radius: 6px; }

/* An awning: the stall's colour in stripes, with a scalloped edge. */
.awning {
  height: 46px; position: relative;
  background: repeating-linear-gradient(90deg, var(--stall) 0 36px, var(--stripe) 36px 72px);
}
.awning::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -14px; height: 14px;
  background: radial-gradient(circle at 18px 0, var(--stall) 17px, transparent 18px) 0 0 / 72px 14px repeat-x,
              radial-gradient(circle at 54px 0, var(--stripe) 17px, transparent 18px) 0 0 / 72px 14px repeat-x;
  filter: drop-shadow(0 3px 2px rgba(43, 36, 51, .12));
}
.awning.thin { height: 18px; }

/* The bar every stall shares: back to the market, and the stall's name. */
.bar {
  display: flex; align-items: center; gap: 14px; padding: 12px 20px; background: #2b2433; color: #fff;
  font-size: 14px;
}
.bar a { color: #fff; text-decoration: none; opacity: .85; }
.bar a:hover { opacity: 1; }
.bar .sp { flex: 1; }
.bar .tag { font-family: var(--mono); font-size: 12px; opacity: .6; }

/* The canopy: the bar and the page's awning, staying at the top as you scroll. Once you do,
   the awning slims down. */
.canopy { position: sticky; top: 0; z-index: 20; }
.canopy > .awning { transition: height .2s; }
.canopy.scrolled > .awning { height: 22px; }
[id] { scroll-margin-top: 120px; }

/* The day/night switch, hanging from the right of the awning like a lantern. */
.mode {
  position: absolute; right: 18px; top: calc(100% + 16px); z-index: 2;
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--board); color: var(--ink); font: 700 13px var(--sans);
  box-shadow: var(--shadow); transition: transform .15s;
}
.mode::before { content: ""; position: absolute; left: 50%; top: -16px; height: 16px; border-left: 2px solid var(--muted); opacity: .5; }
.mode:hover { transform: translateY(2px) rotate(-2deg); }

/* String lights under the awning: only at night. */
.lights { display: none; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.board { background: var(--board); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.btn {
  display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 12px; cursor: pointer;
  padding: .65rem 1.15rem; background: var(--stall); color: var(--stall-ink); font-weight: 700; text-decoration: none;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .18); transition: transform .08s, filter .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .18); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn:disabled { opacity: .5; cursor: default; }

.made {
  text-align: center; font-size: 13.5px; color: var(--muted); padding: 28px 20px 36px;
}
.made b { color: var(--ink); }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #2b2433; color: #fff; padding: .7rem 1.1rem; border-radius: 12px; transition: .25s; z-index: 50;
  max-width: calc(100% - 32px);
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---- Night at the market ---- */
[data-theme=night] {
  --bg: #141128; --board: #201b3a; --ink: #efeaff; --muted: #aca3c8; --line: #342d57;
  --violet: #a99cff; --violet-soft: #2c2552; --shadow: 0 12px 34px -14px rgba(0, 0, 0, .8);
  color-scheme: dark;
}
[data-theme=night] body {
  background-color: var(--bg);
  /* A few stars, fixed while the market scrolls. */
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff9 50%, transparent 51%), radial-gradient(1px 1px at 28% 62%, #fff8 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 47% 9%, #fffa 50%, transparent 51%), radial-gradient(1px 1px at 66% 41%, #fff7 50%, transparent 51%),
    radial-gradient(2px 2px at 83% 14%, #ffeab0bb 50%, transparent 51%), radial-gradient(1px 1px at 91% 72%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 7% 84%, #fff7 50%, transparent 51%), radial-gradient(1.5px 1.5px at 56% 88%, #fff8 50%, transparent 51%),
    radial-gradient(900px 500px at 80% -10%, rgba(169, 156, 255, .16), transparent 70%);
  background-attachment: fixed;
}
[data-theme=night] .awning { --stripe: #2a2348 !important; }
[data-theme=night] .awning, [data-theme=night] .awning::after { filter: saturate(.85) brightness(.88); }
[data-theme=night] .bar { background: #0d0b1c; }
[data-theme=night] :where(a:not(.btn):not(.stall):not(.sign)) { color: var(--violet); }
[data-theme=night] .bar a, [data-theme=night] .bar a:not(.btn) { color: #fff; }
[data-theme=night] input, [data-theme=night] textarea, [data-theme=night] select {
  background: #17132e !important; color: var(--ink); border-color: var(--line) !important;
}
[data-theme=night] .btn.ghost { color: var(--ink); }
/* Warm light spilling from the stalls. */
[data-theme=night] .board, [data-theme=night] .stall { box-shadow: 0 0 0 1px rgba(255, 214, 140, .05), 0 18px 40px -20px rgba(255, 190, 90, .25), var(--shadow); }

/* The string lights (drawn by market.js): a wire sagging between hooks along the awning's
   edge, with bulbs hanging from it. Each bulb glows and twinkles on its own. */
[data-theme=night] .lights { display: block; position: absolute; left: 0; right: 0; top: calc(100% + 6px); height: 44px; pointer-events: none; overflow: visible; }
.lights svg { display: block; width: 100%; height: 100%; overflow: visible; }
.lights .bulb { animation: twinkle 3.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes twinkle { 0%, 100% { opacity: 1; } 45% { opacity: .62; } 55% { opacity: .9; } }
[data-theme=night] .mode { top: calc(100% + 40px); }
[data-theme=night] .mode::before { top: -40px; height: 40px; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
