/* DHA · colours · the three manual panels as cards with thickness that turn to show their backs, then turn back.
   From the live page (antoniz-release/work/dha/index.html CSS L166–173 + L230–236, dl-d26.js slabs() + once()).
   Finished state = this file alone: three cards front-facing, whole. The run is added by colours.js (WAAPI).
   Uses the kit v2.6 tokens, with fallbacks so the piece also stands alone. */

.dha-colours{
  --card-max:300px;          /* the widest a card gets; override on the root if the page wants larger */
  --edge:#2a3a3d;            /* the card's thickness */
  --d:7px;                   /* thickness */
  --rx:16%; --ry:9.6%;       /* the manual's rounded corner (bottom right), measured from the panel art */
  --rest:-14deg;
  display:block;width:100%;max-width:100%;margin:0;padding:0;box-sizing:border-box;
  container-type:inline-size;container-name:dha-colours;
}
.dha-colours *,.dha-colours *::before,.dha-colours *::after{box-sizing:border-box}

/* the row: always three on one line, never stacked */
.dha-colours__row{
  list-style:none;margin:0;
  /* room above and below for the near edge while a card turns (about 8% of its height) */
  padding:min(42px,4.6cqi) var(--s1,8px);
  display:grid;grid-template-columns:repeat(3,minmax(0,var(--card-max)));justify-content:center;
  gap:var(--s3,24px);align-items:start;
}
.dha-colours__item{margin:0;padding:0;min-width:0}
.dha-colours__fig{margin:0;display:flex;flex-direction:column;align-items:stretch}

/* the card: a picture with a back and four edges */
.dha-colours__card{
  position:relative;display:block;width:100%;
  transform-style:preserve-3d;
  transform:perspective(1100px) rotateY(var(--rest));
}
.dha-colours__card>img{
  position:relative;display:block;width:100%;height:auto;max-width:none;
  transform:translateZ(calc(var(--d) / 2));backface-visibility:hidden;-webkit-backface-visibility:hidden;
}
.dha-colours__card>.sf{position:absolute;display:block;background:var(--edge);pointer-events:none;margin:0}
/* the back: its own bottom LEFT corner sits behind the front's bottom right once it is turned 180° */
.dha-colours__card>.sf-b{
  inset:0;transform:rotateY(180deg) translateZ(calc(var(--d) / 2));
  backface-visibility:hidden;-webkit-backface-visibility:hidden;
  border-bottom-left-radius:var(--rx) var(--ry);
  display:flex;align-items:flex-end;padding:var(--s2,16px) var(--s2,16px) calc(var(--ry) + var(--s1,8px));
}
.dha-colours__card>.sf-l{top:0;bottom:0;left:calc(var(--d) / -2);width:var(--d);transform:rotateY(-90deg)}
.dha-colours__card>.sf-r{top:0;bottom:var(--ry);right:calc(var(--d) / -2);width:var(--d);transform:rotateY(90deg)}
.dha-colours__card>.sf-t{left:0;right:0;top:calc(var(--d) / -2);height:var(--d);transform:rotateX(90deg)}
.dha-colours__card>.sf-u{left:0;right:var(--rx);bottom:calc(var(--d) / -2);height:var(--d);transform:rotateX(-90deg);filter:brightness(.82)}

/* the name on the back: flat colour only, never over the picture. Jost 600, large enough to be "large text" */
.dha-colours__back{
  display:block;font:600 clamp(19px,6cqi,24px)/1.15 var(--display,"Jost",system-ui,sans-serif);
  letter-spacing:.01em;color:#fff;overflow-wrap:break-word;min-width:0;text-wrap:balance;
}
.dha-colours__card.c1>.sf-b{background:#231F20}
.dha-colours__card.c2>.sf-b{background:#008B99}
.dha-colours__card.c3>.sf-b{background:#8CC63F}
.dha-colours__card.c3 .dha-colours__back{color:#04181c}

/* the same name under each card, so the finished state still says it */
.dha-colours__cap{
  margin:min(42px,4.6cqi) 0 0;padding-top:var(--s1,8px);
  font:600 var(--t-small,15px)/1.3 var(--display,"Jost",system-ui,sans-serif);color:inherit;text-wrap:balance;
}

/* smaller rooms: tighter gaps, so three still fit on one line */
@container dha-colours (max-width:560px){
  .dha-colours__row{gap:var(--s2,16px)}
  .dha-colours__card{--d:5px}
  .dha-colours__card>.sf-b{padding:var(--s1,8px) var(--s1,8px) calc(var(--ry) + 4px)}
}
@container dha-colours (max-width:340px){
  .dha-colours__row{gap:var(--s1,8px)}
  .dha-colours__card{--d:4px}
}
