/* T-040: the inventory is an open bag lying in the dungeon, not a menu.
   The dungeon stays visible, dimmed. Each backpack has its own generated picture; the grid sits on its lining
   and the amulet slots hang from the four rings of its belt. Everything is sized from --bag-w, the width of
   the picture. The numbers per backpack (lining box, ring centres, picture ratio) are measured from the
   pictures by scripts/bag-art-pack.py; do not edit them by hand. */

/* generated: per-backpack measurements */
#amulet-panel.bag-open[data-backpack="pouch"] { --bag-art:url("assets/ui/bag/bag-pouch.png"); --bag-ratio:750 / 453; --bag-hw:0.6040; --lin-x:20.00%; --lin-y:19.07%; --lin-w:0.6000; --lin-h:0.5755; --ring-y:94.40%; --ring-0:26.97%; --ring-1:42.10%; --ring-2:58.23%; --ring-3:74.17%; }
#amulet-panel.bag-open[data-backpack="satchel"] { --bag-art:url("assets/ui/bag/bag-satchel.png"); --bag-ratio:749 / 442; --bag-hw:0.5901; --lin-x:27.90%; --lin-y:17.76%; --lin-w:0.4419; --lin-h:0.6188; --ring-y:95.59%; --ring-0:26.70%; --ring-1:41.89%; --ring-2:58.11%; --ring-3:73.40%; }
#amulet-panel.bag-open[data-backpack="basic"] { --bag-art:url("assets/ui/bag/bag-basic.png"); --bag-ratio:701 / 455; --bag-hw:0.6491; --lin-x:29.01%; --lin-y:18.44%; --lin-w:0.4212; --lin-h:0.5708; --ring-y:95.58%; --ring-0:28.47%; --ring-1:42.59%; --ring-2:57.45%; --ring-3:71.63%; }
#amulet-panel.bag-open[data-backpack="field"] { --bag-art:url("assets/ui/bag/bag-field.png"); --bag-ratio:512 / 686; --bag-hw:1.3398; --lin-x:15.92%; --lin-y:26.66%; --lin-w:0.6816; --lin-h:0.5601; --ring-y:94.97%; --ring-0:23.83%; --ring-1:40.87%; --ring-2:59.18%; --ring-3:76.17%; }
#amulet-panel.bag-open[data-backpack="wide"] { --bag-art:url("assets/ui/bag/bag-wide.png"); --bag-ratio:762 / 442; --bag-hw:0.5801; --lin-x:23.16%; --lin-y:11.53%; --lin-w:0.5374; --lin-h:0.6768; --ring-y:96.38%; --ring-0:27.69%; --ring-1:42.29%; --ring-2:57.41%; --ring-3:72.28%; }
#amulet-panel.bag-open[data-backpack="expedition"] { --bag-art:url("assets/ui/bag/bag-expedition.png"); --bag-ratio:621 / 544; --bag-hw:0.8760; --lin-x:19.89%; --lin-y:21.30%; --lin-w:0.6023; --lin-h:0.6189; --ring-y:97.58%; --ring-0:24.44%; --ring-1:41.10%; --ring-2:58.49%; --ring-3:75.56%; }
/* end generated */

/* An unknown backpack is drawn as the pouch. */
#amulet-panel.bag-open { --bag-art:url("assets/ui/bag/bag-pouch.png"); --bag-ratio:750 / 453; --bag-hw:0.6040; --lin-x:20.00%; --lin-y:19.07%; --lin-w:0.6000; --lin-h:0.5755; --ring-y:94.40%; --ring-0:26.97%; --ring-1:42.10%; --ring-2:58.23%; --ring-3:74.17%; --charm-w:84px; }
#amulet-panel.bag-open.amulet-overlay { padding:0; place-items:center; background:#0a1310c4; }
#amulet-panel.bag-open .amulet-content { display:grid; place-items:center; width:100%; height:100%; max-width:none; max-height:none; margin:0; padding:0; overflow:hidden; border:0; background:transparent; box-shadow:none; clip-path:none; }
/* The picture plus the hanging charms (about two charm widths tall) must fit the height; the info panel takes 300px. */
#amulet-panel.bag-open #bag-section {
  --bag-w:min(calc(100vw - 400px),calc((88vh - var(--charm-w) * 2.4) / var(--bag-hw)),920px);
  display:grid; grid-template-columns:var(--bag-w) minmax(220px,300px); align-items:center; justify-content:center; gap:24px; padding:0 16px;
}
#amulet-panel.bag-open .bag-body { position:relative; width:var(--bag-w); aspect-ratio:var(--bag-ratio); margin-bottom:calc(var(--charm-w) * 1.75); background:var(--bag-art) center / 100% 100% no-repeat; image-rendering:pixelated; filter:drop-shadow(0 14px 0 #0008); }

/* Grid on the lining. The cell is as large as fits both ways for this bag's columns and rows. */
#amulet-panel.bag-open .bag-layout { position:absolute; left:var(--lin-x); top:var(--lin-y); display:grid; place-items:center; width:calc(var(--lin-w) * 100%); height:calc(var(--lin-h) * 100%); min-height:0; gap:0; grid-template-columns:none; }
#amulet-panel.bag-open .bag-board { overflow:visible; padding:0; border:0; background:transparent; }
#amulet-panel.bag-open #bag-grid { --bag-cell-size:min(calc(var(--bag-w) * var(--lin-w) * .96 / var(--bag-columns,5)),calc(var(--bag-w) * var(--bag-hw) * var(--lin-h) * .95 / var(--bag-rows,3))); gap:0; }
#amulet-panel.bag-open .bag-cell { padding:0; border:0; border-radius:0; background:transparent; box-shadow:inset 0 0 0 1px #6f8a6c3d; }
#amulet-panel.bag-open .bag-cell::after { display:none; }
#amulet-panel.bag-open .bag-cell-number { display:none; }
#amulet-panel.bag-open .bag-cell:hover { background:#acd58a1f; }
#amulet-panel.bag-open .bag-cell[aria-selected="true"] { box-shadow:inset 0 0 0 2px #edbf80; }
#amulet-panel.bag-open #bag-grid[data-moving="true"] .bag-cell { box-shadow:inset 0 0 0 1px #8bd8c4; }

/* The one remaining control: a tag tied to the top of the bag. */
#amulet-panel.bag-open #bag-sort { position:absolute; right:calc(100% - var(--lin-x) - var(--lin-w) * 100%); top:calc(var(--lin-y) - 34px); min-height:0; padding:3px 12px 4px; border:2px solid #513f35; border-radius:0; background:#efe6cf; color:#2a2320; font-size:13px; font-weight:700; line-height:1.3; box-shadow:0 3px 0 #0006; }
#amulet-panel.bag-open #bag-sort:hover:not(:disabled) { background:#fff7df; }
#amulet-panel.bag-open #bag-sort:disabled { opacity:.55; }
/* T-048: the equipped backpack, on a tag just above the picture (on the picture it covered the straps and the
   sort tag, and a narrow screen cut the name off). The whole name is always shown. */
#amulet-panel.bag-open #bag-pack-tag { position:absolute; left:50%; bottom:calc(100% + 8px); display:flex; align-items:baseline; gap:8px; margin:0; padding:3px 12px 4px 9px; border:2px solid #513f35; border-left:6px solid var(--pack-color,#bac6bd); background:#efe6cf; color:#2a2320; font-size:13px; line-height:1.3; white-space:nowrap; transform:translateX(-50%); box-shadow:0 3px 0 #0006; pointer-events:none; }
#amulet-panel.bag-open #bag-pack-tag .bag-pack-label { color:#6b5a4c; font-size:11px; font-weight:700; }
#amulet-panel.bag-open #bag-pack-tag .bag-pack-name { font-weight:700; }
#amulet-panel.bag-open #bag-pack-tag .bag-pack-size { color:#4d4038; font-weight:700; }
#amulet-panel.bag-open #bag-pack-tag:empty { display:none; }

/* Amulet slots: charms on cords, hung from the belt rings. */
#amulet-panel.bag-open #amulet-slots { position:absolute; left:0; top:calc(var(--ring-y) - 2.2%); width:100%; height:calc(var(--charm-w) * 2); margin:0; padding:0; border:0; background:transparent; }
#amulet-panel.bag-open .amulet-slot-list { display:block; position:relative; width:100%; height:100%; margin:0; padding:0; gap:0; }
#amulet-panel.bag-open .amulet-slot { position:absolute; top:0; left:50%; width:min(var(--charm-w),calc(var(--bag-w) * .135)); height:auto; min-width:0; max-width:none; min-height:0; aspect-ratio:113 / 224; margin:0; padding:0; border:0; border-radius:0; background:url("assets/ui/bag/charm-slot.png") center / 100% 100% no-repeat; box-shadow:none; image-rendering:pixelated; transform:translateX(-50%); transform-origin:50% 0; }
#amulet-panel.bag-open .amulet-slot[data-ring="0"] { left:var(--ring-0); }
#amulet-panel.bag-open .amulet-slot[data-ring="1"] { left:var(--ring-1); }
#amulet-panel.bag-open .amulet-slot[data-ring="2"] { left:var(--ring-2); }
#amulet-panel.bag-open .amulet-slot[data-ring="3"] { left:var(--ring-3); }
#amulet-panel.bag-open .amulet-slot[aria-pressed="true"],#amulet-panel.bag-open .amulet-slot[data-equip-target="true"],#amulet-panel.bag-open .amulet-slot:focus-visible { background-image:url("assets/ui/bag/charm-slot-selected.png"); outline:0; }
/* Hover must not move the slot: moving it out from under the pointer makes it flicker and breaks dragging. */
#amulet-panel.bag-open .amulet-slot:hover { filter:brightness(1.18); }
#amulet-panel.bag-open .amulet-slot:disabled { opacity:.7; }
#amulet-panel.bag-open .amulet-slot-art { position:absolute; left:50%; top:76.5%; width:88%; height:auto; max-height:none; transform:translate(-50%,-50%); image-rendering:pixelated; pointer-events:none; }

/* What the pointer is on, to the right of the bag. Nothing is shown for an empty cell. */
#amulet-panel.bag-open #bag-details { align-self:center; width:100%; max-height:min(74vh,560px); overflow:auto; box-shadow:0 10px 0 #0007; }
#amulet-panel.bag-open #bag-details[data-shown="false"] { visibility:hidden; }

/* Only a refusal or a confirmation is worth a line; it sits at the bottom and is otherwise absent. */
#amulet-panel.bag-open #bag-status { position:absolute; left:50%; bottom:14px; margin:0; padding:6px 14px; border:0; border-left:4px solid #edbf80; background:#14272af0; color:#efe6cf; font-size:14px; transform:translateX(-50%); pointer-events:none; }
/* Not display:none: a live region that appears and changes text at once may go unannounced. The hints stay
   in the page for assistive technology and are only kept off the screen. */
#amulet-panel.bag-open #bag-status:not([data-kind="reason"]),#amulet-panel.bag-open #bag-status:empty { width:1px; height:1px; padding:0; border:0; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }

@media (max-width:900px) {
  #amulet-panel.bag-open { --charm-w:54px; }
  #amulet-panel.bag-open #bag-section { --bag-w:min(calc(100vw - 24px),calc((60vh - var(--charm-w) * 1.9) / var(--bag-hw))); grid-template-columns:var(--bag-w); gap:8px; align-content:center; }
  #amulet-panel.bag-open #bag-details { max-height:26vh; }
  /* T-048: a long name wraps instead of running off a narrow screen (.amulet-content hides overflow). */
  #amulet-panel.bag-open #bag-pack-tag { flex-wrap:wrap; justify-content:center; width:max-content; max-width:calc(100vw - 24px); white-space:normal; column-gap:8px; row-gap:0; }
}

/* The amulet catalogue moved from the bag into the guide, which is a light sheet: its text needs dark ink there. */
#help-panel #catalog-section .amulet-tabs button { color:#2a2320; }
#help-panel #catalog-section .amulet-tabs button[aria-pressed="true"] { color:#efe6cf; }
#help-panel #catalog-section .amulet-results { color:#4c4a43; }
#help-panel #catalog-section .amulet-stats { margin-bottom:12px; }
