/*
 * assets/ui/fountain-square.css - THE VILLAGE SQUARE at the Fountain (the Gathering at the Altar on the Horde),
 * js/fountain-square.js, lesson UI-237. The specials board hangs on two chains under the painting on a PC (or leads the
 * Square on a phone); each special is a card with its tag, its picture in a ring of light, the old price struck and the
 * new one in gold. The Herd's gold and pink; the Horde's green and bone (data-side="horde"). Every motion is a transform,
 * an opacity or a custom-property angle, and prefers-reduced-motion stills them all. Words at the room kit's floor
 * (--rui-min, 16 px), every button 44 px tall at least.
 */
.fsq-board {
  --fs-min: var(--rui-min, 16px);
  --fs-ink: #FBF3E7; --fs-soft: #DED4F2; --fs-dim: #B7ACD3; --fs-line: rgba(255, 236, 190, .18);
  --fs-gold: #F5C242; --fs-gold-hi: #FFE7A0; --fs-pop: #FF8FC7; --fs-pop-ink: #2A0F1E; --fs-glow: rgba(245, 194, 66, .45);
  --fs-wood1: #4A2E1C; --fs-wood2: #2A190F; --fs-bg1: #2B1D4D; --fs-bg2: #140D26; --fs-chain: #C9A86A;
  position: relative; isolation: isolate; display: grid; gap: 12px; min-width: 0; margin-top: 26px; padding: 16px; color: var(--fs-ink);
  border-radius: 18px; border: 3px solid color-mix(in srgb, var(--fs-gold) 55%, var(--fs-wood1));
  background:
    radial-gradient(120% 80% at 50% 0, color-mix(in srgb, var(--fs-gold) 16%, transparent), transparent 60%),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .07) 0 2px, transparent 2px 46px),
    linear-gradient(180deg, var(--fs-bg1), var(--fs-bg2));
  box-shadow: 0 16px 40px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(255, 236, 190, .08), 0 0 24px var(--fs-glow);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  container: fsq / inline-size; transform-origin: 50% -26px; animation: fs-swing 7s ease-in-out infinite;
}
.fsq-board[data-side="horde"] {
  --fs-gold: #6BE04A; --fs-gold-hi: #D7FFBF; --fs-pop: #F5C242; --fs-pop-ink: #1A1404; --fs-glow: rgba(107, 224, 74, .4);
  --fs-wood1: #2C2A20; --fs-wood2: #14130E; --fs-bg1: #1D3320; --fs-bg2: #0B120C; --fs-chain: #8C8A7A;
}
.fsq-board.is-weekend { --fs-pop: #FF6FB5; --fs-glow: rgba(255, 111, 181, .5); }
.fsq-board[data-side="horde"].is-weekend { --fs-pop: #FFB23D; --fs-glow: rgba(255, 178, 61, .45); }
@keyframes fs-swing { 0%, 100% { transform: rotate(-.35deg); } 50% { transform: rotate(.35deg); } }

/* the two chains it hangs by, and the slow rays behind its title */
.fsq-board__chains { position: absolute; top: -26px; left: 14%; right: 14%; height: 26px; display: flex; justify-content: space-between; pointer-events: none; }
.fsq-board__chains i { width: 8px; height: 100%; border-radius: 4px;
  background: repeating-linear-gradient(180deg, var(--fs-chain) 0 5px, color-mix(in srgb, var(--fs-chain) 40%, #000) 5px 7px); box-shadow: 0 2px 4px rgba(0, 0, 0, .5); }
/* the slow rays behind the title: a layer of the board's own size, so nothing of it reaches past the board (UI-237) */
@property --fs-ray { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.fsq-board::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: repeating-conic-gradient(from var(--fs-ray, 0deg) at 50% 56px, color-mix(in srgb, var(--fs-gold-hi) 18%, transparent) 0 7deg, transparent 7deg 18deg);
  -webkit-mask: radial-gradient(circle 190px at 50% 56px, #000 18%, transparent 100%); mask: radial-gradient(circle 190px at 50% 56px, #000 18%, transparent 100%);
  animation: fs-rays 30s linear infinite; }
@keyframes fs-rays { to { --fs-ray: 360deg; } }
.fsq-board { overflow: visible; }
.fsq-board::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; overflow: hidden; pointer-events: none;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .07) 48%, transparent 60%); background-size: 260% 100%; animation: fs-sheen 6s ease-in-out infinite; }
@keyframes fs-sheen { 0% { background-position: 120% 0; } 55%, 100% { background-position: -40% 0; } }

/* the head: the little word, the big title, and the clock to the next ones */
.fsq-board__head { display: grid; justify-items: center; gap: 4px; text-align: center; }
.fsq-board__eye { font-size: var(--fs-min); font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--fs-pop); line-height: 1.1; }
.fsq-board__title { margin: 0; font: 700 clamp(24px, 2.4vw, 32px)/1.1 var(--rui-title-font, "Palatino Linotype", Palatino, Georgia, serif);
  background: linear-gradient(100deg, var(--fs-gold-hi) 20%, #fff 45%, var(--fs-gold) 62%); background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: fs-shine 4.5s ease-in-out infinite;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .6)); }
@keyframes fs-shine { 0% { background-position: 100% 0; } 60%, 100% { background-position: -20% 0; } }
.fsq-board__ends { font-size: var(--fs-min); color: var(--fs-dim); }
.fsq-board__clock { color: var(--fs-gold-hi); font-variant-numeric: tabular-nums; font-weight: 800; }
.fsq-board__none, .fsq-board__rule { margin: 0; font-size: var(--fs-min); line-height: 1.4; color: var(--fs-soft); text-align: center; }
.fsq-board__rule { color: var(--fs-dim); }

/* the cards: one a building, side by side when they fit, one over the other when they do not */
.fsq-specials { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 12px; }
.fsq-specials__item { min-width: 0; display: grid; }
.fsq-special { position: relative; display: grid; grid-template-columns: 84px minmax(0, 1fr); grid-template-rows: auto 1fr auto; column-gap: 12px; row-gap: 6px;
  align-items: center; min-height: 44px; padding: 34px 12px 12px; border-radius: 14px; text-align: left; cursor: pointer; color: inherit; font: inherit;
  border: 1px solid var(--fs-line); background: linear-gradient(160deg, rgba(255, 236, 190, .07), rgba(0, 0, 0, .25));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06); transition: transform .15s, box-shadow .15s, border-color .15s; }
.fsq-special:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--fs-gold) 60%, transparent); box-shadow: 0 8px 22px rgba(0, 0, 0, .4), 0 0 16px var(--fs-glow); }
.fsq-special:focus-visible { outline: 3px solid var(--fs-pop); outline-offset: 2px; }
.fsq-special__tag { position: absolute; top: 8px; left: 8px; padding: 4px 12px; border-radius: 999px; line-height: 1;
  font-size: var(--fs-min); font-weight: 900; letter-spacing: .06em; color: var(--fs-pop-ink);
  background: linear-gradient(90deg, var(--fs-pop), var(--fs-gold-hi)); box-shadow: 0 3px 12px var(--fs-glow); animation: fs-pulse 2.6s ease-in-out infinite; }
@keyframes fs-pulse { 50% { transform: scale(1.06); } }
.fsq-special__pic { grid-row: 1 / 4; position: relative; width: 84px; height: 84px; display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--fs-gold) 30%, transparent), transparent 70%); }
.fsq-special__pic::before { content: ""; position: absolute; inset: -4px; border-radius: 50%;
  background: conic-gradient(from var(--fs-spin, 0deg), var(--fs-gold), transparent 30%, var(--fs-pop) 50%, transparent 80%, var(--fs-gold));
  -webkit-mask: radial-gradient(circle, transparent 60%, #000 62%); mask: radial-gradient(circle, transparent 60%, #000 62%); animation: fs-ring 5s linear infinite; }
@property --fs-spin { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes fs-ring { to { --fs-spin: 360deg; } }
.fsq-special__art { position: relative; width: 70px; height: 70px; object-fit: contain; filter: drop-shadow(0 0 8px var(--fs-glow)); animation: fs-bob 3.4s ease-in-out infinite; }
@keyframes fs-bob { 50% { transform: translateY(-4px); } }
.fsq-special__spark { position: absolute; top: 6px; right: 8px; width: 12px; height: 12px; background: var(--fs-gold-hi);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); opacity: 0; animation: fs-twinkle 2.2s ease-in-out infinite; }
@keyframes fs-twinkle { 0%, 100% { opacity: 0; transform: scale(.4) rotate(0); } 50% { opacity: 1; transform: scale(1.1) rotate(45deg); } }
.fsq-special__words { grid-column: 2; grid-row: 1 / 3; display: grid; gap: 3px; min-width: 0; }
.fsq-special__place { font-size: var(--fs-min); color: var(--fs-dim); line-height: 1.2; }
.fsq-special__name { font: 700 19px/1.15 var(--rui-title-font, "Palatino Linotype", Palatino, Georgia, serif); color: var(--fs-ink); overflow-wrap: anywhere; }
.fsq-special__price { font-size: var(--fs-min); color: var(--fs-soft); }
.fsq-special__was { color: var(--fs-dim); text-decoration-thickness: 2px; text-decoration-color: color-mix(in srgb, var(--fs-pop) 80%, transparent); }
.fsq-special__now { font-size: 22px; font-weight: 900; color: var(--fs-gold); font-variant-numeric: tabular-nums; text-shadow: 0 0 14px var(--fs-glow); }
.fsq-special__left { font-size: var(--fs-min); color: var(--fs-dim); line-height: 1.25; }
.fsq-special__go { grid-column: 2; grid-row: 3; justify-self: end; display: inline-grid; place-items: center; min-height: 44px; min-width: 64px; padding: 0 16px;
  border-radius: 12px; font-size: var(--fs-min); font-weight: 800; color: #2A1A05; background: linear-gradient(180deg, var(--fs-gold-hi), var(--fs-gold));
  box-shadow: 0 6px 16px var(--fs-glow); }
.fsq-board[data-side="horde"] .fsq-special__go { color: #0E2208; }
.fsq-special.is-weekend { border-color: color-mix(in srgb, var(--fs-pop) 55%, transparent); }
.fsq-special.is-used { cursor: pointer; }
.fsq-special.is-used .fsq-special__tag, .fsq-special.is-used .fsq-special__now { filter: grayscale(.7); opacity: .75; animation: none; }
.fsq-special.is-used .fsq-special__art { filter: grayscale(.6); }

/* a narrow board (a phone, a small left column): the picture smaller */
@container fsq (max-width: 300px) {
  .fsq-special { grid-template-columns: 64px minmax(0, 1fr); }
  .fsq-special__pic { width: 64px; height: 64px; }
  .fsq-special__art { width: 54px; height: 54px; }
}

/* the Square's own parts in the counter: waiting for you, the Village today */
.fsq .fsq-lead { margin: 0 0 12px; }
.fsq .mdeal--square { margin: 14px 0; }
.fsq-part { display: grid; gap: 10px; margin-top: 16px; }
.fsq-part__title { margin: 0; font: 700 var(--rui-h2, 22px)/1.2 var(--rui-title-font, Georgia, serif); color: var(--rui-gold, #F5C242); }
.fsq-quiet { margin: 0; }
.fsq-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fsq-row { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 12px; border-radius: 12px; text-align: left;
  color: var(--rui-ink, #FBF3E7); font: inherit; border: 1px solid var(--rui-line, rgba(201, 168, 245, .4)); background: var(--rui-panel-2, #251C38); }
button.fsq-row { cursor: pointer; transition: transform .15s, border-color .15s; }
button.fsq-row:hover { transform: translateX(2px); border-color: var(--rui-gold, #F5C242); }
button.fsq-row:focus-visible { outline: 3px solid var(--rui-accent, #FF8FC7); outline-offset: 2px; }
.fsq-row__dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--rui-gold, #F5C242); box-shadow: 0 0 10px currentColor; color: var(--rui-gold, #F5C242); animation: fs-dot 2s ease-in-out infinite; }
.fsq-row__dot[data-tone="pink"] { background: #FF8FC7; color: #FF8FC7; }
.fsq-row__dot[data-tone="green"] { background: #8EF07A; color: #8EF07A; }
.fsq-row__dot[data-tone="blue"] { background: #8FD3FF; color: #8FD3FF; }
.fsq-row__dot[data-tone="soft"] { background: #C9BEE0; color: #C9BEE0; animation: none; }
@keyframes fs-dot { 50% { opacity: .55; } }
.fsq-row__words { flex: 1; min-width: 0; display: grid; gap: 2px; }
.fsq-row__title { font-size: var(--rui-body, 18px); line-height: 1.25; overflow-wrap: anywhere; }
.fsq-row__line { font-size: var(--rui-min, 16px); color: var(--rui-soft, #DED4F2); line-height: 1.3; overflow-wrap: anywhere; }
.fsq-row__go { flex: none; display: inline-grid; place-items: center; min-height: 36px; padding: 0 14px; border-radius: 10px; font-size: var(--rui-min, 16px); font-weight: 800;
  color: #2A1A05; background: linear-gradient(180deg, #FFE7A0, #F5C242); }
.fsq-stats { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); gap: 8px; }
.fsq-stat { margin: 0; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--rui-line, rgba(201, 168, 245, .4)); background: var(--rui-panel-2, #251C38); min-width: 0; }
.fsq-stat__label { font-size: var(--rui-min, 16px); color: var(--rui-soft, #DED4F2); line-height: 1.25; }
.fsq-stat__value { margin: 2px 0 0; font-size: var(--rui-num, 22px); font-weight: 800; color: var(--rui-ink, #FBF3E7); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* the board's station on the painting glows while specials are up */
.vr-spot[data-id="square"]::after { content: ""; position: absolute; inset: -6px; border-radius: 10px; pointer-events: none;
  box-shadow: 0 0 18px 4px rgba(255, 231, 160, .55); animation: fs-dot 2.4s ease-in-out infinite; }

/* still: no motion at all */
@media (prefers-reduced-motion: reduce) {
  .fsq-board, .fsq-board *, .fsq-board::before, .fsq-board::after, .fsq *, .vr-spot[data-id="square"]::after { animation: none !important; transition: none !important; }
}
