/* Design pass v2. Additive only.
   Loaded last on every page, after style.css or case.css. Nothing here
   changes copy, colour, font, layout or the hero. Three things:
   paper grain, paper cards, the tagline clusters. */

:root {
  --v2-ease: cubic-bezier(0.22, 1, 0.36, 1);
  /* A warm grey about 9% darker than the card fill. */
  --v2-card-edge: #E3DFD7;
  --v2-card-shadow: 0 12px 24px -12px rgba(60, 45, 20, .18);
}

:root[data-theme="dark"] {
  --v2-card-edge: #2B2E34;
  --v2-card-shadow: 0 12px 24px -12px rgba(0, 0, 0, .55);
}

/* --- 1. Paper grain on the page background ---------------------------- */

/* One static tile, rendered once. No per-frame filter, so it costs nothing
   on scroll. The existing body::after in style.css is a different layer and
   is disabled below so these do not stack. */
.v2-grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: .05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='256' height='256'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23g)'/%3E%3C/svg%3E");
  background-size: 256px 256px;
}

body::after { display: none !important; }

:root[data-theme="dark"] .v2-grain { mix-blend-mode: screen; opacity: .03; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .v2-grain { mix-blend-mode: screen; opacity: .03; }
}

/* The hero photograph is a photograph. The grain stays off it. */
.curtain, .curtain__frame, .tile--portrait { position: relative; z-index: 2; }

/* --- 2. Paper cards ---------------------------------------------------- */

.bento--home .tile__in {
  border-color: var(--v2-card-edge);
  box-shadow: none;
  transition: transform 300ms var(--v2-ease), box-shadow 300ms var(--v2-ease);
}

/* Grain clipped to the card, so each one reads as a sheet resting on the
   page rather than a panel cut out of it. Slightly stronger than the page. */
.bento--home .tile__in::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .07;
  mix-blend-mode: multiply;
  border-radius: inherit;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='256' height='256'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23g)'/%3E%3C/svg%3E");
  background-size: 256px 256px;
}

:root[data-theme="dark"] .bento--home .tile__in::before { mix-blend-mode: screen; opacity: .04; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .bento--home .tile__in::before { mix-blend-mode: screen; opacity: .04; }
}

/* The card's own content already sits above the accent wash at z-index 1,
   so the grain at 0 slots underneath it without touching the stacking. */

.bento--home .tile__media,
.bento--home .tile__media .slot,
.bento--home .tile__media img { transition: transform 300ms var(--v2-ease); }

@media (hover: hover) and (pointer: fine) {
  a.tile:hover .tile__in,
  a.tile:focus-visible .tile__in {
    transform: translateY(-4px);
    box-shadow: var(--v2-card-shadow);
  }
  a.tile:hover .tile__media .slot,
  a.tile:hover .tile__media img,
  a.tile:focus-visible .tile__media .slot,
  a.tile:focus-visible .tile__media img { transform: scale(1.02); }
}

/* --- 4. The tagline clusters ------------------------------------------ */







/* Out: reverse at 1.5x, no stagger. */


@media (prefers-reduced-motion: reduce) {
}

/* --- Cards cut back ---------------------------------------------------
   The cards now carry a project name, the problem as the headline, one
   outcome and a role. With the fact stack gone the headline can take the
   weight it should have had all along. */

.bento--home .tile__title {
  font-size: clamp(23px, 2.5vw, 31px);
  line-height: 1.12;
  letter-spacing: -.025em;
  max-width: 20ch;
}

.bento--home .tile--sm .tile__title,
.bento--home .tile--pair .tile__title {
  font-size: clamp(19px, 1.9vw, 23px);
  line-height: 1.18;
  max-width: 22ch;
}

/* Says what kind of project it is, without a sentence doing the work. */
.tag {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 8px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 9px;
  letter-spacing: .1em;
  vertical-align: 2px;
  opacity: .85;
}

/* One fact left, so it reads as a closing line rather than a column. */
.bento--home .tile--band .tile__more {
  grid-template-columns: minmax(0, 1fr);
  max-width: 46ch;
}

.bento--home .tile__more .fact__v { font-size: 15px; }

/* --- New homepage blocks ---------------------------------------------- */

/* The two app cards sit at the smaller size; the pile and the blogs take
   the widths their content needs. */
/* Uneven on purpose. A row of four equal halves reads as a template, so
   Ezra takes a quarter and Lurch takes the rest and runs taller. */
.bento--home .a-cat { grid-column: span 1; }
.bento--home .a-lurch { grid-column: span 3; }
.bento--home .a-moments { grid-column: span 2; }
.bento--home .a-blog { grid-column: 1 / -1; }

.bento--home .a-lurch .tile__in { min-height: 460px; }
.bento--home .a-cat .tile__in { min-height: 300px; }

/* Lurch has the width for its media and its words side by side. */
@media (min-width: 1100px) {
  .bento--home .a-lurch .tile__in {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: clamp(28px, 3vw, 48px);
    align-items: center;
  }
  .bento--home .a-lurch .tile__media { margin-bottom: 0; min-height: 0; }
  .bento--home .a-lurch .tile__title { font-size: clamp(23px, 2.2vw, 29px); max-width: 18ch; }
}

@media (max-width: 1099px) {
  .bento--home .a-cat,
  .bento--home .a-moments { grid-column: span 1; }
  .bento--home .a-lurch { grid-column: span 2; }
  .bento--home .a-lurch .tile__in { min-height: 0; }
}

/* Photographs stacked on each other. Tap and the next comes to the front,
   which is the only way these lines work without six separate images. */
.pile {
  position: relative;
  margin-top: 20px;
  height: 260px;
}

.pile__card {
  position: absolute;
  inset: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transform: rotate(var(--r, 0deg));
  transition: transform 300ms var(--v2-ease), opacity 300ms var(--v2-ease);
}

.pile__card .slot {
  width: 100%;
  height: 100%;
  margin: 0;
  border-radius: 14px;
  box-shadow: 0 8px 20px -12px rgba(60, 45, 20, .22);
}

.pile__card.is-front { transform: rotate(0deg) scale(1.02); z-index: 3; }
.pile__card.is-mid   { z-index: 2; }
.pile__card.is-back  { z-index: 1; }

.pile__cap {
  margin: 18px 0 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--c-body);
  min-height: 3em;
}

@media (prefers-reduced-motion: reduce) {
  .pile__card { transition: none; }
}

/* Writing. Three embeds across, stacking down as the column narrows. */
.blog {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.blog .slot { min-height: 180px; margin: 0; }

/* --- The sticky bar ---------------------------------------------------
   A rounded pill that floats over the page. It carries the nav that used
   to sit behind the dock's menu button, so both are gone. */

/* Fixed rather than sticky, so it takes no space in the flow and the
   photograph still opens the page at full height. Hidden until the
   curtain has gone by: the bar belongs to the grid, not to the picture.
   Bottom centre since 2026-10-15, his call. */
.bar {
  position: fixed;
  bottom: 16px;
  left: 0;
  right: 0;
  z-index: 400;
  padding: 0 var(--margin, 24px);
}

/* Without JS it simply stays visible, rather than never appearing. */
.js .bar {
  transform: translateY(140%);
  opacity: 0;
  pointer-events: none;
  transition: transform 340ms var(--v2-ease), opacity 240ms var(--v2-ease);
}

.js .bar.is-up { transform: none; opacity: 1; pointer-events: auto; }

@media (prefers-reduced-motion: reduce) { .js .bar { transition: none; } }

.bar__in {
  width: max-content;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  background: var(--c-surface);
  border: 1px solid var(--v2-card-edge);
  border-radius: 999px;
  box-shadow: 0 6px 18px -12px rgba(60, 45, 20, .22);
}

.bar__in > a {
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 15px;
  color: var(--c-body);
  text-decoration: none;
  white-space: nowrap;
  transition: color 180ms var(--v2-ease), background-color 180ms var(--v2-ease);
}

.bar__in > a:hover,
.bar__in > a:focus-visible { color: var(--c-ink); background: var(--c-bg); }






.bar__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border: 1px solid var(--v2-card-edge);
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  color: var(--c-ink);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 180ms var(--v2-ease), border-color 180ms var(--v2-ease);
}

.bar__cta:hover, .bar__cta:focus-visible {
  background: var(--c-ink);
  border-color: var(--c-ink);
  color: var(--c-bg);
}

  /* The bar is three buttons wide now, so there is no stranded CTA to
     rescue and no name to shrink. All three go to 44px so they are
     thumb-sized, and the padding comes in so the pill still fits 360px. */
  @media (max-width: 760px) {
    .bar { bottom: 10px; padding: 0 16px; }
    .bar__in { gap: 4px; padding: 5px; max-width: 100%; }
    .bar__in > a { min-height: 44px; display: inline-flex; align-items: center; padding: 0 13px; font-size: 14px; }
    .bar__cta { padding: 0 15px; font-size: 14px; }
  }

/* The curtain used to sit under a transparent page top. Now there is a bar
   above it, so the curtain starts below the bar rather than behind it. */
.bar + main .curtain,
.bar ~ .wrap .curtain { margin-top: 0; }

/* --- The intro card ---------------------------------------------------
   Three voices in one column, and a tray in the corner beside them.

     the name        30px / 800   ink
     one claim       21px / 450   ink
     two notes       16px / 400   soft, under a rule, each marked by a disc

   The claim and the notes are the same weight of information at different
   temperatures: the claim is what he does, the notes are where he is right
   now. Weight and size carry that, not colour, because the palette here is
   five greys and a sixth would mean something was wrong.

   On the overlap: the client allowed the discs to sit on this copy, and
   they do not. A disc is 46px across and a line of this type is 30px tall,
   so a disc landing on a sentence is not a graphic accent, it covers three
   words, and it covers them until a reader moves it. There is no scrim or
   blend that saves both the type and the look of the discs, so the discs
   get a corner of their own, 172 by 132, and the words get a guaranteed
   clear field. What they do instead of overlapping is touch: the rule
   under the claim runs to within 32px of the tray, so the heap reads as
   the end of that line rather than as a thing parked in a spare column.
   ---------------------------------------------------------------------- */

.intro__lead b { font-weight: 800; }

/* One column. The old split put the words in the left 44% and left 270px
   of nothing between them and the tray, which at 1440 was the largest hole
   on the card. The words now run to the rail and stop. */
.bento--home .tile__lead.intro {
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  align-items: start;
  row-gap: 0;
}

/* The one sentence on this page that says what he actually does, so it is
   set as a statement rather than as body copy: ink, not grey, and held to
   a reading measure the card's width is not allowed to stretch. */
.intro__claim {
  margin: clamp(13px, 1.3vw, 20px) 0 0;
  max-width: 46ch;
  /* The rem term is what makes this climb with the card rather than with
     the viewport: 17.6 against a 24px name at 768, 21 against 30 at 1440,
     so the step between the two voices holds at both ends. A pure vw ramp
     put it at 15.6 on a 1100px card, which read as a caption. */
  font-size: clamp(16.5px, 0.84rem + 0.45vw, 20px);
  font-weight: 450;
  line-height: 1.45;
  letter-spacing: -0.012em;
  color: var(--c-ink);
  /* Two lines, so where the break lands is half the setting. Left to
     itself it broke after "think," and left "behave, and feel." hanging,
     which cuts the one phrase in the sentence that has to stay whole. */
  text-wrap: balance;
}

/* The rule is the card's horizon. It is the card's own border colour, so it
   reads as part of how the sheet is built rather than as a divider dropped
   on it, and it runs the full width of the text column. */
.intro__notes {
  margin: clamp(17px, 1.7vw, 26px) 0 0;
  padding: clamp(15px, 1.5vw, 22px) 0 0;
  border-top: 1px solid var(--v2-card-edge);
  list-style: none;
  display: grid;
  row-gap: 11px;
}

.intro__notes li {
  position: relative;
  padding-left: 17px;
  max-width: 44ch;
  font-size: clamp(14.5px, 0.78rem + 0.26vw, 16px);
  line-height: 1.5;
  color: var(--c-body-soft);
  text-wrap: pretty;
}

/* The mark is a disc, because the five things in the corner are discs: the
   same shape at an eightieth of the area, one punctuating and five playing.
   It is also what makes these two read as two items rather than as one
   sentence with a comma where a full stop belongs. */
.intro__notes li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--c-muted);
}

/* The two notes move out of the running order and into a column of their
   own, which is what they were always asking for: one ends on a comma and
   the next opens on a capital, so as a stack under the claim they read as a
   sentence that lost its way, and side by side with it they read as what
   they are, two notes pinned next to a statement.

   Row 2 of the card, right-hand cell. The claim keeps the left. Both cells
   take the same rule along their top, so the card's horizon still runs the
   full width with a break at the gutter, and both are top-aligned so the
   two rules land on one line.

   Below 1000 they go back under the claim, which is the only honest thing
   a 30ch column can do. */
@media (min-width: 1000px) {
  .bento--home .tile__lead.intro {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: clamp(32px, 3.4vw, 64px);
  }

  .intro__lead { grid-column: 1 / -1; }

  .intro__claim,
  .intro__notes {
    grid-row: 2;
    margin-top: clamp(17px, 1.7vw, 26px);
    padding-top: clamp(15px, 1.5vw, 22px);
    border-top: 1px solid var(--v2-card-edge);
  }

  .intro__claim { grid-column: 1; }
  .intro__notes { grid-column: 2; row-gap: 13px; }
  .intro__notes li { max-width: 42ch; }
}

/* --- The pile's room -------------------------------------------------
   The words used to stop 172px short of the right edge, because the box was
   a 172px bin in the corner and nothing was allowed to touch a line of
   type. The box is the whole card now and a counter can be thrown across
   it, so that guarantee is gone and the rail with it.

   What is still true is where the pile comes to rest: the well in the
   bottom-right corner, with its top counter about 98px above the card's
   edge. So the reserve turns through ninety degrees. The notes keep their
   own room above it, and nothing at rest ever lands on a word. In flight is
   another matter, which is the point of it.

   88px, and one number at both settings, which is a coincidence worth
   writing down. The pile is two counters high and never more, so it stands
   2D above the floor, and the floor is the card's own bottom edge: the room
   the words have to give up is 2D plus air, less the padding the card
   already has under them. On a phone that is 84 and 24, on a desktop 92 and
   32, and the two differences cancel. What it buys is about 18px between
   the last line of the notes and the top counter, measured at every width
   from 360 to 1440.

   Gated on .has-toys, which v2.js puts on the card before it measures the
   box, because this is the rule that decides how tall the card is. With no
   JS the class never arrives, .toybox:empty is display:none, and there is
   no reserve left holding room for a pile that is not there. */
.a-intro.has-toys .intro__notes { padding-bottom: 88px; }

.intro__sub a {
  color: var(--c-ink);
  font-weight: 600;
  text-decoration-color: var(--acc-produsa);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

/* ======================================================================
   MOBILE PASS
   Everything below is the phone. The grid already stacks and nothing
   overflows at 360, 390, 414 or 768, verified by rendering rather than by
   reading: documentElement.scrollWidth equals clientWidth at every one.
   What was wrong was composition and touch, not structure.

   Deliberately NOT touched: the intro card and its tagline clusters, at
   any width. That block is being redesigned elsewhere.
   ====================================================================== */

/* --- The curtain, on a phone ------------------------------------------
   The crop steps in style.css all start at min-aspect-ratio 3/4, so every
   phone in portrait fell through to the base 50% 50% and the phone case
   was an accident rather than a decision. It happened to be close, because
   below 3:4 the full image height is kept and the crop goes sideways, and
   the subject is almost horizontally centred. Close is not the same as
   right, and at tall aspects it runs out.

   Measured on the 1200x1600 source, as fractions of width:
     green character, left edge   0.235
     WHOA.                        0.32 to 0.41
     mustard character            0.385 to 0.49
     him, right edge              0.75
     picnic table, bench to bench 0.19 to 0.80
   So the band that must survive is 0.235 to 0.75, and its centre is 0.493,
   not 0.50. With object-fit: cover the visible width fraction is
   v = aspect / 0.75, and the window's left edge lands at P * (1 - v).

   At P = 48% the margins either side of the protected band come out even:
     360x800   v 0.600  window 0.192 to 0.792   0.043 left, 0.042 right
     390x844   v 0.616  window 0.184 to 0.800   0.051 left, 0.050 right
     414x896   v 0.616  window 0.184 to 0.800   0.051 left, 0.050 right
     360x880   v 0.545  window 0.218 to 0.764   0.017 left, 0.014 right
   That last one is the worst viewport a phone realistically produces. At
   50% it left 0.0075, about four screen pixels, between the green
   character's arm and the edge, which is a character pinned to the frame.
   48% roughly doubles the worst case and balances it, and at 390 and 414
   it also brings the left bench back inside the frame.

   74/100 rather than 3/4 so this can never collide with the first
   min-aspect-ratio step at exactly 3:4. */
@media (max-aspect-ratio: 74/100) {
  .curtain__img { object-position: 48% 50%; }
}

/* --- Anchors clear the bar --------------------------------------------
   The bar is fixed at top 10px and 60px tall, so it owns the first 70px.
   Without this, Get in touch jumps to #contact and the bar sits on the
   heading it just took you to. */
#work, #writing, #contact { scroll-margin-top: 86px; }

@media (max-width: 760px) {

  /* --- Card headlines ---------------------------------------------------
     1.12 is a desktop line height, set when these headlines ran one or two
     lines at 34px. On a phone they are 24px over three lines and 1.12
     closes them into a block. */
  .bento--home .tile__title { line-height: 1.2; }

  /* --- Writing ----------------------------------------------------------
     Three embeds that are 180px tall each, stacked, made this the tallest
     card on the page at 732px: a fifth of the whole homepage spent on
     three identical grey rectangles that say the same seven words. Until
     the embeds are real they should take the room a stub deserves. */
  .blog { gap: 12px; margin-top: 18px; }
  .blog .slot { min-height: 124px; }

  /* --- Contact ----------------------------------------------------------
     The three links were 23px tall, which is half a thumb. The negative
     margin keeps the visual spacing while the hit area grows. */
  .contact__links { gap: 0 20px; }
  .contact__links a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin: -10px 0;
  }
}

/* --- The photo pile ---------------------------------------------------
   Three photographs sharing one card. On a pointer you get a hover; on a
   phone you got nothing at all, so it read as a single static placeholder
   and two of the three lines were unreachable. The stack now shows its own
   edges, and v2.js adds a counter underneath. */
.pile__card .slot {
  border: 1px solid var(--v2-card-edge);
  background-clip: padding-box;
}

/* Back cards sit slightly down and in, so the pile reads as a pile from
   across the room rather than only at its rotated corners. */
.pile__card.is-mid  { transform: rotate(var(--r, 0deg)) scale(.965) translateY(6px); }
.pile__card.is-back { transform: rotate(var(--r, 0deg)) scale(.93) translateY(12px); }

.pile__nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.pile__dots { display: flex; gap: 6px; }

.pile__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--v2-card-edge);
  transition: background-color 240ms var(--v2-ease);
}

.pile__dot.is-on { background: var(--c-body); }

.pile__hint {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--c-label, #777);
}

/* The caption reserved 3em for its tallest line and left a gap under the
   shorter ones. The nav row now sits directly below it. */
.pile__cap { min-height: 0; margin-top: 14px; }

@media (max-width: 760px) {
  /* A photograph needs more than 260px of a 390px screen to be a
     photograph rather than a thumbnail. */
  .pile { height: 300px; }
}

@media (prefers-reduced-motion: reduce) {
  .pile__card.is-mid,
  .pile__card.is-back { transition: none; }
  .pile__dot { transition: none; }
}

/* --- desserts.html and studio.html ------------------------------------
   These two still carry the old floating dock at bottom right. It is
   position: fixed, so it sits on whatever the page ends with: at 390 it
   lands on top of a tag pill on studio.html and on the artwork on
   desserts.html. Give the page a floor the dock can stand on. */
.dock ~ main { padding-bottom: 104px; }

/* --- Pair tiles, unpaired --------------------------------------------
   .tile--pair carries min-height 340px so two of them sitting side by side
   in a desktop row come out level. In the single column there is no row to
   level against, so on the Desserts card, which has no image, that floor
   was just 180px of empty paper between the headline and the role line. */
@media (max-width: 699px) {
  .bento--home .tile--pair .tile__in { min-height: 0; }
}

/* --- The two app cards at tablet --------------------------------------
   At 1100 and up Ezra takes a quarter and Lurch takes the rest, which is
   the uneven pairing that stops the row reading as a template. Below that
   the grid drops to two columns and Lurch was still spanning both, so it
   could not sit beside Ezra and wrapped to its own row. That left Ezra
   alone in column one with an empty cell next to it, about 400px square of
   nothing, which at 768 is the largest hole on the page.
   In a two column grid the pair is even by definition, so let them pair. */
@media (min-width: 700px) and (max-width: 1099px) {
  .bento--home .a-lurch { grid-column: span 1; }
}

/* The box. The tile's overflow:hidden is what keeps the counters inside
   it, so the card is the box and the clip is its walls. */

/* No JS, no toys. The card is then exactly what it is without this, rather
   than a dead layer promising an interaction it cannot deliver. Gated on
   .has-toys rather than on :empty, which says the same thing about the
   right thing: whether v2.js got as far as a box with a real size. It also
   survives anything that goes into the box in the markup. */
.a-intro:not(.has-toys) .toybox { display: none; }

/* Out of flow against .tile__in, which is position:relative and clips, so
   the card's own height is untouchable from here.

   inset:0, at every width: the whole card is the play area, and a counter
   can be thrown anywhere in it. Where the pile lives is a well cut into the
   bottom-right corner, 173 by 133, which v2.js owns and nothing draws. The
   old bin was that well and nothing else, which is why a thrown counter had
   nowhere to go.

   Transparent to the pointer, because this now lies over every word on the
   card. The counters take it back for themselves, and every listener is on
   this element, so a press on one still arrives here by bubbling. Without
   it the card's own text could not be selected at all. */
.toybox {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

/* --- One counter ------------------------------------------------------- */

.toy {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--d, 48px);
  height: var(--d, 48px);
  border-radius: 50%;
  /* The box above gave the pointer away. The counters are the one thing on
     it that wants a pointer, so they take it back. */
  pointer-events: auto;
  /* The pointer drives this thing, so it must never be read as a scroll
     gesture or as a text selection or as a draggable image. */
  touch-action: none;
  cursor: grab;
  -webkit-tap-highlight-color: transparent;
}

.toybox.is-awake .toy { will-change: transform; }
.toy.is-held { cursor: grabbing; }


.toy__f {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(118% 118% at 30% 20%, #FFFDF9 0%, #F5F1E9 56%, #E7E1D5 100%);
  box-shadow:
    inset 0 0 0 1px rgba(40, 30, 10, 0.1),
    inset 0 -2px 5px rgba(40, 30, 10, 0.07),
    inset 0 2px 3px rgba(255, 255, 255, 0.9);
  /* The hit target is .toy. Nothing inside it competes for the pointer. */
  pointer-events: none;
  transition: transform 220ms var(--v2-ease);
}

.toy__f img {
  width: 52%;
  height: 52%;
  display: block;
  -webkit-user-drag: none;
}

/* Hover is a lift, not a reveal. It says touchable and says nothing else,
   and it rides a CSS transition on the face so it costs no frames: the
   simulation can stay asleep while you run the cursor over the pile. */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .toy.is-hot .toy__f { transform: scale(1.05); }
}

:root[data-theme="dark"] .toy__f {
  background: radial-gradient(118% 118% at 30% 20%, #F2EFEA 0%, #DBD6CC 56%, #C3BDB0 100%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .toy__f {
    background: radial-gradient(118% 118% at 30% 20%, #F2EFEA 0%, #DBD6CC 56%, #C3BDB0 100%);
  }
}

/* --- Reduced motion ---------------------------------------------------- */

/* A box of tumbling objects is the exact thing this setting is for. v2.js
   still builds the pile and still runs the solver, but it runs it once with
   no frames and no listeners, so what lands is a real settled pile rather
   than a hand-faked one, and then nothing ever moves again. */
.toybox.is-still .toy {
  pointer-events: none;
  cursor: default;
  will-change: auto;
}

.toybox.is-still .toy__f { transition: none; }
