/* Clovermind, the homepage's pencil Pong.
   Only what the game needs inside the hero figure: the board's box, the
   canvas, the play and pause controls and the failure note. The card around
   it, the layout and the caption belong to main.css.

   The board reserves its 2:1 box before the script runs (no layout shift)
   and shows the pencil paper colour, so there is no flash before the paint.
   Override --hero-pong-radius to match the card the board sits in. */

.hero-pong__board {
  position: relative;
  aspect-ratio: 2 / 1;
  overflow: hidden;
  isolation: isolate;
  background: #EFE6D5;
  border-radius: var(--hero-pong-radius, 16px);
  line-height: 0;
}

/* With scripting off the board is not left blank under a caption that says
   it is playing: it shows the same composed still the page draws under
   reduced motion (rendered once from js/pencil.js). Browsers with scripts
   on never fetch it. */
@media (scripting: none) {
  .hero-pong__board {
    background-image: url("../adam15/img/pencil-court-still.webp");
    background-position: center;
    background-size: 100% 100%;
    background-repeat: no-repeat;
  }
}

.hero-pong__canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

/* ── Watch Adam play: the drawn circle and play mark, the words under it ──
   The same hand as the Adam 15 page's start control (js/pencil.js paints
   the glyph), on a soft patch of the board's own paper so the net does not
   run through it. No pill, no shadow: hover only darkens and underlines the
   words; keyboard focus rings the circle. */
.hero-pong__play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 22px 40px 20px;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(239, 230, 213, .96) 64%, rgba(239, 230, 213, 0) 100%);
  color: #57524A;
  font: 500 15px/1.3 "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0.005em;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.hero-pong__play[hidden] { display: none; }
.hero-pong__glyph {
  display: block;
  width: 64px;
  height: 64px;
  flex: none;
  border-radius: 50%;
}
.hero-pong__label {
  text-decoration: underline 1px transparent;
  text-underline-offset: 4px;
  transition: color .2s ease, text-decoration-color .2s ease;
}
.hero-pong__play:hover .hero-pong__label,
.hero-pong__play:focus-visible .hero-pong__label {
  color: #1C1A17;
  text-decoration-color: currentColor;
}
.hero-pong__play:focus-visible { outline: none; }
.hero-pong__play:focus-visible .hero-pong__glyph { outline: 2px solid #2E2433; outline-offset: 1px; }

/* ── the pause control: quiet, there on hover and on keyboard focus ─── */
.hero-pong__pause {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 44px;
  height: 44px;
  padding: 7px;
  border: 0;
  border-radius: 50%;
  /* only a breath of paper under it: the drawing (a paddle at the top of its run) shows through */
  background: radial-gradient(closest-side, rgba(239, 230, 213, .55) 60%, rgba(239, 230, 213, 0) 100%);
  cursor: pointer;
  opacity: 0;
  transition: opacity .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.hero-pong__pause canvas { display: block; width: 30px; height: 30px; }
.hero-pong__board:hover .hero-pong__pause,
.hero-pong__pause:focus-visible { opacity: 1; }
.hero-pong__pause:focus-visible { outline: 2px solid #2E2433; outline-offset: -3px; }
.hero-pong__pause[hidden] { display: none; }
@media (hover: none) {
  .hero-pong__board:hover .hero-pong__pause { opacity: 0; }
}

/* ── the honest note, if the model did not load ─────────────────────── */
.hero-pong__note {
  position: absolute;
  left: 12px;
  bottom: 12px;
  margin: 0;
  width: fit-content;
  max-width: calc(100% - 24px);
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(251, 248, 242, 0.94);
  box-shadow: 0 0 0 1px rgba(28, 26, 23, 0.12);
  color: #57524A;
  font: 400 13.5px/1.4 "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (max-width: 480px) {
  .hero-pong__play { gap: 6px; padding: 14px 30px 12px; font-size: 14px; }
  .hero-pong__glyph { width: 52px; height: 52px; }
  .hero-pong__note { font-size: 12.5px; left: 8px; bottom: 8px; padding: 6px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-pong__label, .hero-pong__pause { transition: none; }
}

/* Scripting off: the board shows a still (see .hero-pong__board above); say so plainly. */
.hero-pong__noscript {
  margin: 10px 0 0;
  color: #57524A;
  font: 400 14px/1.5 "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
