/* The main menu's two worlds (js/ui/home-worlds.js): the World in 3D and the Tabletop in 2D, side by side and the same
   size. The World is a lit window, lamp amber and a hazard-striped way in; the Tabletop is drawn flat on a pegboard,
   potion green, its posters a colour, a pattern and one big icon. Phones (720px and under) keep the heroes side by side
   and show one shelf at a time, picked by the 3D/2D switch. */
#worlds { --hw-amber: var(--wk-amber); --hw-green: var(--wk-potion);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px 22px; width: min(1100px, calc(100vw - 32px)); margin: 18px auto 6px; font-family: var(--f-ui); text-align: left; }
#worlds:empty { display: none; }
#worlds .hw-col { display: grid; gap: 16px; align-content: start; min-width: 0; }
#worlds .hw-tabs { display: none; }

/* ---------- the heroes ---------- */
#worlds .hw-hero { position: relative; height: 320px; border: 4px solid var(--wk-ink); border-radius: 16px; overflow: hidden; box-shadow: 0 8px 0 var(--wk-ink); }
#worlds .hw-in { position: absolute; inset: 0; z-index: 2; padding: 16px 18px; display: flex; flex-direction: column; }
#worlds .hw-hero h2 { font-family: var(--f-head); font-weight: 400; font-size: 44px; line-height: 1; margin: auto 0 4px; }
#worlds .hw-hero p { margin: 0 0 14px; font-size: 15px; max-width: 440px; }
#worlds .hw-row { display: flex; gap: 10px; flex-wrap: wrap; }
#worlds .hw-h3 { box-shadow: 0 8px 0 var(--wk-ink), 0 0 40px rgba(255, 154, 42, 0.22); }
#worlds .hw-h3 > img:not(.hw-gob) { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#worlds .hw-h3::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10, 6, 18, 0.1), rgba(10, 6, 18, 0.15) 35%, rgba(10, 6, 18, 0.92)); box-shadow: inset 0 0 70px rgba(255, 154, 42, 0.28), inset 0 -3px 0 rgba(255, 154, 42, 0.6); }
#worlds .hw-h3 h2 { color: #fff4e0; text-shadow: 0 0 22px rgba(255, 154, 42, 0.75), 4px 4px 0 var(--wk-ink); }
#worlds .hw-h3 p { color: #ffd8a8; }
#worlds .hw-h2 { background: radial-gradient(circle, rgba(10, 6, 18, 0.55) 0 2px, transparent 3px) 0 0 / 22px 22px, #2f4a2a; }
#worlds .hw-h2::before { content: ""; position: absolute; inset: 14px; border: 3px dashed rgba(10, 6, 18, 0.6); border-radius: 10px; }
#worlds .hw-h2::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(20, 28, 18, 0.92)); }
#worlds .hw-h2 h2 { color: var(--hw-green); text-shadow: 4px 4px 0 var(--wk-ink); }
#worlds .hw-h2 p { color: #d8e8c8; }
/* the cards, dice and coins spread over the table */
#worlds .hw-spread { position: absolute; right: 8px; top: 30px; width: 56%; height: 48%; }
#worlds .hw-spread span { position: absolute; width: 76px; height: 76px; border: 3px solid var(--wk-ink); border-radius: 14px; background: var(--wk-plate); box-shadow: 5px 6px 0 var(--wk-ink); display: grid; place-items: center; }
#worlds .hw-spread .gi { width: 52px; height: 52px; }
#worlds .hw-s0 { left: 2%; top: 8%; transform: rotate(-12deg); } #worlds .hw-s1 { left: 27%; top: 0; transform: rotate(8deg); }
#worlds .hw-s2 { left: 51%; top: 12%; transform: rotate(-4deg); } #worlds .hw-s3 { left: 75%; top: 2%; transform: rotate(14deg); }
#worlds .hw-s4 { left: 14%; top: 54%; transform: rotate(6deg); } #worlds .hw-s5 { left: 40%; top: 52%; transform: rotate(-10deg); }
#worlds .hw-s6 { left: 64%; top: 58%; transform: rotate(4deg); }

/* yer goblin on each, facing the other across the middle: the World's on its right, the Tabletop's on its left, so
   the Tabletop's words and its spread of cards sit the other way round */
#worlds .hw-gob { position: absolute; bottom: 8px; z-index: 1; height: 80%; pointer-events: none; }
#worlds .hw-gob3 { right: 12px; width: auto; filter: drop-shadow(0 0 18px rgba(255, 154, 42, 0.35)); }
#worlds .hw-gob2 { left: 16px; aspect-ratio: 24 / 30; filter: drop-shadow(4px 5px 0 rgba(10, 6, 18, 0.8)); }
#worlds .hw-gob2 svg { width: 100%; height: 100%; display: block; }
#worlds .hw-h2 .hw-in { align-items: flex-end; text-align: right; }
#worlds .hw-h2 .hw-row { justify-content: flex-end; }
#worlds .hw-h2 .hw-spread { right: auto; left: 30%; width: 66%; top: 18px; height: 40%; }
#worlds .hw-hero p { max-width: 62%; }

/* ---------- badges and buttons ---------- */
#worlds .hw-badge { font: 800 13px/1 var(--f-ui); letter-spacing: 1px; padding: 5px 8px 4px; border-radius: 6px; border: 2px solid var(--wk-ink); display: inline-block; color: var(--wk-ink); vertical-align: middle; }
#worlds .hw-b3d { background: linear-gradient(180deg, #ffd27a, var(--hw-amber)); box-shadow: 0 0 14px rgba(255, 154, 42, 0.6), 2px 2px 0 var(--wk-ink); }
#worlds .hw-b2d { background: var(--hw-green); box-shadow: 2px 2px 0 var(--wk-ink); }
#worlds .hw-btn { font: 800 16px/1 var(--f-ui); text-transform: uppercase; letter-spacing: 1px; color: var(--wk-paper); min-height: 52px; padding: 0 18px; border: 3px solid var(--wk-ink); border-radius: 10px; background: var(--wk-plate); box-shadow: var(--wk-drop-sm); cursor: pointer; transform: rotate(-1deg); }
#worlds .hw-btn:nth-child(even) { transform: rotate(1deg); }
#worlds .hw-go3, #worlds .hw-go2 { padding: 0 10px; background: var(--wk-hazard); }
#worlds .hw-go2 { background: repeating-linear-gradient(135deg, var(--hw-green) 0 14px, var(--wk-ink) 14px 22px); }
#worlds .hw-go3 span, #worlds .hw-go2 span { display: inline-block; background: var(--wk-well); border: 2px solid var(--wk-ink); border-radius: 6px; padding: 9px 18px; }
#worlds .hw-btn:hover { filter: brightness(1.12); }
#worlds button:focus-visible, #worlds button.padfocus { outline: 3px solid var(--wk-brass); outline-offset: 3px; }

/* ---------- the shelves of posters ---------- */
#worlds .hw-shelf h3 { font-family: var(--f-head); font-weight: 400; font-size: 22px; margin: 0 0 10px; color: var(--wk-brass); display: flex; align-items: center; gap: 10px; }
#worlds .hw-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
#worlds .hw-poster { position: relative; height: 118px; padding: 0; border: 3px solid var(--wk-ink); border-radius: 12px; overflow: hidden; cursor: pointer; text-align: left; color: var(--wk-paper); font-family: var(--f-ui); transition: transform 0.15s; }
#worlds .hw-poster:hover { transform: translateY(-2px); }
#worlds .hw-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 10px; }
#worlds .hw-cap b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--f-head); font-weight: 400; font-size: 16px; line-height: 1.1; text-shadow: 2px 2px 0 var(--wk-ink); }
#worlds .hw-cap small { display: block; font-size: 11.5px; font-weight: 700; margin-top: 2px; }
/* a place: its picture, lamp-lit round the edge */
#worlds .hw-p3 { background: #000; box-shadow: 0 6px 0 var(--wk-ink), 0 0 0 2px rgba(255, 154, 42, 0.25); }
#worlds .hw-p3 img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#worlds .hw-p3 .hw-cap { padding-top: 24px; background: linear-gradient(180deg, transparent, rgba(10, 6, 18, 0.95)); }
#worlds .hw-p3 small { color: var(--hw-amber); }
#worlds .hw-ico { position: absolute; top: 7px; left: 7px; width: 32px; height: 32px; border: 2px solid var(--wk-ink); border-radius: 8px; background: rgba(10, 6, 18, 0.7); display: grid; place-items: center; }
#worlds .hw-ico .gi { width: 22px; height: 22px; }
/* a game: flat colour, a pattern, one big icon, no light */
#worlds .hw-p2 { background: var(--hw-c); box-shadow: 0 6px 0 var(--wk-ink); }
#worlds .hw-p2::before { content: ""; position: absolute; inset: 0; background: var(--hw-pat); opacity: 0.5; }
#worlds .hw-big { position: absolute; right: -6px; top: -4px; width: 80px; height: 80px; transform: rotate(-8deg); filter: drop-shadow(3px 3px 0 var(--wk-ink)); }
#worlds .hw-big .gi { width: 100%; height: 100%; }
#worlds .hw-p2 .hw-cap { background: var(--wk-ink); }
#worlds .hw-p2 small { color: var(--hw-green); }
/* (a last one alone on its row runs the width of it, as a short bar) */
#worlds .hw-p2:last-child:nth-child(3n + 1) { grid-column: 1 / -1; height: 70px; }
#worlds .hw-p2:last-child:nth-child(3n + 1) .hw-big { width: 64px; height: 64px; right: 10px; top: 2px; }
#worlds .hw-p2:last-child:nth-child(3n + 1) .hw-cap { top: 0; right: 90px; display: flex; flex-direction: column; justify-content: center; background: none; }
#worlds .hw-p2.locked { filter: grayscale(0.8) brightness(0.7); }
#worlds .hw-p2 .tb { position: absolute; top: 6px; left: 6px; font: 800 11px/1 var(--f-ui); color: var(--wk-ink); background: var(--hw-green); border: 2px solid var(--wk-ink); border-radius: 8px; padding: 3px 6px; }
#worlds .hw-p2 .tb:empty { display: none; }
#worlds .hw-p2 .tb.lock { background: var(--wk-paper); line-height: 0; padding: 3px; }
#worlds .hw-p2 .tb .gi { width: 16px; height: 16px; }

/* ---------- phones: the heroes side by side, small, and one shelf at a time ---------- */
@media (max-width: 720px) {
  #worlds { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 10px; width: calc(100vw - 24px); }
  #worlds .hw-col { display: contents; }
  #worlds .hw-hero { height: 236px; border-radius: 12px; grid-row: 1; }
  #worlds .hw-col2 .hw-hero { grid-column: 2; }
  #worlds .hw-in { padding: 10px; }
  #worlds .hw-hero h2 { font-size: 24px; }
  #worlds .hw-hero p, #worlds .hw-alt { display: none; }
  #worlds .hw-row .hw-btn { width: 100%; min-height: 46px; font-size: 12px; letter-spacing: 0.4px; padding: 0 5px; }
  #worlds .hw-row .hw-btn span { padding: 8px 4px; }
  #worlds .hw-spread { width: 96%; height: 34%; right: 0; top: 40px; }
  #worlds .hw-spread span { width: 44px; height: 44px; border-radius: 10px; box-shadow: 3px 4px 0 var(--wk-ink); }
  #worlds .hw-spread .gi { width: 30px; height: 30px; }
  #worlds .hw-spread .hw-s4, #worlds .hw-spread .hw-s5, #worlds .hw-spread .hw-s6 { display: none; }
  #worlds .hw-gob { height: 36%; bottom: 66px; }
  #worlds .hw-gob3 { right: 2px; }
  #worlds .hw-gob2 { left: 6px; }
  #worlds .hw-h2 .hw-spread { left: 4px; right: auto; width: 84%; top: 40px; }
  #worlds .hw-tabs { display: grid; grid-row: 2; grid-column: 1 / -1; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border: 3px solid var(--wk-ink); border-radius: 12px; background: var(--wk-deep); }
  #worlds .hw-tabs button { min-height: 44px; border: 2px solid transparent; border-radius: 9px; background: none; color: var(--wk-paper); font: 800 12px var(--f-ui); text-transform: uppercase; letter-spacing: 0.6px; display: flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; }
  #worlds .hw-tabs button.on { background: var(--wk-plate); border-color: var(--wk-ink); box-shadow: inset 0 0 0 2px var(--hw-amber); }
  #worlds .hw-tabs button.on[data-tab="2d"] { box-shadow: inset 0 0 0 2px var(--hw-green); }
  #worlds .hw-shelf { grid-row: 3; grid-column: 1 / -1; }
  #worlds .hw-shelf h3 { display: none; }
  #worlds[data-tab="3d"] .hw-shelf2d, #worlds[data-tab="2d"] .hw-shelf3d { display: none; }
  #worlds .hw-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  #worlds .hw-poster { height: 112px; }
  #worlds .hw-p2:last-child:nth-child(3n + 1) { grid-column: auto; height: 112px; }
  #worlds .hw-p2:last-child:nth-child(3n + 1) .hw-big { width: 80px; height: 80px; right: -6px; top: -4px; }
  #worlds .hw-p2:last-child:nth-child(3n + 1) .hw-cap { top: auto; right: 0; display: block; background: var(--wk-ink); }
  #worlds .hw-poster:last-child:nth-child(odd) { grid-column: 1 / -1; height: 84px; }
}
