/* Recipes page Tips (js/tips.js): the quiet "Tips" toggle next to the title, its few short notes, and the
   "Mixing table shortcuts" dialog. Each shortcut has a slow drawn demo of the table (our own drawing, Facepunch's item
   icons). The demo is a picture of the game, so it stays dark in both themes, like the item slots. */

/* ---------- toggle + notes ---------- */
.tp-toggle { color: var(--muted); }
.tp-toggle:hover, .tp-toggle[aria-expanded="true"] { color: var(--text); }
.tp-chev {
  width: .42em; height: .42em; margin-left: .1em; border: solid currentColor; border-width: 0 2px 2px 0;
  transform: translateY(-.14em) rotate(45deg); transition: transform .18s;
}
.tp-toggle[aria-expanded="true"] .tp-chev { transform: translateY(.1em) rotate(-135deg); }
.tp-panel {
  max-width: 40rem; margin-top: .7rem; padding: .65rem .85rem .75rem;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2);
}
.tp-notes { display: grid; gap: .25rem; margin: 0 0 .7rem; padding-left: 1.1rem; color: var(--muted); }
.tp-notes li::marker { color: var(--accent); }
.tp-play { width: .55em; height: .66em; background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%); }

/* ---------- dialog ---------- */
.tp-dlg { width: min(620px, calc(100vw - 32px)); }
.tp-title { margin: 0 0 .7rem; font-size: 1.08rem; line-height: 1.3; }
.tp-demo { margin: 0; }
.tp-stage { min-height: 12rem; }
.tp-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem .75rem; margin: .55rem 0 .45rem; }
.tp-playbtn { min-width: 6.2rem; }
.tp-pp { width: .7em; height: .75em; border: solid currentColor; border-width: 0 .22em; }   /* pause bars */
.tp-playbtn.is-paused .tp-pp { border: 0; background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.tp-steps { display: grid; gap: .2rem; margin: 0; padding-left: 1.5rem; color: var(--dim); }
.tp-steps li { transition: color .3s; }
.tp-steps li.is-now { color: var(--text); font-weight: 600; }
.tp-steps li.is-now::marker { color: var(--accent-2); }
.tp-foot { justify-content: space-between; flex-wrap: nowrap; }
.tp-next { min-width: 5.5rem; }
.tp-dots { display: flex; gap: 2px; }
.tp-dot {
  appearance: none; display: grid; place-items: center; width: 24px; height: 24px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; cursor: pointer;
}
.tp-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); transition: background .15s, transform .15s; }
.tp-dot:hover::before { background: var(--muted); }
.tp-dot[aria-current="true"]::before { background: var(--accent); transform: scale(1.3); }
.tp-dlg.is-still .tp-playbtn { display: none; }
.tp-dlg.is-still .tp-steps { color: var(--text); }

/* ---------- keycaps and mouse (light up while held) ---------- */
.tp-keys { display: flex; align-items: center; gap: .45rem; margin-left: auto; }
.tp-key { font-size: .85rem; padding: .2em .6em; transition: background .25s, color .25s, border-color .25s, box-shadow .25s; }
.tp-key.is-down {
  background: var(--accent); color: var(--on-accent); border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
}
.tp-key-mouse { display: inline-grid; place-items: center; padding: 0; border: 0; }
.tp-mouse { display: block; width: 26px; height: 36px; }
.tp-mb-body { fill: var(--panel-2); stroke: var(--line-strong); stroke-width: 1.5; }
.tp-mb-l, .tp-mb-r { fill: transparent; stroke: var(--line-strong); stroke-width: 1; }
.tp-mb-w { fill: var(--muted); transition: fill .25s; }
.tp-key-mouse.is-left .tp-mb-l, .tp-key-mouse.is-right .tp-mb-r { animation: tp-btn 1s ease-out both; }
.tp-key-mouse.is-wheel .tp-mb-w { fill: var(--accent); }
.tp-key-mouse.is-wheel .tp-mb-body { stroke: var(--accent); }
@keyframes tp-btn { 0%, 55% { fill: var(--accent); } 100% { fill: transparent; } }

/* ---------- the drawn table ---------- */
.tp-scene {
  --s: 44px; --rh: 30px;
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "list table" "list inv";
  gap: 10px 14px; padding: 12px; overflow: hidden; user-select: none;
  border: 1px solid rgba(255, 255, 255, .08); border-radius: 4px;
  background: linear-gradient(180deg, #292723, #1b1a17); color: #e3dccf;
}
.tp-scene.is-reset { animation: tp-fade .6s ease-out; }
.tp-sec { display: grid; gap: 6px; align-content: start; min-width: 0; }
.tp-sec-list { grid-area: list; padding: 6px; border-radius: 3px; background: rgba(0, 0, 0, .22); }
.tp-sec-table { grid-area: table; }
.tp-sec-inv { grid-area: inv; }
.tp-label {
  font: 700 10.5px/1 var(--head-font); font-stretch: 87.5%; text-transform: uppercase; letter-spacing: .09em; color: #a39b8d;
}
.tp-list { position: relative; height: calc(var(--n, 3) * var(--rh)); }
.tp-row {
  position: absolute; left: 0; right: 0; top: calc(var(--i, 0) * var(--rh)); height: calc(var(--rh) - 2px);
  display: flex; align-items: center; gap: 7px; padding: 0 6px; border-radius: 2px; overflow: hidden;
  color: #7c766c; font-size: 13px; white-space: nowrap;
  transition: top 1s cubic-bezier(.45, .05, .3, 1), color .7s, background-color .4s, box-shadow .4s;
}
.tp-row-ic { flex: none; width: calc(var(--rh) - 8px); height: calc(var(--rh) - 8px); opacity: .45; filter: grayscale(.7); transition: opacity .7s, filter .7s; }
.tp-row-name { overflow: hidden; text-overflow: ellipsis; }
.tp-row.is-ready { color: #fbf8f2; }
.tp-row.is-ready .tp-row-ic { opacity: 1; filter: none; }
.tp-row.is-sel { background: rgba(255, 255, 255, .1); }
.tp-row.is-hl { box-shadow: inset 0 0 0 2px #f0b43c; animation: tp-hl 1.4s ease-in-out infinite alternate; }
.tp-table { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px 8px; }
.tp-slotcol { display: grid; gap: 5px; }
.tp-go { padding-top: calc((var(--s) - 28px) / 2); }
/* the mixing timer: a thin bar under the slots (fills by sliding, never stretching), the seconds left at its end */
.tp-mixrow { display: flex; align-items: center; gap: 6px; }
.tp-mixbar { position: relative; flex: 1; height: 3px; overflow: hidden; border-radius: 2px; background: rgba(255, 255, 255, .07); }
.tp-mixfill {
  position: absolute; inset: 0; background: #d9a441;
  transform: translateX(calc((var(--p, 0) - 1) * 100%)); transition: transform var(--gap, 0s) linear;
}
.tp-mixleft {
  min-width: 4.4em; min-height: 13px; text-align: right; white-space: nowrap;
  font: 700 12px/13px var(--head-font); font-stretch: 87.5%; font-variant-numeric: tabular-nums; color: #f1ece2;
}
.tp-ff { margin-left: .35em; color: #a39b8d; font-size: 10.5px; }
.tp-slots { display: flex; gap: 4px; }
.tp-slot {
  position: relative; display: grid; place-items: center; flex: none; width: var(--s); height: var(--s); border-radius: 2px;
  background: radial-gradient(ellipse 68% 55% at 50% 40%, rgba(255, 255, 255, .1), transparent 72%), linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(0, 0, 0, .2)), var(--slot, #3a3834);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .09), inset 0 -2px 0 rgba(0, 0, 0, .28), inset 0 0 0 1px rgba(0, 0, 0, .35), inset 0 0 12px rgba(0, 0, 0, .35);
}
.tp-slot > .item-ic, .tp-carry > .item-ic, .tp-fly > .item-ic { width: 84%; height: 84%; max-width: none; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .6)); }
.tp-q {
  position: absolute; right: 3px; bottom: 0; z-index: 1;
  font: 700 calc(var(--s) * .36)/1 var(--head-font); font-stretch: 87.5%; font-variant-numeric: tabular-nums;
  color: #f1ece2; text-shadow: 0 1px 2px #000, 0 0 3px #000;
}
.tp-slot.is-new > * { animation: tp-pop .5s ease-out both; }
.tp-slot.is-land > .item-ic { animation: tp-land .38s ease-out; }
.tp-slot:is(.is-land, .is-tick) > .tp-q { animation: tp-count .7s ease-out; }
/* an item in flight: a copy of the icon on an arc (js/tips.js launch), above the slots, under the pointer */
.tp-fly {
  position: absolute; left: 0; top: 0; z-index: 4; display: grid; place-items: center;
  width: var(--s); height: var(--s); pointer-events: none;
}
.tp-start {
  display: inline-grid; place-items: center; height: 28px; padding: 0 .9em; border-radius: 2px;
  font: 700 12px/1 var(--head-font); font-stretch: 87.5%; text-transform: uppercase; letter-spacing: .08em;
  color: #e3dccf; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .16);
}
.tp-start.is-press { animation: tp-press .7s ease-out; }

/* the pointer: slides between targets; a ring shows each click */
.tp-cursor {
  position: absolute; left: 0; top: 0; z-index: 5; pointer-events: none;
  transform: translate(var(--cx, 0), var(--cy, 0)); transition: transform 1s cubic-bezier(.45, .05, .3, 1), opacity .3s;
}
.tp-cursor.no-move { transition: none; }
.tp-cursor.is-hidden { opacity: 0; }
.tp-arrow { position: relative; z-index: 1; display: block; fill: #fff; stroke: #141311; stroke-width: 1.1; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .55)); }
.tp-ripple {
  position: absolute; left: -15px; top: -15px; width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid #f0b43c; opacity: 0;
}
.tp-ripple.is-on { animation: tp-ripple 1s ease-out; }
.tp-ripple.is-still { opacity: .9; transform: scale(.75); }
.tp-carry { position: absolute; left: 6px; top: 12px; display: none; place-items: center; width: calc(var(--s) * .85); height: calc(var(--s) * .85); opacity: .92; }
.tp-cursor.is-carrying .tp-carry { display: grid; }

@keyframes tp-pop { from { opacity: 0; transform: translateY(8px); } }
@keyframes tp-land { 40% { transform: translateY(3px); } }
@keyframes tp-count { from { color: #f0b43c; } }
@keyframes tp-ripple { from { opacity: 1; transform: scale(.3); } to { opacity: 0; transform: scale(1.6); } }
@keyframes tp-press { 25% { background: rgba(255, 255, 255, .3); transform: translateY(1px); } }
@keyframes tp-hl { from { box-shadow: inset 0 0 0 2px rgba(240, 180, 60, .45); } }
@keyframes tp-fade { from { opacity: .2; } }

/* ---------- reduced motion: every step as a small still frame ---------- */
.tp-frames { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: .6rem; margin: 0; padding: 0; list-style: none; }
.tp-frame { position: relative; display: grid; gap: 4px; align-content: start; }
.tp-frame-n {
  position: absolute; left: 5px; top: 5px; z-index: 6; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); font: 700 12px/20px var(--head-font); text-align: center;
}
.tp-frame-keys { display: flex; flex-wrap: wrap; gap: 4px; }
.tp-frame-keys .kbd { font-size: .72rem; }
.tp-scene.tp-mini {
  --s: 22px; --rh: 19px;
  grid-template-columns: minmax(0, 1fr); grid-template-areas: "list" "table" "inv"; gap: 5px; padding: 28px 6px 6px;
}
.tp-mini .tp-sec { gap: 3px; }
.tp-mini .tp-sec-list { padding: 3px; }
.tp-mini .tp-label { font-size: 8.5px; }
.tp-mini .tp-row { font-size: 10px; gap: 4px; padding: 0 3px; }
.tp-mini .tp-slots { gap: 2px; }
.tp-mini .tp-start { height: 18px; font-size: 9px; padding: 0 .6em; }
.tp-mini .tp-table { gap: 3px 4px; }
.tp-mini .tp-slotcol { gap: 3px; }
.tp-mini .tp-go { padding-top: calc((var(--s) - 18px) / 2); }
.tp-mini .tp-mixrow { gap: 3px; }
.tp-mini .tp-mixbar { height: 2px; }
.tp-mini .tp-mixleft { min-height: 10px; font-size: 9.5px; line-height: 10px; }
.tp-mini .tp-ff { font-size: 8.5px; }
.tp-mini .tp-q { font-size: 10px; right: 1px; }
.tp-mini .tp-arrow { width: 12px; height: 18px; }
.tp-mini .tp-ripple { left: -10px; top: -10px; width: 20px; height: 20px; border-width: 2px; }
.tp-mini .tp-row.is-hl { animation: none; }

/* ---------- phones: the list sits above the table ---------- */
@media (max-width: 540px) {
  .tp-scene:not(.tp-mini) { --s: 38px; --rh: 27px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "list" "table" "inv"; gap: 9px; padding: 10px; }
  .tp-stage { min-height: 0; }
  .tp-steps { padding-left: 1.3rem; font-size: .92rem; }
  .tp-dot { width: 22px; }
  .tp-foot .btn { padding-inline: .55rem; }
  .tp-next { min-width: 0; }
}
