/*
 * ASL v4 — the Arabic heritage layer (docs/asl-v4.md §4.1). Loaded by the studio only, after
 * app.css, studio.css and quest.css, so it restyles without touching the classic workspace, the
 * admin console or the organisation console.
 *
 * Five motifs, used with restraint (design canvas "ASL v4 — Arabic heritage restyle"):
 *   khatam   the eight-pointed star (two squares): Najm, the prompt's stars, badges, the logo mark
 *   arch     the pointed arch framing each mode's icon and today's challenge
 *   band     a hairline chain of lozenges under the top bar, nowhere else
 *   astrolabe  tick marks around the power arc (quest.js draws them)
 *   shamsa   one sun medallion behind the home title, at 9% — never behind text that must be read
 * Rules: ornament sits on edges, not behind reading text; one ornament per screen region; gold
 * (#D9B26A) is for what the user has earned, antique gold (#6E5E3A) for ornament lines, the logo's
 * azure for actions. Reem Kufi (a geometric Kufi with Latin) for titles, ranks and card names only;
 * IBM Plex Sans Arabic for everything else.
 */
:root {
  --background: #0D1522;
  --surface-raised: #14223A;
  --border: #2A4058;
  --star: #D9B26A;
  --star-deep: #A8853F;
  --ornament: #6E5E3A;
  --star-wash: color-mix(in srgb, var(--star) 6%, var(--surface-raised));
  --font-heritage: "Reem Kufi", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --font-display: var(--font-heritage);
}
body { background: var(--background); }

/* ---------------------------------------------------------------- titles in Kufi */
.studio-brand span, .studio-title, .qcard-head strong, .rank-name, .levelup .display, .drawer-head .sub,
.pq .gauge-tier, .daily h3, .drawer-sub { font-family: var(--font-heritage); }
.studio-brand span { font-size: 24px; font-weight: 600; letter-spacing: 0; }
.studio-title { font-weight: 600; }
:lang(ar) .studio-title { font-weight: 600; }
.qcard-head strong { font-size: 17px; }
.drawer-sub { font-weight: 600; }
.studio-brand .mark { inline-size: 28px; block-size: 28px; background: none; border-radius: 0; }

/* ---------------------------------------------------------------- band: a hairline under the top bar */
.studio-top::after { content: ""; position: absolute; inset-inline: 0; inset-block-end: -11px; block-size: 10px; pointer-events: none; opacity: .5;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='10'%3E%3Cpath d='M0 5L5 0L10 5L5 10Z M10 5L15 0L20 5L15 10Z' fill='none' stroke='%23D9B26A' stroke-width='0.6'/%3E%3Ccircle cx='10' cy='5' r='0.9' fill='%23D9B26A'/%3E%3C/svg%3E") repeat-x; }
.studio-top { border-block-end-color: #22344C; }

/* ---------------------------------------------------------------- shamsa: the home title's medallion */
.studio-main:not(.has-mode) .modes { position: relative; isolation: isolate; }
.studio-main:not(.has-mode) .studio-title { position: relative; padding-block: var(--space-8); }
.studio-main:not(.has-mode) .studio-title::before { content: ""; position: absolute; z-index: -1; inset-block-start: 50%; inset-inline-start: 50%;
  inline-size: 300px; block-size: 300px; translate: -50% -50%; opacity: .09; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 300'%3E%3Cg fill='none' stroke='%23D9B26A' stroke-width='1'%3E%3Cpath d='M150 6L192.2 48.2L251.8 48.2L251.8 107.8L294 150L251.8 192.2L251.8 251.8L192.2 251.8L150 294L107.8 251.8L48.2 251.8L48.2 192.2L6 150L48.2 107.8L48.2 48.2L107.8 48.2Z'/%3E%3Cpath d='M150 36L182.2 67.8L227.6 67.8L227.6 113.2L259 150L227.6 186.8L227.6 232.2L182.2 232.2L150 264L117.8 232.2L72.4 232.2L72.4 186.8L41 150L72.4 113.2L72.4 67.8L117.8 67.8Z'/%3E%3Ccircle cx='150' cy='150' r='86'/%3E%3Ccircle cx='150' cy='150' r='80'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat; }
[dir="rtl"] .studio-main:not(.has-mode) .studio-title::before { translate: 50% -50%; }

/* ---------------------------------------------------------------- arch: the mode icons */
.studio-main:not(.has-mode) .mode-ico { inline-size: 64px; block-size: 72px; border-radius: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 72'%3E%3Cpath d='M6 71V34C6 18 20 8 32 2C44 8 58 18 58 34V71' fill='%230F1A2C' stroke='%236E5E3A' stroke-width='1.2'/%3E%3C/svg%3E") center / contain no-repeat; padding-block-start: 14px; box-sizing: border-box; }
.studio-main:not(.has-mode) .mode-tile:hover .mode-ico { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 72'%3E%3Cpath d='M6 71V34C6 18 20 8 32 2C44 8 58 18 58 34V71' fill='%230F1A2C' stroke='%23A8853F' stroke-width='1.2'/%3E%3C/svg%3E"); }
.mode-tile { border-radius: var(--radius-lg); }
.has-mode .mode-ico { background: transparent; }
.has-mode .mode-tile.on .mode-ico { background: transparent; color: var(--accent); }

/* today's challenge on the home screen, under the modes: a rule with a khatam at each end */
.home-daily { display: flex; align-items: center; gap: 14px; inline-size: 100%; max-inline-size: 47.5rem; margin-block-start: var(--space-6);
  color: var(--text-muted); font-size: 15px; line-height: 24px; text-align: center; }
.home-daily::before, .home-daily::after { content: ""; flex: 1; min-inline-size: 24px; block-size: 14px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2L14.93 4.93L19.07 4.93L19.07 9.07L22 12L19.07 14.93L19.07 19.07L14.93 19.07L12 22L9.07 19.07L4.93 19.07L4.93 14.93L2 12L4.93 9.07L4.93 4.93L9.07 4.93Z' fill='none' stroke='%23D9B26A' stroke-width='1.4'/%3E%3C/svg%3E") no-repeat, linear-gradient(#22344C, #22344C) no-repeat; }
.home-daily::before { background-position: right center, left center; background-size: 14px 14px, calc(100% - 22px) 1px; }
.home-daily::after { background-position: left center, right center; background-size: 14px 14px, calc(100% - 22px) 1px; }
[dir="rtl"] .home-daily::before { background-position: left center, right center; }
[dir="rtl"] .home-daily::after { background-position: right center, left center; }
.home-daily .plus { font-size: 15px; }
.home-daily.done { opacity: .7; }

/* ---------------------------------------------------------------- the coach */
.pq { background: color-mix(in srgb, var(--surface-raised) 60%, var(--background)); }
.pq.tier-legend { border-color: var(--ornament); }
.pq .gauge .arc { inline-size: 7rem; block-size: 4.2rem; }
.pq-head { grid-template-columns: 7rem minmax(0, 1fr) auto; }
.pq .gauge-n { inset-block-start: 1.7rem; font-size: 24px; }
.pq .gauge-tier { font-size: 15px; }
.pq .arc-track, .pq .arc-fill { stroke-width: 6; }
.arc-tick { stroke: var(--ornament); stroke-width: 1; fill: none; }
.arc.tier-legend .arc-tick { stroke: var(--star-deep); }
.say { border-radius: 12px; }
/* the divider between Najm and the cards: a rule with a khatam in the middle */
.pq-body { position: relative; padding-block-start: var(--space-4); border-block-start: 1px solid #22344C; margin-block-start: var(--space-4); }
.pq-body::before { content: ""; position: absolute; inset-block-start: -6px; inset-inline-start: 50%; translate: -50% 0; inline-size: 24px; block-size: 11px;
  background: color-mix(in srgb, var(--surface-raised) 60%, var(--background)) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2L14.93 4.93L19.07 4.93L19.07 9.07L22 12L19.07 14.93L19.07 19.07L14.93 19.07L12 22L9.07 19.07L4.93 19.07L4.93 14.93L2 12L4.93 9.07L4.93 4.93L9.07 4.93Z' fill='%236E5E3A'/%3E%3C/svg%3E") center / 11px 11px no-repeat; }
.pq.closed .pq-body::before { display: none; }
[dir="rtl"] .pq-body::before { translate: 50% 0; }
.qcard { border-radius: 12px; }
.qcard-head svg.star { inline-size: 16px; block-size: 16px; }
.gremlin { border-style: dashed; border-color: color-mix(in srgb, var(--alert) 40%, var(--border)); }

/* ---------------------------------------------------------------- the Quest drawer and the moments */
.rank-name { font-size: 28px; line-height: 40px; font-weight: 600; }
.daily { position: relative; margin-block-start: var(--space-4); padding-block-start: var(--space-6); border-style: solid; border-color: var(--ornament); border-radius: 4px 4px 12px 12px; }
.daily::before { content: ""; position: absolute; inset-block-start: -12px; inset-inline-start: 50%; translate: -50% 0; inline-size: 120px; block-size: 22px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 22'%3E%3Cpath d='M0 22H38C48 22 54 10 60 1C66 10 72 22 82 22H120' fill='%2314223A' stroke='%236E5E3A' stroke-width='1'/%3E%3Cpath d='M60 9l2 2-2 2-2-2z' fill='%23D9B26A'/%3E%3C/svg%3E") center / contain no-repeat; }
[dir="rtl"] .daily::before { translate: 50% 0; }
.daily.done { border-color: var(--border); }
.qbadge { border-radius: 10px; justify-items: center; text-align: center; }
.qbadge.on { border-color: var(--ornament); background: transparent; }
.qbadge svg.star { inline-size: 28px; block-size: 28px; }
.levelup { border-color: var(--ornament); }
.lvl-star { position: relative; inline-size: 150px; block-size: 150px; margin-inline: auto; display: grid; place-items: center;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 150 150'%3E%3Cg fill='none' stroke='%236E5E3A' stroke-width='0.8'%3E%3Ccircle cx='75' cy='75' r='72'/%3E%3Ccircle cx='75' cy='75' r='66'/%3E%3Cpath d='M75 12L95 30L120 30L120 55L138 75L120 95L120 120L95 120L75 138L55 120L30 120L30 95L12 75L30 55L30 30L55 30Z'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat; }
.levelup .lede { color: var(--star); }
.xp-chip { border-color: #3A3426; }
.xp-chip:hover { border-color: var(--ornament); }
.quest-toast { border-color: var(--ornament); }

@media (max-width: 640px) {
  .studio-main:not(.has-mode) .studio-title::before { inline-size: 220px; block-size: 220px; }
  .pq-head { grid-template-columns: 5.25rem minmax(0, 1fr) auto; }
  .pq .gauge .arc { inline-size: 5.25rem; block-size: 3.2rem; }
  .pq .gauge-n { inset-block-start: 1.2rem; font-size: 20px; }
  .home-daily { font-size: 14px; }
}
