/* الگوی صالح — colour themes + the appearance panel (js/theme.js). Tokens: design-system/MASTER.md §2, §13 */

/* ---------- colour themes (palettes from the eslimi-ornaments skill) ---------- */
html[data-theme="firouzeh"] { /* فیروزه — kashi tiles */
  --mint-500: #3bbfb4; --mint-700: #126b66; --mint-100: #dcf2ef;
  --accent-rgb: 59, 191, 180; --accent-soft-rgb: 220, 242, 239;
  --navy-600: #123e73; --navy-700: #0d2f59; --navy-800: #0d2442; --navy-500: #3d5272; --navy-400: #56657f; --navy-100: #e3eaf2;
  --primary-rgb: 18, 62, 115; --ink-rgb: 13, 36, 66; --shadow-rgb: 13, 36, 66;
  --paper: #f7f1e3;
}
html[data-theme="lajvard"] { /* لاجورد و طلا — manuscript illumination */
  --mint-500: #c8a24a; --mint-700: #7a5b12; --mint-100: #f6ecd2;
  --accent-rgb: 200, 162, 74; --accent-soft-rgb: 246, 236, 210;
  --navy-600: #0f2c59; --navy-700: #0a1f40; --navy-800: #0a1d3b; --navy-500: #3e4a63; --navy-400: #5a6478; --navy-100: #e6e9f0;
  --primary-rgb: 15, 44, 89; --ink-rgb: 10, 29, 59; --shadow-rgb: 10, 29, 59;
  --paper: #f5ebd7;
}
html[data-theme="laki"] { /* لاکی و سرمه‌ای — carpet reds */
  --mint-500: #b8913a; --mint-700: #2e6b5e; --mint-100: #e2eee9;
  --accent-rgb: 184, 145, 58; --accent-soft-rgb: 226, 238, 233;
  --navy-600: #7a1f2b; --navy-700: #621822; --navy-800: #1b2440; --navy-500: #4a4f66; --navy-400: #5e6275; --navy-100: #f3e4e2;
  --primary-rgb: 122, 31, 43; --ink-rgb: 27, 36, 64; --shadow-rgb: 27, 36, 64;
  --paper: #f2e6d0;
}
html[data-theme="shab"] { /* شب و طلا — dark */
  color-scheme: dark;
  --paper: #0e0f12;
  --surface: #1c1e24; --surface-rgb: 28, 30, 36;
  --ink-rgb: 239, 230, 210; --shadow-rgb: 0, 0, 0;
  --rim-o: .22;
  --navy-800: #efe6d2; --navy-500: #c2b9a6; --navy-400: #a39b8a; --navy-100: #2a2c33;
  --navy-600: #d4af5a; --navy-700: #e0c077; --primary-rgb: 212, 175, 90; --on-primary: #17150f;
  --mint-500: #d4af5a; --mint-700: #e3c886; --mint-100: #2e2a1e;
  --accent-rgb: 212, 175, 90; --accent-soft-rgb: 46, 42, 30;
  --amber-100: #3a2e12; --amber-700: #ebc064; --red-100: #3b1b19; --red-700: #f2928a;
  --field-k: .45;
}
html[data-theme="shab"] .brand img,
html[data-theme="shab"] .welcome__logo,
html[data-theme="shab"] .head img { filter: brightness(1.75) saturate(.75); }

/* ---------- triggers ---------- */
.nav-btn {
  display: flex; align-items: center; gap: var(--s-3); width: 100%; min-height: 44px; padding: 0 var(--s-3); margin-top: auto;
  border: 0; border-radius: var(--r-md); background: none; color: var(--navy-500); font-size: .9375rem; font-weight: 500; text-align: start;
  transition: background-color 150ms ease, color 150ms ease;
}
.nav-btn:hover { background: rgba(var(--surface-rgb), .7); color: var(--navy-800); }
.nav-btn + .sidebar__foot { margin-top: var(--s-3); }
.topbar__actions { display: flex; gap: 2px; }
.appearance-fab {
  position: fixed; z-index: 30; inset-inline-end: 20px; inset-block-end: calc(20px + env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: var(--s-2); min-height: 48px; padding: 0 var(--s-4) 0 var(--s-5);
  border-radius: var(--r-full); color: var(--navy-800); font-size: var(--fs-small); font-weight: 600;
  transition: transform 160ms var(--ease-out);
}
.appearance-fab:active { transform: scale(.97); }

/* ---------- the panel ---------- */
.ap {
  position: fixed; z-index: 60; inset-block: 16px; inset-inline-end: 16px; width: 384px; max-width: calc(100vw - 32px);
  display: flex; flex-direction: column; border-radius: var(--r-xl);
  background: rgba(var(--surface-rgb), .82); /* fixed opacity: the panel must stay legible while glass is being tuned */
  -webkit-backdrop-filter: blur(28px) saturate(170%); backdrop-filter: blur(28px) saturate(170%);
  box-shadow: var(--glass-inner), 0 2px 6px rgba(var(--shadow-rgb), .08), 0 30px 60px -24px rgba(var(--shadow-rgb), .35);
  transform: translateX(-24px); opacity: 0; visibility: hidden;
  transition: transform 320ms cubic-bezier(0.32, 0.72, 0, 1), opacity 200ms ease, visibility 0s linear 320ms;
}
[dir="ltr"] .ap { transform: translateX(24px); }
.ap[data-open] { transform: none; opacity: 1; visibility: visible; transition: transform 320ms cubic-bezier(0.32, 0.72, 0, 1), opacity 200ms ease, visibility 0s; }
.ap__head { display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-5) var(--s-5) var(--s-4); border-bottom: 1px solid var(--line); }
.ap__head h2 { font-size: var(--fs-h2); font-weight: 700; line-height: 1.5; }
.ap__head p { font-size: var(--fs-small); color: var(--navy-500); line-height: 1.7; }
.ap__head .icon-btn { margin-inline-start: auto; margin-block-start: -6px; }
.ap__body { flex: 1; overflow-y: auto; padding: var(--s-2) var(--s-5) var(--s-5); overscroll-behavior: contain; }
.ap__sec { padding-block: var(--s-5); }
.ap__sec + .ap__sec { border-top: 1px solid var(--line); }
.ap__sec > h3 { font-size: var(--fs-h3); font-weight: 600; margin-bottom: var(--s-3); }

/* theme swatches */
.ap-themes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s-2); }
.ap-theme { display: grid; justify-items: center; gap: 6px; padding: var(--s-2) 0; border: 0; border-radius: var(--r-md); background: none; font-size: var(--fs-micro); color: var(--navy-500); line-height: 1.4; transition: background-color 150ms ease; }
.ap-theme:hover { background: rgba(var(--ink-rgb), .05); }
.ap-theme__dot { position: relative; width: 40px; height: 40px; border-radius: 50%; background: var(--sw-paper); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); overflow: hidden; transition: transform 160ms var(--ease-out), box-shadow 160ms ease; }
.ap-theme__dot::before { content: ""; position: absolute; inset: 0 0 50% 0; background: var(--sw-primary); }
.ap-theme__dot::after { content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%; inset: 0; margin: auto; background: var(--sw-accent); box-shadow: 0 0 0 2px var(--sw-paper); }
.ap-theme[aria-checked="true"] { color: var(--navy-800); font-weight: 600; }
.ap-theme[aria-checked="true"] .ap-theme__dot { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--navy-600); }
.ap-theme:active .ap-theme__dot { transform: scale(.94); }

/* sliders */
.ap-range { display: grid; gap: var(--s-1); margin-top: var(--s-3); }
.ap-range:first-of-type { margin-top: 0; }
.ap-range__top { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--fs-small); }
.ap-range__top label { font-weight: 500; }
.ap-range__top output { color: var(--navy-400); font-size: var(--fs-micro); }
.ap-range__ends { display: flex; justify-content: space-between; font-size: var(--fs-micro); color: var(--navy-400); }
.ap input[type="range"] {
  --p: 50%;
  -webkit-appearance: none; appearance: none; width: 100%; height: 28px; margin: 0; background: transparent; cursor: pointer; direction: rtl;
}
.ap input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: linear-gradient(to left, var(--navy-600) var(--p), rgba(var(--ink-rgb), .12) var(--p)); }
.ap input[type="range"]::-moz-range-track { height: 6px; border-radius: 6px; background: rgba(var(--ink-rgb), .12); }
.ap input[type="range"]::-moz-range-progress { height: 6px; border-radius: 6px; background: var(--navy-600); }
.ap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 1px rgba(var(--shadow-rgb), .12), 0 2px 6px rgba(var(--shadow-rgb), .25); transition: transform 160ms var(--ease-out);
}
.ap input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px rgba(var(--shadow-rgb), .12), 0 2px 6px rgba(var(--shadow-rgb), .25); }
.ap input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.12); }
.ap input[type="range"]:focus-visible { outline: none; }
.ap input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--navy-600); }

/* motif slots */
.ap-slots { -webkit-mask: linear-gradient(to left, transparent, #000 20px, #000 calc(100% - 20px), transparent); mask: linear-gradient(to left, transparent, #000 20px, #000 calc(100% - 20px), transparent); display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin: var(--s-4) calc(var(--s-5) * -1) var(--s-3); padding-inline: var(--s-5); scrollbar-width: none; }
.ap-slots button { flex: none; min-height: 36px; padding: 0 var(--s-3); border: 1px solid var(--line-strong); border-radius: var(--r-full); background: none; font-size: var(--fs-micro); font-weight: 500; color: var(--navy-500); white-space: nowrap; transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease; }
.ap-slots button:hover { color: var(--navy-800); border-color: rgba(var(--ink-rgb), .3); }
.ap-slots button[aria-selected="true"] { background: var(--navy-600); border-color: var(--navy-600); color: var(--on-primary); }
.ap-motifs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); }
.ap-motif { position: relative; display: grid; gap: 4px; padding: var(--s-2); border: 1px solid var(--line); border-radius: var(--r-md); background: rgba(var(--surface-rgb), .6); text-align: start; font-size: var(--fs-micro); color: var(--navy-500); transition: border-color 150ms ease, background-color 150ms ease, transform 160ms var(--ease-out); }
.ap-motif:hover { border-color: var(--line-strong); background: var(--surface); }
.ap-motif:active { transform: scale(.98); }
.ap-motif__art { height: 76px; border-radius: 10px; background: rgba(var(--ink-rgb), .035); display: grid; place-items: center; overflow: hidden; }
.ap-motif__art i { width: 70%; height: 80%; background: var(--mint-500); -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.ap-motif__art.is-tile i { width: 100%; height: 100%; background: var(--navy-800); opacity: .35; -webkit-mask: var(--m) 0 0 / 38px 38px repeat; mask: var(--m) 0 0 / 38px 38px repeat; }
.ap-motif__art.is-none { background: none; border: 1px dashed var(--line-strong); color: var(--navy-400); }
.ap-motif[aria-checked="true"] { border-color: var(--navy-600); background: var(--surface); color: var(--navy-800); font-weight: 600; box-shadow: 0 0 0 1px var(--navy-600); }
.ap-motif__tick { position: absolute; inset-block-start: 8px; inset-inline-start: 8px; width: 22px; height: 22px; border-radius: 50%; background: var(--navy-600); color: var(--on-primary); display: grid; place-items: center; opacity: 0; transform: scale(.8); transition: opacity 150ms ease, transform 180ms var(--ease-out); }
.ap-motif__tick .icon { width: 14px; height: 14px; stroke-width: 2.2; }
.ap-motif[aria-checked="true"] .ap-motif__tick { opacity: 1; transform: none; }
.ap-loading { padding: var(--s-5) 0; text-align: center; font-size: var(--fs-small); color: var(--navy-400); }

/* footer */
.ap__foot { padding: var(--s-4) var(--s-5) var(--s-5); border-top: 1px solid var(--line); display: grid; gap: var(--s-3); }
.ap__status { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); font-size: var(--fs-micro); color: var(--navy-400); min-height: 28px; }
.ap__status .chip { transition: opacity 150ms ease; }
.ap__status .ap-compare { min-height: 32px; padding: 0 var(--s-3); border: 1px solid var(--line-strong); border-radius: var(--r-full); background: none; font-size: var(--fs-micro); color: var(--navy-500); user-select: none; -webkit-user-select: none; touch-action: none; }
.ap__status .ap-compare:active, .ap__status .ap-compare[data-holding] { background: var(--navy-100); color: var(--navy-800); }
.ap__actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: var(--s-2); }
.ap__reset { justify-self: center; border: 0; background: none; font-size: var(--fs-micro); color: var(--navy-500); text-decoration: underline; text-underline-offset: .3em; min-height: 32px; }
.ap__reset:hover { color: var(--navy-800); }
.ap-toast {
  position: fixed; z-index: 70; inset-inline: 0; margin-inline: auto; width: max-content; max-width: calc(100vw - 32px); inset-block-end: calc(24px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-4); border-radius: var(--r-full);
  background: var(--navy-800); color: var(--paper); font-size: var(--fs-small); box-shadow: 0 10px 30px -10px rgba(var(--shadow-rgb), .4);
  opacity: 0; transform: translateY(8px); transition: opacity 200ms ease, transform 400ms var(--ease-out); pointer-events: none;
}
.ap-toast[data-show] { opacity: 1; transform: none; }

/* smooth theme switching while previewing */
html.ap-previewing body, html.ap-previewing .glass, html.ap-previewing .ground::before { transition: background-color 240ms ease, color 240ms ease, opacity 240ms ease; }

@media (max-width: 639.98px) {
  .ap { inset: auto 0 0 0; width: 100%; max-width: none; max-height: 62dvh; border-radius: 26px 26px 0 0; transform: translateY(24px); padding-bottom: env(safe-area-inset-bottom); }
  [dir="ltr"] .ap { transform: translateY(24px); }
  .ap__head { padding-top: var(--s-6); position: relative; }
  .ap__head::before { content: ""; position: absolute; inset-block-start: 10px; inset-inline: 0; margin: auto; width: 40px; height: 4px; border-radius: 4px; background: rgba(var(--ink-rgb), .18); }
  .ap-themes { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .appearance-fab span { display: none; }
  .appearance-fab { padding: 0; width: 48px; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { .ap, .ap[data-open] { transform: none !important; } }

.ap [hidden] { display: none !important; }

/* ---------- glass style + motion choices ---------- */
.ap-choices { display: grid; gap: var(--s-2); margin-bottom: var(--s-4); }
.ap-choices--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ap-choice {
  display: grid; gap: 4px; align-content: start; padding: var(--s-2); border: 1px solid var(--line); border-radius: var(--r-md);
  background: rgba(var(--surface-rgb), .55); text-align: start; color: var(--navy-500); font-size: var(--fs-micro); line-height: 1.6;
  transition: border-color 150ms ease, background-color 150ms ease, transform 160ms var(--ease-out);
}
.ap-choice b { display: block; font-size: var(--fs-small); font-weight: 600; color: var(--navy-800); }
.ap-choice:hover { border-color: var(--line-strong); background: var(--surface); }
.ap-choice:active { transform: scale(.98); }
.ap-choice[aria-checked="true"] { border-color: var(--navy-600); background: var(--surface); box-shadow: 0 0 0 1px var(--navy-600); }
.ap-choice--row { grid-template-columns: 56px 1fr; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-3) var(--s-2) var(--s-2); }

/* glass style thumbnails: a chip of that glass over a patterned ground */
.ap-gart { position: relative; height: 56px; border-radius: 10px; overflow: hidden; margin-bottom: 4px;
  background:
    radial-gradient(60% 90% at 85% 10%, rgba(var(--accent-rgb), .7), transparent 70%),
    radial-gradient(60% 90% at 10% 100%, rgba(var(--primary-rgb), .55), transparent 70%),
    repeating-linear-gradient(45deg, rgba(var(--ink-rgb), .12) 0 2px, transparent 2px 9px), var(--paper); }
.ap-gart i { position: absolute; inset: 12px 14px; border-radius: 10px; -webkit-backdrop-filter: blur(8px) saturate(180%); backdrop-filter: blur(8px) saturate(180%); }
.ap-gart--liquid i { background: linear-gradient(155deg, rgba(255, 255, 255, .55), rgba(255, 255, 255, .12) 50%), rgba(var(--surface-rgb), .35); border: 1.5px solid rgba(255, 255, 255, .7); box-shadow: inset 0 1.5px 0 #fff, inset 0 0 10px rgba(255, 255, 255, .35), 0 6px 12px -6px rgba(var(--shadow-rgb), .45); }
.ap-gart--clear i { background: rgba(var(--surface-rgb), .12); border: 1.5px solid rgba(255, 255, 255, .8); box-shadow: inset 0 1px 0 #fff; -webkit-backdrop-filter: blur(5px) saturate(200%); backdrop-filter: blur(5px) saturate(200%); }
.ap-gart--frost i { background: rgba(var(--surface-rgb), .78); border: 1px solid rgba(255, 255, 255, .5); }

/* motion thumbnails: three bars that act the motion out when chosen or hovered */
.ap-mart { display: grid; gap: 4px; padding: 8px; height: 48px; border-radius: 10px; background: rgba(var(--ink-rgb), .05); align-content: center; }
.ap-mart i { height: 6px; border-radius: 3px; background: var(--navy-600); opacity: .55; }
.ap-mart i:nth-child(2) { width: 80%; } .ap-mart i:nth-child(3) { width: 60%; }
@media (prefers-reduced-motion: no-preference) {
  .ap-choice[aria-checked="true"] .ap-mart--soft i, .ap-choice:hover .ap-mart--soft i { animation: mart-soft 1.8s var(--ease-out) infinite; }
  .ap-choice[aria-checked="true"] .ap-mart--glass i, .ap-choice:hover .ap-mart--glass i { animation: mart-glass 1.8s var(--ease-out) infinite; }
  .ap-choice[aria-checked="true"] .ap-mart--cascade i, .ap-choice:hover .ap-mart--cascade i { animation: mart-soft 1.8s var(--ease-out) infinite; }
  .ap-mart--cascade i:nth-child(2) { animation-delay: 90ms !important; } .ap-mart--cascade i:nth-child(3) { animation-delay: 180ms !important; }
  @keyframes mart-soft { 0% { opacity: 0; transform: translateY(5px); } 35%, 100% { opacity: .55; transform: none; } }
  @keyframes mart-glass { 0% { opacity: 0; filter: blur(4px); transform: scale(.94); } 40%, 100% { opacity: .55; filter: none; transform: none; } }
}

/* ticks */
.ap-check { display: grid; grid-template-columns: 22px 1fr; gap: var(--s-3); align-items: start; margin-top: var(--s-4); cursor: pointer; font-size: var(--fs-micro); color: var(--navy-500); line-height: 1.6; }
.ap-check b { display: block; font-size: var(--fs-small); font-weight: 500; color: var(--navy-800); }
.ap-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ap-check__box { width: 22px; height: 22px; margin-top: 2px; border-radius: 7px; border: 1.5px solid rgba(var(--ink-rgb), .3); background: var(--surface); display: grid; place-items: center; color: var(--on-primary); transition: background-color 150ms ease, border-color 150ms ease; }
.ap-check__box .icon { width: 14px; height: 14px; stroke-width: 2.4; opacity: 0; transform: scale(.7); transition: opacity 120ms ease, transform 180ms var(--ease-out); }
.ap-check input:checked + .ap-check__box { background: var(--navy-600); border-color: var(--navy-600); }
.ap-check input:checked + .ap-check__box .icon { opacity: 1; transform: none; }
.ap-check input:focus-visible + .ap-check__box { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--navy-600); }
.ap-replay { margin-top: var(--s-4); }
.ap-replay .icon { width: 16px; height: 16px; }

/* slot caption + placement choices */
.ap-where { margin: 0 0 var(--s-3); font-size: var(--fs-micro); line-height: 1.7; color: var(--navy-500); padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); background: rgba(var(--accent-soft-rgb), .7); }
.ap-extra { margin-top: var(--s-4); }
.ap-sub { font-size: var(--fs-small); font-weight: 500; margin: var(--s-3) 0 var(--s-2); }
.ap-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.ap-pill { min-height: 36px; padding: 0 var(--s-3); border: 1px solid var(--line-strong); border-radius: var(--r-full); background: rgba(var(--surface-rgb), .6); font-size: var(--fs-micro); font-weight: 500; color: var(--navy-500); transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease, transform 160ms var(--ease-out); }
.ap-pill:hover { color: var(--navy-800); border-color: rgba(var(--ink-rgb), .3); }
.ap-pill:active { transform: scale(.97); }
.ap-pill[aria-checked="true"] { background: var(--navy-600); border-color: var(--navy-600); color: var(--on-primary); }
.ap-extra .ap-check { margin-top: 0; }

/* lachak corner picker: a little frame, one button per corner */
.ap-corners {
  position: relative; height: 150px; margin-bottom: var(--s-3); border-radius: 18px;
  background: linear-gradient(155deg, rgba(var(--surface-rgb), .9), rgba(var(--surface-rgb), .55)), rgba(var(--accent-soft-rgb), .6);
  box-shadow: inset 0 0 0 1px var(--line-strong), inset 0 1px 0 rgba(var(--rim-rgb), .8);
}
.ap-corners::before { content: ""; position: absolute; inset: 34px 70px; border-radius: 8px; border: 1px dashed var(--line-strong); }
.ap-corners__label { position: absolute; inset: 0; display: grid; place-items: center; font-size: var(--fs-micro); color: var(--navy-500); pointer-events: none; }
.ap-corner {
  position: absolute; width: 62px; height: 62px; padding: 6px; border: 0; border-radius: 14px; background: transparent;
  transition: background-color 150ms ease, box-shadow 150ms ease, transform 160ms var(--ease-out);
}
.ap-corner--tr { top: 6px; right: 6px; } .ap-corner--tl { top: 6px; left: 6px; }
.ap-corner--br { bottom: 6px; right: 6px; } .ap-corner--bl { bottom: 6px; left: 6px; }
.ap-corner i { display: block; width: 100%; height: 100%; background: var(--orn-ink); -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.ap-corner.is-empty i { -webkit-mask: none; mask: none; background: none; border: 1.5px dashed rgba(var(--ink-rgb), .28); border-radius: 10px; position: relative; }
.ap-corner.is-empty i::after { content: "خالی"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-style: normal; color: var(--navy-400); }
.ap-corner:hover { background: rgba(var(--surface-rgb), .8); }
.ap-corner:active { transform: scale(.95); }
.ap-corner[aria-checked="true"] { background: var(--surface); box-shadow: 0 0 0 2px var(--navy-600), 0 6px 14px -8px rgba(var(--shadow-rgb), .4); }
.ap-lk-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--s-2); }
.ap-motif__art.is-corner { place-items: initial; display: flex; padding: 6px; }
.ap-motif__art.is-corner i { width: 58px; height: 58px; background: var(--orn-ink); }
.ap-motif__art.is-tr { justify-content: flex-start; align-items: flex-start; }  /* RTL: start = right */
.ap-motif__art.is-tl { justify-content: flex-end; align-items: flex-start; }
.ap-motif__art.is-br { justify-content: flex-start; align-items: flex-end; }
.ap-motif__art.is-bl { justify-content: flex-end; align-items: flex-end; }
.ap-motif__art.is-corner.is-none { display: grid; place-items: center; font-size: var(--fs-micro); }

/* ---------- buttons & menu section ---------- */
.ap-choices--btn { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ap-bart { display: flex; gap: 6px; justify-content: center; align-items: center; height: 52px; border-radius: 10px; margin-bottom: 4px;
  background: radial-gradient(70% 120% at 85% 0%, rgba(var(--accent-rgb), .35), transparent 70%), rgba(var(--ink-rgb), .04); }
.ap-bart i { font-style: normal; font-size: 11px; font-weight: 600; line-height: 1; padding: 8px 10px; border-radius: 9px; border: 1px solid transparent; }
.ap-bart i:first-child { background: var(--btn); color: var(--btn-fg); }
.ap-bart i:last-child { background: rgba(var(--surface-rgb), .7); color: var(--navy-800); border-color: var(--line); }
[data-btn-demo="default"] i:first-child { background-image: linear-gradient(180deg, rgba(255, 255, 255, .2), transparent 55%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 4px 10px -5px color-mix(in srgb, var(--btn) 60%, transparent); }
[data-btn-demo="mac"] i { border-radius: 999px; }
[data-btn-demo="mac"] i:first-child { background: linear-gradient(180deg, rgba(255, 255, 255, .32), rgba(255, 255, 255, .04) 52%), color-mix(in srgb, var(--btn) 84%, transparent); border-color: rgba(255, 255, 255, .35); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 4px 10px -5px color-mix(in srgb, var(--btn) 70%, transparent); }
[data-btn-demo="mac"] i:last-child { background: linear-gradient(180deg, rgba(var(--rim-rgb), .6), rgba(var(--rim-rgb), .15)), rgba(var(--surface-rgb), .4); border-color: rgba(var(--rim-rgb), .7); box-shadow: inset 0 1px 0 rgba(var(--rim-rgb), .9); }
[data-btn-demo="flat"] i:last-child { background: rgba(var(--ink-rgb), .07); border-color: transparent; }
[data-btn-demo="outline"] i:first-child { background: transparent; color: var(--btn); border: 1.5px solid var(--btn); }
[data-btn-demo="outline"] i:last-child { background: transparent; border: 1.5px solid var(--line-strong); }
[data-btn-demo="tonal"] i:first-child { background: color-mix(in srgb, var(--btn) 15%, transparent); color: var(--btn); }
[data-btn-demo="tonal"] i:last-child { border-color: transparent; }

/* menu effect samples: three items and a moving marker */
.ap-nart { position: relative; display: grid; gap: 4px; padding: 6px; height: 52px; border-radius: 10px; background: rgba(var(--ink-rgb), .05); align-content: center; }
.ap-nart i { position: relative; z-index: 1; height: 8px; border-radius: 3px; margin-inline: 6px; background: rgba(var(--ink-rgb), .22); }
.ap-nart b { position: absolute; inset-inline: 4px; top: 4px; height: 14px; border-radius: 6px; transform: translateY(0); }
.ap-nart--glide b { background: var(--surface); box-shadow: 0 1px 3px rgba(var(--shadow-rgb), .2), inset 0 1px 0 #fff; }
.ap-nart--glow b { background: color-mix(in srgb, var(--btn) 8%, rgba(var(--surface-rgb), .6)); box-shadow: inset 0 -2px 0 var(--nav-line), 0 3px 6px -2px color-mix(in srgb, var(--nav-line) 60%, transparent); }
.ap-nart--line b { background: none; box-shadow: inset -3px 0 0 var(--nav-line); }
.ap-nart--none b { background: var(--surface); }
@media (prefers-reduced-motion: no-preference) {
  .ap-choice[aria-checked="true"] .ap-nart:not(.ap-nart--none) b, .ap-choice:hover .ap-nart:not(.ap-nart--none) b { animation: nart 2.4s cubic-bezier(0.23, 1, 0.32, 1) infinite; }
  .ap-choice[aria-checked="true"] .ap-nart--none b, .ap-choice:hover .ap-nart--none b { animation: nart-jump 2.4s steps(1) infinite; }
  @keyframes nart { 0%, 30% { transform: translateY(0); } 45% { transform: translateY(6px) scaleY(1.25); } 60%, 100% { transform: translateY(12px); } }
  @keyframes nart-jump { 0%, 49% { transform: translateY(0); } 50%, 100% { transform: translateY(12px); } }
}
/* custom button colour */
.ap-color { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 var(--s-3) 0 6px; border: 1px solid var(--line-strong); border-radius: var(--r-full); font-size: var(--fs-micro); font-weight: 500; color: var(--navy-500); cursor: pointer; }
.ap-color input { width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.ap-color input::-webkit-color-swatch-wrapper { padding: 0; }
.ap-color input::-webkit-color-swatch { border: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.ap-color input::-moz-color-swatch { border: 0; border-radius: 50%; }
.ap-color[data-on="true"] { border-color: var(--pick); box-shadow: 0 0 0 1px var(--pick); color: var(--navy-800); }
.ap-color:focus-within { outline: 2px solid var(--navy-600); outline-offset: 2px; }

/* the admin decides the look for everyone (N-19): no personal appearance button */
html[data-appearance-locked] [data-appearance-open] { display: none !important; }
