/* Joséphine board — a two-deck patience matted inside the shell's editorial page
   (ARCHITECTURE.md §6 allows a per-game texture as long as it honours mode /
   colorBlind / reducedMotion). All selectors are scoped under .jo-root so nothing
   leaks into the shell chrome. Ten columns and eight foundations make it wider
   than Klondike, so the cards run a touch narrower. Joséphine shares Forty
   Thieves' geometry but takes a slightly warmer baize to tell them apart. */

.jo-root {
  --felt: #1a6350;
  --felt-hi: #287a64;
  --paper: #fdfcf7;
  --ink: #14110e;
  --madder: #c0182b;   /* refusal / red suits — the board's semantic red */
  --gold: #e0bd63;
  --line: rgba(253, 252, 247, 0.22);
  --cw: clamp(30px, 8.6vw, 74px);
  --ch: calc(var(--cw) * 1.45);
  --gap: clamp(4px, 0.9vw, 10px);
  --r: calc(var(--cw) * 0.041); /* matches the corner radius baked into the card SVGs */

  position: relative;
  padding: clamp(12px, 3vw, 26px) clamp(6px, 1.8vw, 18px);
  border-radius: var(--radius-md);
  background: var(--felt);
  background-image: radial-gradient(ellipse 80% 70% at 50% 24%, var(--felt-hi), var(--felt) 74%);
  color: #eaf3ed;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(20, 17, 14, 0.25), var(--shadow-sm);
}

/* Dark mode: deepen the baize a touch; card faces stay the lightest surface. */
@media (prefers-color-scheme: dark) {
  .jo-root { --felt: #134a3c; --felt-hi: #1c5c4b; }
}
.jo-root.mode-dark { --felt: #134a3c; --felt-hi: #1c5c4b; }

.jo-board {
  max-width: calc(var(--cw) * 10 + var(--gap) * 9);
  margin: 0 auto;
  position: relative;
}
.jo-top {
  display: grid;
  grid-template-columns: repeat(10, var(--cw));
  gap: var(--gap);
  margin-bottom: calc(var(--gap) * 1.7);
}
.jo-slot {
  width: var(--cw);
  height: var(--ch);
  border-radius: var(--r);
  border: 1.5px solid var(--line);
  position: relative;
  display: grid;
  place-items: center;
  color: rgba(253, 252, 247, 0.24);
  font-size: calc(var(--cw) * 0.44);
}
/* Foundations sit two-per-suit but are unmarked: any Ace opens one. */
.jo-found { border-style: dashed; }
.jo-cols {
  display: grid;
  grid-template-columns: repeat(10, var(--cw));
  gap: var(--gap);
}
.jo-pile {
  position: relative;
  min-height: var(--ch);
  width: var(--cw);
}
.jo-pile > .jo-base {
  position: absolute;
  inset: 0 0 auto 0;
  height: var(--ch);
  border-radius: var(--r);
  border: 1.5px solid var(--line);
}

/* Left-handed layout (variant "gaucher", if enabled): mirror the top row. */
.jo-root.hand-left .jo-top { direction: rtl; }
.jo-root.hand-left .jo-top > * { direction: ltr; }

.jo-root .card {
  position: absolute;
  left: 0;
  width: var(--cw);
  height: var(--ch);
  /* The face SVG is the whole card (its own rounded ground + hairline border),
     so the card neither fills nor clips — that would nibble the SVG corners.
     border-radius is kept only so the drop shadow follows the card silhouette. */
  border-radius: var(--r);
  color: var(--ink);
  user-select: none;
  touch-action: none;
  box-shadow: 0 -1px 0 rgba(20, 17, 14, 0.16), 0 -4px 7px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.12);
  transition: top 0.17s cubic-bezier(0.2, 0.7, 0.3, 1), left 0.17s cubic-bezier(0.2, 0.7, 0.3, 1);
}
/* Both faces and the back are one full-card SVG image (its own rounded ground +
   black die-cut outline). Aspect matches the card, so object-fit: fill is exact. */
.jo-root .cf {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  display: block;
  object-fit: fill;
  z-index: 2;
}
.jo-root .card.lift {
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.16), 0 14px 28px rgba(0, 0, 0, 0.38);
}
/* Hint: flash the suggested card with a gold ring. */
.jo-root .card.hint {
  outline: 3px solid var(--gold);
  outline-offset: 1px;
  border-radius: var(--r);
  z-index: 40;
  animation: jo-hint 0.6s ease-in-out 2;
}
@keyframes jo-hint { 0%, 100% { outline-color: var(--gold); } 50% { outline-color: transparent; } }
@media (prefers-reduced-motion: reduce) { .jo-root .card.hint { animation: none; } }

.jo-drag {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 50;
}
.jo-drag .card { transition: none; }

.jo-win {
  position: absolute;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .jo-root .card { transition: none; }
}
.jo-root.no-motion .card { transition: none; }
