/* Khazana v9 round 5: the first folder design is back (tool logos fan out of the folder), now with a liquid glass front
   that follows the light or dark theme. One sliding row: 3 folders on a phone, 6 on a laptop. Flashcards use more of the width. */

/* ---------- folders: one sliding row ---------- */
.fd9-row { display: grid; grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: calc((100% - 2 * 12px) / 3); gap: 12px;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 58px 2px 8px; margin: 0 -2px; }
.fd9-row::-webkit-scrollbar { display: none; }
.fd9w { scroll-snap-align: start; }
@media (min-width: 700px) { .fd9-row { grid-auto-columns: calc((100% - 4 * 14px) / 5); gap: 14px; padding-top: 78px; } }
@media (min-width: 900px) { .fd9-row { grid-auto-columns: calc((100% - 5 * 14px) / 6); } }
@media (max-width: 520px) { .fd9-row { grid-template-columns: none; } }

/* ---------- liquid glass, light theme ---------- */
.fd9 { max-width: 172px; }
.fd9-back { background: linear-gradient(160deg, color-mix(in srgb, var(--c) 42%, var(--surface)), color-mix(in srgb, var(--c) 26%, var(--surface)));
  border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); box-shadow: 0 10px 24px color-mix(in srgb, var(--c) 22%, transparent); }
.fd9-front { background:
    radial-gradient(120% 70% at 20% 0%, rgba(255, 255, 255, .75), rgba(255, 255, 255, 0) 55%),
    linear-gradient(145deg, color-mix(in srgb, var(--c) 14%, rgba(255, 255, 255, .62)), color-mix(in srgb, var(--c) 8%, rgba(255, 255, 255, .34)));
  -webkit-backdrop-filter: blur(16px) saturate(180%) brightness(1.05); backdrop-filter: blur(16px) saturate(180%) brightness(1.05);
  border: 1px solid rgba(255, 255, 255, .7);
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .95), inset 0 -10px 18px color-mix(in srgb, var(--c) 10%, transparent), inset 0 0 0 .5px rgba(255, 255, 255, .4), 0 8px 20px rgba(0, 0, 0, .12); }
.fd9-front::after { content: ''; position: absolute; left: 10%; right: 40%; top: 5px; height: 30%; border-radius: 50%; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0)); filter: blur(1px); }
.fd9-front b { color: var(--ink); text-shadow: none; position: relative; z-index: 1; }
.fd9-front small { color: var(--muted); text-shadow: none; position: relative; z-index: 1; }
.fd9-front .fd9-ic { color: var(--c); opacity: 1; z-index: 1; }

/* ---------- liquid glass, dark theme ---------- */
[data-theme="dark"] .fd9-back { background: linear-gradient(160deg, color-mix(in srgb, var(--c) 46%, #0d0f16), color-mix(in srgb, var(--c) 26%, #0d0f16));
  border-color: color-mix(in srgb, var(--c) 40%, transparent); box-shadow: 0 10px 26px rgba(0, 0, 0, .5); }
[data-theme="dark"] .fd9-front { background:
    radial-gradient(120% 70% at 20% 0%, rgba(255, 255, 255, .16), rgba(255, 255, 255, 0) 55%),
    linear-gradient(145deg, color-mix(in srgb, var(--c) 22%, rgba(22, 24, 34, .72)), color-mix(in srgb, var(--c) 10%, rgba(14, 16, 24, .55)));
  border-color: rgba(255, 255, 255, .16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), inset 0 -10px 18px rgba(0, 0, 0, .25), 0 8px 22px rgba(0, 0, 0, .45); }
[data-theme="dark"] .fd9-front::after { background: linear-gradient(180deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, 0)); }
[data-theme="dark"] .fd9-front .fd9-ic { color: color-mix(in srgb, var(--c) 55%, #fff); }

/* logos stay whole circles */
.fd9-l .lg9 { border-radius: 50%; }
.fd9-l .lg9 img { inset: 18%; width: 64%; height: 64%; }

/* ---------- phone: 3 to a row, everything scaled to fit ---------- */
@media (max-width: 520px) {
  .fd9-l { width: 34px; height: 34px; margin-left: -17px; top: 22%; }
  .fd9:hover .fd9-l, .fd9:focus-visible .fd9-l { transform: translate(calc(var(--a) * 26px), -44px) rotate(calc(var(--a) * 12deg)); }
  .fd9-front { padding: 7px 8px; }
  .fd9-front b { font-size: 12.5px; }
  .fd9-front small { font-size: 10.5px; }
  .fd9-front .fd9-ic { top: 6px; right: 7px; }
  .fd9-front .fd9-ic svg { width: 15px; height: 15px; }
  .fd9-tags { display: none; }
}

/* ---------- flashcards: wider, small margin at the sides ---------- */
.dk9:not(.fan) .dk9-c { --sx: 12px; --w: min(300px, calc(100% - 4 * var(--sx) - 16px)); }
@media (max-width: 520px) { .dk9:not(.fan) .dk9-c { --sx: 9px; --w: calc(100% - 4 * var(--sx) - 24px); } }
/* the wider card keeps about the same height, so it never covers the buttons under the deck */
.dk9:not(.fan) .fc8-in { aspect-ratio: 6 / 5; }
