/* =================================================================
   NBCC ELF DETECTIVE SCHOOL: page stylesheet

   Loaded only by the elf screens (src/elf/pages/), after styles.css.
   Deliberately not part of the shared stylesheet: donate.html sits at
   its enforced weight budget (test/unit/perf-budget.test.ts), and that
   page is where donations are made.

   Everything builds on the brand tokens in styles.css, cut from paper
   (the paper look, at the end of this file). The design is one loud
   thing a page: on the calendar that is the advent calendar's painted
   board; everything round it stays NBCC cream.

   Nothing here scrolls inside a box (no inner scrollbars: content
   wraps and the page grows), and every animation is inside a
   prefers-reduced-motion: no-preference block.
   ================================================================= */

.elf-page {
  /* What is left of the wave 1 look, until Detective HQ, the wardrobe and the poster are in paper:
     paper behind the wardrobe's stage and its shadow, the clue's ink, and the gold card's edge. */
  --elf-walnut-deep: #55331D;
  --elf-paper: #FBF3E6;
  --elf-ink: #3A2416;
  --elf-brass: #C9A24A;
  /* The gold of the "You're first!" card, and the ink that reads on it. */
  --elf-gold-pale: #FBEFC4;
  --elf-gold: #F1D888;
  --elf-gold-deep: #E0BC5A;
  --elf-gold-ink: #3A2A07;
  --elf-gold-ink-soft: #5C4308;

  /* Things slow to a stop the way real objects do. No bounce. */
  --elf-ease: cubic-bezier(0.25, 1, 0.5, 1);
  --elf-ease-expo: cubic-bezier(0.16, 1, 0.3, 1);

  /* The present cut out of every door (Jaimie, 12 November 2026: "just make a standard present on
     them"): a box with its lid and its ribbon cut apart, and a bow of two loops and a knot on the lid.
     One colour, through the carving's mask. Every cut is at least 2.5 of its 48 units, so it still
     shows on a 40 pixel door. */
  --elf-present: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M6.9 19.4H17.6A0.9 0.9 0 0 1 18.5 20.3V25.5A0.9 0.9 0 0 1 17.6 26.4H6.9A0.9 0.9 0 0 1 6 25.5V20.3A0.9 0.9 0 0 1 6.9 19.4ZM21.7 19.4H26.3A0.5 0.5 0 0 1 26.8 19.9V25.9A0.5 0.5 0 0 1 26.3 26.4H21.7A0.5 0.5 0 0 1 21.2 25.9V19.9A0.5 0.5 0 0 1 21.7 19.4ZM30.4 19.4H41.1A0.9 0.9 0 0 1 42 20.3V25.5A0.9 0.9 0 0 1 41.1 26.4H30.4A0.9 0.9 0 0 1 29.5 25.5V20.3A0.9 0.9 0 0 1 30.4 19.4ZM9.9 29.8H17.6A0.9 0.9 0 0 1 18.5 30.7V44.9A0.9 0.9 0 0 1 17.6 45.8H9.9A0.9 0.9 0 0 1 9 44.9V30.7A0.9 0.9 0 0 1 9.9 29.8ZM21.7 29.8H26.3A0.5 0.5 0 0 1 26.8 30.3V45.3A0.5 0.5 0 0 1 26.3 45.8H21.7A0.5 0.5 0 0 1 21.2 45.3V30.3A0.5 0.5 0 0 1 21.7 29.8ZM30.4 29.8H38.1A0.9 0.9 0 0 1 39 30.7V44.9A0.9 0.9 0 0 1 38.1 45.8H30.4A0.9 0.9 0 0 1 29.5 44.9V30.7A0.9 0.9 0 0 1 30.4 29.8Z'/%3E%3Cpath fill-rule='evenodd' d='M22.2 17L17.38 7.92A5.3 5.3 0 1 0 12.01 15.65ZM18.21 14.23L15 8.99A2.7 2.7 0 1 0 12.18 13.05Z'/%3E%3Cpath fill-rule='evenodd' d='M25.8 17L35.99 15.65A5.3 5.3 0 1 0 30.62 7.92ZM29.79 14.23L35.82 13.05A2.7 2.7 0 1 0 33 8.99Z'/%3E%3Cpath d='M22.5 14H25.5A1.8 1.8 0 0 1 27.3 15.8V18.2A1.8 1.8 0 0 1 25.5 20H22.5A1.8 1.8 0 0 1 20.7 18.2V15.8A1.8 1.8 0 0 1 22.5 14Z'/%3E%3C/svg%3E");
  /* A snow day's door: a six armed snowflake, cut out the same way. */
  --elf-flake: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='%23000' stroke-width='3.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M24 4v40M6.7 14l34.6 20M6.7 34l34.6-20M19 6l5 5 5-5M37.1 10.7l-1.8 6.8 6.8 1.8M42.1 28.7l-6.8 1.8 1.8 6.8M29 42l-5-5-5 5M10.9 37.3l1.8-6.8-6.8-1.8M5.9 19.3l6.8-1.8-1.8-6.8'/%3E%3C/svg%3E");
}

/* ---------- the banner, and the strip under it ----------
   The banner across the top, its menu and the footer are the site's own (src/site/chrome.ts), and
   nothing here styles them: they look and work exactly as on every other page (Jaimie, 11 November
   2026: "the same banner and the same nav bar across the entire site"). main.js paints the banner once
   the page is scrolled and opens its menu on a phone, as it does everywhere.

   Straight under the banner, Elf Detective School's own strip: a sheet of holly paper with its
   name, leading back to the calendar, and the page's own button. The torn bands at the top
   of the page are its bottom edge. It wraps rather than scroll, and the button is a thumb's height. */
.elf-bar {
  position: relative;
  z-index: 2;
  margin-top: var(--nav-h);
  background-color: var(--holly);
  background-image: var(--elf-grain);
  background-size: 384px;
  background-blend-mode: soft-light;
  color: var(--elf-on-dark);
}
.elf-bar .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding-block: 10px 6px; }
.elf-bar__home { font-family: var(--font-head); font-weight: 800; font-size: clamp(1rem, 0.9rem + 0.6vw, 1.35rem); line-height: 1.2; color: var(--elf-on-dark); text-decoration: none; text-wrap: balance; }
.elf-bar__home:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.elf-bar__home:focus-visible,
.elf-bar .elf-btn:focus-visible { outline: 3px solid var(--cream); outline-offset: 4px; border-radius: 6px; }
.elf-bar .elf-btn { flex: none; padding-inline: 16px; }

.elf-page .elf-icon { vertical-align: -0.18em; flex: none; }

.elf-page .elf-link { color: var(--maroon); text-underline-offset: 3px; }
/* A link that stands by itself is tall enough for a thumb. */
.elf-poster__links .elf-link,
.elf-win__links .elf-link,
.elf-visit__links .elf-link,
.elf-photo-sheet__links .elf-link,
.elf-wd-back .elf-link { display: inline-flex; align-items: center; min-height: 44px; }

/* ---------- the top of the calendar page ---------- */
.elf-top { padding-bottom: clamp(20px, 3vw, 36px); }
.elf-top__grid { display: grid; gap: clamp(28px, 4vw, 48px); align-items: center; }
.elf-top h1 { font-size: var(--fs-page-intro); text-wrap: balance; }
/* On the calendar the logo IS the heading. */
.elf-top__logo { display: block; width: clamp(190px, 46vw, 260px); max-width: 100%; height: auto; margin: -6px 0 4px -6px; }
/* The year's class on a torn holly label, tucked under the school's name. */
.elf-top .elf-top__class { margin: 0 0 0 clamp(20px, 6vw, 46px); }
.elf-top .lede { margin-top: 18px; }
/* The grand prize, under the welcome (TASK-613): the lede's measure, in the page's own words size. */
.elf-top__prize { max-width: 54ch; }
.elf-top__actions { display: flex; flex-wrap: wrap; gap: 14px 16px; margin: 24px 0 0; }
/* The film (TASK-616): a photo taped to the page, after the title and its opening words. On a phone it is
   the full width of the column, between the opening words and the prize; on a laptop it sits beside the
   opening words, and Today's news beside the prize and the buttons. Its space is held before it loads:
   the video is always 16 to 9 and never wider than its column. */
.elf-film { min-width: 0; margin: 0; padding: 12px; }
.elf-film__stage { position: relative; }
.elf-film__video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; background: var(--maroon); }
/* The sound button sits on the film's top left corner, clear of the browser's controls along the bottom. */
.elf-film__stage .elf-btn { position: absolute; top: 10px; left: 10px; z-index: 2; max-width: calc(100% - 20px); min-height: 44px; padding: 8px 20px 10px; }
.elf-film__stage .elf-btn[hidden] { display: none; }
@media (min-width: 981px) {
  .elf-top__grid { grid-template-columns: 1fr 1fr; grid-template-areas: "intro film" "rest status"; row-gap: 0; column-gap: clamp(34px, 4vw, 56px); }
  .elf-top__intro { grid-area: intro; }
  .elf-film { grid-area: film; }
  .elf-top__rest { grid-area: rest; margin-top: 8px; }
  .elf-top__grid > .elf-status { grid-area: status; margin-top: 36px; }
}

/* Today's news, on a card sheet: the board below is the loud thing. The colour of the sheet under
   it says what kind of news it is, and while an elf is being hunted the card itself turns holly
   green: the one moment it should catch the eye. */
.elf-status { --elf-layer: var(--crimson); padding: 30px clamp(20px, 3vw, 30px) clamp(20px, 3vw, 28px); color: var(--slate); }
.elf-status p { margin: 6px 0 0; }
.elf-status .elf-status__eyebrow { margin: -44px 0 14px -6px; }
.elf-status__title { font-size: clamp(1.5rem, 1.25rem + 1.2vw, 2.1rem); color: var(--maroon); margin-top: 4px; text-wrap: balance; }
.elf-status--today { --elf-layer: var(--elf-paper-gold); }
.elf-status--found,
.elf-status--foundhidden { --elf-layer: var(--holly); --elf-layer-tilt: -1.3deg; }
.elf-status--revealed,
.elf-status--snow { --elf-layer: var(--tan); --elf-layer-tilt: -1.5deg; }
.elf-status--hunting { --elf-layer: var(--elf-paper-gold); --elf-card-face: var(--holly); color: var(--elf-on-dark); }
.elf-status--hunting .elf-status__title { color: var(--elf-on-dark); }

/* The countdown on a candy cane strip: cream paper on a torn candy cane edge, as the cane button. */
.elf-cane-strip { position: relative; isolation: isolate; display: inline-block; padding: 6px 22px 10px; font-family: var(--font-head); font-weight: 800; font-size: clamp(2rem, 1.6rem + 2vw, 3rem); line-height: 1.05; color: var(--crimson); font-variant-numeric: lining-nums tabular-nums; filter: var(--elf-drop-small); }
.elf-cane-strip::before { content: ""; position: absolute; inset: 0; z-index: -1; background: url(/assets/img/elf/paper/ui/btn-l-cream.svg) 0 0 / 100% 100% no-repeat; }
.elf-cane-strip::after { content: ""; position: absolute; inset: -7px -10px -9px -9px; z-index: -2; background: url(/assets/img/elf/paper/ui/btn-m-cane.svg) 0 0 / 100% 100% no-repeat; transform: rotate(-2.5deg); }
.elf-status .elf-cane-strip { margin: 16px 0 10px 10px; }

/* ---------- the calendar: an advent calendar ----------
   One board (Jaimie, 4 November 2026: "when you say calendar, it looks like an advent calendar") of
   NBCC's solid rich maroon (Jaimie, 5 November 2026: the painting across the doors looked messy),
   torn and laid on a holly sheet, with the 24 doors cut into it in order. Mobile first: two doors
   to a row on a phone, as big as the wardrobe's door cards, so the picture behind an open door can
   be seen without zooming; more to a row only as the board itself widens (.elf-advent is a
   container). */
.elf-calendar { padding-block: clamp(18px, 3vw, 36px) clamp(24px, 4vw, 44px); }
.elf-calendar__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; margin-bottom: 14px; }
.elf-calendar__head .elf-strip { margin: 0; font-size: clamp(1.6rem, 1.35rem + 1.2vw, 2.2rem); }
.elf-tally { margin: 0; color: var(--slate-soft); }
.elf-tally b { font-family: var(--font-head); font-weight: 800; font-size: 1.35em; color: var(--maroon); font-variant-numeric: lining-nums; }

.elf-advent {
  position: relative;
  isolation: isolate;
  container-type: inline-size;
  margin: 10px 8px 0 0;
  padding: clamp(16px, 2.8vw, 26px);
}
.elf-advent__card { position: absolute; inset: 0; z-index: -1; filter: var(--elf-drop-big); pointer-events: none; }
.elf-advent__card::before { content: ""; position: absolute; inset: 0; background-color: var(--maroon); background-image: var(--elf-grain); background-size: 384px; background-blend-mode: soft-light; -webkit-mask: var(--elf-tear-card-a); mask: var(--elf-tear-card-a); }
.elf-advent__card::after { content: ""; position: absolute; inset: 10px -9px -12px 8px; z-index: -1; background-color: var(--holly); background-image: var(--elf-grain); background-size: 384px; background-blend-mode: soft-light; -webkit-mask: var(--elf-tear-card-b); mask: var(--elf-tear-card-b); transform: rotate(0.4deg); }

.elf-board {
  --cols: 2;
  --gap: 10px;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  /* dense: an opened detail takes a whole row, and the doors after it fill the row above it, so the
     detail sits directly under its own door's row with no script working anything out. */
  grid-auto-flow: row dense;
  gap: var(--gap);
}
/* Every door stays between about 135 and 235 pixels wide, so the doors keep their size as the board
   widens and the rows multiply instead. 22 doors and the wide door 23 fill every row of 2, 3, 4 or
   6; door 24 has a row of its own. A browser with no container queries keeps two to a row. */
@container (min-width: 480px) {
  .elf-board { --cols: 3; }
}
@container (min-width: 640px) {
  .elf-board { --cols: 4; --gap: 12px; }
}
@container (min-width: 900px) {
  .elf-board { --cols: 6; --gap: 14px; }
}

/* One door: the hole cut in the board (plain card, shaded under its top and left edges) and the door
   in it, a little taller than it is wide. --elf-depth is how deep the room behind it looks as the
   door turns: about eight of its own widths, so every door opens the same way. */
.elf-door {
  --elf-depth: 1300px;
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  justify-items: center;
  align-items: center;
  aspect-ratio: 1 / 1.12;
  padding: 8px 8px 9px;
  border-radius: 3px;
  background-color: color-mix(in srgb, var(--tan) 32%, var(--card));
  background-image: var(--elf-grain-light);
  background-size: 384px;
  background-blend-mode: multiply;
  box-shadow: inset 3px 4px 8px rgba(58, 0, 0, 0.5), inset 0 0 0 1px rgba(58, 0, 0, 0.55);
  color: var(--maroon);
  text-decoration: none;
  font-size: 0.75rem;
  line-height: 1.2;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  /* "Close door 7" jumps back to the door: clear of the bar across the top. */
  scroll-margin-top: calc(var(--nav-h) + 16px);
}
/* The door itself: card of the board's own maroon, a dark cut round it with the light on its top and
   left edges, and its shadow on the board. It turns on its left edge. */
.elf-door__flap {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  /* One column as wide as the door, so a chip can never widen it. */
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  justify-items: center;
  align-items: center;
  padding: 8px 8px 9px;
  border-radius: 3px;
  background-color: var(--maroon);
  background-image: var(--elf-grain);
  background-size: 384px;
  background-blend-mode: soft-light;
  box-shadow: inset 0 0 0 1px rgba(30, 0, 0, 0.7), inset 1.5px 1.5px 0 1px rgba(255, 248, 239, 0.24), 0 2px 4px rgba(20, 0, 0, 0.55);
  transform-origin: left center;
}

/* Its number, printed large on the door in cream. */
.elf-door__num { grid-row: 1; grid-column: 1; justify-self: start; align-self: start; font-family: var(--font-head); font-weight: 800; font-size: 2.1rem; line-height: 0.9; color: var(--elf-on-dark); text-shadow: 0 1.5px 0 var(--elf-maroon-deep); font-variant-numeric: lining-nums; }
/* The little paper pull tab, on the edge the door opens from. */
.elf-door__tab { position: absolute; top: 50%; right: -5px; width: 9px; height: 19px; margin-top: -9.5px; border-radius: 0 8px 8px 0; background-color: var(--elf-edge); background-image: var(--elf-grain-light); background-size: 384px; background-blend-mode: multiply; box-shadow: 1px 1.5px 2px rgba(30, 0, 0, 0.45), inset -1px 0 0 rgba(94, 0, 0, 0.22); }
.elf-door__face { position: relative; grid-row: 2; grid-column: 1; display: grid; place-items: center; }

/* The present cut out of card and laid on the door: the card, its darker cut edge and a soft shadow.
   Every door has the same present, and a snow day the snowflake. */
.elf-carve { --shape: var(--elf-present); position: relative; display: block; width: 58px; height: 58px; filter: drop-shadow(0 2px 2px rgba(20, 0, 0, 0.5)); }
.elf-carve__hi,
.elf-carve__lo { position: absolute; inset: 0; -webkit-mask: var(--shape) center / contain no-repeat; mask: var(--shape) center / contain no-repeat; }
.elf-carve__lo { background: var(--elf-edge-dark); transform: translate(0.8px, 1.6px); }
.elf-carve__hi { background-color: var(--card); background-image: var(--elf-grain-light); background-size: 384px; background-blend-mode: multiply; }

/* Chips: what a door says, beside its number, and its day or its countdown at its foot. Every door is
   big enough for both at every width. */
.elf-door .elf-chip { padding: 3px 9px 5px; font-size: 0.72rem; }
.elf-door__chip { grid-row: 1; grid-column: 1; justify-self: end; align-self: start; }
.elf-door__foot { grid-row: 3; grid-column: 1; }
/* Today's door shows its countdown in place of the word Today (Jaimie's choice for a phone, now the
   same everywhere). Its gold and its bow still say which door is today's. */
.elf-door--today.has-chip .elf-door__foot { display: inline-flex; font-variant-numeric: tabular-nums; }
.elf-door--today .elf-door__chip { display: none; }
/* Who found an elf whose place is still hidden: a name can run to two lines, so the chip wraps and the
   shape on the door steps down a size to leave it room. */
.elf-door .elf-door__by { max-width: 100%; white-space: normal; font-size: 0.64rem; line-height: 1.15; overflow-wrap: break-word; }
.elf-door--found-hidden .elf-carve { width: 40px; height: 40px; }

/* Today's door, and the one being hunted: gold card round the door, a gold glow on the board round
   it, a gold shape and the painted bow, as on a present. */
.elf-door--gold .elf-door__flap { box-shadow: inset 0 0 0 2.5px var(--elf-paper-gold), inset 0 0 0 3.5px rgba(94, 0, 0, 0.4), 0 0 0 1px rgba(58, 0, 0, 0.5), 0 2px 3px rgba(20, 0, 0, 0.5); }
.elf-door--gold .elf-door__flap::after { content: ""; position: absolute; inset: -2px; z-index: -1; border-radius: 4px; box-shadow: 0 0 16px 5px rgba(240, 200, 100, 0.75); pointer-events: none; }
.elf-door--gold .elf-carve__hi { background-color: var(--elf-paper-gold); }
/* The bow sits on top of the door, as on a present: a little right of the middle, clear of a two
   figure number, and only just over the door above. The chip steps down below it. */
.elf-door__bow { position: absolute; top: -16px; left: 57%; z-index: 2; width: 60px; height: auto; margin-left: -30px; filter: drop-shadow(0 2px 1px rgba(58, 0, 0, 0.35)); pointer-events: none; }
.elf-door--gold .elf-door__chip { margin-top: 22px; }

/* An open door stands open on its hinge, swung almost flat, so the room behind it fills the door
   (Jaimie, 5 November 2026: what is behind must be big enough to see on a phone). Shown open here,
   swung open only for a visitor happy with motion (below). A revealed elf's chip, Still here, is stuck
   on at the top. */
.elf-door.is-open { padding-left: 25%; }
.elf-door.is-open .elf-door__flap { transform: perspective(var(--elf-depth, 1300px)) rotateY(-78deg); }
.elf-door.is-open .elf-carve__hi { background-color: var(--elf-paper-gold); }
.elf-door.is-open .elf-door__chip { position: absolute; top: 6px; right: 5px; z-index: 3; }

/* The room behind an open door (door-scrapbook-v2.html): its number, up to three of the elves that
   found it on little polaroids (elves only, never a photo), its place, and how many pictures its
   scrapbook holds. Laid over the hole beside the swung door, so it can never make a door taller,
   however wide the door (23 and the double doors too). Each polaroid takes its size from the room's
   height, so it fits a short wide door as well as a tall one. */
.elf-room { position: absolute; inset: 7px 7px 7px 25%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 3px; text-align: left; }
.elf-room__num { justify-self: start; font-family: var(--font-head); font-weight: 800; font-size: 0.95rem; line-height: 1; color: var(--maroon); font-variant-numeric: lining-nums; }
.elf-room__pics { position: relative; min-height: 0; display: grid; place-items: center; }
.elf-mini { position: absolute; top: 8%; left: 0; height: 78%; padding: 3px 3px 9px; border-radius: 2px; background-color: var(--card); background-image: var(--elf-grain-light); background-size: 384px; background-blend-mode: multiply; box-shadow: 0 1px 1px rgba(94, 0, 0, 0.25), 0 3px 5px rgba(94, 0, 0, 0.22); transform: rotate(-7deg); }
.elf-mini:nth-child(2) { top: 0; left: 50%; z-index: 2; transform: translateX(-50%) rotate(4deg); }
.elf-mini:nth-child(3) { top: 14%; left: auto; right: 0; z-index: 1; transform: rotate(-2deg); }
.elf-mini:only-child { top: 2%; left: 50%; height: 92%; transform: translateX(-50%) rotate(-3deg); }
.elf-mini:first-child:nth-last-child(2) { left: 6%; }
.elf-mini:nth-child(2):last-child { left: auto; right: 6%; transform: rotate(4deg); }
.elf-mini img { display: block; width: auto; height: 100%; aspect-ratio: 2 / 3; object-fit: cover; object-position: 50% 70%; border-radius: 1px; background: var(--elf-paper); }
/* The place beside the count; on a door too narrow for the place's longest word and the count side by
   side (a phone under about 340 pixels wide), the count drops to a line of its own rather than a word
   breaking. */
.elf-room__foot { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 2px 4px; min-width: 0; }
.elf-room .elf-door__place { flex: 1 1 0; font-size: 0.66rem; font-weight: 600; line-height: 1.15; color: var(--maroon); overflow-wrap: break-word; }
.elf-door .elf-room__count { flex: none; margin-left: auto; padding: 1px 8px 3px; font-size: 0.7rem; }
.elf-room .elf-door__marks { top: 46%; }

/* Door 23 is two doors wide, so the 24 fill every row at every width. */
.elf-door--wide { --elf-depth: 2600px; grid-column: span 2; aspect-ratio: 2.065 / 1.12; }
/* Door 24: the big double doors, the whole last row at every width (so the board ends square, with no
   bare maroon beside them) and a little taller than a door, opening from the middle. */
.elf-door--double { grid-column: 1 / -1; justify-self: stretch; aspect-ratio: 2.065 / 1.4; }
@supports (width: 1cqw) {
  /* As tall as 1.4 of the doors above, however many are to a row; each half turns with a depth of
     eight of its own widths, like every other door. */
  .elf-door--double { --elf-depth: calc(100cqw * 4); height: calc((100cqw - (var(--cols) - 1) * var(--gap)) / var(--cols) * 1.4); }
}
.elf-door--double .elf-door__flap--left { inset: 0 50% 0 0; z-index: 2; grid-template-columns: 200%; }
.elf-door--double .elf-door__flap--right { inset: 0 0 0 50%; transform-origin: right center; }
.elf-door--double .elf-door__num { font-size: 2.6rem; }
.elf-door--double .elf-carve { width: 84px; height: 84px; }
/* Its two tabs meet at the middle, above the present. */
.elf-door--double .elf-door__tab { top: 30%; border-radius: 8px; }
.elf-door--double .elf-door__flap--left .elf-door__tab { right: 5px; }
.elf-door--double .elf-door__flap--right .elf-door__tab { right: auto; left: 5px; }
.elf-door--double .elf-door__bow { left: 100%; }
.elf-door--double.is-open { padding-inline: 13%; }
.elf-door--double.is-open .elf-door__flap--right { transform: perspective(var(--elf-depth, 1300px)) rotateY(78deg); }
/* Both halves swing away, so the room is between them. */
.elf-door--double .elf-room { left: 13%; right: 13%; }
.elf-door--double.is-open .elf-door__chip { right: calc(13% + 5px); }

/* A door the signed in family has done, cracked or visited: the painted holly, put on by the page's
   script. */
.elf-door.is-done::after { content: ""; position: absolute; top: -13px; right: -11px; z-index: 3; width: 40px; height: 38px; background: url(/assets/img/elf/paper/deco/holly.webp) center / contain no-repeat; filter: drop-shadow(0 2px 1px rgba(58, 0, 0, 0.3)); pointer-events: none; }

.elf-door:focus-visible { outline: 3px solid var(--elf-paper-gold); outline-offset: 2px; }
/* The door whose detail is open. */
.elf-door[aria-expanded="true"],
.elf-door:has(+ .elf-detail:target) { outline: 3px solid var(--card); outline-offset: 2px; }

/* A snow day's face: a paper snowflake cut out of card the way the present is (no picture: the
   stylesheet supplies its shape, as it does the present). */
.elf-snowflake { --shape: var(--elf-flake); }

/* A family's own marks, laid on by the page's script. Marks are only ever earned at an open door,
   so they sit down the edge of what is behind it, like stickers. */
.elf-door__marks { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); display: grid; gap: 3px; }
.elf-door__marks:empty { display: none; }
.elf-mark {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: var(--card);
  background-image: var(--elf-grain-light);
  background-size: 384px;
  background-blend-mode: multiply;
  box-shadow: 0 1px 1px rgba(94, 0, 0, 0.3), 0 3px 4px rgba(94, 0, 0, 0.16);
  vertical-align: -0.3em;
}
.elf-mark--cracked { color: var(--holly); }
.elf-door__marks .elf-mark { width: 22px; height: 22px; }
.elf-door__marks .elf-icon { width: 15px; height: 15px; }

/* ---------- pills: Detective HQ's gold seal, until HQ is in paper ---------- */
.elf-pill {
  display: inline-block;
  padding: 3px 5px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  background: var(--holly);
  color: var(--cream);
}
.elf-pill--big { background: var(--gold-ink); color: #2A1C05; }
@media (min-width: 640px) {
  .elf-pill { font-size: 0.72rem; padding: 4px 9px; }
}

/* ---------- a door's detail: a note taped across the calendar ----------
   Hidden until asked for. With no script, a door is a link to its detail and :target shows it. With
   the script (which adds is-live to the board) only is-open counts, so two can never show at once. */
.elf-detail { display: none; grid-column: 1 / -1; scroll-margin-top: calc(var(--nav-h) + 132px); }
.elf-detail.elf-note { gap: 14px 22px; margin: 12px 4px 8px; padding: 26px 18px 18px; color: var(--slate); }
.elf-detail.elf-note::before { background: var(--elf-grain-light) 0 0 / 384px, var(--card); background-blend-mode: multiply; -webkit-mask: var(--elf-tear-card-c); mask: var(--elf-tear-card-c); }
.elf-detail:target,
.elf-detail.is-open { display: grid; }
.elf-board.is-live .elf-detail:target:not(.is-open) { display: none; }
.elf-detail p { margin: 0 0 8px; }
.elf-detail__media { justify-self: center; }
/* The present (or a snow day's snowflake) on a square of the doors' maroon, as it is on its door. */
.elf-detail__shape { display: grid; place-items: center; width: 150px; min-height: 150px; padding: 12px; border-radius: 3px; background-color: var(--maroon); background-image: var(--elf-grain); background-size: 384px; background-blend-mode: soft-light; box-shadow: inset 0 0 0 1px rgba(30, 0, 0, 0.6), 0 3px 6px rgba(58, 0, 0, 0.3); }
.elf-detail__shape .elf-carve { width: 96px; height: 96px; }
.elf-detail--today .elf-detail__shape,
.elf-detail--hunting .elf-detail__shape,
.elf-detail--found-hidden .elf-detail__shape { box-shadow: inset 0 0 0 3px var(--elf-paper-gold), 0 0 14px 3px rgba(240, 200, 100, 0.6); }
.elf-detail--today .elf-carve__hi,
.elf-detail--hunting .elf-carve__hi,
.elf-detail--found-hidden .elf-carve__hi { background-color: var(--elf-paper-gold); }
.elf-detail__meta { font-size: 0.86rem; color: var(--maroon); margin-bottom: 4px; }
.elf-detail__title { font-size: clamp(1.3rem, 1.15rem + 0.8vw, 1.7rem); color: var(--maroon); margin-bottom: 10px; text-wrap: balance; overflow-wrap: anywhere; }
.elf-detail__when { color: var(--holly-dark); }
.elf-detail__by .elf-icon { color: var(--gold-ink); }
.elf-detail__big { margin-right: 4px; }
.elf-detail__counts { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
/* The fact and the family's own line, each on a slip of holly paper. */
.elf-detail__fact,
.elf-detail__mine { position: relative; isolation: isolate; padding: 9px 14px 11px; color: var(--holly-dark); }
.elf-detail__fact::before,
.elf-detail__mine::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--elf-grain-light) 0 0 / 384px, var(--holly-soft); background-blend-mode: multiply; -webkit-mask: var(--elf-tear-fine-a); mask: var(--elf-tear-fine-a); }
.elf-detail__hint { color: var(--slate-soft); font-size: 0.94rem; }
.elf-detail__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 14px; }
.elf-detail .elf-cd { font-weight: 600; font-variant-numeric: tabular-nums; }
@media (min-width: 560px) {
  .elf-detail.elf-note { grid-template-columns: auto minmax(0, 1fr); align-items: start; padding: 28px 24px 20px; }
}

/* ---------- behind an open door: the scrapbook ----------
   door-scrapbook-v2.html, with decision 11's two rows in place of its mixed collage: who found the elf
   beside a paper rosette, the prize beside the shape cut into the door, then everyone's elves on
   polaroids with their detective names (the finders first, wide, with the FOUND FIRST! rosette), then
   the photos in a row of their own with no names at all. Both rows are grids that wrap, two
   polaroids to a row on a phone; nothing scrolls inside a box. One column at every width. */
.elf-detail.elf-note.elf-book { grid-template-columns: minmax(0, 1fr); justify-self: center; width: calc(100% - 8px); max-width: 780px; }
.elf-book .elf-detail__title { margin-bottom: 12px; }
.elf-book__found { display: flex; align-items: center; gap: 12px; font-size: 0.95rem; line-height: 1.35; }
.elf-detail .elf-book__found { margin: 0 0 12px; }
.elf-book__found b { color: var(--maroon); }
.elf-book__seal { position: relative; display: grid; place-items: center; flex: none; width: 60px; height: 60px; filter: drop-shadow(0 2px 2px rgba(94, 0, 0, 0.25)); }
.elf-book__rosette { position: absolute; inset: 0; width: 100%; height: 100%; }
.elf-book__seal b { position: relative; color: var(--elf-on-dark); font-size: 0.5rem; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; }
/* The prize on a slip of tan paper, beside the shape cut into the door in gold on the door's maroon. */
.elf-book__prize { position: relative; isolation: isolate; display: flex; align-items: center; gap: 12px; padding: 10px 14px 11px; color: var(--elf-ink-on-tan); font-size: 0.92rem; line-height: 1.35; }
.elf-detail .elf-book__prize { margin: 0 0 14px; }
.elf-book__prize::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--elf-grain-light) 0 0 / 384px, color-mix(in srgb, var(--tan) 26%, var(--card)); background-blend-mode: multiply; -webkit-mask: var(--elf-tear-fine-a); mask: var(--elf-tear-fine-a); }
.elf-book__cut { display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 3px; background-color: var(--maroon); background-image: var(--elf-grain); background-size: 384px; background-blend-mode: soft-light; box-shadow: inset 0 0 0 1px rgba(30, 0, 0, 0.6), 0 2px 3px rgba(58, 0, 0, 0.3); }
.elf-book__cut .elf-carve { width: 32px; height: 32px; }
.elf-book__cut .elf-carve__hi { background-color: var(--elf-paper-gold); }
.elf-book__still { font-size: 1rem; }
/* The rows' headings, in handwriting, with how many pictures under the first. */
.elf-book__heading { margin: 20px 0 6px; color: var(--maroon); font-family: var(--elf-hand); font-weight: 700; font-size: 1.7rem; line-height: 1.05; letter-spacing: 0; }
.elf-book__count { display: block; margin-top: 3px; color: var(--slate-soft); font-family: var(--font-body); font-weight: 500; font-size: 0.82rem; line-height: 1.2; }
/* Two polaroids to a row on a phone, however narrow: a column may shrink to half the row less half the
   12px gap, so two always fit and the finders' polaroids across two columns never add a third that
   would widen the row (at 320 pixels wide the row has about 192). More to a row only as the scrapbook
   widens. */
.elf-collage,
.elf-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(calc(50% - 6px), 100px), 1fr)); gap: 20px 12px; margin: 0 0 4px; padding: 12px 2px 6px; }
/* A polaroid: cream card on the paper, a strip of tape over its top, a little out of true. */
.elf-pol { position: relative; container-type: inline-size; margin: 0; padding: 6px 6px 8px; border-radius: 3px; background-color: var(--card); background-image: var(--elf-grain-light); background-size: 384px; background-blend-mode: multiply; box-shadow: 0 2px 2px rgba(94, 0, 0, 0.2), 0 8px 10px rgba(94, 0, 0, 0.18); transform: rotate(-1.6deg); }
.elf-pol:nth-child(even) { transform: rotate(1.4deg); }
.elf-pol::before { content: ""; position: absolute; left: 50%; top: -9px; width: 46px; height: 16px; margin-left: -23px; background: url(/assets/img/elf/paper/ui/tape.svg) 0 0 / 100% 100% no-repeat; transform: rotate(-3deg); pointer-events: none; }
.elf-pol__shot { display: block; overflow: hidden; aspect-ratio: 0.86; border-radius: 2px; background: var(--elf-paper); }
.elf-pol__shot img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 85%; }
.elf-photos .elf-pol__shot img { object-position: 50% 30%; }
/* A detective's name, in handwriting a little smaller on a narrow polaroid, so a long festive surname
   ("Merrymittens") still fits on a line of its own on the narrowest phone. */
.elf-pol figcaption { margin-top: 5px; color: var(--elf-ink-on-tan); font-family: var(--elf-hand); font-weight: 700; font-size: 1.1rem; font-size: clamp(0.88rem, 15cqi, 1.1rem); line-height: 1.05; text-align: center; overflow-wrap: break-word; }
/* The finders' elves: across the row, the mockup's shape (wider than tall, 1.25 to 1), framed on the elf
   from its hat to its feet, with the FOUND FIRST! rosette pinned to the corner. */
.elf-pol--first { grid-column: span 2; padding: 8px 8px 10px; transform: rotate(-0.8deg); }
.elf-pol--first:nth-child(even) { transform: rotate(0.9deg); }
.elf-pol--first .elf-pol__shot { aspect-ratio: 1.25; }
.elf-pol--first .elf-pol__shot img { object-position: 50% 72%; }
.elf-pol--first figcaption { font-size: 1.3rem; }
.elf-pol__seal { position: absolute; z-index: 2; top: -14px; right: -8px; display: grid; place-items: center; width: 64px; height: 64px; color: var(--elf-on-dark); text-align: center; filter: drop-shadow(0 3px 3px rgba(94, 0, 0, 0.3)); transform: rotate(8deg); }
.elf-pol__rosette { position: absolute; inset: 0; width: 100%; height: 100%; }
.elf-pol__seal b { position: relative; max-width: 42px; font-size: 0.56rem; font-weight: 800; line-height: 1.05; letter-spacing: 0.04em; }
/* The family's own photo, marked by the calendar's script with Your photo and Take it down: a gold edge,
   as today's door has. Nobody else sees it marked. */
.elf-pol--mine { box-shadow: 0 0 0 3px var(--elf-paper-gold), 0 2px 2px rgba(94, 0, 0, 0.2), 0 8px 10px rgba(94, 0, 0, 0.18); }
.elf-pol--mine figcaption { color: var(--maroon); }
.elf-pol--mine .elf-btn { width: 100%; margin-top: 6px; }
.elf-book .elf-detail__fact { margin-top: 18px; }
.elf-detail .elf-book__end { margin: 16px 0 0; color: var(--slate-soft); font-size: 0.92rem; text-align: center; }
.elf-detail .elf-book__gone { color: var(--maroon); font-weight: 600; }
/* The calendar everyone shares, before Christmas Day: an open door's last line asks where its elf was
   hiding, and its Have a go button sits on a line of its own under the question, centred, however narrow
   the phone. */
.elf-detail .elf-book__go .elf-btn { display: flex; width: fit-content; margin: 10px auto 0; }
.elf-book .elf-detail__mine { margin-top: 12px; }
.elf-detail .elf-book__close { margin: 16px 0 0; text-align: center; }

/* ---------- under the board ---------- */
.elf-legend { list-style: none; margin: 24px 2px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px 24px; font-size: 0.9rem; color: var(--slate-soft); }
.elf-legend li { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- how it works: four steps, each number on a paper rosette ---------- */
.elf-page .section.elf-how { padding-block: clamp(22px, 3vw, 36px) clamp(36px, 5vw, 64px); }
.elf-how .elf-strip { font-size: clamp(1.8rem, 1.5rem + 1.4vw, 2.6rem); }
.elf-steps { list-style: none; margin: clamp(18px, 3vw, 28px) 0 0; padding: 0; display: grid; gap: clamp(22px, 3vw, 34px) clamp(28px, 5vw, 64px); }
.elf-steps > li { display: grid; grid-template-columns: auto minmax(0, 1fr); align-content: start; column-gap: 16px; max-width: 46ch; }
.elf-steps__n { position: relative; grid-row: 1 / span 2; display: grid; place-items: center; width: 54px; height: 54px; color: var(--elf-on-dark); filter: drop-shadow(0 2px 2px rgba(94, 0, 0, 0.25)); }
.elf-steps__rosette { position: absolute; inset: 0; width: 100%; height: 100%; }
.elf-steps__n b { position: relative; font: 800 1.35rem/1 var(--font-head); font-variant-numeric: lining-nums; }
.elf-steps h3 { font-size: 1.2rem; color: var(--maroon); margin: 6px 0 4px; }
.elf-steps p { margin: 0; color: var(--slate); }
@media (min-width: 720px) {
  .elf-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* The one safety line, on a taped kraft note so it is read. */
.elf-grown-up { margin: clamp(30px, 4vw, 40px) 0 0; max-width: 620px; color: var(--elf-ink-on-tan); font-weight: 600; }

/* ---------- the ask at the foot: a card sheet on a crimson sheet, above the paper hills ---------- */
.elf-page .section.elf-join { padding-top: clamp(10px, 2vw, 24px); }
.elf-join__card { max-width: 780px; margin: 0 10px 0 0; padding: clamp(24px, 4vw, 38px) clamp(20px, 4vw, 40px) clamp(22px, 3vw, 32px); }
.elf-join .elf-strip { margin-top: 0; font-size: clamp(1.6rem, 1.3rem + 1.4vw, 2.4rem); }
.elf-join .lede { margin-top: 6px; color: var(--slate); }
.elf-join p { color: var(--slate); }
.elf-join .elf-btn { margin-top: 12px; }

/* =================================================================
   DETECTIVE HQ: a family's own page
   ================================================================= */

/* The top: the school's name on a torn label over the title strip, and the greeting, all centred. */
.elf-hq-top .wrap { text-align: center; }
.elf-hq-top .elf-hq__hello { max-width: 52ch; margin-inline: auto; }

.elf-hq-case { padding-bottom: clamp(8px, 2vw, 20px); }

/* Today's case, on a note taped to the page: it is what the family came for. While its elf is being
   hunted, a holly sheet shows under it, and under a door's go page while the family has its go. */
.elf-case.elf-note { max-width: 760px; margin: 12px auto 0; padding: clamp(30px, 4vw, 40px) clamp(20px, 4vw, 36px) clamp(22px, 3vw, 32px); color: var(--slate); }
.elf-case.elf-note::before { background: var(--elf-grain-light) 0 0 / 384px, var(--card); background-blend-mode: multiply; -webkit-mask: var(--elf-tear-card-c); mask: var(--elf-tear-card-c); }
.elf-case--hunting::after,
.elf-case--found-hidden::after,
.elf-go--go::after { content: ""; position: absolute; inset: 9px -9px -10px 8px; z-index: -2; background-color: var(--holly); background-image: var(--elf-grain); background-size: 384px; background-blend-mode: soft-light; -webkit-mask: var(--elf-tear-card-b); mask: var(--elf-tear-card-b); transform: rotate(1.2deg); }
.elf-case h2 { font-size: clamp(1.6rem, 1.3rem + 1.4vw, 2.3rem); color: var(--maroon); margin-bottom: 12px; text-wrap: balance; }
.elf-case p { margin: 0 0 10px; }
.elf-case__door { font-family: var(--elf-hand); font-weight: 700; font-size: 1.7rem; line-height: 1; color: var(--crimson); }
/* A practice evening says so, on a crimson chip beside "The practice door". */
.elf-practice { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.elf-practice .elf-chip { font-family: var(--font-body); font-size: 0.8rem; }
.elf-case .elf-case__count { margin: 14px 0 16px 10px; }
.elf-case__by .elf-icon { color: var(--gold-ink); }
/* How it turned out, on a slip of paper: holly when the family cracked it. */
.elf-case__verdict { position: relative; isolation: isolate; padding: 12px 16px 13px; }
.elf-case__verdict::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--elf-grain-light) 0 0 / 384px, var(--tan-soft); background-blend-mode: multiply; -webkit-mask: var(--elf-tear-fine-a); mask: var(--elf-tear-fine-a); }
.elf-case__verdict.is-cracked { color: var(--holly-dark); }
.elf-case__verdict.is-cracked::before { background-color: var(--holly-soft); background-image: var(--elf-grain-light); }
.elf-case__hint { color: var(--slate-soft); }

/* The clue ladder: one note of kraft paper a clue, taped on as each comes out, a little out of true,
   the newest at the foot. The words are set a size up from everything round them: they are read
   aloud to children. A picture fits the note's width. Then when the next clue comes out (counting
   down on the candy cane strip), or when the hiding place is shown. */
.elf-ladder { list-style: none; margin: 6px 0 clamp(16px, 3vw, 22px); padding: 0; display: grid; gap: 24px; }
/* A clue is an item of the ladder's grid: min-width 0 lets it be narrower than its longest word, and its words break
   anywhere they must, so a very long word wraps inside the note at 390 and 360 instead of pushing every note out. */
.elf-clue { position: relative; isolation: isolate; min-width: 0; margin: 0; padding: clamp(22px, 3vw, 28px) clamp(16px, 3vw, 24px) clamp(16px, 2.5vw, 22px); color: var(--elf-ink-on-tan); filter: var(--elf-drop-small); transform: rotate(-0.4deg); }
.elf-clue:nth-child(even) { transform: rotate(0.5deg); }
.elf-clue::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--elf-grain) 0 0 / 384px, color-mix(in srgb, var(--tan) 45%, var(--card)); background-blend-mode: soft-light; -webkit-mask: var(--elf-tear-tile-a); mask: var(--elf-tear-tile-a); }
.elf-clue:nth-child(even)::before { -webkit-mask: var(--elf-tear-tile-b); mask: var(--elf-tear-tile-b); }
.elf-clue .elf-clue__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin: 0 0 6px; }
.elf-clue__n { color: var(--crimson); font-family: var(--elf-hand); font-weight: 700; font-size: 1.55rem; line-height: 1; }
.elf-clue__at { font-size: 0.86rem; font-weight: 600; }
.elf-clue .elf-clue__words { margin: 0; font-size: clamp(1.12rem, 1.05rem + 0.5vw, 1.35rem); line-height: 1.55; overflow-wrap: anywhere; }
.elf-clue__pic { display: block; max-width: 100%; height: auto; margin: 12px 0 0; border-radius: 3px; box-shadow: 0 2px 3px rgba(58, 0, 0, 0.25); }
.elf-case .elf-ladder__next { margin: 0 0 4px; color: var(--holly-dark); font-weight: 600; }
/* When the hiding place closes, on the door's own day (Plan 2c-1): under the clues, before the guess. */
.elf-case .elf-ladder__closes { margin: 10px 0 4px; color: var(--maroon); font-weight: 600; }

/* The guess: one box to type the place in, cut into the note. The site gives every form a card of its
   own; this one already sits on the note. */
.elf-case form { background: none; border: 0; border-radius: 0; box-shadow: none; padding: 0; }
.elf-guess fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.elf-guess legend { padding: 0; margin-bottom: 4px; font-family: var(--font-head); font-weight: 800; font-size: 1.2rem; color: var(--maroon); }
.elf-guess .elf-guess__hint { margin: 0 0 10px; color: var(--slate-soft); font-size: 0.92rem; font-weight: 400; }
.elf-guess .elf-guess__text {
  width: 100%; min-height: 52px; padding: 12px 14px; border: 0; border-radius: 6px; color: var(--slate); font: inherit; font-size: 1.15rem;
  background-color: var(--card); background-image: var(--elf-grain-light); background-size: 384px; background-blend-mode: multiply;
  box-shadow: inset 0 2px 3px rgba(94, 0, 0, 0.2), inset 0 0 0 1.5px color-mix(in srgb, var(--maroon) 55%, transparent);
}
.elf-guess .elf-guess__text:focus-visible { outline: 3px solid var(--gold-ink); outline-offset: 2px; }
.elf-case .elf-guess__status { min-height: 1.7em; margin: 12px 0; color: var(--holly-dark); }
.elf-case .elf-guess__status.is-error { color: var(--crimson); }
.elf-guess button[disabled] { opacity: 0.6; cursor: progress; }

/* The detectives. One card sheet each, a child is a person, not a row in a table: their elf in the
   frame they chose, their rank on a chip, the doors done on the candy cane strip. */
.elf-hq-team .elf-strip,
.elf-hq-marks .elf-strip { font-size: clamp(1.6rem, 1.35rem + 1.2vw, 2.2rem); }
.elf-page .section.elf-hq-team { padding-block: clamp(30px, 5vw, 64px) clamp(16px, 3vw, 32px); }
.elf-page .section.elf-hq-marks { padding-top: clamp(16px, 3vw, 32px); }
.elf-detectives { display: grid; gap: 30px 26px; margin-top: clamp(16px, 3vw, 24px); }
.elf-detective { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: start; margin-right: 8px; padding: 20px; }
.elf-detective__frame { width: 96px; padding: 8px; }
.elf-detective__elf { display: block; width: 100%; height: auto; border-radius: 6px; }
.elf-detective h3 { font-size: 1.25rem; color: var(--maroon); overflow-wrap: anywhere; }
.elf-detective p { margin: 6px 0 0; }
.elf-detective__rank { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--slate-soft); }
/* The doors done: a torn candy cane in a torn paper slot. Still the page's own progress bar. */
.elf-cane-progress {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 20px;
  margin-top: 12px;
  border: 0;
  border-radius: 6px;
  background-color: color-mix(in srgb, var(--tan) 55%, var(--cream));
  background-image: var(--elf-grain);
  background-size: 384px;
  background-blend-mode: soft-light;
  box-shadow: inset 0 2px 4px rgba(94, 0, 0, 0.3);
  color: var(--crimson);
  overflow: hidden;
  -webkit-mask: var(--elf-tear-fine-a);
  mask: var(--elf-tear-fine-a);
}
.elf-cane-progress::-webkit-progress-bar { background: transparent; }
.elf-cane-progress::-webkit-progress-value { border-radius: 4px; background: var(--elf-grain) 0 0 / 384px, repeating-linear-gradient(45deg, var(--crimson) 0 9px, var(--card) 9px 18px); background-blend-mode: soft-light, normal; box-shadow: inset 0 -2px 0 rgba(94, 0, 0, 0.22); }
.elf-cane-progress::-moz-progress-bar { border-radius: 4px; background: var(--elf-grain) 0 0 / 384px, repeating-linear-gradient(45deg, var(--crimson) 0 9px, var(--card) 9px 18px); background-blend-mode: soft-light, normal; }
.elf-detective__note { font-size: 0.9rem; color: var(--slate-soft); }
.elf-detective .elf-detective__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; }
/* A graduate's certificate, share card and video (Plan 2c-2): across the whole foot of the card, under the elf and
   the progress, so each button has the card's full width at 360 pixels and drops under the one before when it must. */
.elf-detective .elf-detective__graduate { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0; }
.elf-add-detective { margin: clamp(22px, 3vw, 30px) 0 0; }
@media (min-width: 720px) {
  .elf-detectives { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .elf-detective__frame { width: 118px; padding: 10px; }
}

/* Doors you can still crack (Plan 2c-1), under today's case: a card sheet for each missed door, newest
   first, with its number in the hand, its day and its elf, and a go. The words wrap before the button drops
   under them, and the cards sit two across once there is room. */
.elf-page .section.elf-hq-crack { padding-block: clamp(30px, 5vw, 64px) clamp(8px, 2vw, 16px); }
.elf-hq-crack .elf-strip { font-size: clamp(1.6rem, 1.35rem + 1.2vw, 2.2rem); }
.elf-hq-crack .lede { margin-top: 12px; }
.elf-crack { list-style: none; margin: clamp(16px, 3vw, 24px) 0 0; padding: 0; display: grid; gap: 26px; }
.elf-crack__door { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-right: 8px; padding: 16px 20px; color: var(--slate); }
.elf-crack__door h3 { margin: 0; font-family: var(--elf-hand); font-size: 1.6rem; line-height: 1; color: var(--crimson); }
.elf-crack__door p { margin: 0; overflow-wrap: anywhere; }
.elf-crack__door .elf-btn { margin-left: auto; }
@media (min-width: 720px) { .elf-crack { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* The grand prize (Plan 2c-2), from Christmas Eve, between today's case and the doors still to crack: a card
   sheet for each graduate, with the button to send their picture, or a tick once it is in. A long name wraps
   before the button drops under it, and the cards sit two across once there is room, as the doors' do. */
.elf-page .section.elf-hq-prize { padding-block: clamp(30px, 5vw, 64px) clamp(8px, 2vw, 16px); }
.elf-hq-prize .elf-strip { font-size: clamp(1.6rem, 1.35rem + 1.2vw, 2.2rem); }
.elf-hq-prize .lede { margin-top: 12px; }
.elf-prize { list-style: none; margin: clamp(16px, 3vw, 24px) 0 0; padding: 0; display: grid; gap: 26px; }
.elf-prize__detective { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-right: 8px; padding: 16px 20px; color: var(--slate); }
.elf-prize__detective p { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.elf-prize__detective .elf-prize__name { font-family: var(--elf-hand); font-weight: 700; font-size: 1.5rem; line-height: 1.1; color: var(--crimson); }
.elf-prize__detective .elf-prize__in { color: var(--holly-dark); font-weight: 600; }
.elf-prize__in .elf-icon { color: var(--holly); }
.elf-prize__detective .elf-btn { margin-left: auto; }
@media (min-width: 720px) { .elf-prize { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* The family's marks: all 24 doors, small, each a square of paper; holly once it is done. */
.elf-hq-marks .lede { margin-top: 12px; }
.elf-marks { list-style: none; margin: clamp(16px, 3vw, 24px) 0 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.elf-marks li {
  position: relative;
  isolation: isolate;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 3px;
  min-height: 62px;
  padding: 7px 2px;
  filter: drop-shadow(0 1.5px 1px rgba(94, 0, 0, 0.18));
}
.elf-marks li::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--elf-grain-light) 0 0 / 384px, var(--card); background-blend-mode: multiply; -webkit-mask: var(--elf-tear-fine-b); mask: var(--elf-tear-fine-b); }
.elf-marks li:nth-child(odd)::before { -webkit-mask: var(--elf-tear-fine-a); mask: var(--elf-tear-fine-a); }
.elf-marks li.is-done::before { background-color: var(--holly-soft); background-image: var(--elf-grain-light); }
.elf-marks__num { font-family: var(--font-head); font-weight: 800; color: var(--slate-soft); font-variant-numeric: lining-nums; }
.elf-marks li.is-done .elf-marks__num { color: var(--holly-dark); }
.elf-marks .elf-mark { width: 20px; height: 20px; }
.elf-marks__sum { margin: 16px 0 20px; color: var(--slate-soft); }
@media (min-width: 640px) { .elf-marks { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
@media (min-width: 981px) { .elf-marks { grid-template-columns: repeat(12, minmax(0, 1fr)); } }

/* Your emails (Plan 2c-2), last on Detective HQ while December's doors are on: what is emailed, the one button to
   stop it or start it again, and what always comes. The site gives every form a card of its own; this one, here
   and on the page its emails' link opens, is only its button. */
.elf-page .section.elf-hq-emails { padding-block: clamp(16px, 3vw, 32px) clamp(8px, 2vw, 16px); }
.elf-hq-emails .elf-strip { font-size: clamp(1.6rem, 1.35rem + 1.2vw, 2.2rem); }
.elf-hq-emails .lede { margin-top: 12px; }
form.elf-emails { margin: 16px 0 0; padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; }
.elf-hq-emails .elf-emails__always { margin-top: 14px; }

/* =================================================================
   HAVING A GO: a missed door's own page in Detective HQ (Plan 2c-1)
   ================================================================= */

/* The top, centred as Detective HQ's is: Detective HQ's label over the door's title strip, the Practice
   chip on the practice door, and the door's elf. */
.elf-go-top .wrap { text-align: center; }
.elf-go-top .elf-practice { justify-content: center; margin: 10px 0 0; }
.elf-go-top .elf-go__elf { max-width: 52ch; margin-inline: auto; }

/* The case, on a note taped to the page as today's case is in Detective HQ (the note is an .elf-case too,
   so its words, clues and guess look the same). Who found the elf heads it. */
.elf-go-case { padding-bottom: clamp(8px, 2vw, 20px); }
.elf-go .elf-go__found { color: var(--slate-soft); font-weight: 600; }
.elf-go__found .elf-icon { color: var(--gold-ink); vertical-align: -2px; }
/* Show me the next clue: a button on a line of its own under the clues, before the one guess. */
.elf-go .elf-go__next { margin: 0 0 clamp(18px, 3vw, 24px); }
.elf-go .elf-go__one { margin: 12px 0 0; color: var(--maroon); font-weight: 600; }
/* How it went, on today's case's slip of paper, a size up: it is what the family came back for. */
.elf-go .elf-go__verdict { font-size: clamp(1.08rem, 1rem + 0.5vw, 1.25rem); font-weight: 600; overflow-wrap: break-word; }
.elf-go__back { max-width: 760px; margin: clamp(18px, 3vw, 26px) auto 0; text-align: center; }

/* =================================================================
   SENDING IN A PICTURE FOR THE GRAND PRIZE (Plan 2c-2)
   ================================================================= */

/* The top, centred as Detective HQ's is: Detective HQ's label over the title strip, and who the picture is for. */
.elf-entry-top .wrap { text-align: center; }
.elf-entry-top .elf-entry__for { max-width: 52ch; margin-inline: auto; }

/* The page on a note taped to the page, as today's case is in Detective HQ (the note is an .elf-case too, so its
   words, form and status line look the same): the picture that is in, the form, and the promise. */
.elf-entry-page { padding-bottom: clamp(8px, 2vw, 20px); }
/* The picture in, on a cream mount a little out of true: always the whole picture, a drawing never cut off,
   shrunk to fit the note's width, and never taller than most of a phone's screen. */
.elf-entry__pic { display: block; width: auto; max-width: 100%; height: auto; max-height: min(70vh, 560px); margin: 4px auto 18px; padding: 8px; border-radius: 3px; background-color: var(--card); background-image: var(--elf-grain-light); background-size: 384px; background-blend-mode: multiply; box-shadow: 0 2px 2px rgba(94, 0, 0, 0.2), 0 8px 10px rgba(94, 0, 0, 0.18); transform: rotate(-1deg); }
.elf-entry-note .elf-entry__in { color: var(--holly-dark); font-weight: 600; overflow-wrap: anywhere; }
.elf-entry-note .elf-entry__closes { color: var(--maroon); font-weight: 600; }
.elf-entry { display: grid; gap: 14px; margin: 6px 0 0; }
.elf-entry .elf-field { margin: 0; min-width: 0; }
.elf-entry .elf-field input[type="tel"] {
  width: 100%; min-height: 52px; padding: 12px 14px; border: 0; border-radius: 6px; color: var(--slate); font: inherit; font-size: 1.15rem;
  background-color: var(--card); background-image: var(--elf-grain-light); background-size: 384px; background-blend-mode: multiply;
  box-shadow: inset 0 2px 3px rgba(94, 0, 0, 0.2), inset 0 0 0 1.5px color-mix(in srgb, var(--maroon) 55%, transparent);
}
.elf-entry .elf-field input:focus-visible { outline: 3px solid var(--gold-ink); outline-offset: 2px; }
.elf-entry .elf-field input[type="file"] { width: 100%; max-width: 100%; }
.elf-entry .elf-form-status { min-height: 0; margin: 0; overflow-wrap: anywhere; }
.elf-entry button { justify-self: start; }
.elf-entry button[disabled] { opacity: 0.6; cursor: progress; }
/* The promise beside a sprig of holly, as the photo sheet's is. */
.elf-entry-note .elf-entry__promise { position: relative; isolation: isolate; margin: 18px 0 0; padding: 12px 14px 12px 52px; color: var(--holly-dark); font-size: 0.86rem; line-height: 1.45; }
.elf-entry__promise::before { content: ""; position: absolute; left: 12px; top: 10px; width: 30px; height: 29px; background: url(/assets/img/elf/paper/deco/holly.webp) center / contain no-repeat; filter: drop-shadow(0 1px 1px rgba(58, 0, 0, 0.3)); }
.elf-entry__promise::after { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--elf-grain-light) 0 0 / 384px, var(--holly-soft); background-blend-mode: multiply; -webkit-mask: var(--elf-tear-fine-b); mask: var(--elf-tear-fine-b); }
.elf-entry__back { max-width: 760px; margin: clamp(18px, 3vw, 26px) auto 0; text-align: center; }

/* =================================================================
   THE EMAILS A FAMILY CAN STOP (Plan 2c-2): the page the link in an email opens
   ================================================================= */

/* The top, centred as Detective HQ's is: Elf Detective School's label over the title strip. */
.elf-emails-top .wrap { text-align: center; }

/* The page on a note taped to the page, as today's case is in Detective HQ (the note is an .elf-case too, so its
   words, button and small print look the same): where the emails stand, or what the button has just done, then
   the button and what always comes. */
.elf-emails-page { padding-bottom: clamp(8px, 2vw, 20px); }
.elf-emails-note .elf-emails__said { color: var(--holly-dark); font-weight: 600; }

/* =================================================================
   THE WARDROBE: dressing an elf, in paper (mockup 6, approved by Jaimie on 4 November 2026)
   The loud thing here is the elf on its stage, in its paper frame. Everything else is cut from card:
   the name plate, step 1's sheet torn off a pad, the gift tags on a gold string, and each door's
   costumes on a card sheet of their own.
   ================================================================= */

.elf-wd-top .wrap { text-align: center; }
.elf-wd-top .lede { max-width: 54ch; margin-inline: auto; }
.elf-wd-top { padding-bottom: clamp(10px, 2vw, 20px); }
.elf-wd-section { padding-bottom: clamp(36px, 6vw, 72px); }
/* The site gives every form a card of its own. This form is the whole page. */
form.elf-wd { display: grid; gap: clamp(26px, 4vw, 44px); padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; }
.elf-wd-tools[hidden], .elf-wd-taphint[hidden], .elf-wd-peek[hidden] { display: none; }

/* ---- the stage, in its paper frame, with baubles, its fairy lights and the count on a rosette ---- */
.elf-wd-preview { display: grid; justify-items: center; align-content: start; gap: 14px; min-width: 0; }
/* The stage, its hint and its two tools, kept together: beside the choices this block stays in view. */
.elf-wd-stick { display: grid; justify-items: center; gap: 12px; width: 100%; }
.elf-wd-show { position: relative; width: min(100%, 360px); padding-top: 12px; }
.elf-wd-frame { padding: 12px; }
/* The stage: the look's paper pictures, each in its place, as fractions of a stage 2 by 3 (the same
   places the elf's PNG uses, src/elf/elf-png.ts). The elf's picture is its whole canvas, and so are
   the glasses and the bow tie, so the three line up; the friend is fitted in a square and stands on
   the front of the plinth. */
.elf-wd-stage { position: relative; width: 100%; aspect-ratio: 2 / 3; border-radius: 6px; overflow: hidden; container-type: inline-size; background: var(--elf-paper); cursor: pointer; }
.elf-wd-pic { position: absolute; display: block; }
.elf-wd-pic[data-picture="scene"] { inset: 0; width: 100%; height: 100%; object-fit: cover; }
.elf-wd-pic[data-picture="body"], .elf-wd-pic[data-picture="glasses"], .elf-wd-pic[data-picture="bow"] { left: 23.1%; top: 33%; width: 53.7%; height: auto; }
.elf-wd-pic[data-picture="body"] { filter: drop-shadow(0 8px 8px rgba(40, 10, 0, 0.4)); }
.elf-wd-pic[data-picture="friend"] { left: 52.5%; bottom: 18%; width: 21%; aspect-ratio: 1; object-fit: contain; object-position: 50% 100%; }
/* The village window's painted fairy lights, each with a soft warm glow; other scenes keep their own. */
.elf-wd-glows { position: absolute; inset: 0; pointer-events: none; }
.elf-wd-stage:not([data-scene="village"]) .elf-wd-glows { display: none; }
.elf-wd-glows span { position: absolute; width: calc(var(--d) * 2.8cqw); height: calc(var(--d) * 2.8cqw); margin: calc(var(--d) * -1.4cqw) 0 0 calc(var(--d) * -1.4cqw); border-radius: 50%; background: radial-gradient(circle, rgba(255, 240, 190, 0.9) 0 16%, rgba(233, 196, 106, 0.45) 36%, transparent 68%); mix-blend-mode: screen; opacity: 0.7; }
.elf-wd-snow { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.elf-wd-snow .is-flurry { position: absolute; top: -10px; left: var(--x); width: var(--s); height: var(--s); border-radius: 50%; background: #FFFDF8; opacity: 0.9; }
.elf-wd-flash { position: absolute; inset: 0; background: #FFFDF8; opacity: 0; pointer-events: none; }
.elf-wd-hang { position: absolute; z-index: 3; top: -2px; width: 30px; height: auto; transform-origin: 50% 0; filter: drop-shadow(0 4px 3px rgba(94, 0, 0, 0.3)); pointer-events: none; }
.elf-wd-hang--a { left: 11%; }
.elf-wd-hang--b { left: 23%; width: 24px; }
.elf-wd-seal { position: absolute; z-index: 4; top: -6px; right: -16px; display: grid; justify-items: center; align-content: start; width: 74px; height: 80px; padding-top: 18px; color: var(--elf-on-dark); font-family: var(--font-head); font-weight: 800; text-align: center; filter: drop-shadow(0 5px 5px rgba(90, 0, 0, 0.25)); transform: rotate(8deg); }
.elf-wd-seal__rosette { position: absolute; inset: 0; width: 100%; height: 100%; }
.elf-wd-seal b { position: relative; font-size: 1.45rem; line-height: 0.9; font-variant-numeric: lining-nums; }
.elf-wd-seal small { position: relative; font-family: var(--font-body); font-size: 0.6rem; font-weight: 600; }
/* What the elf says, in a speech bubble of paper over the stage. */
.elf-wd-say { position: absolute; z-index: 5; left: 50%; top: 20%; margin: 0; padding: 8px 16px 10px; border-radius: 18px; background-color: var(--card); background-image: var(--elf-grain-light); background-size: 384px; background-blend-mode: multiply; color: var(--maroon); font-family: var(--elf-hand); font-weight: 700; font-size: 1.45rem; line-height: 1; white-space: nowrap; box-shadow: 0 3px 0 var(--elf-edge-dark), 0 10px 14px rgba(94, 0, 0, 0.22); opacity: 0; transform: translateX(-50%) scale(0.7); pointer-events: none; }
.elf-wd-say:empty { display: none; }
.elf-wd-say.is-on { opacity: 1; transform: translateX(-50%) scale(1); }
.elf-wd-taphint { margin: 0; color: var(--maroon); font-family: var(--elf-hand); font-size: 1.15rem; }

/* ---- the name plate: a card sheet with the name on a torn strip, the tools and the favourite looks ---- */
/* On a phone the plate sits just under the stage, 14px below as the stage's own column spaces things; it is
   the form's next part, so the form's gap is drawn back to that. */
.elf-wd-plate { display: grid; justify-items: center; justify-self: center; gap: 12px; width: min(100%, 380px); margin-top: calc(14px - clamp(26px, 4vw, 44px)); margin-right: 8px; padding: 26px 18px 22px; text-align: center; }
.elf-wd-plate .elf-strip { margin: 0; font-size: clamp(1.25rem, 1.1rem + 0.8vw, 1.6rem); }
.elf-wd-plate p { margin: 0; }
.elf-wd-preview__rank { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; color: var(--slate-soft); }
.elf-wd-wearing { color: var(--slate); font-size: 0.95rem; line-height: 1.5; }
.elf-wd-status { min-height: 1.4em; font-size: 0.9rem; color: var(--holly-dark); }
.elf-wd-status.is-error { color: var(--crimson); }
.elf-wd-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.elf-wd-tools img, .elf-wd-sound img { width: 26px; height: auto; }
.elf-wd-looks { display: grid; justify-items: center; gap: 4px; width: 100%; }
.elf-wd-looks .elf-strip { margin: 4px 0 0; font-family: var(--elf-hand); font-size: 1.6rem; }
.elf-wd-looks__line { position: relative; width: 100%; min-height: 70px; }
.elf-wd-looks__string { position: absolute; left: 6%; right: 6%; top: 0; height: 20px; border-bottom: 2px solid var(--elf-paper-gold); border-radius: 0 0 50% 50%; }
.elf-wd-looks__row { position: relative; display: flex; justify-content: center; gap: 10px; padding-top: 12px; }
.elf-wd-looks__empty { padding-top: 16px; color: var(--slate-soft); font-family: var(--elf-hand); font-size: 1.2rem; }
.elf-wd-polaroid { position: relative; display: grid; gap: 4px; width: 86px; padding: 6px 6px 8px; border: 0; border-radius: 3px; background-color: var(--card); background-image: var(--elf-grain-light); background-size: 384px; background-blend-mode: multiply; box-shadow: 0 2px 2px rgba(94, 0, 0, 0.2), 0 8px 10px rgba(94, 0, 0, 0.18); cursor: pointer; transform: rotate(-4deg); }
.elf-wd-polaroid:nth-child(2) { transform: rotate(3deg); }
.elf-wd-polaroid:nth-child(3) { transform: rotate(-2deg); }
.elf-wd-polaroid::before { content: ""; position: absolute; left: 50%; top: -9px; width: 10px; height: 18px; margin-left: -5px; border-radius: 2px; background: color-mix(in srgb, var(--tan) 60%, var(--card)); box-shadow: 0 1px 1px rgba(94, 0, 0, 0.3); }
.elf-wd-polaroid:focus-visible { outline: 3px solid var(--gold-ink); outline-offset: 3px; }
.elf-wd-polaroid__pic { position: relative; display: block; aspect-ratio: 2 / 3; overflow: hidden; border-radius: 2px; background: var(--elf-paper); }
.elf-wd-polaroid__pic img { position: absolute; display: block; }
.elf-wd-polaroid__scene { inset: 0; width: 100%; height: 100%; object-fit: cover; }
.elf-wd-polaroid__elf { left: 23.1%; top: 33%; width: 53.7%; height: auto; }
.elf-wd-polaroid__cap { color: var(--maroon); font-family: var(--elf-hand); font-weight: 700; font-size: 1rem; line-height: 1; overflow-wrap: anywhere; }
.elf-wd-sound.is-on { color: var(--holly-dark); }

/* ---- step 1: your elf, on a holly card strip, folding open onto a sheet torn off a pad ---- */
.elf-wd-dress { display: grid; gap: clamp(26px, 4vw, 40px); min-width: 0; }
.elf-wd-step { min-width: 0; }
.elf-wd-me { display: flex; align-items: center; gap: 14px; margin-right: 8px; padding: 14px 16px; }
.elf-wd-me .elf-wd-me__bow { top: -20px; left: -16px; width: 54px; transform: rotate(-12deg); }
.elf-wd-me__badge { position: relative; display: grid; place-items: center; flex: none; width: 66px; height: 66px; }
.elf-wd-me__rosette { position: absolute; inset: 0; width: 100%; height: 100%; --elf-rosette-disc: var(--tan-soft); }
.elf-wd-me__face { position: relative; width: 42px; height: 42px; border-radius: 50%; object-fit: cover; object-position: 50% 30%; transform: scale(1); }
.elf-wd-me__words { flex: 1; min-width: 0; }
.elf-wd-me h2 { font-size: 1.3rem; color: var(--maroon); }
.elf-wd-me__said { margin: 2px 0 0; color: var(--slate-soft); font-size: 0.92rem; }
.elf-wd-fold { display: grid; grid-template-rows: 1fr; }
.elf-wd-fold__in { min-height: 0; }
.elf-wd-fold.is-folded { grid-template-rows: 0fr; }
.elf-wd-fold.is-folded .elf-wd-fold__in { overflow: hidden; visibility: hidden; }
.elf-wd-maker { margin: 18px 6px 4px; }
.elf-wd-maker__title { margin: 0 0 6px; color: var(--crimson); font-family: var(--elf-hand); font-weight: 700; font-size: 2.2rem; line-height: 1; }
.elf-wd-maker .elf-wd-group legend { width: 100%; padding: 0 0 4px; margin-bottom: 12px; border-bottom: 1px solid color-mix(in srgb, var(--maroon) 18%, transparent); color: var(--holly); font-family: var(--elf-hand); font-weight: 700; font-size: 1.55rem; line-height: 1.1; }
.elf-wd-done { margin-top: 8px; }

/* ---- step 2: dress up, its sections named on gift tags hung from a gold string ---- */
.elf-wd-step--dress > .elf-strip { margin: 0 0 8px; font-size: clamp(1.8rem, 1.5rem + 1.4vw, 2.6rem); }
.elf-wd-tabs { position: relative; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 0 0 22px; padding: 34px 10px 0; list-style: none; }
.elf-wd-tabs::before { content: ""; position: absolute; left: 0; right: 26px; top: 8px; height: 9px; border-radius: 5px; background-color: var(--elf-paper-gold); background-image: var(--elf-grain); background-size: 384px; background-blend-mode: soft-light; box-shadow: 0 2px 2px rgba(94, 0, 0, 0.25); }
.elf-wd-tabs::after { content: ""; position: absolute; right: -8px; top: -10px; width: 52px; height: 40px; background: url(/assets/img/elf/paper/deco/bow-gold.webp) center / contain no-repeat; filter: drop-shadow(0 3px 2px rgba(94, 0, 0, 0.3)); }
.elf-wd-tabs li { position: relative; display: flex; justify-content: center; min-width: 0; }
.elf-wd-tabs li::before { content: ""; position: absolute; left: 50%; top: -18px; width: 2px; height: 30px; margin-left: -1px; background: var(--elf-paper-gold); }
.elf-wd-tab.elf-tag { position: relative; display: block; width: 100%; max-width: 132px; text-decoration: none; transform-origin: 50% 0; }
.elf-wd-tab__label { position: absolute; inset: 32% 6% 9%; display: grid; justify-items: center; align-content: start; gap: 4px; color: var(--maroon); font-family: var(--font-head); font-weight: 800; font-size: 0.72rem; line-height: 1.1; text-align: center; overflow-wrap: anywhere; }
.elf-wd-tabs li:nth-child(1) .elf-wd-tab__label, .elf-wd-tabs li:nth-child(2) .elf-wd-tab__label { color: var(--elf-on-dark); }
.elf-wd-tab__label img { width: 30px; height: 30px; padding: 3px; border-radius: 50%; background: var(--card); object-fit: contain; box-shadow: 0 1px 2px rgba(94, 0, 0, 0.3); }
.elf-wd-tab[aria-selected="true"] { transform: translateY(5px); }
.elf-wd-tab[aria-selected="true"] .elf-wd-tab__label::after { content: ""; display: block; width: 60%; height: 3px; margin: 2px auto 0; border-radius: 2px; background: var(--elf-paper-gold); }
.elf-wd-tab:focus-visible { outline: 3px solid var(--gold-ink); outline-offset: 3px; }
.elf-wd-tab__new { position: absolute; top: 26%; right: 10%; width: 12px; height: 12px; border-radius: 50%; background: var(--elf-paper-gold); box-shadow: 0 0 0 2px var(--card), 0 1px 2px rgba(94, 0, 0, 0.4); }
.elf-wd-panel { scroll-margin-top: calc(var(--nav-h) + 60px); }
.elf-wd-panel + .elf-wd-panel { margin-top: 28px; }
.elf-wd-group { min-width: 0; margin: 0 0 20px; padding: 0; border: 0; }
.elf-wd-group legend { padding: 0; margin-bottom: 10px; font-family: var(--font-head); font-weight: 800; font-size: 1.35rem; color: var(--maroon); }
/* As a tab, a section already has its name on show: the heading stays for a screen reader only. */
.elf-wd.is-live .elf-wd-group--named > legend { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.elf-wd-note { margin: 0 0 14px; color: var(--slate-soft); font-size: 0.94rem; }
.elf-wd-haul { margin: 0 0 6px; color: var(--crimson); font-family: var(--elf-hand); font-weight: 700; font-size: 1.6rem; line-height: 1.1; }
.elf-wd-haul b { font-size: 1.15em; }
.elf-wd-haul__bar { max-width: 360px; margin: 0 0 18px; }
.elf-wd-back { margin: 0; }

/* Each door's costumes on a card sheet: its number on a rosette, its chip, its two costumes. */
.elf-wd-doors { display: grid; gap: 28px 26px; margin-top: 18px; }
.elf-wd-door { margin-right: 8px; padding: 16px 16px 18px; }
.elf-wd-door__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
.elf-wd-door__num { position: relative; display: grid; place-items: center; flex: none; width: 46px; height: 46px; color: var(--elf-on-dark); }
.elf-wd-door__rosette { position: absolute; inset: 0; width: 100%; height: 100%; }
.elf-wd-door__num b { position: relative; font: 800 1.05rem/1 var(--font-head); font-variant-numeric: lining-nums; }
.elf-wd-door__star { position: relative; width: 18px; height: 18px; fill: var(--elf-on-dark); }
.elf-wd-door__name { margin: 0; color: var(--maroon); font-family: var(--font-head); font-weight: 800; font-size: 1.15rem; }
.elf-wd-door__chip { margin-left: auto; }
@media (min-width: 1180px) {
  .elf-wd-doors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .elf-wd-doors > .elf-wd-door:first-child { grid-column: 1 / -1; }
}

/* ---- one choice. The radio button itself is invisible and covers the tile; the label is what is seen ---- */
.elf-wd-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; }
.elf-wd-row--words { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px 14px; }
.elf-wd-row--circles { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.elf-wd-tile { position: relative; }
/* z-index keeps the button on top of its label at every moment. Without it, a label that moves
   under a thumb (it has a transform while pressed) rises above the button halfway through the tap:
   the press lands on one and the release on the other, and the browser throws the tap away. */
.elf-wd-tile input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
/* A locked choice takes no taps itself, so that a tap reaches the tile and it can rattle. */
.elf-wd-tile input:disabled { pointer-events: none; }
.elf-wd-tile label { position: relative; isolation: isolate; display: grid; justify-items: center; align-content: start; gap: 4px; height: 100%; min-height: 96px; margin: 0; padding: 10px 6px 10px; color: var(--maroon); font-size: 0.82rem; font-weight: 600; line-height: 1.2; text-align: center; overflow-wrap: anywhere; filter: drop-shadow(0 2px 1px rgba(94, 0, 0, 0.2)) drop-shadow(0 5px 5px rgba(94, 0, 0, 0.12)); }
.elf-wd-tile label::before { content: ""; position: absolute; inset: 0; z-index: -1; background-color: var(--card); background-image: var(--elf-grain-light); background-size: 384px; background-blend-mode: multiply; -webkit-mask: var(--elf-tear-tile-a); mask: var(--elf-tear-tile-a); }
.elf-wd-tile:nth-child(even) label::before { -webkit-mask: var(--elf-tear-tile-b); mask: var(--elf-tear-tile-b); }
.elf-wd-art { display: block; }
.elf-wd-art img { display: block; max-width: 100%; height: auto; }
.elf-wd-tile--costume .elf-wd-art img { width: 74px; }
.elf-wd-tile--scene .elf-wd-art img { width: 70px; border-radius: 3px; }
.elf-wd-tile--friend .elf-wd-art img { width: 62px; }
.elf-wd-swatch { display: block; width: 58px; height: 58px; padding: 0; }
/* Worn: a holly sheet, and the tick on a crimson circle of paper. */
.elf-wd-tile input:checked + label { color: var(--holly-dark); }
.elf-wd-tile input:checked + label::before { background-color: var(--holly-soft); background-image: var(--elf-grain-light); }
.elf-wd-tile input:checked + label::after { content: ""; position: absolute; top: -6px; left: -6px; width: 24px; height: 24px; border-radius: 50%; background: var(--crimson) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FFF8EF' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 15px no-repeat; box-shadow: 0 2px 2px rgba(94, 0, 0, 0.3); }
.elf-wd-tile input:focus-visible + label { outline: 3px solid var(--gold-ink); outline-offset: 2px; }
/* Locked: faint, with the painted padlock; tapped, it says why on a note. */
.elf-wd-tile.is-locked label { color: var(--slate-soft); cursor: not-allowed; }
.elf-wd-tile.is-locked .elf-wd-art { opacity: 0.42; filter: grayscale(0.45); }
.elf-wd-lock { position: absolute; z-index: 1; top: -8px; right: -5px; width: 26px; transform: rotate(10deg); }
.elf-wd-lock img { display: block; width: 100%; height: auto; filter: drop-shadow(0 2px 2px rgba(58, 0, 0, 0.35)); }
.elf-wd-why { position: absolute; z-index: 2; left: 2px; right: 2px; bottom: 6px; padding: 7px 8px 8px; color: var(--maroon); font-family: var(--elf-hand); font-weight: 700; font-size: 1.05rem; line-height: 1; background: url(/assets/img/elf/paper/ui/note-cream.svg) 0 0 / 100% 100% no-repeat; filter: drop-shadow(0 2px 2px rgba(94, 0, 0, 0.3)); opacity: 0; pointer-events: none; }
.elf-wd-tile.is-telling .elf-wd-why { opacity: 1; }
/* A present: the costume is wrapped up until it is picked. */
.elf-wd-present { position: absolute; inset: 4px; z-index: 1; display: grid; place-items: center; align-content: center; gap: 2px; }
.elf-wd-present img { width: 78%; max-width: 92px; height: auto; filter: drop-shadow(0 4px 3px rgba(94, 0, 0, 0.3)); }
.elf-wd-present span { color: var(--crimson); font-family: var(--elf-hand); font-weight: 700; font-size: 1.05rem; line-height: 1; }
.elf-wd-tile.is-new .elf-wd-art { visibility: hidden; }
.elf-wd-tile.is-opened .elf-wd-art { visibility: visible; }
.elf-wd-tile.is-opened .elf-wd-present { opacity: 0; pointer-events: none; }
/* Paper circles for the skin and hair colours; picked, the crimson mat shows under it. */
.elf-wd-tile--circle label { min-height: 0; padding: 4px 0 2px; filter: none; }
.elf-wd-tile--circle label::before { display: none; }
.elf-wd-tile--circle .elf-wd-art { width: min(100%, 50px); }
.elf-wd-tile--circle input:checked + label .elf-circle__mat { opacity: 1; }
.elf-wd-tile--circle input:checked + label::before { display: none; }
.elf-wd-tile--circle input:checked + label::after { top: -4px; left: auto; right: 0; width: 20px; height: 20px; background-size: 12px; }
.elf-wd-tile--circle input:checked + label { color: var(--crimson); }
.elf-wd-tile--circle .elf-wd-name { font-family: var(--elf-hand); font-size: 1.1rem; font-weight: 700; color: var(--holly-dark); }
.elf-wd-tile--circle input:checked + label .elf-wd-name { color: var(--crimson); }
/* A choice that is only words, on a torn paper button: crimson once it is picked. */
.elf-wd-tile--word label { align-content: center; min-height: 48px; padding: 9px 12px 11px; font-size: 0.92rem; filter: drop-shadow(0 2px 1px rgba(94, 0, 0, 0.22)); }
.elf-wd-tile--word label::before { background: url(/assets/img/elf/paper/ui/btn-m-cream.svg) 0 0 / 100% 100% no-repeat; -webkit-mask: none; mask: none; }
.elf-wd-tile--word label::after { content: ""; position: absolute; inset: 4px 1px -4px 2px; z-index: -2; background: url(/assets/img/elf/paper/ui/btn-m-tan.svg) 0 0 / 100% 100% no-repeat; }
.elf-wd-tile--word input:checked + label { color: var(--elf-on-dark); }
.elf-wd-tile--word input:checked + label::before { background: url(/assets/img/elf/paper/ui/btn-m-crimson.svg) 0 0 / 100% 100% no-repeat; }
.elf-wd-tile--word input:checked + label::after { top: 4px; left: 2px; width: auto; height: auto; border-radius: 0; inset: 4px 1px -4px 2px; background: url(/assets/img/elf/paper/ui/btn-m-maroon.svg) 0 0 / 100% 100% no-repeat; box-shadow: none; }
.elf-wd-group > .elf-wd-tile--word { max-width: 220px; margin-bottom: 16px; }

/* ---- on a phone, the round bubble that brings the elf back into view ---- */
.elf-wd-peek { position: fixed; z-index: 40; right: 14px; bottom: 18px; width: 62px; height: 62px; border: 0; border-radius: 50%; background: var(--card) url(/assets/img/elf/paper/icons/icon-costume.webp) center / 58% no-repeat; box-shadow: 0 0 0 4px var(--crimson), 0 8px 16px rgba(94, 0, 0, 0.35); opacity: 0; pointer-events: none; cursor: pointer; }
.elf-wd-peek.is-on { opacity: 1; pointer-events: auto; }
.elf-wd-peek:focus-visible { outline: 3px solid var(--gold-ink); outline-offset: 4px; }
.elf-wd-bursts { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.elf-wd-spark { position: fixed; width: var(--z); height: var(--z); margin: calc(var(--z) / -2) 0 0 calc(var(--z) / -2); color: var(--c); opacity: 0; }
.elf-wd-spark svg { display: block; width: 100%; height: 100%; fill: currentColor; }

/* In a narrow column (a phone, or beside the stage on a small laptop) the tags hang three over two, as
   mockup 6 has them on a phone: five in a row there leaves no room for their names. */
.elf-wd-step--dress { container-type: inline-size; }
@container (max-width: 640px) {
  .elf-wd-tabs { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px 10px; }
  .elf-wd-tabs li { grid-column: span 2; }
  .elf-wd-tabs li:nth-child(4) { grid-column: 2 / span 2; }
  .elf-wd-tabs li:nth-child(5) { grid-column: 4 / span 2; }
  .elf-wd-tabs li:nth-child(n + 4)::before { display: none; }
}
@media (min-width: 560px) {
  .elf-wd-tab__label { font-size: 0.82rem; }
  .elf-wd-tab__label img { width: 38px; height: 38px; }
}
@media (min-width: 900px) {
  /* Beside the choices the stage and its two tools stand alone in their column and stay in view, the
     stage no taller than the screen leaves room for (measured at 1366 by 657: a whole sticky plate put
     Snap a photo below the screen). The name plate and its photos head the choices instead: under the
     stage in its column they were hidden as the page scrolled (Jaimie, 8 November 2026). */
  form.elf-wd { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); grid-template-areas: "preview plate" "preview dress"; align-items: start; }
  .elf-wd-preview { grid-area: preview; align-self: stretch; }
  .elf-wd-stick { position: sticky; top: calc(var(--nav-h) + 16px); z-index: 2; }
  .elf-wd-plate { grid-area: plate; justify-self: start; margin-top: 0; }
  .elf-wd-dress { grid-area: dress; }
  .elf-wd-show { width: min(100%, 360px, calc((100vh - var(--nav-h) - 210px) * 0.6)); }
  .elf-wd-peek { display: none; }
}
/* A phone on its side has no height to spare: nothing stays put there. */
@media (max-height: 520px) {
  .elf-wd-stick { position: static; }
}

@media (prefers-reduced-motion: no-preference) {
  .elf-wd-glows span { animation: elf-bulb 2.8s ease-in-out var(--t) infinite alternate; }
  @keyframes elf-bulb { from { opacity: 0.25; transform: scale(0.85); } to { opacity: 1; transform: scale(1.1); } }
  .elf-wd-hang { animation: elf-sway 4.2s ease-in-out infinite alternate; }
  .elf-wd-hang--b { animation-duration: 3.6s; animation-delay: -1.2s; }
  @keyframes elf-sway { from { transform: rotate(-7deg); } to { transform: rotate(7deg); } }
  .elf-wd-say { transition: opacity 0.2s var(--elf-ease), transform 0.3s var(--elf-ease); }
  .elf-wd-stage.is-hop .elf-wd-pic[data-picture="body"] { animation: elf-hop 0.55s var(--elf-ease-expo); }
  @keyframes elf-hop { 35% { transform: translateY(-7%); } }
  .elf-wd-stage.is-wiggle .elf-wd-pic[data-picture="body"] { animation: elf-wiggle 0.6s var(--elf-ease); }
  @keyframes elf-wiggle { 30% { transform: rotate(-4deg); } 65% { transform: rotate(3deg); } }
  .elf-wd-snow .is-flurry { animation: elf-flurry var(--d) linear var(--delay) both; }
  @keyframes elf-flurry { to { transform: translate3d(var(--drift), 156cqw, 0); opacity: 0.3; } }
  .elf-wd-flash.is-on { animation: elf-flash 0.5s var(--elf-ease); }
  @keyframes elf-flash { 10% { opacity: 0.85; } }
  .elf-wd-seal.is-bump { animation: elf-bump 0.5s var(--elf-ease-expo); }
  @keyframes elf-bump { 40% { transform: rotate(8deg) scale(1.18); } }
  .elf-wd-fold { transition: grid-template-rows 0.45s var(--elf-ease); }
  .elf-wd-fold .elf-wd-fold__in { transition: visibility 0s linear 0.45s; }
  .elf-wd-fold:not(.is-folded) .elf-wd-fold__in { transition-delay: 0s; }
  .elf-wd-tab.is-swing { animation: elf-tag-swing 0.7s var(--elf-ease); }
  @keyframes elf-tag-swing { 25% { transform: translateY(5px) rotate(-6deg); } 60% { transform: translateY(5px) rotate(4deg); } }
  .elf-wd-tile label { transition: transform 0.15s var(--elf-ease); }
  .elf-wd-tile input:active + label { transform: scale(0.96); }
  .elf-wd-tile.is-pop label { animation: elf-pop 0.32s var(--elf-ease); }
  @keyframes elf-pop { 40% { transform: scale(1.06); } }
  .elf-wd-tile.is-rattled label { animation: elf-rattle 0.45s var(--elf-ease-expo); }
  .elf-wd-why { transition: opacity 0.2s var(--elf-ease); }
  .elf-wd-tile.is-wrapped .elf-wd-present img { animation: elf-wobble 2.4s ease-in-out infinite; }
  @keyframes elf-wobble { 0%, 70%, 100% { transform: rotate(0deg); } 78% { transform: rotate(-6deg); } 86% { transform: rotate(5deg); } 94% { transform: rotate(-3deg); } }
  .elf-wd-tile.is-opened .elf-wd-present { animation: elf-unwrap 0.6s var(--elf-ease) both; }
  @keyframes elf-unwrap { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(1.35) rotate(8deg); } }
  .elf-wd-spark { animation: elf-spark 0.85s var(--elf-ease) forwards; }
  @keyframes elf-spark { 0% { opacity: 1; transform: translate(0, 0) scale(0.4) rotate(0deg); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1) rotate(var(--r)); } }
  .elf-wd-peek { transition: opacity 0.25s var(--elf-ease); }
  .elf-wd-surprise.is-spinning img { animation: elf-spin 0.6s linear infinite; }
  @keyframes elf-spin { to { transform: rotate(360deg); } }
}

/* =================================================================
   THE POSTER PAGE: the word on the elf's tag, and the photo
   Used on a phone, standing in a shop: one narrow column, big
   targets, every card on a taped note. The loud thing is the gold
   card for whoever is first.
   ================================================================= */

.elf-poster-top { padding-bottom: clamp(14px, 2vw, 24px); }
.elf-poster { padding-bottom: clamp(48px, 7vw, 88px); }
.elf-poster > .wrap { display: grid; gap: 18px; justify-items: start; }
.elf-poster > .wrap > * { width: 100%; }
/* Its cards line up with the place's name above them, rather than standing in the middle. */
.elf-poster .elf-case.elf-note { margin: 12px 0 0; }

/* Where the answer to a form goes. Empty until there is one. */
.elf-result:empty { display: none; }
.elf-result:focus { outline: none; }
.elf-result { scroll-margin-top: calc(var(--nav-h) + 12px); }

/* Tick boxes for the family's detectives: each row a slip of paper that is a whole button to a thumb,
   holly once it is ticked. */
.elf-ticks { min-width: 0; margin: 0 0 18px; padding: 0; border: 0; }
.elf-ticks legend,
.elf-field > label { display: block; padding: 0; margin: 0 0 10px; font-family: var(--font-head); font-weight: 800; font-size: 1.2rem; line-height: 1.25; color: var(--maroon); }
.elf-ticks ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.elf-ticks li { position: relative; }
.elf-ticks input { position: absolute; z-index: 1; left: 14px; top: 50%; width: 20px; height: 20px; margin: -10px 0 0; padding: 0; accent-color: var(--holly); }
.elf-ticks label { position: relative; isolation: isolate; display: block; min-height: 48px; margin: 0; padding: 12px 14px 12px 46px; color: var(--slate); font-size: 1rem; font-weight: 400; cursor: pointer; overflow-wrap: break-word; }
.elf-ticks label::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--elf-grain-light) 0 0 / 384px, color-mix(in srgb, var(--tan) 18%, var(--card)); background-blend-mode: multiply; -webkit-mask: var(--elf-tear-fine-b); mask: var(--elf-tear-fine-b); filter: drop-shadow(0 1px 1px rgba(94, 0, 0, 0.2)); }
.elf-ticks input:checked + label { color: var(--holly-dark); font-weight: 600; }
.elf-ticks input:checked + label::before { background-color: var(--holly-soft); background-image: var(--elf-grain-light); }
.elf-ticks input:focus-visible { outline: none; }
.elf-ticks input:focus-visible + label { outline: 3px solid var(--holly); outline-offset: 2px; }

.elf-field { margin: 0 0 16px; }
.elf-case .elf-hint { margin: 7px 0 0; font-size: 0.9rem; color: var(--slate-soft); }
/* The secret word, set large and cut into the note: the staff may want to read it over a shoulder. */
.elf-field .elf-word__input {
  width: 100%; min-height: 54px; padding: 12px 14px; border: 0; border-radius: 6px; color: var(--slate); font: inherit; font-size: 1.3rem; letter-spacing: 0.06em; text-transform: uppercase;
  background-color: var(--card); background-image: var(--elf-grain-light); background-size: 384px; background-blend-mode: multiply;
  box-shadow: inset 0 2px 3px rgba(94, 0, 0, 0.2), inset 0 0 0 1.5px color-mix(in srgb, var(--maroon) 55%, transparent);
}
.elf-field .elf-word__input:focus-visible { outline: 3px solid var(--gold-ink); outline-offset: 2px; }
.elf-field input[type="file"] { padding: 10px; background: var(--white); font-size: 0.95rem; }
.elf-case .elf-form-status { min-height: 1.5em; margin: 12px 0; color: var(--holly-dark); }
.elf-case .elf-form-status:empty { min-height: 0; margin: 0 0 4px; }
.elf-case .elf-form-status.is-error { color: var(--crimson); }
.elf-word button[disabled],
.elf-photo-sheet__form button[disabled] { opacity: 0.6; cursor: progress; }

/* Who already has this place's candy cane, on a slip of holly paper. */
.elf-case .elf-word__have { position: relative; isolation: isolate; display: flex; align-items: baseline; gap: 8px; margin: 0 0 14px; padding: 10px 14px 11px; color: var(--holly-dark); }
.elf-case .elf-word__have::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--elf-grain-light) 0 0 / 384px, var(--holly-soft); background-blend-mode: multiply; -webkit-mask: var(--elf-tear-fine-a); mask: var(--elf-tear-fine-a); }
.elf-poster__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.elf-poster__links { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 4px 0 0; }

/* A word that counted: the door done. A card sheet on a holly sheet: the candy cane on a circle of
   paper, each detective's doors on a slip, the elves on the door, and the photo sheet taped beneath. */
.elf-visit { max-width: 760px; margin-right: 8px; padding: clamp(22px, 4vw, 34px) clamp(18px, 4vw, 30px) clamp(20px, 3vw, 28px); color: var(--slate); }
.elf-visit p { margin: 0 0 10px; }
.elf-visit h2 { margin: 10px 0 8px; font-size: clamp(1.8rem, 1.4rem + 2vw, 2.6rem); color: var(--holly-dark); text-wrap: balance; }
.elf-visit__cane { display: inline-grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; background-color: var(--card); background-image: var(--elf-grain-light); background-size: 384px; background-blend-mode: multiply; box-shadow: 0 2px 2px rgba(94, 0, 0, 0.2), 0 6px 8px rgba(94, 0, 0, 0.16); }
.elf-visit .elf-visit__from { color: var(--holly-dark); font-weight: 600; }
.elf-visit__who { list-style: none; margin: 12px 0 14px; padding: 0; display: grid; gap: 8px; }
.elf-visit__who li { position: relative; isolation: isolate; padding: 10px 14px 11px; overflow-wrap: break-word; }
.elf-visit__who li::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--elf-grain-light) 0 0 / 384px, color-mix(in srgb, var(--tan) 18%, var(--card)); background-blend-mode: multiply; -webkit-mask: var(--elf-tear-fine-b); mask: var(--elf-tear-fine-b); }
.elf-visit__up { color: var(--crimson); font-weight: 600; }
.elf-visit .elf-visit__door { color: var(--maroon); font-family: var(--elf-hand); font-weight: 700; font-size: 1.55rem; line-height: 1.1; }
.elf-visit__links { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; margin: 18px 0 0; }

/* The photo sheet: a note taped on, the grown up's yes on a slip of its own (unticked until they tick
   it), and the promise beside a sprig of holly. */
.elf-photo-sheet.elf-note { margin: 24px 0 6px; padding: 28px clamp(16px, 4vw, 26px) 18px; color: var(--slate); }
.elf-photo-sheet.elf-note::before { background: var(--elf-grain-light) 0 0 / 384px, var(--card); background-blend-mode: multiply; -webkit-mask: var(--elf-tear-card-c); mask: var(--elf-tear-card-c); }
.elf-photo-sheet h3 { margin: 0 0 6px; font-size: clamp(1.3rem, 1.15rem + 0.8vw, 1.6rem); color: var(--maroon); text-wrap: balance; }
.elf-photo-sheet p { margin: 0 0 12px; }
form.elf-photo-sheet__form { display: grid; gap: 14px; margin: 0; padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; }
.elf-photo-sheet__form .elf-field { margin: 0; }
.elf-photo-sheet__preview { justify-self: center; width: min(76%, 220px); transform: rotate(-1.4deg); }
.elf-photo-sheet__preview[hidden] { display: none; }
.elf-consent { position: relative; isolation: isolate; padding: 12px 14px 13px; }
.elf-consent::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--elf-grain-light) 0 0 / 384px, var(--card); background-blend-mode: multiply; -webkit-mask: var(--elf-tear-fine-a); mask: var(--elf-tear-fine-a); filter: drop-shadow(0 1px 1px rgba(94, 0, 0, 0.25)); }
.elf-consent label { display: grid; gap: 2px; margin: 0; padding-top: 1px; color: var(--slate-soft); font-size: 0.9rem; font-weight: 400; line-height: 1.4; }
.elf-consent label b { color: var(--maroon); font-size: 1rem; font-weight: 600; }
.elf-photo-sheet .elf-form-status { min-height: 0; margin: 0; color: var(--holly-dark); }
.elf-photo-sheet .elf-form-status.is-error { color: var(--crimson); }
.elf-photo-sheet .elf-photo-sheet__links { margin: 10px 0 0; text-align: center; }
.elf-photo-sheet .elf-photo-sheet__promise { position: relative; isolation: isolate; margin: 14px 0 0; padding: 12px 14px 12px 52px; color: var(--holly-dark); font-size: 0.86rem; line-height: 1.45; }
.elf-photo-sheet__promise::before { content: ""; position: absolute; left: 12px; top: 10px; width: 30px; height: 29px; background: url(/assets/img/elf/paper/deco/holly.webp) center / contain no-repeat; filter: drop-shadow(0 1px 1px rgba(58, 0, 0, 0.3)); }
.elf-photo-sheet__promise::after { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--elf-grain-light) 0 0 / 384px, var(--holly-soft); background-blend-mode: multiply; -webkit-mask: var(--elf-tear-fine-b); mask: var(--elf-tear-fine-b); }

/* The family's own photo for this door, with Take it down, and Send another, which opens the sheet
   again with no script. */
.elf-case .elf-your-photo__said { margin: 0 0 12px; }
.elf-case .elf-your-photo__said.is-ok { color: var(--holly-dark); font-weight: 600; }
.elf-case .elf-your-photo__actions { margin: 0 0 12px; }
.elf-your-photo__again > summary { list-style: none; cursor: pointer; }
.elf-your-photo__again > summary::-webkit-details-marker { display: none; }
/* An answer card brings its own way on, so the same links are not offered twice. */
.elf-result:not(:empty) ~ .elf-poster__links { display: none; }

/* "You're first!" Gold, because it is the one thing on this page the staff must not miss. */
.elf-win {
  position: relative;
  max-width: 760px;
  padding: clamp(22px, 5vw, 40px);
  border: 2px solid var(--elf-brass);
  border-radius: var(--radius-lg);
  background: linear-gradient(155deg, var(--elf-gold-pale) 0%, var(--elf-gold) 44%, var(--elf-gold-deep) 100%);
  box-shadow: inset 0 0 0 5px rgba(255, 253, 250, 0.55), var(--shadow);
  color: var(--elf-gold-ink);
  text-align: center;
  overflow: hidden;
}
.elf-win > * { position: relative; }
.elf-win p { margin: 0 0 10px; }
.elf-win h2 { margin: 6px 0 12px; font-size: clamp(2.6rem, 2rem + 4vw, 4.2rem); line-height: 1; color: var(--maroon); }
.elf-win__door { font-size: var(--fs-eyebrow); font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--elf-gold-ink-soft); }
.elf-win__who { font-size: 1.15rem; overflow-wrap: anywhere; }
.elf-win__badges { list-style: none; margin: 16px 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.elf-win__badges li { display: grid; justify-items: center; gap: 6px; min-width: 132px; padding: 12px; border-radius: 12px; background: var(--card); box-shadow: var(--shadow-sm); font-size: 0.9rem; line-height: 1.35; color: var(--slate); overflow-wrap: anywhere; }
.elf-win__badges img { width: 72px; height: auto; }
.elf-win__now b { display: block; font-family: var(--font-head); font-weight: 800; font-size: 1.7rem; line-height: 1.2; font-variant-numeric: lining-nums tabular-nums; }
.elf-win .elf-win__staff { max-width: 44ch; margin: 14px auto; padding: 12px 14px; border-radius: 12px; background: rgba(255, 253, 250, 0.72); }
.elf-win__links { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 22px; margin-top: 16px; }
.elf-win .elf-link { color: var(--elf-gold-ink); }

/* ---------- motion: only where something changes ---------- */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  /* A shut door, under the pointer, opens a crack. */
  .elf-door:not(.is-open):hover .elf-door__flap { transform: perspective(var(--elf-depth, 600px)) rotateY(-14deg); }
}
@media (prefers-reduced-motion: no-preference) {
  /* A door turns on its hinge. */
  .elf-door__flap { transition: transform 0.35s var(--elf-ease); }

  /* The board fills, a column at a time, when the page opens. */
  .elf-door { animation: elf-arrive 0.45s var(--elf-ease) backwards; }
  .elf-door:nth-of-type(6n + 2) { animation-delay: 40ms; }
  .elf-door:nth-of-type(6n + 3) { animation-delay: 80ms; }
  .elf-door:nth-of-type(6n + 4) { animation-delay: 120ms; }
  .elf-door:nth-of-type(6n + 5) { animation-delay: 160ms; }
  .elf-door:nth-of-type(6n + 6) { animation-delay: 200ms; }
  @keyframes elf-arrive { from { opacity: 0; transform: translateY(8px); } }

  /* A detail slides out from under its door. */
  .elf-detail.is-open,
  .elf-detail:target { animation: elf-drawer 0.28s var(--elf-ease); }
  @keyframes elf-drawer { from { opacity: 0; transform: translateY(-8px); } }

  /* A shut door, tapped: it rattles, and stays shut. */
  .elf-door.is-rattled { animation: elf-rattle 0.45s var(--elf-ease-expo); }
  @keyframes elf-rattle { 30% { transform: rotate(-2.5deg); } 60% { transform: rotate(2deg); } }

  /* An elf has just been found: its door swings open on its hinge, from shut. */
  .elf-door.is-opening .elf-door__flap { animation: elf-swing 0.9s var(--elf-ease-expo); }
  @keyframes elf-swing { from { transform: perspective(var(--elf-depth, 600px)) rotateY(0deg); } }

  /* Today's door glows, gently. */
  .elf-door--gold .elf-door__flap::after { animation: elf-glow 2.6s ease-in-out infinite; }
  @keyframes elf-glow { 50% { opacity: 0.35; } }

  /* The hunt is on: its chip breathes. */
  .elf-door--hunting .elf-door__chip { animation: elf-breathe 1.8s ease-in-out infinite; }
  @keyframes elf-breathe { 50% { opacity: 0.72; } }

  /* Something has arrived: the present's lid lifts when the page opens. */
  .elf-gift__lid { transform-box: fill-box; transform-origin: 12% 100%; animation: elf-lid 1.1s var(--elf-ease-expo) 0.4s backwards; }
  @keyframes elf-lid { 35% { transform: translateY(-3px) rotate(-16deg); } }

  /* First to the elf: the gold card arrives, and light fans out behind the words once. */
  .elf-win { animation: elf-first 0.6s var(--elf-ease-expo); }
  @keyframes elf-first { from { opacity: 0; transform: scale(0.9); } }
  .elf-win::before {
    content: "";
    position: absolute;
    inset: -70%;
    background: repeating-conic-gradient(from 0deg, rgba(255, 253, 250, 0.55) 0 7deg, transparent 7deg 20deg);
    opacity: 0;
    pointer-events: none;
    animation: elf-rays 1.8s var(--elf-ease) 0.15s;
  }
  @keyframes elf-rays {
    0% { opacity: 0; transform: rotate(0deg) scale(0.6); }
    25% { opacity: 0.9; }
    100% { opacity: 0; transform: rotate(38deg) scale(1.1); }
  }

  /* A candy cane lands like a rubber stamp. */
  .elf-visit__cane { animation: elf-stamp 0.5s var(--elf-ease-expo); }
  @keyframes elf-stamp { from { opacity: 0; transform: scale(1.7) rotate(-14deg); } }
}

/* ---------- the enrol page (src/elf/pages/join.ts), in paper ----------
   The form on a card sheet on a holly sheet, taped at the top; each detective, the payment and the
   gift on slips of paper; the boxes to write in cut into the card; tick boxes as squares of card. */
.elf-join-form { display: grid; gap: clamp(22px, 3vw, 32px); max-width: 720px; margin-right: 10px; padding: clamp(36px, 4vw, 48px) clamp(18px, 3.5vw, 36px) clamp(26px, 3vw, 34px); }
.elf-join-form fieldset { margin: 0; padding: 0; border: 0; min-width: 0; display: grid; gap: 14px; }
.elf-join-form legend { padding: 0; margin-bottom: 6px; }
/* The form's parts are named in handwriting, as its payment and gift are. */
.elf-join-you > legend,
.elf-join-detectives > legend { font-family: var(--elf-hand); font-weight: 700; font-size: clamp(1.9rem, 1.6rem + 1vw, 2.4rem); line-height: 1.05; color: var(--maroon); }
/* A page's title strip stands clear of the words under it. */
.elf-title + .lede,
.elf-title + .elf-sign-in,
.elf-title + .elf-sign-in__message { margin-top: 20px; }
.elf-page .page-top.elf-rules-top { padding-bottom: clamp(8px, 2vw, 18px); }
.elf-join-form .elf-field { display: grid; gap: 6px; }
.elf-join-form input[type="text"],
.elf-join-form input[type="email"],
.elf-join-form input[type="tel"],
.elf-join-form select,
.elf-sign-in input[type="text"],
.elf-sign-in input[type="email"] {
  width: 100%; min-height: 48px; padding: 10px 14px; border: 0; border-radius: 6px; color: var(--slate); font: inherit;
  background-color: var(--card); background-image: var(--elf-grain-light); background-size: 384px; background-blend-mode: multiply;
  /* The edge at maroon 55% on the card is about 3.5 to 1, so the box can be seen. */
  box-shadow: inset 0 2px 3px rgba(94, 0, 0, 0.2), inset 0 0 0 1.5px color-mix(in srgb, var(--maroon) 55%, transparent);
}
.elf-join-form input:focus-visible,
.elf-join-form select:focus-visible,
.elf-sign-in input:focus-visible { outline: 3px solid var(--gold-ink); outline-offset: 2px; }
.elf-join-detective { position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 14px; align-items: end; padding: 16px 16px 18px; }
.elf-join-detective::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--elf-grain-light) 0 0 / 384px, color-mix(in srgb, var(--tan) 24%, var(--card)); background-blend-mode: multiply; -webkit-mask: var(--elf-tear-fine-a); mask: var(--elf-tear-fine-a); }
.elf-join-detective:nth-child(even)::before { -webkit-mask: var(--elf-tear-fine-b); mask: var(--elf-tear-fine-b); }
.elf-join-detective[hidden] { display: none; }
.elf-join-detective__n { grid-column: 1 / -1; margin: 0; font-weight: 600; color: var(--maroon); }
.elf-join-detective .elf-field:last-child { grid-template-columns: minmax(0, 1fr) auto; }
.elf-join-detective .elf-field:last-child label { grid-column: 1 / -1; }
.elf-join-add { justify-self: start; }
/* The payment on a slip of gold paper, the gift on a slip of pink. */
.elf-join-pay,
.elf-join-gift { position: relative; isolation: isolate; display: grid; gap: 12px; padding: clamp(18px, 3vw, 26px); }
.elf-join-pay::before,
.elf-join-gift::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--elf-grain-light) 0 0 / 384px, var(--elf-slip, var(--elf-gold-soft)); background-blend-mode: multiply; -webkit-mask: var(--elf-tear-tile-a); mask: var(--elf-tear-tile-a); }
.elf-join-gift { --elf-slip: var(--elf-crimson-soft); }
.elf-join-gift::before { -webkit-mask: var(--elf-tear-tile-b); mask: var(--elf-tear-tile-b); }
.elf-join-pay p, .elf-join-gift p { margin: 0; }
.elf-join-pay h2, .elf-join-gift h2 { font-family: var(--elf-hand); font-weight: 700; font-size: clamp(1.9rem, 1.6rem + 1vw, 2.4rem); color: var(--maroon); line-height: 1.05; }
.elf-join-declaration[hidden] { display: none; }
.elf-declaration-words { font-size: .92rem; line-height: 1.55; }
/* A tick box: a little square of card, ticked in holly. Underneath it is still the page's own tick
   box, so it works, and reads, as one. */
.elf-tick { display: flex; gap: 12px; align-items: flex-start; margin: 0; }
.elf-tick input { -webkit-appearance: none; appearance: none; flex: none; width: 26px; height: 26px; margin: 0; border-radius: 4px; background-color: var(--card); background-image: var(--elf-grain-light); background-size: 384px; background-blend-mode: multiply; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--maroon) 55%, transparent), 0 2px 2px rgba(94, 0, 0, 0.2); transform: rotate(-2deg); cursor: pointer; }
.elf-tick input:checked { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.2 4.3L19 7' fill='none' stroke='%231A531A' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"), var(--elf-grain-light); background-size: 20px, 384px; background-position: center, 0 0; background-repeat: no-repeat, repeat; }
.elf-tick input:focus-visible { outline: 3px solid var(--gold-ink); outline-offset: 2px; }
.elf-tick label { padding-top: 2px; }
@media (forced-colors: active) {
  .elf-tick input { -webkit-appearance: auto; appearance: auto; }
}
.elf-hint { margin: 0; font-size: .9rem; color: var(--slate-soft); }
.elf-join-last { display: grid; gap: 14px; }
/* What to put right, on a torn pink note. The script draws the same box. Its news for an email that has
   already paid for detectives (a code has gone to it, TASK-614) goes on the same note. */
.elf-join-errors,
.elf-join-notice { position: relative; isolation: isolate; margin: 0 0 24px; padding: 18px 20px 16px; max-width: 720px; color: var(--maroon); }
.elf-join-notice p { margin: 0; }
.elf-join-errors::before,
.elf-join-notice::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--elf-grain-light) 0 0 / 384px, var(--elf-crimson-soft); background-blend-mode: multiply; -webkit-mask: var(--elf-tear-card-c); mask: var(--elf-tear-card-c); }
.elf-join-errors ul { margin: 8px 0 0; padding-left: 20px; }
.elf-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 520px) { .elf-join-detective { grid-template-columns: minmax(0, 1fr); } }

/* the handwriting of the gift tags and the paper, as /fill: Caveat (SIL Open Font License, beside the
   file in assets/fonts/caveat-OFL.txt), Latin subset, weights 400 to 700 in one file. */
@font-face {
  font-family: "Caveat"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/assets/fonts/caveat-latin.woff2) format("woff2");
}

/* The soft tints of /bag and /fill the paper slips use, a bright gold for the paper stars, and the
   handwriting. */
.elf-page {
  --elf-gold-bright: #E9C46A;
  --elf-gold-soft: #F6EBD3;
  --elf-crimson-soft: #F9E1E4;
  --elf-shine: rgba(255, 255, 255, .38);
  --elf-hand: "Caveat", "Bradley Hand", "Segoe Print", "Noteworthy", "Chalkboard SE", "Ink Free", "Comic Sans MS", cursive;
}

/* ---------- the present at the top of the enrol page (src/elf/pages/gift.ts) ----------
   The painted present, the school's elf peeking out from behind it over the bow, a paper gift tag and
   a paper rosette. The elf is cut at 54% of the logo (above the line under its hands, which sits at 59
   to 60%) inside an edge that never moves, and the present is laid over it, placed so the bow covers
   the cut however the elf bobs (from 3px down to 4px up; measured against the two pictures). */
.elf-join-top__grid { display: grid; gap: clamp(12px, 3vw, 32px); align-items: center; }
@media (min-width: 760px) { .elf-join-top__grid { grid-template-columns: minmax(0, 300px) minmax(0, 1fr); } }
.elf-gift { position: relative; width: min(300px, 78vw); margin: 0 auto; }
.elf-gift__art { position: relative; display: block; width: 100%; aspect-ratio: 300 / 370; transform-origin: 50% 100%; }
.elf-gift__edge { position: absolute; top: 0; left: 16.667%; width: 66.667%; aspect-ratio: 100 / 54; overflow: hidden; }
.elf-gift__peek { display: block; width: 100%; height: auto; clip-path: inset(0 0 46% 0); }
.elf-gift__box { position: absolute; left: 0; bottom: 0; width: 100%; height: auto; filter: var(--elf-drop); }
.elf-gift__tag { position: absolute; z-index: 2; left: -7%; top: 47%; width: 86px; transform: rotate(-14deg); transform-origin: 50% 8%; filter: drop-shadow(0 3px 0 rgba(94, 0, 0, 0.2)) drop-shadow(0 8px 8px rgba(90, 0, 0, 0.22)); }
.elf-gift__tag .elf-tag__card { display: block; width: 100%; height: auto; overflow: visible; }
.elf-gift__words { position: absolute; left: 8%; right: 8%; top: 36%; color: var(--maroon); font-family: var(--elf-hand); font-weight: 700; font-size: 1.3rem; line-height: 0.95; text-align: center; }
.elf-gift__seal { position: absolute; z-index: 2; right: -6%; top: 50%; display: grid; align-content: start; justify-items: center; width: 88px; height: 95px; padding-top: 25px; color: var(--elf-on-dark); text-align: center; font-family: var(--font-head); font-weight: 800; transform: rotate(9deg); filter: drop-shadow(0 6px 6px rgba(90, 0, 0, 0.25)); }
.elf-gift__rosette { position: absolute; inset: 0; width: 100%; height: 100%; }
.elf-gift__seal b { position: relative; display: block; font-size: 26px; line-height: .9; font-variant-numeric: lining-nums; }
.elf-gift__seal small { position: relative; display: block; font-family: var(--font-body); font-weight: 600; font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }

/* the gold band that passes across a main button now and then (Detective HQ, the wardrobe and the
   poster, until they are in paper). Only in the page itself: the footer's Sign up is the site's. */
.elf-page .site-main .btn-primary { position: relative; overflow: hidden; }
.elf-page .site-main .btn-primary::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, var(--elf-shine) 50%, transparent 65%);
  transform: translateX(-110%);
}

/* ---------- signing in and the welcome (src/elf/pages/sign-in.ts), in paper ---------- */
.elf-sign-in,
.elf-welcome { display: grid; gap: 14px; max-width: 560px; margin: clamp(18px, 3vw, 28px) 10px 0 0; padding: clamp(24px, 4vw, 34px) clamp(20px, 4vw, 32px); }
.elf-sign-in p,
.elf-welcome p { margin: 0; }
.elf-sign-in .elf-field { display: grid; gap: 6px; margin: 0; }
.elf-sign-in-top .wrap > .elf-hint { margin-top: 22px; }
/* What happened, on a note: green for done, pink for something to put right. */
.elf-sign-in__message { position: relative; isolation: isolate; max-width: 560px; margin: 14px 0 0; padding: 12px 16px 13px; font-weight: 600; }
.elf-sign-in__message::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--elf-grain-light) 0 0 / 384px, var(--holly-soft); background-blend-mode: multiply; -webkit-mask: var(--elf-tear-fine-a); mask: var(--elf-tear-fine-a); }
.elf-sign-in__message.is-ok { color: var(--holly-dark); }
.elf-sign-in__message.is-error { color: var(--maroon); }
.elf-sign-in__message.is-error::before { background-color: var(--elf-crimson-soft); background-image: var(--elf-grain-light); }
/* The painted presents in a heap, under the thanks. */
.elf-welcome__presents { display: flex; justify-content: center; align-items: flex-end; max-width: 560px; margin: clamp(10px, 2vw, 18px) 0 -22px; }
.elf-welcome__present { position: relative; width: clamp(86px, 22vw, 122px); height: auto; filter: var(--elf-drop); }
.elf-welcome__present:nth-child(1) { margin-right: -16px; transform: rotate(-9deg); }
.elf-welcome__present:nth-child(2) { z-index: 1; width: clamp(104px, 27vw, 146px); }
.elf-welcome__present:nth-child(3) { margin-left: -16px; transform: rotate(8deg); }
.elf-welcome { position: relative; z-index: 2; }
/* A fall of gold paper stars over the thanks. They lie still for anyone who asked for less motion. */
.elf-welcome-top .wrap { position: relative; }
.elf-stars { position: absolute; inset: -20px 0 auto; height: 260px; overflow: hidden; pointer-events: none; }
.elf-stars i { position: absolute; left: var(--x); top: var(--y); width: var(--s); height: var(--s); background-color: var(--elf-paper-gold); background-image: var(--elf-grain); background-size: 384px; background-blend-mode: soft-light; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); transform: rotate(var(--r)); }
.elf-stars i:nth-child(1) { --x: 3%; --y: 8%; --s: 22px; --r: -14deg; --d: 0s; }
.elf-stars i:nth-child(2) { --x: 14%; --y: 62%; --s: 14px; --r: 18deg; --d: 0.35s; }
.elf-stars i:nth-child(3) { --x: 26%; --y: 20%; --s: 18px; --r: 32deg; --d: 0.15s; }
.elf-stars i:nth-child(4) { --x: 38%; --y: 70%; --s: 12px; --r: -24deg; --d: 0.5s; }
.elf-stars i:nth-child(5) { --x: 47%; --y: 4%; --s: 16px; --r: 8deg; --d: 0.25s; }
.elf-stars i:nth-child(6) { --x: 57%; --y: 48%; --s: 20px; --r: -36deg; --d: 0.6s; }
.elf-stars i:nth-child(7) { --x: 66%; --y: 14%; --s: 13px; --r: 22deg; --d: 0.1s; }
.elf-stars i:nth-child(8) { --x: 74%; --y: 66%; --s: 17px; --r: -8deg; --d: 0.45s; }
.elf-stars i:nth-child(9) { --x: 82%; --y: 26%; --s: 24px; --r: 14deg; --d: 0.3s; }
.elf-stars i:nth-child(10) { --x: 90%; --y: 58%; --s: 12px; --r: -30deg; --d: 0.7s; }
.elf-stars i:nth-child(11) { --x: 95%; --y: 6%; --s: 15px; --r: 40deg; --d: 0.2s; }
.elf-stars i:nth-child(12) { --x: 8%; --y: 36%; --s: 11px; --r: 4deg; --d: 0.55s; }

/* ---------- the rules (src/elf/pages/rules.ts), in paper ----------
   One sheet torn off a pad and taped up; each part's heading on a torn strip; each rule marked with a
   small circle of paper. */
.elf-page .section.elf-rules-body { padding-top: clamp(14px, 2vw, 24px); }
.elf-rules-sheet { max-width: 820px; padding: clamp(40px, 5vw, 56px) clamp(18px, 4vw, 40px) clamp(28px, 4vw, 40px) clamp(40px, 6vw, 64px); }
.elf-rules-part + .elf-rules-part { margin-top: clamp(26px, 4vw, 38px); }
.elf-rules-part .elf-strip { font-size: clamp(1.35rem, 1.2rem + 0.8vw, 1.75rem); }
.elf-rules-part p { max-width: 64ch; }
.elf-rules-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; max-width: 64ch; }
.elf-rules-list li { position: relative; padding-left: 30px; }
.elf-rules-list li::before { content: ""; position: absolute; left: 2px; top: 0.42em; width: 14px; height: 14px; border-radius: 50%; background-color: var(--crimson); background-image: var(--elf-grain); background-size: 384px; background-blend-mode: soft-light; box-shadow: 0 1.5px 1px rgba(94, 0, 0, 0.3), inset 0 0 0 2px color-mix(in srgb, var(--card) 70%, transparent); }
.elf-rules-list li:nth-child(even)::before { background-color: var(--holly); }

@media (prefers-reduced-motion: no-preference) {
  .elf-gift__art { animation: elf-drop 1.25s var(--elf-ease) .1s both; }
  .elf-gift__peek { animation: elf-peek 4.6s var(--elf-ease) 1.3s infinite; }
  .elf-gift__tag { animation: elf-swing-in 1s var(--elf-ease) 1.3s both; }
  .elf-gift__seal { animation: elf-swing-in .9s var(--elf-ease) 1.1s both; }
  .elf-page .site-main .btn-primary::after { animation: elf-shimmer 4s var(--elf-ease) 1.6s infinite; }
  .elf-stars i { animation: elf-fall 1.5s var(--elf-ease) var(--d) both; }
  .elf-tick input { transition: transform 0.15s var(--elf-ease); }
  .elf-tick input:checked { transform: rotate(-2deg) scale(1.06); }

  @keyframes elf-drop {
    0% { opacity: 0; transform: translateY(-130px) rotate(-5deg); }
    36% { opacity: 1; transform: translateY(0) scale(1.05, .93) rotate(0); }
    52% { transform: translateY(-16px) scale(.98, 1.03) rotate(2deg); }
    68% { transform: translateY(0) scale(1.02, .98) rotate(-1.5deg); }
    100% { opacity: 1; transform: none; }
  }
  @keyframes elf-peek { 0%, 100% { transform: translateY(3px); } 30%, 70% { transform: translateY(-4px); } }
  @keyframes elf-swing-in { 0% { opacity: 0; transform: rotate(-40deg) scale(.5); } 55% { opacity: 1; transform: rotate(18deg) scale(1.06); } 100% { opacity: 1; } }
  @keyframes elf-shimmer { 0% { transform: translateX(-110%); } 40%, 100% { transform: translateX(110%); } }
  @keyframes elf-fall { from { opacity: 0; transform: translateY(-160px) rotate(-140deg); } }
}

/* The enrol form follows its top section closely: one page, not two. */
.elf-page .section.elf-join-body { padding-top: clamp(8px, 2vw, 16px); }
.elf-join-top .elf-gift { margin-top: clamp(12px, 3vw, 24px); }
.elf-page .page-top.elf-join-top { padding-bottom: clamp(8px, 2vw, 16px); }

/* The private preview (Jaimie, 3 November 2026): every page says so across the top. */
/* It sits straight under the banner (which stays fixed at the top), above Elf Detective School's
   strip, and the strip moves down after it. */
.elf-preview-strip { position: relative; z-index: 3; margin: var(--nav-h) 0 0; padding: 10px 16px; background: var(--maroon); color: var(--cream); font-size: .9rem; text-align: center; }
.elf-preview-strip + .elf-bar { margin-top: 0; }

/* =================================================================
   The paper look (docs/superpowers/specs/2026-11-04-elf-paper-design.md; mockup 6, approved by Jaimie
   on 4 November 2026: "Yes, this is it"). Everything looks cut from coloured card: torn edges that
   show the white core of the tear, sheets laid on sheets, a soft shadow under each layer, the light
   from the top left so every shadow falls down the page. The torn shapes are files drawn by
   scripts/elf-paper/shapes.mjs (assets/img/elf/paper/ui/, sizes in its shapes.json); the pieces with
   words or the page's colours are drawn by src/elf/pages/paper.ts.
   ================================================================= */
.elf-page {
  --elf-grain: url(/assets/img/elf/paper/ui/grain.webp);
  --elf-grain-light: url(/assets/img/elf/paper/ui/grain-light.webp);
  /* The paper's own gold (mockup 6), and the inks that read on tan and on gold. */
  --elf-paper-gold: #D9A93E;
  --elf-maroon-deep: #5E0000;
  --elf-ink-on-tan: #4A0F0F;
  --elf-on-dark: #FFF8EF;
  --elf-edge: color-mix(in srgb, var(--tan) 30%, var(--cream));
  --elf-edge-dark: color-mix(in srgb, var(--tan) 58%, var(--cream));
  --elf-drop-small: drop-shadow(0 2px 1px rgba(94, 0, 0, 0.24)) drop-shadow(0 5px 5px rgba(94, 0, 0, 0.16));
  --elf-drop: drop-shadow(0 2px 1.5px rgba(94, 0, 0, 0.22)) drop-shadow(0 10px 12px rgba(94, 0, 0, 0.22));
  --elf-drop-big: drop-shadow(0 3px 2px rgba(94, 0, 0, 0.2)) drop-shadow(0 18px 20px rgba(94, 0, 0, 0.26));
  /* Masks that tear all four edges of a box of any size: a torn strip repeated along each side, the
     middle filled in. Each side's strip is a different length, so no two sides line up. */
  --elf-tear-card-a: url(/assets/img/elf/paper/ui/tear-card-a-top.svg) left top / 263px 12px repeat-x, url(/assets/img/elf/paper/ui/tear-card-a-bottom.svg) left bottom / 241px 12px repeat-x, url(/assets/img/elf/paper/ui/tear-card-a-left.svg) left top / 12px 227px repeat-y, url(/assets/img/elf/paper/ui/tear-card-a-right.svg) right top / 12px 251px repeat-y, linear-gradient(#000 0 0) center / calc(100% - 22px) calc(100% - 22px) no-repeat;
  --elf-tear-card-b: url(/assets/img/elf/paper/ui/tear-card-b-top.svg) left top / 251px 12px repeat-x, url(/assets/img/elf/paper/ui/tear-card-b-bottom.svg) left bottom / 233px 12px repeat-x, url(/assets/img/elf/paper/ui/tear-card-b-left.svg) left top / 12px 239px repeat-y, url(/assets/img/elf/paper/ui/tear-card-b-right.svg) right top / 12px 229px repeat-y, linear-gradient(#000 0 0) center / calc(100% - 22px) calc(100% - 22px) no-repeat;
  --elf-tear-card-c: url(/assets/img/elf/paper/ui/tear-card-c-top.svg) left top / 241px 11px repeat-x, url(/assets/img/elf/paper/ui/tear-card-c-bottom.svg) left bottom / 257px 11px repeat-x, url(/assets/img/elf/paper/ui/tear-card-c-left.svg) left top / 11px 233px repeat-y, url(/assets/img/elf/paper/ui/tear-card-c-right.svg) right top / 11px 247px repeat-y, linear-gradient(#000 0 0) center / calc(100% - 20px) calc(100% - 20px) no-repeat;
  --elf-tear-tile-a: url(/assets/img/elf/paper/ui/tear-tile-a-top.svg) left top / 173px 8px repeat-x, url(/assets/img/elf/paper/ui/tear-tile-a-bottom.svg) left bottom / 191px 8px repeat-x, url(/assets/img/elf/paper/ui/tear-tile-a-left.svg) left top / 8px 157px repeat-y, url(/assets/img/elf/paper/ui/tear-tile-a-right.svg) right top / 8px 181px repeat-y, linear-gradient(#000 0 0) center / calc(100% - 14px) calc(100% - 14px) no-repeat;
  --elf-tear-tile-b: url(/assets/img/elf/paper/ui/tear-tile-b-top.svg) left top / 181px 8px repeat-x, url(/assets/img/elf/paper/ui/tear-tile-b-bottom.svg) left bottom / 167px 8px repeat-x, url(/assets/img/elf/paper/ui/tear-tile-b-left.svg) left top / 8px 163px repeat-y, url(/assets/img/elf/paper/ui/tear-tile-b-right.svg) right top / 8px 177px repeat-y, linear-gradient(#000 0 0) center / calc(100% - 14px) calc(100% - 14px) no-repeat;
  --elf-tear-fine-a: url(/assets/img/elf/paper/ui/tear-fine-a-top.svg) left top / 131px 6px repeat-x, url(/assets/img/elf/paper/ui/tear-fine-a-bottom.svg) left bottom / 149px 6px repeat-x, url(/assets/img/elf/paper/ui/tear-fine-a-left.svg) left top / 6px 127px repeat-y, url(/assets/img/elf/paper/ui/tear-fine-a-right.svg) right top / 6px 139px repeat-y, linear-gradient(#000 0 0) center / calc(100% - 10px) calc(100% - 10px) no-repeat;
  --elf-tear-fine-b: url(/assets/img/elf/paper/ui/tear-fine-b-top.svg) left top / 139px 6px repeat-x, url(/assets/img/elf/paper/ui/tear-fine-b-bottom.svg) left bottom / 127px 6px repeat-x, url(/assets/img/elf/paper/ui/tear-fine-b-left.svg) left top / 6px 143px repeat-y, url(/assets/img/elf/paper/ui/tear-fine-b-right.svg) right top / 6px 133px repeat-y, linear-gradient(#000 0 0) center / calc(100% - 10px) calc(100% - 10px) no-repeat;
  /* Only the top edge torn, as a sheet torn off a pad. */
  --elf-tear-top: url(/assets/img/elf/paper/ui/tear-top.svg) left top / 233px 14px repeat-x, linear-gradient(#000 0 0) left 13px / 100% calc(100% - 13px) no-repeat;

  /* The page itself: cream with a fine paper grain all over. */
  background-color: var(--cream);
  background-image: var(--elf-grain-light);
  background-size: 384px;
  background-repeat: repeat;
  background-blend-mode: multiply;
}
/* Paper that hangs over the edge of the screen (a holly sprig, a scrap) is cut there, never widening it. */
.elf-page .site-main { position: relative; z-index: 1; overflow-x: clip; }
/* A page's top section starts below the torn bands, whether or not it is also a .section (whose own
   spacing would otherwise leave room for the banner again: Elf Detective School's strip already sits
   below the banner, so the page starts below the strip). */
.elf-page .page-top { padding-top: calc(40px + clamp(14px, 3vw, 40px)); }
/* The footer is the site's own, looking as it does on every page: it only sits above the paper sky. */
.elf-page .site-footer { position: relative; z-index: 1; }
.elf-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* The colours of the pieces drawn into the page. */
.elf-fill-crimson { fill: var(--crimson); }
.elf-fill-holly { fill: var(--holly); }
.elf-fill-gold { fill: var(--elf-paper-gold); }
.elf-fill-tan { fill: var(--tan); }
.elf-fill-maroon { fill: var(--maroon); }

/* The torn bands under Elf Detective School's strip: holly over crimson, cut to the screen's width.
   Their holly runs on from the strip's, so the two read as one sheet with a torn edge. */
.elf-bands { position: absolute; left: 0; right: 0; top: 0; z-index: 2; height: 40px; pointer-events: none; filter: drop-shadow(0 4px 3px rgba(94, 0, 0, 0.22)); }
.elf-bands svg { display: block; width: 100%; height: 100%; }

/* The cut paper hills, as wide as the screen and in proportion, running into the footer. */
/* Exactly the screen's width: on a phone the least height keeps the hills tall and the picture is cut
   to its middle, rather than the least height widening the page past the screen. */
.elf-hills { position: relative; z-index: 1; width: 100%; aspect-ratio: 1600 / 260; min-height: 130px; margin: -18px 0 -2px; overflow: hidden; pointer-events: none; }
.elf-hills svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.elf-hills__grain { mix-blend-mode: soft-light; }

/* A few paper stars and snowflakes behind the page. Still for anyone who asked for less motion. They
   fall from under the site's banner, never behind it, so the banner looks as it does on every page. */
.elf-sky { position: fixed; inset: var(--nav-h) 0 0; z-index: 0; overflow: hidden; pointer-events: none; }
.elf-sky i { position: absolute; top: var(--y); left: var(--x); width: var(--s); height: var(--s); border-radius: 50%; background: var(--tan); opacity: 0.38; }
.elf-sky .elf-sky__star { border-radius: 0; background: var(--elf-gold-bright); opacity: 0.7; clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); }
.elf-sky i:nth-child(1) { --x: 0.0%; --y: 44.7%; --s: 10.9px; --d: 14.5s; --delay: -20.7s; --drift: -6px; }
.elf-sky i:nth-child(2) { --x: 51.7%; --y: 46.8%; --s: 6.4px; --d: 17.4s; --delay: -5.2s; --drift: 15px; }
.elf-sky i:nth-child(3) { --x: 14.1%; --y: 38.0%; --s: 6.9px; --d: 23.9s; --delay: -9.2s; --drift: -29px; }
.elf-sky i:nth-child(4) { --x: 21.8%; --y: 73.5%; --s: 7.0px; --d: 20.7s; --delay: -11.5s; --drift: -19px; }
.elf-sky i:nth-child(5) { --x: 30.8%; --y: 79.6%; --s: 9.1px; --d: 16.3s; --delay: -13.8s; --drift: 15px; }
.elf-sky i:nth-child(6) { --x: 1.4%; --y: 38.4%; --s: 8.4px; --d: 20.3s; --delay: -2.3s; --drift: 8px; }
.elf-sky i:nth-child(7) { --x: 95.9%; --y: 32.1%; --s: 8.5px; --d: 14.2s; --delay: -17.2s; --drift: 22px; }
.elf-sky i:nth-child(8) { --x: 94.9%; --y: 28.7%; --s: 4.8px; --d: 23.6s; --delay: -22.8s; --drift: 16px; }
.elf-sky i:nth-child(9) { --x: 97.0%; --y: 80.1%; --s: 11.6px; --d: 17.1s; --delay: -14.8s; --drift: -33px; }
.elf-sky i:nth-child(10) { --x: 95.2%; --y: 83.2%; --s: 5.8px; --d: 24.5s; --delay: -0.4s; --drift: 12px; }
.elf-sky i:nth-child(11) { --x: 95.1%; --y: 55.0%; --s: 7.4px; --d: 20.1s; --delay: -20.5s; --drift: -5px; }
.elf-sky i:nth-child(12) { --x: 92.8%; --y: 96.8%; --s: 6.1px; --d: 23.7s; --delay: -12.2s; --drift: -19px; }
.elf-sky i:nth-child(13) { --x: 4.8%; --y: 5.2%; --s: 14.0px; --d: 15.3s; --delay: -8.4s; --drift: 4px; }
.elf-sky i:nth-child(14) { --x: 37.7%; --y: 47.2%; --s: 4.5px; --d: 18.5s; --delay: -4.2s; --drift: 5px; }
.elf-sky i:nth-child(15) { --x: 55.1%; --y: 92.5%; --s: 4.5px; --d: 25.8s; --delay: -23.9s; --drift: 19px; }
.elf-sky i:nth-child(16) { --x: 56.5%; --y: 37.0%; --s: 8.3px; --d: 21.8s; --delay: -12.1s; --drift: -14px; }
.elf-sky i:nth-child(17) { --x: 53.3%; --y: 25.7%; --s: 14.8px; --d: 20.8s; --delay: -21.8s; --drift: -25px; }
.elf-sky i:nth-child(18) { --x: 15.9%; --y: 96.2%; --s: 7.5px; --d: 17.5s; --delay: -19.8s; --drift: -10px; }

/* The painted paper decorations: presents, holly, candy cane, bauble, gold bow. */
.elf-deco { position: absolute; z-index: 2; display: block; height: auto; pointer-events: none; filter: drop-shadow(0 3px 0 rgba(94, 0, 0, 0.16)) drop-shadow(0 8px 7px rgba(94, 0, 0, 0.22)); }

/* A page's title: a torn strip of card on a torn strip of colour, scraps behind, cane and holly. */
.elf-title { position: relative; display: inline-block; max-width: 100%; margin: 14px auto 6px; padding: 20px clamp(26px, 6vw, 46px); isolation: isolate; }
.elf-title > svg { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; overflow: visible; }
.elf-title__back { transform: rotate(-2.4deg) scale(1.02, 1.08); filter: drop-shadow(0 6px 6px rgba(94, 0, 0, 0.25)); }
.elf-title__front { transform: rotate(0.8deg); filter: drop-shadow(0 3px 0 var(--elf-edge-dark)) drop-shadow(0 10px 10px rgba(94, 0, 0, 0.22)); }
.elf-title__text { position: relative; margin: 0; color: var(--crimson); font-family: var(--font-head); font-size: clamp(2.3rem, 1.7rem + 3.4vw, 4rem); line-height: 1.05; text-shadow: 0 1.5px 0 var(--elf-maroon-deep), 0 6px 9px rgba(94, 0, 0, 0.22); text-wrap: balance; overflow-wrap: anywhere; }
.elf-title .elf-deco--cane { left: -20px; bottom: -18px; width: clamp(42px, 7vw, 60px); transform: rotate(-14deg); transform-origin: 50% 100%; }
.elf-title .elf-deco--holly { right: -50px; top: -38px; width: clamp(56px, 10vw, 88px); transform: rotate(16deg); }
.elf-title .elf-scrap--title-a { left: -6%; bottom: -16px; width: 120px; height: 56px; transform: rotate(-8deg); }
.elf-title .elf-scrap--title-b { right: 14%; top: -20px; width: 110px; height: 50px; transform: rotate(6deg); }
@media (max-width: 600px) {
  .elf-title .elf-deco--cane { left: -8px; bottom: -16px; }
  .elf-title .elf-deco--holly { right: -8px; top: -28px; }
  .elf-title .elf-scrap--title-a { left: 2%; width: 90px; }
  .elf-title .elf-scrap--title-b { right: 18%; width: 84px; }
}

/* The small line above a title ("Elf Detective School") on a torn holly label, tucked over the title. */
.elf-label { position: relative; z-index: 3; isolation: isolate; display: flex; width: fit-content; margin: 0 auto -12px; padding: 8px 20px 10px; color: var(--elf-on-dark); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; transform: rotate(-2.5deg); filter: var(--elf-drop-small); }
.elf-label::before { content: ""; position: absolute; inset: 0; z-index: -1; background: url(/assets/img/elf/paper/ui/label-holly.svg) 0 0 / 100% 100% no-repeat; }

/* A section's heading on a smaller torn strip, laid the same way. */
.elf-strip { position: relative; display: inline-block; max-width: 100%; margin: 6px 0 18px; padding: 10px 28px 13px; isolation: isolate; color: var(--maroon); }
.elf-strip > svg { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; overflow: visible; }
.elf-strip__back { transform: rotate(-2deg) scale(1.03, 1.14); filter: drop-shadow(0 4px 4px rgba(94, 0, 0, 0.25)); }
.elf-strip__front { transform: rotate(0.9deg); filter: drop-shadow(0 2px 0 var(--elf-edge-dark)) drop-shadow(0 7px 7px rgba(94, 0, 0, 0.2)); }
.elf-strip__text { position: relative; }
.elf-strip__colour { fill: var(--elf-strip-back, var(--holly)); }
.elf-strip__card { fill: var(--card); }
.elf-strip--crimson { --elf-strip-back: var(--crimson); }
.elf-strip--holly { --elf-strip-back: var(--holly); }
.elf-strip--gold { --elf-strip-back: var(--elf-paper-gold); }
.elf-strip--tan { --elf-strip-back: var(--tan); }

/* A scrap of torn coloured paper, tucked behind something; where it sits is the page's business. */
.elf-scrap { position: absolute; z-index: -1; display: block; pointer-events: none; filter: drop-shadow(0 2px 1px rgba(94, 0, 0, 0.22)) drop-shadow(0 6px 6px rgba(94, 0, 0, 0.16)); }
.elf-scrap svg { display: block; width: 100%; height: 100%; overflow: visible; }
.elf-scrap--s { width: 84px; height: 46px; }
.elf-scrap--m { width: 110px; height: 58px; }

/* A card sheet: a torn sheet of card on a torn coloured backing sheet, with a shadow under both. */
.elf-card { position: relative; isolation: isolate; filter: var(--elf-drop-big); }
.elf-card::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 16px; background-color: var(--elf-card-face, var(--card)); background-image: var(--elf-grain-light); background-size: 384px; background-blend-mode: multiply; -webkit-mask: var(--elf-tear-card-a); mask: var(--elf-tear-card-a); transform: rotate(var(--elf-tilt, 0deg)); pointer-events: none; }
.elf-card::after { content: ""; position: absolute; inset: 8px -7px -8px 7px; z-index: -2; border-radius: 16px; background-color: var(--elf-layer, var(--tan)); background-image: var(--elf-grain); background-size: 384px; background-blend-mode: soft-light; -webkit-mask: var(--elf-tear-card-b); mask: var(--elf-tear-card-b); transform: rotate(var(--elf-layer-tilt, 1.4deg)); pointer-events: none; }
.elf-card--crimson { --elf-layer: var(--crimson); }
.elf-card--holly { --elf-layer: var(--holly); --elf-layer-tilt: -1.3deg; }
.elf-card--gold { --elf-layer: var(--elf-paper-gold); }
.elf-card--tan { --elf-layer: var(--tan); --elf-layer-tilt: -1.5deg; }

/* A torn button: torn paper standing on its own darker torn edge; pressed, it goes down onto it. */
.elf-btn { position: relative; isolation: isolate; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 26px 12px; border: 0; background: none; color: var(--maroon); font: 600 1rem/1.2 var(--font-body); text-align: center; text-decoration: none; cursor: pointer; filter: var(--elf-drop-small); -webkit-tap-highlight-color: transparent; --elf-btn-face: url(/assets/img/elf/paper/ui/btn-m-cream.svg); --elf-btn-edge: url(/assets/img/elf/paper/ui/btn-m-tan.svg); }
.elf-btn::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--elf-btn-face) 0 0 / 100% 100% no-repeat; }
.elf-btn::after { content: ""; position: absolute; inset: 4px 1px -4px 2px; z-index: -2; background: var(--elf-btn-edge) 0 0 / 100% 100% no-repeat; }
.elf-btn--s { --elf-btn-face: url(/assets/img/elf/paper/ui/btn-s-cream.svg); --elf-btn-edge: url(/assets/img/elf/paper/ui/btn-s-tan.svg); min-height: 44px; padding: 8px 20px 10px; font-size: 0.95rem; }
.elf-btn--l { --elf-btn-face: url(/assets/img/elf/paper/ui/btn-l-cream.svg); --elf-btn-edge: url(/assets/img/elf/paper/ui/btn-l-tan.svg); min-height: 56px; padding: 12px 32px 14px; font-size: 1.08rem; }
.elf-btn--crimson { --elf-btn-face: url(/assets/img/elf/paper/ui/btn-m-crimson.svg); --elf-btn-edge: url(/assets/img/elf/paper/ui/btn-m-maroon.svg); color: var(--elf-on-dark); }
.elf-btn--crimson.elf-btn--s { --elf-btn-face: url(/assets/img/elf/paper/ui/btn-s-crimson.svg); --elf-btn-edge: url(/assets/img/elf/paper/ui/btn-s-maroon.svg); }
.elf-btn--crimson.elf-btn--l { --elf-btn-face: url(/assets/img/elf/paper/ui/btn-l-crimson.svg); --elf-btn-edge: url(/assets/img/elf/paper/ui/btn-l-maroon.svg); }
.elf-btn--holly { --elf-btn-face: url(/assets/img/elf/paper/ui/btn-m-holly.svg); --elf-btn-edge: url(/assets/img/elf/paper/ui/btn-m-hollydark.svg); color: var(--elf-on-dark); }
.elf-btn--holly.elf-btn--s { --elf-btn-face: url(/assets/img/elf/paper/ui/btn-s-holly.svg); --elf-btn-edge: url(/assets/img/elf/paper/ui/btn-s-hollydark.svg); }
.elf-btn--holly.elf-btn--l { --elf-btn-face: url(/assets/img/elf/paper/ui/btn-l-holly.svg); --elf-btn-edge: url(/assets/img/elf/paper/ui/btn-l-hollydark.svg); }
.elf-btn--cream { color: var(--maroon); }
.elf-btn--cane { --elf-btn-face: url(/assets/img/elf/paper/ui/btn-m-cream.svg); --elf-btn-edge: url(/assets/img/elf/paper/ui/btn-m-cane.svg); color: var(--maroon); }
.elf-btn--cane::after { inset: -6px -9px -8px -8px; transform: rotate(-2.5deg); }
.elf-btn:hover { transform: translateY(-1px); }
.elf-btn:hover::after { transform: translateY(1px); }
.elf-btn--cane:hover::after { transform: rotate(-2.5deg) translateY(1px); }
.elf-btn:active { transform: translateY(3px); filter: drop-shadow(0 1px 1px rgba(94, 0, 0, 0.28)); }
.elf-btn:active::after { transform: translateY(-3px); }
.elf-btn--cane:active::after { transform: rotate(-2.5deg) translateY(-3px); }
.elf-btn:focus-visible { outline: 3px solid var(--gold-ink); outline-offset: 5px; }
.elf-btn[hidden] { display: none; }

/* A chip: a small torn label (Done, Today, Missed, a date, Two presents). */
.elf-chip { position: relative; isolation: isolate; display: inline-flex; align-items: center; gap: 4px; padding: 5px 14px 7px; color: var(--slate); font-size: 0.8rem; font-weight: 600; line-height: 1.2; white-space: nowrap; filter: var(--elf-drop-small); transform: rotate(var(--elf-chip-tilt, -2deg)); }
.elf-chip::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--elf-chip-face, url(/assets/img/elf/paper/ui/chip-cream.svg)) 0 0 / 100% 100% no-repeat; }
.elf-chip--done { --elf-chip-face: url(/assets/img/elf/paper/ui/chip-holly.svg); color: var(--elf-on-dark); }
.elf-chip--missed { --elf-chip-face: url(/assets/img/elf/paper/ui/chip-tan.svg); color: var(--elf-ink-on-tan); }
.elf-chip--today { --elf-chip-face: url(/assets/img/elf/paper/ui/chip-gold.svg); color: var(--elf-maroon-deep); }
.elf-chip--soon { --elf-chip-face: url(/assets/img/elf/paper/ui/chip-cream.svg); color: var(--slate); }
.elf-chip--new { --elf-chip-face: url(/assets/img/elf/paper/ui/chip-crimson.svg); color: var(--elf-on-dark); }

/* A note: torn cream or kraft paper, most with a strip of tape across the top. */
.elf-note { position: relative; isolation: isolate; padding: 18px 22px 14px; color: var(--maroon); filter: var(--elf-drop-small); }
.elf-note::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--elf-note-face, url(/assets/img/elf/paper/ui/note-cream.svg)) 0 0 / 100% 100% no-repeat; }
.elf-note--kraft { --elf-note-face: url(/assets/img/elf/paper/ui/note-kraft.svg); }
.elf-note--holly { --elf-note-face: url(/assets/img/elf/paper/ui/note-holly.svg); color: var(--elf-on-dark); }
.elf-tape { position: absolute; left: 50%; top: -10px; z-index: 1; display: block; width: 66px; height: 20px; margin-left: -33px; background: url(/assets/img/elf/paper/ui/tape.svg) 0 0 / 100% 100% no-repeat; transform: rotate(-3deg); pointer-events: none; }

/* A sheet torn off a notepad: torn along its top, a red margin line down its left. */
.elf-paper { position: relative; isolation: isolate; padding: 34px 18px 24px 38px; filter: var(--elf-drop); }
.elf-paper::after { content: ""; position: absolute; inset: 0; z-index: -2; background-color: var(--card); background-image: var(--elf-grain-light); background-size: 384px; background-blend-mode: multiply; -webkit-mask: var(--elf-tear-top); mask: var(--elf-tear-top); }
.elf-paper::before { content: ""; position: absolute; top: 14px; bottom: 0; left: 20px; z-index: -1; width: 1px; background: color-mix(in srgb, var(--crimson) 45%, transparent); }

/* A paper rosette, for a number or a count. Its colours can be set by what holds it. */
.elf-rosette { display: block; overflow: visible; }
.elf-rosette__under { fill: var(--elf-rosette-under, var(--maroon)); }
.elf-rosette__ring { fill: var(--elf-rosette-ring, var(--elf-paper-gold)); }
.elf-rosette__disc { fill: var(--elf-rosette-disc, var(--crimson)); }

/* A gift tag: two sheets, the stitched line, the eyelet and the paper grain. */
.elf-tag__card { display: block; width: 100%; height: auto; overflow: visible; }
.elf-tag__fill { fill: var(--elf-tag-face, var(--card)); }
.elf-tag__back { fill: var(--elf-tag-back, var(--card)); }
.elf-tag__grain { mix-blend-mode: soft-light; }
.elf-tag__grain--light { mix-blend-mode: multiply; }
.elf-tag__stitch { fill: none; stroke: color-mix(in srgb, var(--maroon) 55%, transparent); stroke-width: 1.6; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.elf-tag__ring { fill: var(--elf-paper-gold); }
.elf-tag__hole { fill: var(--cream); }
.elf-tag--crimson { --elf-tag-face: var(--crimson); --elf-tag-back: var(--elf-paper-gold); }
.elf-tag--holly { --elf-tag-face: var(--holly); --elf-tag-back: var(--crimson); }
.elf-tag--tan { --elf-tag-face: var(--tan); --elf-tag-back: var(--holly); }
.elf-tag--card { --elf-tag-face: var(--card); --elf-tag-back: var(--crimson); }
.elf-tag--gold { --elf-tag-face: var(--elf-paper-gold); --elf-tag-back: var(--holly); }
.elf-tags { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; align-items: start; justify-items: center; }
.elf-tag { position: relative; display: block; width: 100%; max-width: 150px; padding: 0; border: 0; background: none; color: var(--maroon); cursor: pointer; filter: drop-shadow(0 3px 0 rgba(94, 0, 0, 0.22)) drop-shadow(0 12px 12px rgba(90, 0, 0, 0.24)); -webkit-tap-highlight-color: transparent; }

/* The candy cane strip: a torn candy cane in a torn paper slot, as far along as done. */
.elf-cane-bar { position: relative; height: 22px; border-radius: 6px; background-color: color-mix(in srgb, var(--tan) 55%, var(--cream)); background-image: var(--elf-grain); background-size: 384px; background-blend-mode: soft-light; box-shadow: inset 0 2px 4px rgba(94, 0, 0, 0.3); -webkit-mask: var(--elf-tear-fine-a); mask: var(--elf-tear-fine-a); overflow: hidden; }
.elf-cane-bar > span { position: absolute; inset: 0 auto 0 0; width: var(--elf-cane-done, 0%); border-radius: 4px; background: var(--elf-grain) 0 0 / 384px, repeating-linear-gradient(45deg, var(--crimson) 0 9px, var(--card) 9px 18px); background-blend-mode: soft-light, normal; box-shadow: inset 0 -2px 0 rgba(94, 0, 0, 0.22); }

/* The frames round an elf's picture: the pattern on torn card, laid on a torn coloured sheet. With no
   frame chosen, a plain paper mount. */
.elf-frame { position: relative; isolation: isolate; padding: 14px; filter: var(--elf-drop-big); --elf-frame-paint: var(--elf-grain-light) 0 0 / 384px, var(--card); --elf-frame-blend: multiply, normal; --elf-frame-back: var(--tan); }
.elf-frame::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 24px; background: var(--elf-frame-paint); background-blend-mode: var(--elf-frame-blend); -webkit-mask: var(--elf-tear-card-c); mask: var(--elf-tear-card-c); }
.elf-frame::after { content: ""; position: absolute; inset: -10px -9px -13px -10px; z-index: -2; border-radius: 28px; background-color: var(--elf-frame-back); background-image: var(--elf-grain); background-size: 384px; background-blend-mode: soft-light; -webkit-mask: var(--elf-tear-card-a); mask: var(--elf-tear-card-a); transform: rotate(-1.5deg); }
.elf-frame--candy { --elf-frame-paint: var(--elf-grain) 0 0 / 384px, repeating-linear-gradient(45deg, var(--crimson) 0 14px, var(--card) 14px 28px); --elf-frame-blend: soft-light, normal; --elf-frame-back: var(--holly); }
.elf-frame--gold { --elf-frame-paint: var(--elf-grain) 0 0 / 384px, var(--elf-paper-gold); --elf-frame-blend: soft-light, normal; --elf-frame-back: var(--crimson); }
.elf-frame--holly { --elf-frame-paint: var(--elf-grain) 0 0 / 384px, radial-gradient(circle at 8px 8px, var(--crimson) 0 3.6px, transparent 4.6px) 0 0 / 22px 22px, radial-gradient(circle at 15px 6px, var(--crimson) 0 3px, transparent 4px) 0 0 / 22px 22px, var(--holly); --elf-frame-blend: soft-light, normal, normal, normal; --elf-frame-back: var(--elf-paper-gold); }
.elf-frame--tartan { --elf-frame-paint: var(--elf-grain) 0 0 / 384px, repeating-linear-gradient(0deg, rgba(26, 83, 26, 0.8) 0 6px, transparent 6px 18px), repeating-linear-gradient(90deg, rgba(26, 83, 26, 0.8) 0 6px, transparent 6px 18px), repeating-linear-gradient(0deg, rgba(233, 196, 106, 0.7) 0 1.5px, transparent 1.5px 9px), repeating-linear-gradient(90deg, rgba(233, 196, 106, 0.7) 0 1.5px, transparent 1.5px 9px), var(--crimson); --elf-frame-blend: soft-light, normal, normal, normal, normal, normal; --elf-frame-back: var(--holly); }
.elf-frame--starry { --elf-frame-paint: var(--elf-grain) 0 0 / 384px, radial-gradient(circle, var(--elf-gold-bright) 0 1.6px, transparent 2.2px) 0 0 / 15px 15px, radial-gradient(circle, rgba(248, 245, 238, 0.85) 0 1px, transparent 1.6px) 7px 8px / 15px 15px, var(--maroon); --elf-frame-blend: soft-light, normal, normal, normal; --elf-frame-back: var(--elf-paper-gold); }

/* A colour choice cut as a circle of paper: a crimson mat shows under the one picked (the page says
   which, by putting .is-picked on what holds it or by the picked radio). */
.elf-circle { display: block; width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 2px 1px rgba(94, 0, 0, 0.26)) drop-shadow(0 4px 4px rgba(94, 0, 0, 0.14)); }
.elf-circle__mat { fill: var(--crimson); opacity: 0; }
.elf-circle__rim { fill: var(--card); }

@media (prefers-reduced-motion: no-preference) {
  .elf-sky i { top: -20px; animation: elf-drift var(--d) linear var(--delay) infinite; }
  .elf-btn { transition: transform 0.12s var(--elf-ease), filter 0.12s var(--elf-ease); }
  .elf-btn::after { transition: transform 0.12s var(--elf-ease); }
  .elf-circle__mat { transition: opacity 0.2s var(--elf-ease); }
  @keyframes elf-drift { to { transform: translate3d(var(--drift), calc(100vh + 40px), 0) rotate(160deg); } }
}
