/* ===== Amond — Liquid Glass design tokens & primitives ===== */
@font-face { font-family: 'Vazirmatn'; src: url('/fonts/Vazirmatn-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url('/fonts/Vazirmatn-Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url('/fonts/Vazirmatn-SemiBold.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url('/fonts/Vazirmatn-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --font: 'Vazirmatn', 'Segoe UI', Tahoma, system-ui, sans-serif;
  --radius-xl: 28px; --radius-lg: 20px; --radius-md: 14px; --radius-sm: 10px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-liquid: cubic-bezier(.34, 1.56, .64, 1);

  /* light theme (almond / rose-gold) */
  --bg: #f4ede4;
  --bg-2: #efe4d8;
  --text: #2a211c;
  --muted: #74675f;
  --line: rgba(255, 255, 255, .62);
  --line-strong: rgba(255, 255, 255, .9);
  --glass: rgba(255, 255, 255, .40);
  --glass-strong: rgba(255, 255, 255, .62);
  --glass-weak: rgba(255, 255, 255, .22);
  --glass-tint: rgba(255, 245, 238, .35);
  --shadow: 0 12px 40px rgba(70, 45, 30, .14), 0 2px 6px rgba(70, 45, 30, .06);
  --shadow-soft: 0 6px 24px rgba(70, 45, 30, .10);
  --highlight: rgba(255, 255, 255, .85);
  --accent: #c4836e;
  --accent-2: #e5b9a5;
  --accent-ink: #fff;
  --accent-grad: linear-gradient(135deg, #c98a74 0%, #e3b6a2 55%, #f0d2c3 100%);
  --gold: #cfae7a;
  --danger: #c0564f;
  --success: #4f8f66;
  --warn: #c48f2e;
  --blob-1: #f0b8bd; --blob-2: #e5c79a; --blob-3: #bfd0bb; --blob-4: #f6d3c1;
  --overlay: rgba(28, 20, 16, .55);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #161210;
  --bg-2: #1d1715;
  --text: #f3eae3;
  --muted: #b3a59c;
  --line: rgba(255, 255, 255, .13);
  --line-strong: rgba(255, 255, 255, .28);
  --glass: rgba(40, 32, 29, .46);
  --glass-strong: rgba(48, 38, 34, .70);
  --glass-weak: rgba(40, 32, 29, .28);
  --glass-tint: rgba(60, 40, 36, .30);
  --shadow: 0 14px 44px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .3);
  --shadow-soft: 0 6px 24px rgba(0, 0, 0, .35);
  --highlight: rgba(255, 255, 255, .22);
  --accent: #d9a08a;
  --accent-2: #b97a66;
  --accent-ink: #1c120e;
  --accent-grad: linear-gradient(135deg, #d9a08a 0%, #c4836e 60%, #a96b58 100%);
  --gold: #d6b581;
  --blob-1: #6a3540; --blob-2: #6a5330; --blob-3: #33473a; --blob-4: #5a3a30;
  --overlay: rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); color: var(--text); background: var(--bg);
  line-height: 1.7; font-size: 15.5px; -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "kern";
  overflow-x: hidden;
}
img, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
::selection { background: rgba(201, 138, 116, .35); }

/* ---------- animated liquid background ---------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(120% 90% at 50% -10%, var(--bg-2), var(--bg) 60%); }
.bg .blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .85; will-change: transform; animation: float 26s ease-in-out infinite; }
.bg .b1 { width: 48vmax; height: 48vmax; background: var(--blob-1); top: -18vmax; right: -12vmax; }
.bg .b2 { width: 42vmax; height: 42vmax; background: var(--blob-2); bottom: -16vmax; left: -10vmax; animation-delay: -8s; animation-duration: 32s; }
.bg .b3 { width: 34vmax; height: 34vmax; background: var(--blob-3); top: 38%; left: 28%; animation-delay: -15s; animation-duration: 38s; opacity: .7; }
.bg .b4 { width: 26vmax; height: 26vmax; background: var(--blob-4); top: 12%; left: 8%; animation-delay: -4s; animation-duration: 29s; opacity: .75; }
.bg::after { content: ""; position: absolute; inset: 0; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); opacity: .06; mix-blend-mode: overlay; pointer-events: none; }
@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  33% { transform: translate3d(4vmax, 3vmax, 0) scale(1.08); }
  66% { transform: translate3d(-3vmax, 5vmax, 0) scale(.94); }
}
@media (prefers-reduced-motion: reduce) { .bg .blob { animation: none; } }

/* ---------- glass primitive ---------- */
.glass {
  position: relative; isolation: isolate;
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow), inset 0 1px 0 var(--highlight), inset 0 -1px 0 rgba(255, 255, 255, .08);
}
.glass::before { /* specular sheen */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  background: linear-gradient(135deg, rgba(255, 255, 255, .35) 0%, rgba(255, 255, 255, .05) 35%, rgba(255, 255, 255, 0) 60%, rgba(255, 255, 255, .12) 100%);
}
.glass-strong { background: var(--glass-strong); }
.glass-weak { background: var(--glass-weak); }
.glass-tint { background: var(--glass-tint); }

/* liquid hover: a soft light spot follows the pointer (set by JS via --mx/--my) */
.liquid { overflow: hidden; }
.liquid::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .5s var(--ease);
  background: radial-gradient(180px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, .40), rgba(255, 255, 255, 0) 60%);
  mix-blend-mode: soft-light;
}
.liquid:hover::after { opacity: 1; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .72rem 1.35rem; border-radius: 999px; border: 1px solid var(--line);
  background: var(--glass-strong); color: var(--text); font-weight: 600; font-size: .95rem; line-height: 1.2;
  -webkit-backdrop-filter: blur(14px) saturate(160%); backdrop-filter: blur(14px) saturate(160%);
  box-shadow: var(--shadow-soft), inset 0 1px 0 var(--highlight);
  transition: transform .35s var(--ease-liquid), box-shadow .35s var(--ease), background .3s;
  position: relative; overflow: hidden; white-space: nowrap; user-select: none;
}
.btn:hover { transform: translateY(-2px) scale(1.02); box-shadow: var(--shadow), inset 0 1px 0 var(--highlight); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent-grad); color: var(--accent-ink); border-color: rgba(255, 255, 255, .55); text-shadow: 0 1px 0 rgba(255, 255, 255, .18); }
:root[data-theme="dark"] .btn-primary { text-shadow: none; }
.btn-danger { color: #fff; background: linear-gradient(135deg, #cf6b62, #b64a43); border-color: rgba(255, 255, 255, .35); }
.btn-ghost { background: transparent; box-shadow: none; border-color: transparent; }
.btn-ghost:hover { background: var(--glass-weak); }
.btn-sm { padding: .45rem .9rem; font-size: .85rem; }
.btn-icon { width: 42px; height: 42px; padding: 0; border-radius: 50%; }
.btn svg { width: 1.15em; height: 1.15em; flex: none; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label { font-size: .86rem; font-weight: 600; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; padding: .68rem .95rem; border-radius: var(--radius-md);
  border: 1px solid var(--line); background: var(--glass-weak); color: var(--text); outline: none;
  transition: border-color .25s, box-shadow .25s, background .25s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(201, 138, 116, .18); background: var(--glass); }
.textarea { min-height: 96px; resize: vertical; }
.select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>"); background-repeat: no-repeat; background-position: left .9rem center; padding-left: 2.2rem; }
.switch { position: relative; display: inline-flex; align-items: center; gap: .55rem; cursor: pointer; user-select: none; font-size: .9rem; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 44px; height: 26px; border-radius: 999px; background: var(--glass-weak); border: 1px solid var(--line); position: relative; transition: background .3s; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .08); }
.switch .track::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); transition: transform .35s var(--ease-liquid); }
.switch input:checked + .track { background: var(--accent-grad); }
.switch input:checked + .track::after { transform: translateX(-18px); }

/* ---------- chips / badges ---------- */
.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .42rem .95rem; border-radius: 999px; border: 1px solid var(--line); background: var(--glass-weak); font-size: .88rem; font-weight: 500; transition: all .3s var(--ease); cursor: pointer; white-space: nowrap; }
.chip:hover { background: var(--glass-strong); transform: translateY(-1px); }
.chip.active { background: var(--accent-grad); color: var(--accent-ink); border-color: rgba(255, 255, 255, .55); box-shadow: 0 6px 18px rgba(201, 138, 116, .35); }
.chip .n { font-size: .75rem; opacity: .75; }
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 600; background: var(--glass-strong); border: 1px solid var(--line); }
.badge.ok { color: var(--success); } .badge.warn { color: var(--warn); } .badge.err { color: var(--danger); }

/* ---------- misc ---------- */
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: .5rem; align-items: center; pointer-events: none; }
.toast { padding: .7rem 1.2rem; border-radius: 999px; font-size: .9rem; font-weight: 500; animation: toastIn .45s var(--ease-liquid); pointer-events: auto; }
.toast.err { color: var(--danger); } .toast.ok { color: var(--success); }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
