/* The tiles page (/tiles) in the Parlour Journey's language (27 Nov 2026,
   plans/PLAN-pages.md). Nathan: "finally, revamp the tiles page."

   Linked by tiles.html after gallery.css, so at equal specificity it wins by
   source order. Same contract as parlourskin.css: no layout property — no
   padding, margin, gap, border width, size or font-size changes a box, so the
   page's suites (coach, tilepreview, bonusink, taptargets, language…) measure
   what they always measured. Frames are box-shadows, presses are transforms.
   Motion only without `prefers-reduced-motion`; nothing clickable moves
   forever. Guard: parlourskin.py "Tiles page". */

body.gallery {
  --pk-ink: #1c120c;
  --pk-ink2: #3a2618;
  --pk-gold: #ffd76a;
  --pk-gold2: #f0a830;
  --pk-cream: #fff6dc;
  --pk-cream2: #d9c9a0;
  --pk-jade: #3f9a5e;
  --pk-wood: #6a3d22;
  --pk-wood2: #8a5430;
  --pk-mass: inset 0 -3px 0 #0005, inset 0 2px 0 #fff2, 0 3px 0 var(--pk-ink);
  --pk-mass-down: inset 0 -1px 0 #0005, inset 0 1px 0 #fff2, 0 0 0 var(--pk-ink);
  /* The journey's night over the parlour: a few stars, then deep purple. */
  background-color: #0b0a1c;
  background-image:
    radial-gradient(2px 2px at 12% 6%, #fff8 50%, transparent 51%),
    radial-gradient(2px 2px at 78% 3%, #fff6 50%, transparent 51%),
    radial-gradient(2px 2px at 44% 9%, #fff5 50%, transparent 51%),
    radial-gradient(2px 2px at 90% 14%, #fff4 50%, transparent 51%),
    radial-gradient(2px 2px at 25% 17%, #fff4 50%, transparent 51%),
    linear-gradient(#0b0a1c, #1a1030 900px, #2a1424 2200px, #1c120c 4200px);
  background-attachment: fixed;
}

/* ── The header: a wooden sign ──────────────────────────────────────────── */
body.gallery .ghead {
  background: linear-gradient(#4a2f1c, #2a1810);
  border-bottom-color: var(--pk-gold2);
  box-shadow: inset 0 -4px 0 var(--pk-ink), 0 4px 0 #000a;
}
body.gallery .ghead h1 { text-shadow: 2px 2px 0 var(--pk-ink), 0 0 12px #ffd76a55; }
body.gallery .ghead h1 small { color: var(--pk-cream2); text-shadow: 1px 1px 0 var(--pk-ink); }
body.gallery .ghead .gwrap { position: relative; }      /* positioned: no box moves */
.tp-deco { position: absolute; pointer-events: none; image-rendering: pixelated; image-rendering: crisp-edges; }
/* Hung from the header's own corners, inside its side padding: in the middle
   they landed on the language toggle, and the row wraps on a phone. */
.tp-lantern { top: 0; transform-origin: 50% 0; }
.tp-l1 { left: 4px; }
.tp-l2 { right: 4px; }
/* Bak at 1:1, standing in the page margin beside the sign. Only where there
   is a margin to stand in: anywhere narrower he would cover the title. */
.tp-bak { left: -76px; top: -6px; width: 56px; height: 64px; display: none; }
@media (min-width: 1240px) { .tp-bak { display: block; } }

/* Back to the table: a wooden key that goes down. */
body.gallery .btnlink {
  background: linear-gradient(var(--pk-wood2), var(--pk-wood));
  color: var(--pk-cream); border-color: var(--pk-ink); border-radius: 0;
  text-shadow: 1px 1px 0 var(--pk-ink);
  box-shadow: var(--pk-mass);
}
body.gallery .btnlink:hover { filter: brightness(1.1); }
body.gallery .btnlink:active { transform: translateY(3px); box-shadow: var(--pk-mass-down); }

/* ── The two modes: big cards with mass; the chosen one is gold ──────────── */
body.gallery .modeswitch button {
  border-color: var(--pk-ink); border-radius: 0;
  background: linear-gradient(#3a2618, #24160c);
  color: var(--pk-cream2);
  box-shadow: inset 0 -4px 0 #0006, inset 0 2px 0 #fff1, 0 4px 0 var(--pk-ink);
}
body.gallery .modeswitch button:hover { border-color: var(--pk-ink); color: var(--pk-cream); filter: brightness(1.1); }
body.gallery .modeswitch button[aria-pressed="true"] {
  background-color: var(--pk-gold2);
  background-image: linear-gradient(var(--pk-gold), var(--pk-gold2));
  color: var(--pk-ink); border-color: var(--pk-ink);
  box-shadow: inset 0 -4px 0 #0003, inset 0 2px 0 #fff6, 0 4px 0 var(--pk-ink);
}
body.gallery .modeswitch button[aria-pressed="true"] small { color: var(--pk-ink2); }
body.gallery .modeswitch button:active { transform: translateY(3px); box-shadow: inset 0 -2px 0 #0005, 0 1px 0 var(--pk-ink); }

/* ── Little keys: jump links, examples, Clear/Undo, the speaker ─────────── */
body.gallery .jump a,
body.gallery .example,
body.gallery .ghostbtn,
body.gallery .speakbtn,
body.gallery .coachtarget button {
  border-color: var(--pk-ink); border-radius: 0;
  background: linear-gradient(#3a2618, #24160c);
  color: var(--pk-gold);
  box-shadow: var(--pk-mass);
}
body.gallery .speakbtn, body.gallery .ghostbtn { color: var(--pk-cream2); }
body.gallery .jump a:hover,
body.gallery .example:hover,
body.gallery .ghostbtn:hover,
body.gallery .speakbtn:hover,
body.gallery .coachtarget button:hover { border-color: var(--pk-ink); background: linear-gradient(#4a301c, #2e1c10); }
body.gallery .coachtarget button[aria-pressed="true"] {
  background-color: var(--pk-gold2);
  background-image: linear-gradient(var(--pk-gold), var(--pk-gold2));
  color: var(--pk-ink);
}
body.gallery .jump a:active,
body.gallery .example:active,
body.gallery .ghostbtn:active,
body.gallery .speakbtn:active,
body.gallery .coachtarget button:active { transform: translateY(3px); box-shadow: var(--pk-mass-down); }

/* ── Headings ──────────────────────────────────────────────────────────── */
body.gallery .ghead2 {
  color: var(--pk-gold);
  border-bottom-color: var(--pk-gold2);
  text-shadow: 2px 2px 0 var(--pk-ink), 0 0 10px #ffd76a44;
  box-shadow: 0 2px 0 var(--pk-ink);
}
body.gallery section h2 { color: var(--pk-cream); text-shadow: 2px 2px 0 var(--pk-ink); }
/* A faan band's figure is a stamped gold plate (its spread is a shadow, so
   the line does not grow). */
body.gallery .band h3 { border-bottom-color: #6b5334; }
body.gallery .band h3 .faan {
  background: var(--pk-gold); color: var(--pk-ink);
  box-shadow: 0 0 0 4px var(--pk-gold), 0 0 0 6px var(--pk-ink), 4px 4px 0 6px #000;
  transform: rotate(-2deg);
}

/* ── The tiles: framed felt with a hard drop; a pointed one rises ────────── */
body.gallery .cell {
  border-color: var(--pk-ink); border-radius: 0;
  box-shadow: inset 0 0 0 2px var(--pk-wood), inset 0 0 0 3px var(--pk-ink), 4px 4px 0 #000;
}
body.gallery .cell figcaption b { color: var(--pk-gold); text-shadow: 1px 1px 0 var(--pk-ink); }

/* Scoring combinations: cards with a gold edge and a hard drop. */
body.gallery .faanrow {
  border-color: var(--pk-ink); border-radius: 0;
  box-shadow: inset 3px 0 0 var(--pk-gold2), 4px 4px 0 #000;
}
body.gallery .faanrow .meta b { text-shadow: 1px 1px 0 var(--pk-ink); }

/* ── The simulator and the live helper ─────────────────────────────────── */
/* The hand tray is felt in a wooden rail. */
body.gallery .simhand {
  border-color: var(--pk-ink); border-radius: 0;
  box-shadow: inset 0 0 0 3px var(--pk-wood), inset 0 0 0 4px var(--pk-ink), inset 0 6px 10px #0006, 4px 4px 0 #000;
}
body.gallery .verdict {
  border-radius: 0;
  box-shadow: 4px 4px 0 #000;
}
body.gallery .verdict .headline,
body.gallery .verdict > b { text-shadow: 1px 1px 0 var(--pk-ink); }
body.gallery .search { border-radius: 0; box-shadow: inset 0 3px 0 #0008; }
body.gallery #handpanel { border-color: var(--pk-ink); border-radius: 0; box-shadow: inset 0 0 0 1px var(--pk-gold2), 6px 6px 0 #000b; }
body.gallery #handpanel .hptoggle b { color: var(--pk-gold); text-shadow: 2px 2px 0 var(--pk-ink); }
body.gallery .claim { border-radius: 0; box-shadow: 3px 3px 0 #000; }

/* ── Motion ───────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  /* The title stamps on when the page opens. */
  body.gallery .ghead h1 { animation: tp-stamp .45s cubic-bezier(.2, 1.8, .4, 1) .1s both; transform-origin: left center; }
  /* Lanterns sway (not clickable). */
  .tp-lantern { animation: tp-sway 3.2s ease-in-out infinite; }
  .tp-l2 { animation-delay: -1.4s; }
  /* A pointed tile card or a picker tile lifts; it settles when the pointer
     leaves. A hover, so nothing moves on its own. */
  body.gallery .cell, body.gallery .pick { transition: transform .12s ease-out; }
  body.gallery .cell:hover, body.gallery .pick:hover:not(:disabled) { transform: translateY(-3px); }
  body.gallery .modeswitch button,
  body.gallery .jump a, body.gallery .example, body.gallery .ghostbtn,
  body.gallery .speakbtn, body.gallery .coachtarget button, body.gallery .btnlink {
    transition: transform .06s, box-shadow .06s, filter .1s;
  }
  body.gallery .band h3 .faan { animation: tp-pop .3s ease-out both; }
}
@keyframes tp-stamp { from { transform: scale(1.8) rotate(-6deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes tp-sway { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
@keyframes tp-pop { 0% { transform: rotate(-2deg) scale(1); } 45% { transform: rotate(-2deg) scale(1.12); } 100% { transform: rotate(-2deg) scale(1); } }
