/* ============================================================
   Level 13 — Носки по парам

   Scene only: a bed in late afternoon and an open drawer organiser
   with four linen-lined compartments. Everything that moves is
   handled by shared/puzzle.css.

   The drawer is deliberately built out of many low-opacity layers
   rather than a couple of flat fills, because the first nine levels
   are painted and a flat tan rectangle next to them looks like a
   placeholder. Wood gets two grain passes and an end-grain wash;
   the lining gets a woven weft, a fibre grain and its own ambient
   occlusion where the wall meets the floor of the compartment.
   ============================================================ */

.scene {
  position: fixed;
  inset: 0;
  background-color: #b3a892;
  background-image:
    /* low sun through a window, from the upper right */
    radial-gradient(ellipse 74% 56% at 86% 8%, rgba(255, 240, 206, 0.5), transparent 64%),
    /* the weave of the bedspread everything is lying on */
    repeating-linear-gradient(
      90deg,
      rgba(255, 250, 238, 0.06) 0 1px,
      transparent 1px 6px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(84, 68, 48, 0.07) 0 1px,
      transparent 1px 6px
    ),
    radial-gradient(ellipse 118% 96% at 50% 42%, transparent 42%, rgba(60, 48, 36, 0.32) 100%),
    linear-gradient(178deg, #c2b8a3 0%, #b6ab95 54%, #a49984 100%);
}

/* --- the drawer -------------------------------------------- */

/* The drawer sits a little above centre rather than on the floor of
   the stage: the win card is a bottom sheet, and a drawer any lower
   has its socks covered by the card at the moment they are earned. */
.drawer {
  position: absolute;
  top: 320px;
  left: 74px;
  width: 1052px;
  filter: drop-shadow(0 20px 30px rgba(58, 44, 30, 0.28));
}

/* The well is the inside of the drawer, seen slightly from above,
   so the back wall shows as a band of shadow along the top and the
   near wall as a lit lip along the bottom. */
.drawer__well {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 18px 16px;
  border-radius: 7px 7px 2px 2px;
  background-color: #a8875a;
  background-image:
    /* Grain running the length of the drawer, as sawn board does.
       Two passes at different periods, because a single even one
       reads as corduroy. */
    repeating-linear-gradient(
      179deg,
      rgba(72, 48, 22, 0.11) 0 2px,
      transparent 2px 9px
    ),
    repeating-linear-gradient(
      181deg,
      rgba(255, 234, 194, 0.05) 0 1px,
      transparent 1px 17px
    ),
    linear-gradient(180deg, #7d6239 0%, #916f42 44%, #a07d4c 100%);
  box-shadow:
    inset 0 16px 22px -10px rgba(38, 26, 14, 0.66),
    inset 0 -3px 0 rgba(255, 236, 198, 0.2),
    inset 2px 0 4px -2px rgba(38, 26, 14, 0.4),
    inset -2px 0 4px -2px rgba(38, 26, 14, 0.4);
}

/* Paper grain over the whole box, at the same value the rest of the
   game uses, so the wood sits in the same material world. */
.drawer__well::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: var(--noise-coarse);
  background-size: 180px 180px;
  opacity: 0.09;
  mix-blend-mode: multiply;
  pointer-events: none;
}

/* A compartment is a fabric-lined well, and it is a shade darker
   than the bedspread outside the drawer on purpose: an empty one has
   to read as somewhere a sock could go, and a light hollow does not.
   The lining is a warm taupe rather than a colour, so that all four
   sock designs sit clearly on it. */
.cell {
  position: relative;
  height: 194px;
  border-radius: 3px;
  background-color: #8d795e;
  background-image:
    /* Linen: a weft one way, a fibre grain the other. Both alphas are
       lower than they look like they should be — a fine repeating
       gradient over a scaled stage lightens a surface far more than
       its stated alpha, so the base tone below is mixed darker to
       land where it is wanted. */
    repeating-linear-gradient(
      90deg,
      rgba(255, 248, 230, 0.07) 0 1px,
      transparent 1px 5px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(58, 44, 28, 0.09) 0 1px,
      transparent 1px 5px
    ),
    linear-gradient(180deg, #6f5d46 0%, #8c7859 28%, #907c5f 70%, #7b684f 100%);
  box-shadow:
    inset 0 13px 16px -8px rgba(38, 26, 14, 0.68),
    inset 0 -7px 10px -6px rgba(38, 26, 14, 0.4),
    inset 4px 0 9px -4px rgba(38, 26, 14, 0.46),
    inset -4px 0 9px -4px rgba(38, 26, 14, 0.46),
    inset 0 -1px 0 rgba(255, 240, 208, 0.2);
}

/* Where the lining turns up the compartment wall — the fold is
   what makes the tray read as lined board rather than as a hole. */
.cell::before {
  content: "";
  position: absolute;
  inset: 5px 5px 6px;
  border-radius: 2px;
  box-shadow:
    inset 0 3px 5px -3px rgba(44, 30, 16, 0.4),
    0 -1px 0 rgba(255, 246, 222, 0.22);
  pointer-events: none;
}

.cell::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: var(--noise-fine);
  background-size: 120px 120px;
  opacity: 0.11;
  mix-blend-mode: multiply;
  pointer-events: none;
}

.drawer__front {
  position: relative;
  height: 56px;
  border-radius: 0 0 8px 8px;
  background-color: #ac8a52;
  background-image:
    repeating-linear-gradient(
      179deg,
      rgba(76, 50, 22, 0.12) 0 2px,
      transparent 2px 8px
    ),
    repeating-linear-gradient(
      181deg,
      rgba(255, 238, 202, 0.06) 0 1px,
      transparent 1px 14px
    ),
    linear-gradient(180deg, #c19d68 0%, #ac8952 58%, #8d6c3d 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 214, 0.4),
    inset 0 -2px 5px -2px rgba(52, 34, 16, 0.5);
}

.drawer__front::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: var(--noise-coarse);
  background-size: 180px 180px;
  opacity: 0.08;
  mix-blend-mode: multiply;
}

/* The pull, drawn as a shadowed dip rather than a separate part —
   at this size a modelled handle only adds noise. */
.drawer__front::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 16px;
  width: 152px;
  height: 17px;
  border-radius: var(--r-pill);
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(58, 40, 20, 0.44), rgba(255, 238, 204, 0.32));
  box-shadow: inset 0 2px 3px rgba(48, 32, 14, 0.34);
}

/* --- portrait ---------------------------------------------- */

.stage.is-portrait .drawer {
  top: 660px;
  left: 118px;
  width: 544px;
}

.stage.is-portrait .drawer__well {
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 16px;
}

.stage.is-portrait .cell {
  height: 194px;
}

/* --- the solved drawer ------------------------------------- */

/* Four tidy pairs, and the drawer settles as if just pushed to.
   Animated on the socks' own wrapper, not on the stage, so the
   composition never moves off centre. */
.is-solved .objects {
  animation: drawer-settle var(--dur-reward) var(--ease-snap) both;
}

@keyframes drawer-settle {
  0% {
    transform: translateY(0);
  }
  45% {
    transform: translateY(-3px);
  }
  100% {
    transform: translateY(0);
  }
}
