/* Challenge art (js/challenge-art.js): picture covers, tag pills and badges on the Browse challenges cards, and a
   picture banner with the badge on each challenge page. Every rule is scoped under .chal-stage.ca-on, a class the
   script sets once it has started, so with ?classic=1 (or if the script fails) the page looks as it did.
   The pictures keep the prototype's look (dark ground, lime line work, a little white); text, buttons and spacing
   use the room's tokens. */

.ca-defs{position:absolute;width:0;height:0;overflow:hidden;pointer-events:none}

/* ---------------------------------------------------------------- Browse card
   One grid. Row 1 is the cover: the picture bleeds to the card's edges, the state pill and the tags sit on its
   top-left, the badge straddles its lower edge. Then the date line (beside the badge), the title and the add-on's
   own rows, each in a row of its own (spaced by margins, so empty rows cost nothing). A flexible row before the
   foot takes up any spare height, so the foot keeps to the bottom and the rows above line up across a Browse. */
.chal-stage.ca-on .chal-card.ca-card{--ca-cov:140px;--ca-bd:56px;
  display:grid;grid-template-columns:auto minmax(0,1fr);
  grid-template-rows:var(--ca-cov) repeat(8,min-content) minmax(0,1fr) auto;grid-auto-rows:auto;
  align-content:stretch;align-items:start;gap:0}
.chal-stage.ca-on .ca-card>*,.chal-stage.ca-on .ca-card>.ca-top>*{grid-column:1/-1;min-width:0;margin-top:var(--sp-3)}
.chal-stage.ca-on .ca-card>.ca-top{display:contents}
.chal-stage.ca-on .ca-card>.cc-foot{grid-row:-2/-1}

.chal-stage.ca-on .ca-card>.ca-cover{grid-row:1;align-self:stretch;position:relative;z-index:0;overflow:hidden;
  margin:calc(-1 * var(--sp-4)) calc(-1 * var(--sp-4)) 0;border-bottom:1px solid var(--line);
  border-radius:calc(var(--r-md) - 1px) calc(var(--r-md) - 1px) 0 0;background:#1F2227}
.chal-stage.ca-on .ca-cover>svg,.chal-stage.ca-on .ca-ban-art>svg{position:absolute;inset:0;display:block;width:100%;height:100%}

/* pills on the cover: the add-on's state pill first, the type and coin tags under it (beside it on a phone, where a
   card is wide enough for one row) */
.chal-stage.ca-on .ca-card.ca-pt>.ca-top>.chal-pill{grid-row:1;grid-column:1;z-index:1;align-self:start;justify-self:start;
  margin:0;background-color:#0B0B0BE6}
.chal-stage.ca-on .ca-card>.ca-tags{grid-row:1;z-index:1;align-self:start;margin-top:0}
.chal-stage.ca-on .ca-card.ca-pt>.ca-tags{margin-top:30px}
.chal-stage.ca-on .ca-tags{display:flex;flex-wrap:wrap;gap:6px;min-width:0;overflow:hidden}
.chal-stage.ca-on .ca-tag{display:inline-flex;align-items:center;gap:6px;min-height:24px;padding:0 10px;
  border:1px solid #FFFFFF1F;border-radius:var(--r-round);background:#0B0B0BE6;
  font:500 var(--fs-label) var(--font-display);color:var(--text);white-space:nowrap}
.chal-stage.ca-on .ca-dot{flex:none;width:8px;height:8px;border-radius:50%;background:var(--text-muted)}
.chal-stage.ca-on .ca-dot.ca-c-bch{background:var(--coin-bch)}
.chal-stage.ca-on .ca-dot.ca-c-btc{background:var(--coin-btc)}
.chal-stage.ca-on .ca-dot.ca-c-ltc{background:var(--coin-ltc)}
.chal-stage.ca-on .ca-dot.ca-c-doge{background:var(--coin-doge)}

/* the badge straddles the cover's lower-left edge */
.chal-stage.ca-on .ca-badge{display:block;pointer-events:none}
.chal-stage.ca-on .ca-badge>svg{display:block;width:100%;height:100%;filter:drop-shadow(0 6px 12px #00000073)}
.chal-stage.ca-on .ca-card>.ca-badge{grid-row:1;z-index:2;align-self:end;justify-self:start;margin:0;
  width:var(--ca-bd);height:var(--ca-bd);transform:translateY(40%)}

/* the body: date line beside the badge, then a big title, then the add-on's own rows */
.chal-stage.ca-on .ca-card>.cc-when{order:-2;align-self:center;padding-left:calc(var(--ca-bd) + var(--sp-3))}
.chal-stage.ca-on .ca-card>.ca-top>.cc-name{order:-1;min-height:0;margin-top:14px}
.chal-stage.ca-on .ca-card .cc-name .chal-coin{display:none}
.chal-stage.ca-on .ca-card .cc-name h3{font:600 var(--fs-title)/1.25 var(--font-display);letter-spacing:-.01em}
.chal-stage.ca-on .ca-card .cc-goal{min-height:0}
.chal-stage.ca-on .ca-card .cc-goal b{font-size:30px}
.chal-stage.ca-on .ca-card .cc-goal b.tba{font-size:18px}
.chal-stage.ca-on .ca-card>.cc-foot{align-self:end;margin-top:var(--sp-3);border-top:1px solid var(--line);padding-top:var(--sp-3)}

/* a live challenge gets the lime edge, the way the prototype marks it */
.chal-stage.ca-on .ca-card.ca-live{border-color:#D1FE1766}
.chal-stage.ca-on .ca-card.ca-live:hover{border-color:#D1FE17A6}

@media (min-width:821px){
  /* two title lines on every card, so the rows of a Browse line up */
  .chal-stage.ca-on .ca-card .cc-name h3{min-height:2.5em}
}

/* ---------------------------------------------------------------- challenge page banner */
.chal-stage.ca-on .chal-pane.is-page>.ca-ban{position:relative;height:200px;margin-bottom:var(--sp-3)}
.chal-stage.ca-on .ca-ban-art{position:absolute;inset:0;overflow:hidden;border:1px solid var(--line);border-radius:var(--r-md);background:#1F2227}
.chal-stage.ca-on .ca-ban>.ca-tags{position:absolute;top:var(--sp-4);left:var(--sp-5);right:var(--sp-5)}
.chal-stage.ca-on .ca-ban>.ca-badge{position:absolute;left:var(--sp-5);bottom:0;width:76px;height:76px;transform:translateY(30%)}

@media (max-width:820px){
  .chal-stage.ca-on .chal-card.ca-card{--ca-cov:150px}
  .chal-stage.ca-on .chal-pane.is-page>.ca-ban{height:140px}
  .chal-stage.ca-on .ca-ban>.ca-tags{top:var(--sp-3);left:var(--sp-4);right:var(--sp-4)}
  .chal-stage.ca-on .ca-ban>.ca-badge{left:var(--sp-4);width:60px;height:60px}
}
@media (min-width:360px) and (max-width:520px){
  /* one card per row: the pills fit on one line, as on the prototype's phone */
  .chal-stage.ca-on .ca-card.ca-pt>.ca-tags{grid-column:2;margin:0 0 0 6px}
}
