/* ══════════════════════════════════════════════════════════════════════════
   Oakevale — design tokens.
   Ported from the "Organic" design system the storefront mock was built on:
   a warm parchment ground, an ember-orange accent and a moss-green second
   accent, with both ramps generated on one shared lightness scale.
   ══════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Caprasimo&family=Figtree:wght@400;500;600;700&family=Silkscreen:wght@400;700&display=swap');

:root {
  --color-bg: #f5ead8;
  --color-surface: #ebddc5;
  --color-text: #201e1d;
  --color-accent: #c67139;
  --color-accent-2: #7a8a5e;
  --color-divider: rgba(32, 30, 29, 0.16);

  --color-neutral-100: #f9f4ed;
  --color-neutral-200: #eee7db;
  --color-neutral-300: #dcd3c4;
  --color-neutral-400: #c0b6a5;
  --color-neutral-500: #a19786;
  --color-neutral-600: #82796a;
  --color-neutral-700: #645c50;
  --color-neutral-800: #474238;
  --color-neutral-900: #2e2b25;
  --color-neutral-950: #100e0c;

  --color-accent-100: #fff2eb;
  --color-accent-200: #ffe1d0;
  --color-accent-300: #ffc6a5;
  --color-accent-400: #f6a06b;
  --color-accent-500: #d67f48;
  --color-accent-600: #b2622d;
  --color-accent-700: #8c491a;
  --color-accent-800: #643312;
  --color-accent-900: #402310;

  --color-accent-2-100: #f0fae1;
  --color-accent-2-200: #e1eecc;
  --color-accent-2-300: #ccdbb2;
  --color-accent-2-400: #aebf92;
  --color-accent-2-500: #8fa073;
  --color-accent-2-600: #728157;
  --color-accent-2-700: #56633f;
  --color-accent-2-800: #3d472b;
  --color-accent-2-900: #272e1b;

  --color-success: #4f7a3f;
  --color-success-bg: #e6f0dc;
  --color-warning: #a06a12;
  --color-warning-bg: #fbf0d8;
  --color-danger: #a33224;
  --color-danger-bg: #fbe3df;
  --color-info: #3d5a80;
  --color-info-bg: #e2ebf5;

  --font-heading: 'Caprasimo', Georgia, serif;
  --font-body: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'Cascadia Code', 'SF Mono', Menlo, Consolas, monospace;
  /* Bitmap face for game-side micro-labels: tier stamps, badges, stat chips.
     Used only at small sizes in caps — it is a texture, not a reading face. */
  --font-pixel: 'Silkscreen', 'Courier New', monospace;

  --space-1: 4px;
  --space-2: 9px;
  --space-3: 13px;
  --space-4: 18px;
  --space-6: 26px;
  --space-8: 35px;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 2px rgba(46, 43, 37, 0.14);
  --shadow-md: 0 3px 10px rgba(46, 43, 37, 0.16);
  --shadow-lg: 0 12px 32px rgba(46, 43, 37, 0.22);

  /*
   * Hard offset shadows, no blur. A blurred shadow says "soft UI"; a solid
   * one says the element is a block with a side face, which is the language
   * this store is trading in. These carry the depth on cards and buttons —
   * the blurred set above is kept for overlays, where real diffusion reads
   * better than a hard edge.
   */
  --lift-1: 0 2px 0 rgba(46, 43, 37, 0.28);
  --lift-2: 0 4px 0 rgba(46, 43, 37, 0.3);
  --lift-3: 0 6px 0 rgba(46, 43, 37, 0.32);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5 {
  font-family: var(--font-heading);
  font-weight: 400;
  line-height: 1.14;
  margin: 0 0 var(--space-2);
}

p {
  margin: 0 0 var(--space-3);
}

a {
  color: var(--color-accent-700);
  text-decoration: none;
}
a:hover {
  color: var(--color-accent-800);
  text-decoration: underline;
}

img {
  display: block;
  max-width: 100%;
}

::selection {
  background: var(--color-accent-200);
}

:focus-visible {
  outline: 2px solid var(--color-accent-600);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ── Minecraft-flavoured chrome ─────────────────────────────────────────── */

/* Beveled "inventory slot" frame used for avatars, icons and small panels. */
.bf-slot {
  border: 2px solid var(--color-neutral-800);
  border-radius: var(--radius-sm);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.4), inset -2px -2px 0 rgba(0, 0, 0, 0.22);
  background: var(--color-neutral-100);
}

.bf-slot-dark {
  border: 2px solid var(--color-neutral-950);
  border-radius: var(--radius-sm);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.08), inset -2px -2px 0 rgba(0, 0, 0, 0.5);
  background: var(--color-neutral-800);
}

/* Chunky pressable button with a hard drop-shadow "lip". */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
  padding: 11px 18px;
  border-radius: 6px;
  border: 2px solid rgba(0, 0, 0, 0.35);
  background: var(--color-neutral-200);
  color: var(--color-text);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.12s ease;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.28);
  text-decoration: none;
}
.btn:hover {
  transform: translateY(1px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.28);
  text-decoration: none;
}
.btn:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0.28);
}
.btn[disabled],
.btn[aria-disabled='true'] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--color-accent-500);
  color: #fff;
  box-shadow: 0 3px 0 var(--color-accent-800);
}
.btn-primary:hover {
  background: var(--color-accent-600);
  box-shadow: 0 2px 0 var(--color-accent-800);
  color: #fff;
}
.btn-secondary {
  background: var(--color-accent-2-600);
  color: #fff;
  box-shadow: 0 3px 0 var(--color-accent-2-900);
}
.btn-secondary:hover {
  background: var(--color-accent-2-700);
  color: #fff;
}
.btn-ghost {
  background: transparent;
  border-color: var(--color-divider);
  box-shadow: none;
  font-weight: 600;
}
.btn-ghost:hover {
  background: var(--color-neutral-200);
  box-shadow: none;
  transform: none;
}
.btn-danger {
  background: var(--color-danger);
  color: #fff;
  box-shadow: 0 3px 0 #6d1f16;
}
.btn-danger:hover {
  background: #8c2a1e;
  color: #fff;
}
.btn-sm {
  padding: 7px 12px;
  font-size: 12.5px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}
.btn-block {
  width: 100%;
}

/* ── Forms ──────────────────────────────────────────────────────────────── */

.field {
  display: block;
  margin-bottom: var(--space-3);
}
.field > label,
.label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--color-neutral-700);
  margin-bottom: 5px;
}
.hint {
  font-size: 11.5px;
  color: var(--color-neutral-600);
  margin-top: 4px;
}

.input,
select.input,
textarea.input {
  width: 100%;
  min-height: 38px;
  padding: 8px 11px;
  font: inherit;
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-neutral-100);
  border: 2px solid var(--color-neutral-300);
  border-radius: 6px;
  transition: border-color 0.12s ease;
}
.input:hover {
  border-color: var(--color-neutral-400);
}
.input:focus {
  outline: none;
  border-color: var(--color-accent-500);
}
textarea.input {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}
select.input {
  cursor: pointer;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13.5px;
  cursor: pointer;
  margin-bottom: var(--space-2);
}
.check input {
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  accent-color: var(--color-accent-600);
  flex: none;
  cursor: pointer;
}

/* ── Cards, tags, tables ────────────────────────────────────────────────── */

.card {
  background: var(--color-neutral-100);
  border: 1px solid var(--color-neutral-300);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  background: var(--color-neutral-200);
  color: var(--color-neutral-800);
  white-space: nowrap;
}
.tag-accent {
  background: var(--color-accent-100);
  color: var(--color-accent-800);
}
.tag-accent-2 {
  background: var(--color-accent-2-100);
  color: var(--color-accent-2-800);
}
.tag-outline {
  background: transparent;
  border: 1px solid var(--color-accent-500);
  color: var(--color-accent-700);
  font-weight: 600;
}
.tag-success {
  background: var(--color-success-bg);
  color: var(--color-success);
}
.tag-warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}
.tag-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}
.tag-info {
  background: var(--color-info-bg);
  color: var(--color-info);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.table th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--color-neutral-600);
  padding: 10px 12px;
  border-bottom: 2px solid var(--color-neutral-300);
  white-space: nowrap;
}
.table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--color-neutral-200);
  vertical-align: middle;
}
.table tbody tr:hover {
  background: var(--color-neutral-200);
}
.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.muted {
  color: var(--color-neutral-600);
}
.nowrap {
  white-space: nowrap;
}

/* ── Notices ────────────────────────────────────────────────────────────── */

.notice {
  padding: 12px 15px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  border-left: 4px solid;
  margin-bottom: var(--space-3);
}
.notice-info {
  background: var(--color-info-bg);
  border-color: var(--color-info);
  color: #29405e;
}
.notice-success {
  background: var(--color-success-bg);
  border-color: var(--color-success);
  color: #35521c;
}
.notice-warning {
  background: var(--color-warning-bg);
  border-color: var(--color-warning);
  color: #6d4808;
}
.notice-danger {
  background: var(--color-danger-bg);
  border-color: var(--color-danger);
  color: #7d251a;
}

/* ── Motion ─────────────────────────────────────────────────────────────── */

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, 14px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}
@keyframes shimmerSweep {
  0% {
    transform: translateX(-120%) skewX(-10deg);
  }
  100% {
    transform: translateX(220%) skewX(-10deg);
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/*
 * The whole-view transition, keyed off <body data-page-anim>. This used to be
 * an unconditional fade, which meant something on the page kept moving even
 * with every animation setting turned off — the setting looked broken because
 * the last moving thing was not wired to any setting.
 *
 * No fill-mode. A fill of `both` pins the view at its opening keyframe until
 * the animation starts, so anything preventing it from running leaves the page
 * blank; without one, a skipped transition costs the flourish, not the page.
 */
[data-page-anim='none'] .page-in   { animation: none; }
[data-page-anim='fade'] .page-in   { animation: pFade 0.26s ease; }
[data-page-anim='fadeUp'] .page-in { animation: pageIn 0.34s cubic-bezier(0.2, 0.7, 0.3, 1); }
[data-page-anim='zoom'] .page-in   { animation: pZoom 0.3s cubic-bezier(0.2, 0.85, 0.3, 1.05); }
[data-page-anim='slide'] .page-in  { animation: pSlide 0.32s cubic-bezier(0.2, 0.7, 0.3, 1); }

@keyframes pFade  { from { opacity: 0; } }
@keyframes pZoom  { from { opacity: 0; transform: scale(0.985); } }
@keyframes pSlide { from { opacity: 0; transform: translateX(24px); } }
/*
 * Deliberately NOT staggered per child. A `.page-in > *` stagger with
 * `animation-fill-mode: both` holds every child at opacity 0 for the length
 * of its delay, and any condition that keeps those animations from running to
 * completion leaves the whole view blank with no error to show for it. A
 * storefront cannot trade "content is visible" for an entrance flourish, so
 * the fade stays on the container only, where there is nothing to strand.
 */

.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid var(--color-neutral-300);
  border-top-color: var(--color-accent-600);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Motion is decoration here; anyone who asks for less should get none. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ── Selectable card motion ─────────────────────────────────────────────── */

/*
 * Hover and click motion for every buyable card, chosen by an admin under
 * Admin → Theme and applied as `data-card-hover` / `data-card-click` on <body>.
 *
 * Attribute selectors rather than classes on each card: one write on <body>
 * re-styles every card on the page, including ones rendered later, with no
 * per-card bookkeeping. The selectors are not anchored to <body> so the admin
 * preview can scope the same rules to a single demo card by putting the
 * attributes on its own wrapper. `.is-clicked` is added on pointerdown and removed on
 * animationend — see cardAnimate() in store.js.
 *
 * `.anim-card` marks the elements that opt in, so the same settings drive rank
 * cards, grant cards and store tiles without listing all three everywhere.
 */
.anim-card {
  transition: transform 0.16s cubic-bezier(0.2, 0.7, 0.3, 1), box-shadow 0.16s ease, border-color 0.16s ease;
}

/* ── Hover variants ── */
[data-card-hover='lift'] .anim-card:hover,
[data-card-hover='lift'] .anim-card:focus-visible {
  transform: translateY(-5px);
  box-shadow: var(--lift-3), 0 14px 26px -14px rgba(46, 43, 37, 0.5);
}
[data-card-hover='zoom'] .anim-card:hover,
[data-card-hover='zoom'] .anim-card:focus-visible {
  transform: scale(1.045);
  box-shadow: var(--lift-3), 0 16px 30px -16px rgba(46, 43, 37, 0.5);
}
[data-card-hover='tilt'] .anim-card {
  transform-style: preserve-3d;
}
[data-card-hover='tilt'] .anim-card:hover,
[data-card-hover='tilt'] .anim-card:focus-visible {
  transform: perspective(700px) rotateX(6deg) rotateY(-6deg) translateY(-4px);
  box-shadow: var(--lift-3), 0 18px 30px -16px rgba(46, 43, 37, 0.55);
}
[data-card-hover='glow'] .anim-card:hover,
[data-card-hover='glow'] .anim-card:focus-visible {
  border-color: var(--color-accent-500);
  box-shadow: var(--lift-2), 0 0 0 3px var(--color-accent-200), 0 0 22px -2px var(--color-accent-400);
}
[data-card-hover='sway'] .anim-card:hover,
[data-card-hover='sway'] .anim-card:focus-visible {
  animation: cardSway 1.1s ease-in-out infinite;
  box-shadow: var(--lift-3);
}
@keyframes cardSway {
  0%, 100% { transform: rotate(-1.1deg) translateY(-3px); }
  50%      { transform: rotate(1.1deg) translateY(-3px); }
}

/* ── Click variants ── */
[data-card-click='roll'] .anim-card.is-clicked  { animation: cardRoll 0.55s cubic-bezier(0.3, 0.8, 0.35, 1); }
[data-card-click='flip'] .anim-card.is-clicked  { animation: cardFlip 0.5s cubic-bezier(0.3, 0.8, 0.35, 1); }
[data-card-click='pop'] .anim-card.is-clicked   { animation: cardPop 0.28s ease-out; }
[data-card-click='shake'] .anim-card.is-clicked { animation: cardShake 0.4s ease-in-out; }
[data-card-click='drop'] .anim-card.is-clicked  { animation: cardDrop 0.42s cubic-bezier(0.3, 1.4, 0.5, 1); }

@keyframes cardRoll {
  from { transform: perspective(760px) rotateY(0deg); }
  to   { transform: perspective(760px) rotateY(360deg); }
}
@keyframes cardFlip {
  from { transform: perspective(760px) rotateX(0deg); }
  to   { transform: perspective(760px) rotateX(360deg); }
}
@keyframes cardPop {
  0%   { transform: scale(1); }
  45%  { transform: scale(0.94); }
  100% { transform: scale(1); }
}
@keyframes cardShake {
  0%, 100%    { transform: translateX(0) rotate(0deg); }
  20%         { transform: translateX(-6px) rotate(-2deg); }
  45%         { transform: translateX(5px) rotate(1.8deg); }
  70%         { transform: translateX(-3px) rotate(-1deg); }
}
@keyframes cardDrop {
  0%   { transform: translateY(0) scale(1); }
  40%  { transform: translateY(11px) scale(0.97); }
  100% { transform: translateY(0) scale(1); }
}

/* An admin who picks "none" gets none — including the resting transition. */
[data-card-hover='none'] .anim-card {
  transition: box-shadow 0.16s ease;
}

/* ── Toasts ─────────────────────────────────────────────────────────────── */

#toasts {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--color-neutral-900);
  color: #fff;
  padding: 12px 22px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.28s ease both;
  max-width: min(90vw, 460px);
}
.toast-error {
  background: var(--color-danger);
}
.toast-success {
  background: var(--color-success);
}

/* ── Modal ──────────────────────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 14, 12, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 20px;
  z-index: 150;
  overflow-y: auto;
}
.modal {
  width: min(680px, 100%);
  background: var(--color-bg);
  border: 2px solid var(--color-neutral-400);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: pageIn 0.22s ease both;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-neutral-300);
}
.modal-head h3 {
  margin: 0;
  font-size: 19px;
}
.modal-body {
  padding: 20px;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--color-neutral-300);
  background: var(--color-neutral-100);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-neutral-600);
  padding: 4px;
  line-height: 0;
  border-radius: 4px;
}
.icon-btn:hover {
  background: var(--color-neutral-200);
  color: var(--color-text);
}

/* ── Section animation library ──────────────────────────────────────────── */

/*
 * Decorative motion an admin assigns per page-section from edit mode.
 *
 * Three layers compose on one element without fighting:
 *
 *   entrance — a one-shot on render
 *   idle     — a continuous loop, delayed until the entrance has finished
 *   surface  — a light effect painted on ::after, which never touches transform
 *
 * Entrance and idle both animate `transform`, and two `animation` declarations
 * on the same element do not merge — the later rule replaces the earlier one
 * outright. They are composed through custom properties instead, so a section
 * can carry one of each and the shorthand resolves to a single two-part
 * animation list.
 *
 * Note the deliberate absence of `animation-fill-mode: both` on entrances. A
 * fill of `both` holds the element at its *from* keyframe until the animation
 * starts, so anything that prevents it running leaves the section invisible
 * with no error. Without a fill the resting state is the natural one, and a
 * skipped animation costs a flourish rather than the content.
 */
.anim-sec {
  animation: var(--a-enter, none), var(--a-idle, none);
}

/* ── Entrances (one-shot) ── */
.anim-enter-fadeUp   { --a-enter: aFadeUp 0.55s cubic-bezier(0.2, 0.7, 0.3, 1); }
.anim-enter-fadeDown { --a-enter: aFadeDown 0.55s cubic-bezier(0.2, 0.7, 0.3, 1); }
.anim-enter-zoomIn   { --a-enter: aZoomIn 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.15); }
.anim-enter-flipIn   { --a-enter: aFlipIn 0.7s cubic-bezier(0.25, 0.8, 0.3, 1); }
.anim-enter-dropIn   { --a-enter: aDropIn 0.65s cubic-bezier(0.3, 1.5, 0.5, 1); }
.anim-enter-slideIn  { --a-enter: aSlideIn 0.55s cubic-bezier(0.2, 0.7, 0.3, 1); }

@keyframes aFadeUp   { from { opacity: 0; transform: translateY(26px); } }
@keyframes aFadeDown { from { opacity: 0; transform: translateY(-26px); } }
@keyframes aZoomIn   { from { opacity: 0; transform: scale(0.9); } }
@keyframes aSlideIn  { from { opacity: 0; transform: translateX(-38px); } }
@keyframes aFlipIn   { from { opacity: 0; transform: perspective(900px) rotateX(-72deg); } }
@keyframes aDropIn   { from { opacity: 0; transform: translateY(-60px); } }

/* ── Idles (looping). Delayed past the entrance so the two never overlap. ── */
.anim-idle-float   { --a-idle: aFloat 4.5s ease-in-out 0.6s infinite; }
.anim-idle-sway    { --a-idle: aSway 5s ease-in-out 0.6s infinite; }
.anim-idle-breathe { --a-idle: aBreathe 4s ease-in-out 0.6s infinite; }
.anim-idle-drift   { --a-idle: aDrift 9s ease-in-out 0.6s infinite; }
.anim-idle-pulse   { --a-idle: aPulse 2.6s ease-in-out 0.6s infinite; }
.anim-idle-spin    { --a-idle: aSpin 22s linear 0.6s infinite; }

@keyframes aFloat   { 0%, 100% { transform: translateY(0); }        50% { transform: translateY(-9px); } }
@keyframes aSway    { 0%, 100% { transform: rotate(-0.8deg); }      50% { transform: rotate(0.8deg); } }
@keyframes aBreathe { 0%, 100% { transform: scale(1); }             50% { transform: scale(1.018); } }
@keyframes aDrift   { 0%, 100% { transform: translate(0, 0); }      50% { transform: translate(10px, -6px); } }
@keyframes aPulse   { 0%, 100% { opacity: 1; }                      50% { opacity: 0.82; } }
@keyframes aSpin    { from { transform: rotate(0deg); }             to  { transform: rotate(360deg); } }

/* ── Surface effects (::after — no transform, so they stack with the above) ── */
.anim-surface {
  position: relative;
}
.anim-surface::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  z-index: 4;
}

/* A hard specular band that sweeps across, like light off glass. */
.anim-surf-glint::after {
  background: linear-gradient(
    100deg,
    transparent 38%,
    rgba(255, 255, 255, 0.42) 50%,
    transparent 62%
  );
  background-size: 260% 100%;
  animation: aGlint 4.5s ease-in-out infinite;
}
@keyframes aGlint {
  0%        { background-position: 190% 0; }
  55%, 100% { background-position: -90% 0; }
}

/* Slower, wider and warmer than glint — a sheen rather than a flash. */
.anim-surf-shimmer::after {
  background: linear-gradient(
    115deg,
    transparent 25%,
    var(--color-accent-200) 50%,
    transparent 75%
  );
  background-size: 300% 100%;
  opacity: 0.5;
  animation: aShimmer 7s linear infinite;
}
@keyframes aShimmer {
  0%   { background-position: 220% 0; }
  100% { background-position: -120% 0; }
}

.anim-surf-glow::after {
  box-shadow: inset 0 0 0 2px var(--color-accent-400);
  animation: aGlowRing 3s ease-in-out infinite;
}
@keyframes aGlowRing {
  0%, 100% { opacity: 0.15; }
  50%      { opacity: 0.75; }
}

/* A CRT-style line travelling top to bottom. */
.anim-surf-scan::after {
  background: linear-gradient(to bottom, transparent 46%, rgba(255, 255, 255, 0.3) 50%, transparent 54%);
  background-size: 100% 240%;
  animation: aScan 5.5s linear infinite;
}
@keyframes aScan {
  0%   { background-position: 0 -120%; }
  100% { background-position: 0 220%; }
}

/* ── Edit-mode affordance ── */
/*
 * `position: relative` belongs here, not in JS. The tag is absolutely
 * positioned and needs this element as its containing block, but the node is
 * still detached when it is built — and getComputedStyle on a detached node
 * returns an empty declaration, so a `position === 'static'` test there is
 * never true and the tag ends up anchored to whatever ancestor happens to be
 * positioned.
 */
body.edit-mode .anim-target {
  outline: 2px dashed var(--color-accent-2-600);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
  position: relative;
}
.anim-tag {
  position: absolute;
  top: -12px;
  right: 10px;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-pixel);
  font-size: 8px;
  letter-spacing: 0.4px;
  padding: 5px 9px 4px;
  border: 2px solid var(--color-accent-2-800);
  border-radius: var(--radius-sm);
  background: var(--color-accent-2-600);
  color: #fff;
  cursor: pointer;
  box-shadow: var(--lift-1);
}
.anim-tag:hover {
  background: var(--color-accent-2-700);
}

/* Inside a card the tag tucks into the corner rather than hanging off the top
   edge, where it would sit on top of the card in the row above. */
.anim-tag-inset {
  top: 6px;
  right: 6px;
  font-size: 7px;
  padding: 4px 6px 3px;
}

/* Motion is decoration; anyone asking for less gets a still page. */
@media (prefers-reduced-motion: reduce) {
  .anim-sec {
    animation: none;
  }
  .anim-surface::after {
    animation: none;
    opacity: 0;
  }
}

/* ── Section animation picker (edit mode) ───────────────────────────────── */

.anim-picker {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 22px;
  align-items: start;
}
.anim-group + .anim-group {
  margin-top: 16px;
}
.anim-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.anim-chip {
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 11px;
  border: 2px solid var(--color-neutral-300);
  border-radius: 999px;
  background: var(--color-neutral-100);
  color: var(--color-text);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.anim-chip:hover {
  border-color: var(--color-neutral-400);
}
.anim-chip.selected {
  border-color: var(--color-accent-500);
  background: var(--color-accent-100);
  color: var(--color-accent-800);
}

/* Generous padding: a drop-in or flip renders well outside the tile's box,
   and a tight stage clips the very motion being judged. */
.anim-stage {
  padding: 34px 18px;
  border: 2px dashed var(--color-neutral-300);
  border-radius: var(--radius-md);
  background: var(--color-neutral-200);
  display: flex;
  justify-content: center;
  overflow: hidden;
}
.anim-demo {
  width: 100%;
  padding: 26px 12px;
  text-align: center;
  font-family: var(--font-heading);
  font-size: 15px;
  border: 2px solid var(--color-neutral-400);
  border-radius: var(--radius-md);
  background: var(--color-neutral-100);
  box-shadow: var(--lift-2);
}

@media (max-width: 760px) {
  .anim-picker {
    grid-template-columns: 1fr;
  }
}
