/* Khazana v9 round 4: folders follow the light or dark theme, 3 to a row on a phone, round logos that stay whole,
   a card deck that never runs off the screen, and the progress ring text no longer overlapping. */

/* ---------- folders: one glass tone from the theme ---------- */
.fdk-row { grid-auto-columns: calc((100% - 2 * 10px) / 3); gap: 10px; }
@container (min-width: 700px) { .fdk-row { grid-auto-columns: calc((100% - 4 * 12px) / 5); gap: 12px; } }
@media (min-width: 900px) { .fdk-row { grid-auto-columns: calc((100% - 5 * 12px) / 6); gap: 12px; } }
.fdk { aspect-ratio: 1.02; }
.fdk-back { inset: 10% 0 0; border-radius: 14px; background: color-mix(in srgb, var(--ink) 9%, var(--surface)); border: 1px solid var(--line); box-shadow: 0 6px 16px rgba(0, 0, 0, .08); }
.fdk-back::before { background: color-mix(in srgb, var(--ink) 9%, var(--surface)); border: 1px solid var(--line); border-bottom: 0; top: -11%; height: 13%; border-radius: 9px 9px 0 0; }
.fdk-paper { position: absolute; left: 10%; right: 10%; top: 16%; height: 40%; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 2px 6px rgba(0, 0, 0, .06); transform: rotate(-3deg); transition: transform .35s cubic-bezier(.2, .9, .2, 1.1); z-index: 1; display: block; }
.fdk:hover .fdk-paper, .fdk:focus-visible .fdk-paper { transform: rotate(-6deg) translateY(-12%); }
.fdk-front { height: 66%; padding: 9px 10px; gap: 2px; border-radius: 14px; justify-content: flex-end;
  background: color-mix(in srgb, var(--surface) 74%, transparent); -webkit-backdrop-filter: blur(12px) saturate(160%); backdrop-filter: blur(12px) saturate(160%);
  border: 1px solid color-mix(in srgb, var(--ink) 12%, transparent); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 6px 14px rgba(0, 0, 0, .08); }
[data-theme="dark"] .fdk-front { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 6px 14px rgba(0, 0, 0, .3); }
.fdk-front b { color: var(--ink); font-size: 13px; text-shadow: none; }
.fdk-front small { color: var(--muted); font-size: 11px; text-shadow: none; }
/* logos sit inside the front of the folder as whole circles */
.fdk-ls { display: flex; align-items: center; gap: 4px; margin-bottom: auto; min-width: 0; }
.fdk-l { width: 30px; height: 30px; flex: none; transform: none; transition: transform .3s cubic-bezier(.2, .9, .2, 1.2); transition-delay: calc(var(--i) * 40ms); }
.fdk:hover .fdk-l, .fdk:focus-visible .fdk-l { transform: translateY(-3px); }
.fdk-l .lg9 { border-radius: 50%; background: #fff; border: 1px solid rgba(0, 0, 0, .08); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.fdk-l .lg9 img { inset: 18%; width: 64%; height: 64%; }
.fdk-l .lg9 i { color: #33363d; font-size: 13px; }
.fdk-more { color: var(--ink-2, var(--ink)); background: color-mix(in srgb, var(--ink) 8%, transparent); border: 1px solid var(--line); font-size: 11px; padding: 2px 6px; }
@media (max-width: 520px) {
  .fdk-front { padding: 8px 8px; }
  .fdk-front b { font-size: 12.5px; }
  .fdk-front small { display: block; font-size: 10.5px; }
  .fdk-l { width: 26px; height: 26px; }
  .fdk-more { font-size: 10px; padding: 1px 5px; }
}

/* ---------- flashcards: the logo shows whole inside a round badge ---------- */
.fc8-ic { border-radius: 50%; overflow: hidden; padding: 0; background: #fff; border: 1px solid rgba(0, 0, 0, .08); }
.fc8-ic .lg9 { border-radius: 50%; box-shadow: none; background: #fff; }
.fc8-ic .lg9 img { inset: 20%; width: 60%; height: 60%; }
.fc8-ic .lg9 i { font-size: 19px; color: #33363d; }
.dk9 .fc8-front .fc8-hint { padding-bottom: 0; padding-right: 34px; }

/* ---------- deck: the spread stays inside its box on every screen ---------- */
.dk9:not(.fan) .dk9-c { --w: 214px; --sx: 18px; width: var(--w); margin-left: calc((var(--w) + 4 * var(--sx)) / -2); transform-origin: 50% 50%;
  transform: translateX(calc(var(--k) * var(--sx))) translateY(calc(var(--k) * 3px)) rotate(calc(var(--k) * 2.2deg)) scale(calc(1 - var(--k) * .025)); }
.dk9:not(.fan) .dk9-c.top { transform: none; }
.dk9:not(.fan) .dk9-c.top.drag { transform: translateX(var(--dx, 0)) rotate(calc(var(--dx, 0px) / 18px * 1deg)); }
@media (max-width: 520px) { .dk9:not(.fan) .dk9-c { --w: 186px; --sx: 13px; } }
@media (max-width: 360px) { .dk9:not(.fan) .dk9-c { --w: 170px; --sx: 10px; } }
@media (max-width: 520px) {
  .dk9.fan { height: 300px; }
  .dk9.fan .dk9-c { width: 170px; margin-left: -85px; transform-origin: 50% 150%; transform: translateX(calc(var(--fx) * .3)) rotate(calc(var(--fa) * .4)) scale(.86); }
  .dk9.fan .dk9-c:hover, .dk9.fan .dk9-c:focus-within { transform: translateX(calc(var(--fx) * .3)) translateY(-18px) rotate(calc(var(--fa) * .4)) scale(.86); }
}

/* ---------- progress ring: number and label no longer touch ---------- */
.ring b { transform: translateY(-7px); }
.ring small { bottom: 24px; }
