/* Smocza Matematyka — Montessori materials & Polish money (App.mat, js/core/materials.js).
 * Every material element has class .mat; sizes are set inline by the renderers (stage px).
 */

.mat {
  display: inline-block;
  position: relative;
  flex: none;
  line-height: 0;
  vertical-align: middle;
  -webkit-user-select: none;
  user-select: none;
}
.mat > svg {
  display: block;
  /* fills the wrapper, so a module may resize a material by setting the wrapper's width/height */
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* ---------- beads (golden material, coloured bars, squares) ---------- */

.mat-golden > svg,
.mat-bar > svg,
.mat-square > svg {
  filter: drop-shadow(0 1.5px 1px rgba(60, 40, 0, 0.28));
}
.mat-golden-1000 > svg {
  filter: drop-shadow(0 4px 4px rgba(60, 40, 0, 0.3));
}

.mat-stair {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}
.mat-stair.is-left {
  align-items: flex-start;
}

/* ---------- stamp game tiles ---------- */

.mat-stamp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14%;
  background: linear-gradient(160deg, var(--stamp-hi), var(--stamp-bg) 45%, var(--stamp-bg) 70%, var(--stamp-lo));
  color: #fff;
  font-family: var(--font-num);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  text-shadow: 0 0.06em 0 rgba(0, 0, 0, 0.28);
  box-shadow:
    inset 0 0.07em 0 rgba(255, 255, 255, 0.28),
    inset 0 -0.09em 0 rgba(0, 0, 0, 0.22),
    0 2px 0 rgba(0, 0, 0, 0.18),
    0 4px 8px rgba(42, 34, 56, 0.18);
}
.mat-stamp-1000 {
  /* thousands: deeper green + white inner frame so it never looks like a unit */
  box-shadow:
    inset 0 0 0 3px var(--stamp-bg),
    inset 0 0 0 5px rgba(255, 255, 255, 0.75),
    inset 0 -0.09em 0 rgba(0, 0, 0, 0.22),
    0 2px 0 rgba(0, 0, 0, 0.18),
    0 4px 8px rgba(42, 34, 56, 0.18);
}

/* ---------- large number cards ---------- */

.mat-card {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  background: linear-gradient(180deg, #fffefb, #fbf6ea);
  border-radius: 7px;
  font-family: var(--font-num);
  font-weight: 700;
  line-height: 1;
  /* border drawn with an inset shadow so every digit slot is exactly --dw wide */
  box-shadow:
    inset 0 0 0 2px #d9ccae,
    0 2px 0 rgba(42, 34, 56, 0.1),
    0 4px 10px rgba(42, 34, 56, 0.12);
}
.mat-card-digit {
  display: inline-block;
  width: var(--dw);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.mat-cardstack {
  display: inline-block;
  position: relative;
  line-height: 0;
  transition: height 0.55s ease;
}
.mat-cardstack > .mat-card {
  position: absolute;
  right: 0;
  top: 0;
  transition: transform 0.6s cubic-bezier(0.34, 1.25, 0.5, 1), box-shadow 0.4s;
}
.mat-cardstack.is-layered > .mat-card {
  box-shadow:
    inset 0 0 0 2px #d9ccae,
    -2px 0 0 rgba(42, 34, 56, 0.06),
    0 2px 0 rgba(42, 34, 56, 0.08);
}

/* ---------- coloured numerals ---------- */

.mat-num {
  display: inline-flex;
  align-items: flex-start;
  font-family: var(--font-num);
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}
.mat-num-group {
  position: relative;
  display: inline-flex;
}
.mat-num-group + .mat-num-group {
  margin-left: 0.34em;
}
.mat-num.has-labels .mat-num-group {
  flex-direction: column;
  align-items: center;
}
.mat-num.has-labels .mat-num-group + .mat-num-group {
  margin-left: 0.42em;
}
.mat-num-digits {
  position: relative;
  display: inline-flex;
}
.mat-digit {
  display: inline-block;
}
.mat-num-bracket {
  position: absolute;
  left: 0.05em;
  right: 0.05em;
  top: 100%;
  margin-top: 0.1em;
  height: 0.16em;
  border: 0.05em solid #8a7f99;
  border-top: 0;
  border-radius: 0 0 0.08em 0.08em;
}
.mat-num-label-text {
  /* min 14px so the class name stays readable on small numbers */
  font-size: max(14px, 0.3em);
  margin-top: 1.1em; /* own em ≥ 0.3 × number size, clears the bracket */
  padding: 0 0.15em;
  font-weight: 400;
  line-height: 1.1;
  font-family: var(--font);
  white-space: nowrap;
  color: var(--ink-soft, #5d5470);
}

/* ---------- money ---------- */

.mat-coin {
  border-radius: 50%;
}
.mat-coin > svg {
  filter: drop-shadow(0 2px 1.5px rgba(30, 30, 40, 0.3));
}
.mat-note > svg {
  filter: drop-shadow(0 2px 2px rgba(30, 30, 40, 0.22));
}

/* ---------- baby dragon ---------- */

.mat-babydragon > svg {
  filter: drop-shadow(0 2px 1.5px rgba(20, 10, 40, 0.25));
}

/* ---------- bowl / dish (top view) ---------- */

.mat-bowl {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: center;
  justify-content: center;
  gap: 4px;
  line-height: normal; /* padding is set inline from the bowl size */
  border-radius: 50%;
  background:
    radial-gradient(ellipse 60% 55% at 46% 42%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 70%),
    radial-gradient(closest-side, var(--bowl-in) 0%, var(--bowl-in) 55%, var(--bowl-in-2) 74%, var(--bowl-rim) 80%, var(--bowl-rim-dark) 82%, var(--bowl-rim-light) 86%, var(--bowl-rim) 94%, var(--bowl-rim-dark) 100%);
  box-shadow:
    inset 0 0 0 2px var(--bowl-rim-dark),
    0 5px 0 rgba(70, 45, 20, 0.22),
    0 9px 18px rgba(42, 34, 56, 0.2);
}
.mat-bowl.is-tray {
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 40%),
    linear-gradient(180deg, var(--bowl-in), var(--bowl-in-2));
  box-shadow:
    inset 0 0 0 8px var(--bowl-rim),
    inset 0 0 0 10px var(--bowl-rim-dark),
    inset 0 5px 10px 8px rgba(70, 45, 20, 0.18),
    0 5px 0 rgba(70, 45, 20, 0.22),
    0 9px 18px rgba(42, 34, 56, 0.2);
}
