/* Jorblys polish: the shared "feels alive" layer on every page (linked last in each page's <head>, so it
   sits on top of the page's own styles). Only motion and finish: no colors or layouts change here.
   Buttons lift with a soft shadow under the cursor and press down when tapped; cards rise; the Jorblys
   bob and wiggle; keyboard users get a clear focus ring. Hover effects only on devices with a mouse,
   so nothing "sticks" on phones, and everything is off for people who ask for reduced motion. */

:root { --jx-ease: cubic-bezier(.34, 1.56, .64, 1); --jx-lift: drop-shadow(0 10px 14px rgba(43, 35, 80, .22)); }
html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

/* Headlines and short lines break evenly (no one-word last lines) */
h1, h2, h3, .tagline, .kicker, .tag { text-wrap: balance; }
p, li, .lead { text-wrap: pretty; }

/* ---------- Buttons: lift + glow on hover, press on tap ---------- */
.btn, .gk-btn, .pill, a.jorblys-home, .gear, .game .play, .plans .btn, button.link, a.link {
  cursor: pointer;
  transition: transform .18s var(--jx-ease), filter .18s ease, box-shadow .12s ease, background-color .18s ease, color .18s ease, border-color .18s ease;
  will-change: transform;
}
@media (hover: hover) and (pointer: fine) {
  .btn:hover, .gk-btn:hover:not(:disabled), a.jorblys-home:hover, .gear:hover {
    transform: translateY(-3px) scale(1.03); filter: brightness(1.06) var(--jx-lift);
  }
  .pill:hover { transform: translateY(-2px); filter: var(--jx-lift); background-color: #fff; border-color: #b9a6f2; }
  .pill.signin:hover { background-color: #3b2f6b; border-color: #3b2f6b; }
  /* inside a game card, the card lifts and its Play button brightens with it */
  a.game:hover .play { filter: brightness(1.08); transform: scale(1.05); }
  button.link:hover, a.link:hover { color: #6a46c9; }
}
.btn:active, .gk-btn:active:not(:disabled), .pill:active, a.jorblys-home:active, .gear:active, .plans .btn:active {
  transform: translateY(3px) scale(.98); filter: none; transition-duration: .06s;
}
.gk-btn:disabled, .btn:disabled, .btn[aria-disabled="true"] { cursor: not-allowed; filter: grayscale(.2); }

/* ---------- Cards ---------- */
a.game, .g, .books .book, .player {
  transition: transform .25s var(--jx-ease), box-shadow .25s ease, filter .25s ease;
}
@media (hover: hover) and (pointer: fine) {
  a.game:hover { filter: var(--jx-lift); }
  .g:hover { transform: translateY(-5px); filter: var(--jx-lift); }
  .g:hover .art, a.game:hover .jorbly { animation: jx-wiggle .6s ease; }
}

/* ---------- The Jorblys: a gentle bob, and a happy hop under the cursor ---------- */
.cast > div { transition: transform .3s var(--jx-ease); animation: jx-bob 3.6s ease-in-out infinite; }
.cast > div:nth-child(2n) { animation-delay: -1.2s; }
.cast > div:nth-child(3n) { animation-delay: -2.4s; }
@media (hover: hover) and (pointer: fine) {
  .cast > div:hover { animation: jx-hop .55s var(--jx-ease); cursor: default; }
}
@keyframes jx-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes jx-hop { 0% { transform: translateY(0) scale(1); } 40% { transform: translateY(-16px) scale(1.06) rotate(-4deg); } 100% { transform: translateY(0) scale(1); } }
@keyframes jx-wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-6deg); } 60% { transform: rotate(5deg); } }

/* ---------- Game tiles (letters, cards, cells): a small lift under the cursor ---------- */
@media (hover: hover) and (pointer: fine) {
  .gk-tile:not(:disabled):hover { transform: translateY(-2px); filter: brightness(1.04); }
}

/* ---------- Text links ---------- */
a:not([class]) { text-underline-offset: .18em; text-decoration-thickness: .08em; transition: color .15s ease, text-decoration-color .15s ease; }

/* ---------- Keyboard focus: a clear ring, only for keyboard users ---------- */
:focus { outline: none; }
:focus-visible { outline: 3px solid #6a46c9; outline-offset: 3px; border-radius: 12px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 1px; }
input, select, textarea { transition: border-color .15s ease, box-shadow .15s ease; }
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 4px rgba(106, 70, 201, .18); }

/* ---------- Sections ease in as you scroll (logo.js adds .jx-reveal only when it can show them) ---------- */
.jx-reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s cubic-bezier(.2, .8, .2, 1); }
.jx-reveal.jx-in { opacity: 1; transform: none; }

/* ---------- Page arrival: a quick fade so pages don't "pop" in ---------- */
body { animation: jx-arrive .35s ease both; }
@keyframes jx-arrive { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .jx-reveal { opacity: 1; transform: none; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Small text fixes ---------- */
.hero p { max-width: 62ch; text-wrap: balance; }                                   /* home: the subtitle fits one line on a computer */
.game .progress { text-wrap: balance; border-radius: 16px; line-height: 1.3; padding-block: 5px; }   /* game cards: two-line notes wrap evenly */
