/*
 * TAG Legal desk, Bush glass, WREN lane (WR-02 plumage ramp, WR-10 items, WR-11 colourways).
 * Original work. Colours come only from the art tokens (art/tokens/art_tokens.css, ART_DIRECTION 2.7),
 * so every step and every item follows Light, Dark, Eucalypt, Harbour, the Canteen themes and High contrast.
 *
 * Wren's plumage: wren.js sets data-wr-step (0 to 10, from the team streak) and --wren-t (step / 10) on the
 * Wren's <svg class="art-wren">. Steps swap instantly (no colour ever tweens).
 *   crown and ear coverts turn blue first (steps 1 to 4), the mantle next (5 to 7),
 *   (a female or non breeding bird has no ear covert patch at all, so the patch is not drawn at step 0;
 *   it steps in at step 1 and is fully blue by step 4),
 *   the black markings last (they step in at 0.4 opacity at step 6 and are full at step 10), and with them the
 *   throat and breast band, which darken from the belly tone to the breeding male's deep blue black throat and
 *   black breast band over steps 6 to 10 (sky blue stays on the crown, ear coverts and mantle only).
 *   The tail carries a blue wash from the start (as a female's does) and deepens with the streak.
 *   The rufous eye patch of a female or non breeding bird fades out over steps 1 to 4.
 * Where color-mix is missing, wren.js writes the same colours as plain values (11 precomputed steps).
 */

.art-wren {
  --wr-crown-p: 0%;
  --wr-mantle-p: 0%;
  --wr-tail-p: 22%;
  --wr-bill-p: 34%;
  --wr-black-o: 0;
  --wr-lore-o: 1;
  --wr-ear-p: 0%;
  --wr-ear-o: 0;
  --wr-throat-p: 0%;
  --wr-body: var(--fauna-wren-brown, #9C7E60);
  --wr-wing: var(--fauna-wren-brown, #9C7E60);
  --wr-belly: var(--fauna-wren-belly, #E6DCCB);
  --wr-black: var(--fauna-wren-black, #1E2124);
  --wr-lore: var(--fauna-wren-lore, #C2653A);
  --wr-eye: var(--fauna-eye, #151716);
  --wr-catch: var(--fauna-wren-belly, #E6DCCB);
  --wr-leg: var(--fauna-wren-brown, #9C7E60);
  --wr-crown: color-mix(in oklab, var(--fauna-wren-brown, #9C7E60), var(--fauna-wren-blue, #3C8DD0) var(--wr-crown-p));
  --wr-ear: color-mix(in oklab, var(--fauna-wren-brown, #9C7E60), var(--fauna-wren-blue, #3C8DD0) var(--wr-ear-p));
  --wr-mantle: color-mix(in oklab, var(--fauna-wren-brown, #9C7E60), var(--fauna-wren-blue, #3C8DD0) var(--wr-mantle-p));
  --wr-tail: color-mix(in oklab, var(--fauna-wren-brown, #9C7E60), var(--fauna-wren-blue-deep, #1F4F8A) var(--wr-tail-p));
  /* the bill: the lore colour toned 30% towards the brown (a reddish brown at step 0), darkening to black */
  --wr-bill: color-mix(in oklab, color-mix(in oklab, var(--fauna-wren-lore, #C2653A), var(--fauna-wren-brown, #9C7E60) 30%), var(--fauna-wren-black, #1E2124) var(--wr-bill-p));
  /* the breeding throat: deep blue black (the deep blue taken 45% towards the black), and the black breast band;
     both mixed from the belly tone, so a female or non breeding bird has a pale throat */
  --wr-throat-dk: color-mix(in oklab, var(--fauna-wren-blue-deep, #1F4F8A), var(--fauna-wren-black, #1E2124) 45%);
  --wr-throat: color-mix(in oklab, var(--fauna-wren-belly, #E6DCCB), var(--wr-throat-dk) var(--wr-throat-p));
  --wr-band: color-mix(in oklab, var(--fauna-wren-belly, #E6DCCB), var(--fauna-wren-black, #1E2124) var(--wr-throat-p));
  /* the folded primaries and the far wing: the wing brown a touch darker */
  --wr-wing-dk: color-mix(in oklab, var(--fauna-wren-brown, #9C7E60), var(--fauna-wren-black, #1E2124) 16%);
  /* WR-10 item colours (a is the main cloth or wire, b the band, cuff, stripes or leaf) */
  --wr-beanie-a: var(--flora-gum-deep, #34553A);    --wr-beanie-b: var(--flora-blossom, #F1E8D2);
  --wr-scarf-a: var(--flora-banksia, #C87632);      --wr-scarf-b: var(--flora-blossom, #F1E8D2);
  --wr-bucket-a: var(--flora-bark-pale, #DDD3C3);   --wr-bucket-b: var(--flora-bark, #8B6E55);
  --wr-bushhat-a: var(--flora-bark, #8B6E55);       --wr-bushhat-b: var(--flora-nut, #7A5A3E);
  --wr-flatcap-a: var(--metal-silver-lo, #737B80);  --wr-flatcap-b: var(--metal-silver, #A9B0B5);
  --wr-bowtie-a: var(--flora-wattle-deep, #A87A0C); --wr-bowtie-b: var(--flora-nut, #7A5A3E);
  --wr-specs-a: var(--metal-brass, #B48A3C);        --wr-specs-b: var(--metal-brass-hi, #E2C37E);
  --wr-sprig-a: var(--flora-wattle, #D9A21B);       --wr-sprig-b: var(--flora-gum, #5A7D5E);
  overflow: visible;
}
.art-wren[data-wr-step="0"]  { --wr-crown-p: 0%;   --wr-mantle-p: 0%;   --wr-tail-p: 22%;  --wr-bill-p: 34%;  --wr-black-o: 0;   --wr-lore-o: 1; --wr-ear-p: 0%; --wr-ear-o: 0; }
.art-wren[data-wr-step="1"]  { --wr-crown-p: 25%;  --wr-mantle-p: 0%;   --wr-tail-p: 30%;  --wr-bill-p: 40%;  --wr-black-o: 0;   --wr-lore-o: .75; --wr-ear-p: 45%; --wr-ear-o: 1; }
.art-wren[data-wr-step="2"]  { --wr-crown-p: 50%;  --wr-mantle-p: 0%;   --wr-tail-p: 38%;  --wr-bill-p: 47%;  --wr-black-o: 0;   --wr-lore-o: .5; --wr-ear-p: 65%; --wr-ear-o: 1; }
.art-wren[data-wr-step="3"]  { --wr-crown-p: 75%;  --wr-mantle-p: 0%;   --wr-tail-p: 46%;  --wr-bill-p: 53%;  --wr-black-o: 0;   --wr-lore-o: .25; --wr-ear-p: 85%; --wr-ear-o: 1; }
.art-wren[data-wr-step="4"]  { --wr-crown-p: 100%; --wr-mantle-p: 0%;   --wr-tail-p: 54%;  --wr-bill-p: 60%;  --wr-black-o: 0;   --wr-lore-o: 0; --wr-ear-p: 100%; --wr-ear-o: 1; }
.art-wren[data-wr-step="5"]  { --wr-crown-p: 100%; --wr-mantle-p: 33%;  --wr-tail-p: 62%;  --wr-bill-p: 66%;  --wr-black-o: 0;   --wr-lore-o: 0; --wr-ear-p: 100%; --wr-ear-o: 1; }
.art-wren[data-wr-step="6"]  { --wr-crown-p: 100%; --wr-mantle-p: 67%;  --wr-tail-p: 70%;  --wr-bill-p: 73%;  --wr-black-o: .4;  --wr-lore-o: 0; --wr-ear-p: 100%; --wr-ear-o: 1; --wr-throat-p: 55%; }
.art-wren[data-wr-step="7"]  { --wr-crown-p: 100%; --wr-mantle-p: 100%; --wr-tail-p: 78%;  --wr-bill-p: 80%;  --wr-black-o: .55; --wr-lore-o: 0; --wr-ear-p: 100%; --wr-ear-o: 1; --wr-throat-p: 78%; }
.art-wren[data-wr-step="8"]  { --wr-crown-p: 100%; --wr-mantle-p: 100%; --wr-tail-p: 86%;  --wr-bill-p: 87%;  --wr-black-o: .7;  --wr-lore-o: 0; --wr-ear-p: 100%; --wr-ear-o: 1; --wr-throat-p: 92%; }
.art-wren[data-wr-step="9"]  { --wr-crown-p: 100%; --wr-mantle-p: 100%; --wr-tail-p: 93%;  --wr-bill-p: 93%;  --wr-black-o: .85; --wr-lore-o: 0; --wr-ear-p: 100%; --wr-ear-o: 1; --wr-throat-p: 98%; }
.art-wren[data-wr-step="10"] { --wr-crown-p: 100%; --wr-mantle-p: 100%; --wr-tail-p: 100%; --wr-bill-p: 100%; --wr-black-o: 1;   --wr-lore-o: 0; --wr-ear-p: 100%; --wr-ear-o: 1; --wr-throat-p: 100%; }

/* Tier m is the l drawing with the feather lines off (set by wren.js from the rendered size; the -m symbols
   set it themselves). */
.art-wren[data-wr-tier="m"] { --wr-detail: 0; }

/* ---- WR-11 rare colourways: token swaps on the WR-10 items (flora and metal tokens only, never the
   reserved remembrance tokens). Several can be listed: data-wr-cw="beanie-wattle scarf-smoky". ---- */
.art-wren[data-wr-cw~="beanie-wattle"]   { --wr-beanie-a: var(--flora-wattle, #D9A21B);        --wr-beanie-b: var(--flora-wattle-deep, #A87A0C); }
.art-wren[data-wr-cw~="scarf-smoky"]     { --wr-scarf-a: var(--flora-gum-juvenile, #8FAEA3);   --wr-scarf-b: var(--metal-silver-hi, #E6EAEC); }
.art-wren[data-wr-cw~="bucket-bush"]     { --wr-bucket-a: var(--flora-gum, #5A7D5E);           --wr-bucket-b: var(--flora-gum-deep, #34553A); }
.art-wren[data-wr-cw~="flatcap-banksia"] { --wr-flatcap-a: var(--flora-banksia-cone, #7D5A3C); --wr-flatcap-b: var(--flora-banksia, #C87632); }
.art-wren[data-wr-cw~="bowtie-violet"]   { --wr-bowtie-a: var(--flora-wild-violet, #8C7BC2);   --wr-bowtie-b: var(--flora-wild-white, #F2EFE6); }
.art-wren[data-wr-cw~="specs-silver"]    { --wr-specs-a: var(--metal-silver, #A9B0B5);         --wr-specs-b: var(--metal-silver-hi, #E6EAEC); }

/* ---- High contrast: the art collapses to white fills and ONE black edge (the merged silhouette each pose,
   item and perch carries, drawn behind the fills with a non scaling stroke of --art-hc-edge-w). Wren keeps one
   accent plane, the HC Wren blue, as a cap on the crown above the eye line; the eye and bill stay black, and the
   spectacle wire turns black (a wire needs no edge). ---- */
:root[data-theme="high_contrast"] .art-wren {
  --wr-crown: var(--fauna-wren-blue, #00367A); --wr-ear: #FFFFFF; --wr-mantle: #FFFFFF; --wr-tail: #FFFFFF; --wr-bill: #000000;
  --wr-eye: #000000; --wr-catch: #FFFFFF; --wr-black-o: 0; --wr-lore-o: 0; --wr-throat: #FFFFFF; --wr-band: #FFFFFF;
  --wr-body: #FFFFFF; --wr-wing: #FFFFFF; --wr-wing-dk: #FFFFFF; --wr-belly: #FFFFFF; --wr-leg: #FFFFFF;
  --wr-specs-a: #000000;
}
/* The lorikeets (WR-20) in High contrast: the derived plumage goes flat white like every other fill; the key
   edge carries the shape and the eye stays black. */
:root[data-theme="high_contrast"] {
  --wr-lk-head: #FFFFFF; --wr-lk-streak: #FFFFFF; --wr-lk-collar: #FFFFFF; --wr-lk-breast: #FFFFFF; --wr-lk-belly: #FFFFFF;
  --wr-lk-bill: #FFFFFF; --wr-lk-iris: #FFFFFF; --wr-lk-prim: #000000; --wr-lk-under: #FFFFFF; --wr-lk-ubar: #FFFFFF;
  --wr-lk-ucov: #FFFFFF; --wr-lk-tailu: #FFFFFF;
}
/* The perch. With the twig (art-wr-03-twig-*) the contact shadow is off: the twig carries its own shade. */
.art-wren[data-wr-perch="twig"] { --wr-shadow-o: 0; }

/* ---- Host contract for the Clear panel (bible 2.5, 9.3): Wren sits in the bottom right corner with at least
   16 px clear of every edge, 160 px wide, 110 px under 480 px (bigger from 28 Sep 2026, was 96 and 72), and never
   under the words. Put .wr-clear-host on the panel, .wr-clear-words on the text block and .wr-clear-spot on Wren's
   box. The words keep a reserved gutter on the right (wide) or a reserved band at the bottom (phone), so a wrapped
   headline cannot reach Wren. ---- */
.wr-clear-host { position: relative; }
.wr-clear-words { padding-right: calc(160px + 16px + 8px); }
.wr-clear-spot { position: absolute; right: 16px; bottom: 16px; width: 160px; height: 160px; pointer-events: none; }
.wr-clear-spot > svg { width: 100%; height: 100%; display: block; }
@media (max-width: 479px) {
  .wr-clear-words { padding-right: 0; padding-bottom: calc(110px + 16px); }
  .wr-clear-spot { width: 110px; height: 110px; }
}

/* Forced colours: Wren is decorative art, so it is hidden (ART_DIRECTION 2.7). */
@media (forced-colors: active) {
  .art-wren, .art-lorikeets { display: none !important; }
}

/* ---- Rig parts animate with transform only; the pivot is written into each transform, so the origin is
   the view box origin. ---- */
.art-wren [data-part] { transform-box: view-box; transform-origin: 0 0; }
