/* WordPlace / one light, distinct physical elevations. This is a replacement
   shadow pass over assets2, not another shadow on every ancestor. Native
   material pixels, content tracks and motion owners remain untouched. */
:root {
  --wp-shadow-rest: drop-shadow(.5px 1px .55px #201a224d);
  --wp-shadow-slip: drop-shadow(.7px 1.5px .6px #201a226b) drop-shadow(2.5px 5px 2.5px #201a223b);
  --wp-shadow-paper: drop-shadow(1px 2px .8px #201a2270) drop-shadow(4px 8px 4px #201a2238);
  --wp-shadow-object: drop-shadow(1px 2px 1px #201a2280) drop-shadow(5px 11px 6px #201a224d);
  --wp-shadow-lift: drop-shadow(1.5px 3px 1px #201a2266) drop-shadow(7px 15px 7px #201a2240);
}
@media (forced-colors: active) {
  :root {
    /* The existing receive animation also consumes these tokens. Clear the
       tokens themselves so an animated filter cannot override system mode. */
    --wp-shadow-rest: none;
    --wp-shadow-slip: none;
    --wp-shadow-paper: none;
    --wp-shadow-object: none;
    --wp-shadow-lift: none;
  }
  html .remote-pair, html .remote-pair-done { box-shadow: none; }
  html .session-dialog :is(.session-modes button,.session-confirm) { filter: none; }
  html #zineEchoApp :is(.echo-backboard,.echo-speaker,.echo-word-carrier,.echo-turn-leaf,.echo-imprint,.echo-player,.echo-control) { filter: none; }
  html #zineEchoApp .echo-reset-dialog { box-shadow: none; }
}

/* No decorative shadow treatment in system colours. Existing native borders,
   focus and visibility rules remain the accessible rendering there. */
@media (forced-colors: none) {
  html #zineGameMenu .game-poster { filter: var(--wp-shadow-slip); }
  html #zineGameMenu .gallery-feature { filter: var(--wp-shadow-object); }
  html #zineGameMenu .gallery-brand { filter: var(--wp-shadow-rest); }

  /* The guest list is held above the table, not hovering in a black cloud.
     Pairing/loading have solid rectangular substrates and use box shadows;
     neither the QR itself nor its quiet zone is ever filtered. */
  html .session-dialog { filter: var(--wp-shadow-object); }
  html .session-dialog :is(.session-modes button,.session-confirm) { filter: var(--wp-shadow-slip); }
  html .session-dialog .session-modes button[aria-pressed="true"],
  html .session-dialog :is(.session-modes button,.session-confirm):not(:disabled):active { filter: var(--wp-shadow-rest); }
  html .remote-pair {
    box-shadow: 1px 2px 1px #201a226b, 5px 10px 8px #201a2240;
  }
  html .remote-pair-done { box-shadow: .7px 1.5px 1px #201a2254, 2px 4px 3px #201a222b; }
  html .remote-pair-done:not(:disabled):active { box-shadow: .5px 1px .5px #201a224d; }
  html .zine-stage [data-load-notice] {
    box-shadow: 1px 2px 1px #201a2254, 4px 8px 5px #201a2233;
  }
  html #zineUtilities button { filter: var(--wp-shadow-rest); }

  /* Bound stock and a folded envelope do not stand equally high. Keep one
     cast on each photographic silhouette; their printed sheets are siblings,
     so this never shadows the same material twice. */
  html #zineSandboxApp .fs-paper-art { filter: var(--wp-shadow-object); }
  html #zineEstafetteApp .fs-paper-art { filter: var(--wp-shadow-paper); }
  /* When the photograph is unavailable, the existing opaque recovery stock
     owns the same elevation. The hidden artwork adds no second outline. */
  html #zineSandboxApp[data-material-state="fallback"] .fs-paper-surface::before {
    box-shadow: 1px 2px 1px #201a2280, 5px 11px 6px #201a224d;
  }
  html #zineEstafetteApp[data-material-state="fallback"] .fs-paper-surface::before {
    box-shadow: 1px 2px .8px #201a2270, 4px 8px 4px #201a2238;
  }
  html .fs-stage :is(.fs-action,.fs-choice) { filter: var(--wp-shadow-slip); }
  html .fs-stage .fs-choice[aria-pressed="true"] { filter: var(--wp-shadow-rest); }
  html .fs-stage :is(.fs-action,.fs-choice):not(:disabled):active { filter: var(--wp-shadow-rest); }

  html #zineApp .zine-heading .ink-label { filter: var(--wp-shadow-slip); }
  html #zineApp .zine-heading .ink-label::before { filter: none; }
  /* The same choice component also lives in the Royale lobby. Keep the
     shadow on each button carrier, outside its transparent paper artwork.
     Selection changes the ink/paper colour, not the paper's physical depth;
     only a held press lowers it. */
  html :is(#zineApp,#zineRoyaleApp) .settings-choices button { filter: var(--wp-shadow-slip); }
  html :is(#zineApp,#zineRoyaleApp) .settings-choices button:not(:disabled):active { filter: var(--wp-shadow-rest); }
  html #zineApp .zine-controls :is(.main-action,.pause-action,.stop-action),
  html #zineStoryApp .story-button,
  html #zineCaseApp .case-button { filter: var(--wp-shadow-slip); }
  html #zineApp .zine-controls :is(.main-action,.pause-action,.stop-action):not(:disabled):active,
  html #zineStoryApp .story-button:not(:disabled):active,
  html #zineCaseApp .case-button:not(:disabled):active { filter: var(--wp-shadow-rest); }
  html #zineCaseApp .case-button:disabled { filter: none; }
  html #zineCaseApp[data-phase="recall"] .case-reset { filter: var(--wp-shadow-rest); }

  /* Royale already had sound alpha-contour shadows. Rebalance its planes:
     the thick bomb sits above the table; a thin word slip is not the heaviest
     object. Keep the separate leaf owners for fuse, burst, award and crown. */
  html #zineRoyaleApp.bomtafel {
    --table-shadow-flat: var(--wp-shadow-slip);
    --table-shadow-raised: var(--wp-shadow-paper);
    --table-shadow-object: var(--wp-shadow-object);
  }
  html #zineRoyaleApp.bomtafel .bomb-case { filter: var(--wp-shadow-object); }
  html #zineRoyaleApp.bomtafel .royale-words > .paper-surface { filter: var(--wp-shadow-paper); }
  html #zineRoyaleApp.bomtafel .zine-button { --object-action-shadow: var(--wp-shadow-slip); }
  html #zineRoyaleApp.bomtafel .zine-button:not(:disabled):active { --object-action-shadow: var(--wp-shadow-rest); }
  html #zineRoyaleApp.bomtafel .royale-bomb .bomb-burst { filter: var(--wp-shadow-paper); }
  html #zineRoyaleApp.bomtafel[data-phase="matchEnd"] .royale-result::after { filter: var(--wp-shadow-object); }
  html #zineRoyaleApp.bomtafel[data-phase="matchEnd"] .royale-result::before { filter: var(--wp-shadow-slip); }
  html #zineRoyaleApp #royaleSessionRoster { filter: var(--wp-shadow-slip); }

  /* Echo uses the same top-left light on its physical leaves, not a filter
     around the whole sound-system. The folded control plank already has a
     contact seam/front return; filtering it would cast its buttons twice. */
  html #zineEchoApp .echo-backboard,
  html #zineEchoApp .echo-speaker { filter: var(--wp-shadow-object); }
  html #zineEchoApp .echo-word-carrier { filter: var(--wp-shadow-paper); }
  html #zineEchoApp .echo-turn-leaf { filter: var(--wp-shadow-lift); }
  html #zineEchoApp .echo-imprint { filter: var(--wp-shadow-slip); }
  html #zineEchoApp > .echo-controls { filter: none; }
  html #zineEchoApp .echo-player,
  html #zineEchoApp .echo-control { filter: var(--wp-shadow-slip); }
  html #zineEchoApp .echo-player:enabled:active,
  html #zineEchoApp .echo-control:enabled:active { filter: var(--wp-shadow-rest); }
  html #zineEchoApp .echo-player[data-eliminated="true"] { filter: grayscale(.7) var(--wp-shadow-rest); }
  html #zineEchoApp .echo-player[data-impact] { filter: var(--wp-shadow-paper); }
  /* Completion changes the message, not the pigment of the main action. */
  html #zineEchoApp[data-phase="complete"] .echo-primary::before { filter: none; }
  html #zineEchoApp .echo-reset-dialog {
    box-shadow: 1px 2px 1px #201a226b, 5px 10px 8px #201a2240;
  }

  @media (min-width: 901px) and (min-height: 561px) {
    html #zineRoyaleApp.bomtafel .royale-score { filter: var(--wp-shadow-slip); }
    html #zineRoyaleApp.bomtafel .royale-score[data-active="true"] { filter: var(--wp-shadow-paper); }
    /* Thin stock < guide < load-bearing cardboard. The approved ring and
       every carrier that rotates it remain shadowless, also while held. */
    html #zineApp[data-word-press] .press-window { filter: var(--wp-shadow-slip); }
    html #zineApp[data-word-press] .press-current { filter: var(--wp-shadow-slip); }
    html #zineApp[data-word-press] .press-housing,
    html #zineApp[data-word-press]:not([data-material-state="fallback"]) .press-housing { filter: var(--wp-shadow-object); }
    html #zineApp[data-word-press] .press-crank,
    html #zineApp[data-word-press] .press-crank:not(:disabled):is(:hover, :active),
    html #zineApp[data-word-press] .press-grip-orbit,
    html #zineApp[data-word-press] .press-grip { filter: none; }
    html #zineApp[data-word-press] .character-sprite { filter: var(--wp-shadow-paper); }
    html #zineApp[data-word-press] .press-roller-top { filter: var(--wp-shadow-paper); }
    html #zineApp[data-word-press] .press-roller-bottom { filter: var(--wp-shadow-slip); }
    html #zineApp[data-word-press] .zine-poster::before,
    html #zineApp[data-word-press] .press-assembly::before { filter: var(--wp-shadow-slip); }

    /* Story's stock block touches the table. Its real top sheet is close to
       the stack at rest; the existing tear-out raises that same material. */
    html #zineStoryApp .story-desk::before { filter: var(--wp-shadow-object); }
    html #zineStoryApp .story-paper-lift { filter: var(--wp-shadow-rest); }
    html #zineStoryApp .story-departure-sheet .story-paper-lift { filter: var(--wp-shadow-lift); }

    /* Case has a true 3-D fold. Only these flat children receive filters.
       The shared neutral cast lets the yellow stock supply its own pigment.
       Preserve native hinge light, cast travel and contact compression. */
    html #zineCaseApp .case-folder-base {
      filter: drop-shadow(1px var(--case-contact-y, 2.2px) .8px rgb(32 26 34 / var(--case-contact-alpha, .45))) drop-shadow(5px 11px 6px #201a224d);
    }
    html #zineCaseApp .case-cover-material {
      filter: brightness(var(--cover-light, 1)) drop-shadow(.7px 1.5px .6px #201a226b) drop-shadow(var(--cover-shadow-x, 3px) var(--cover-shadow-y, 6px) var(--cover-shadow-softness, 4px) #201a2242);
    }
    html #zineCaseApp .case-folder-tab { filter: var(--wp-shadow-slip); }
    html #zineCaseApp .case-file-edges span { filter: var(--wp-shadow-rest); }
    html #zineCaseApp .case-note:nth-child(n),
    html #zineCaseApp .case-levels button { filter: var(--wp-shadow-slip); }
    html #zineCaseApp .case-levels button[aria-pressed="true"],
    html #zineCaseApp .case-levels button:not(:disabled):active { filter: var(--wp-shadow-rest); }

    /* Remove the no-op shadow under the same mask. Cast from the unmasked
       sheet carrier; name, words, recovery stock and paper still travel once. */
    html #zineEstafetteApp .fs-letter { filter: var(--wp-shadow-slip); }
    html #zineEstafetteApp .fs-letter::before { filter: none; }
    html #zineEstafetteApp .fs-player { filter: var(--wp-shadow-rest); }
    html #zineEstafetteApp .fs-departure { filter: var(--wp-shadow-lift); }
    /* Notebook photography already contains its paper-stack contact. Only
       a departing page gains air; do not add a second dark outline at rest. */
    html #zineSandboxApp .fs-departure { filter: var(--wp-shadow-paper); }
  }
}
