/* ============================================================
   theshishshiv UI kit: monochrome glass, pills, motion.
   Shared by the studio site and the CRM.
   ============================================================ */
:root {
  --font: "Inter", -apple-system, "Segoe UI", system-ui, sans-serif;
  --display: "Inter Tight", "Inter", -apple-system, system-ui, sans-serif;
  --r-sm: 14px; --r-md: 22px; --r-lg: 30px; --r-pill: 999px;
  --spring: cubic-bezier(.34, 1.36, .64, 1);     /* light overshoot for moving pills */
  --ease: cubic-bezier(.22, 1, .36, 1);          /* smooth deceleration */
  --exit: cubic-bezier(.4, 0, 1, 1);
  --t-fast: .18s; --t-mid: .32s; --t-slow: .5s;
  color-scheme: light dark;
}

/* ---------- light theme ---------- */
:root, :root[data-theme="light"] {
  --bg: #F2F2F4; --bg-2: #FFFFFF;
  --fg: #0A0A0A; --fg-2: rgba(10, 10, 10, .62); --fg-3: rgba(10, 10, 10, .42);
  --line: rgba(10, 10, 10, .09); --line-2: rgba(10, 10, 10, .16);
  --glass: rgba(255, 255, 255, .62); --glass-2: rgba(255, 255, 255, .82); --glass-hi: rgba(10, 10, 10, .06);
  --rim: inset 0 0 0 .5px rgba(255, 255, 255, .8), inset 0 1px 0 rgba(255, 255, 255, .9);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 14px rgba(0, 0, 0, .05);
  --shadow: 0 2px 6px rgba(0, 0, 0, .04), 0 18px 48px -12px rgba(0, 0, 0, .16);
  --primary: #0A0A0A; --on-primary: #FFFFFF;
  --glow-a: rgba(0, 0, 0, .06); --glow-b: rgba(0, 0, 0, .035);
  --skeleton: rgba(10, 10, 10, .06); --skeleton-hi: rgba(10, 10, 10, .1);
  --scrim: rgba(242, 242, 244, .55);
  --ok: #0A0A0A; --err: #B3261E;
}

/* ---------- dark theme (system or explicit) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --bg-2: #0E0E10;
    --fg: #F5F5F7; --fg-2: rgba(245, 245, 247, .66); --fg-3: rgba(245, 245, 247, .42);
    --line: rgba(255, 255, 255, .09); --line-2: rgba(255, 255, 255, .16);
    --glass: rgba(28, 28, 30, .58); --glass-2: rgba(36, 36, 38, .82); --glass-hi: rgba(255, 255, 255, .1);
    --rim: inset 0 0 0 .5px rgba(255, 255, 255, .12), inset 0 1px 0 rgba(255, 255, 255, .09);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .35);
    --shadow: 0 2px 8px rgba(0, 0, 0, .4), 0 24px 60px -16px rgba(0, 0, 0, .7);
    --primary: #F5F5F7; --on-primary: #000000;
    --glow-a: rgba(255, 255, 255, .07); --glow-b: rgba(255, 255, 255, .04);
    --skeleton: rgba(255, 255, 255, .06); --skeleton-hi: rgba(255, 255, 255, .11);
    --scrim: rgba(0, 0, 0, .5);
    --ok: #F5F5F7; --err: #FF8A80;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --bg-2: #0E0E10;
  --fg: #F5F5F7; --fg-2: rgba(245, 245, 247, .66); --fg-3: rgba(245, 245, 247, .42);
  --line: rgba(255, 255, 255, .09); --line-2: rgba(255, 255, 255, .16);
  --glass: rgba(28, 28, 30, .58); --glass-2: rgba(36, 36, 38, .82); --glass-hi: rgba(255, 255, 255, .1);
  --rim: inset 0 0 0 .5px rgba(255, 255, 255, .12), inset 0 1px 0 rgba(255, 255, 255, .09);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .35);
  --shadow: 0 2px 8px rgba(0, 0, 0, .4), 0 24px 60px -16px rgba(0, 0, 0, .7);
  --primary: #F5F5F7; --on-primary: #000000;
  --glow-a: rgba(255, 255, 255, .07); --glow-b: rgba(255, 255, 255, .04);
  --skeleton: rgba(255, 255, 255, .06); --skeleton-hi: rgba(255, 255, 255, .11);
  --scrim: rgba(0, 0, 0, .5);
  --ok: #F5F5F7; --err: #FF8A80;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--fg);
  font: 400 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden;
  transition: background-color var(--t-slow) var(--ease), color var(--t-slow) var(--ease);
}
a { color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; border-radius: 10px; }
::selection { background: var(--fg); color: var(--bg); }
[hidden] { display: none !important; }

/* soft monochrome light behind everything, so glass has something to blur */
.ambient { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.ambient::before, .ambient::after { content: ""; position: absolute; border-radius: 50%; filter: blur(60px); }
.ambient::before { width: 70vmax; height: 70vmax; left: -20vmax; top: -30vmax; background: radial-gradient(circle, var(--glow-a), transparent 65%); animation: drift 30s var(--ease) infinite alternate; }
.ambient::after { width: 60vmax; height: 60vmax; right: -24vmax; bottom: -30vmax; background: radial-gradient(circle, var(--glow-b), transparent 65%); animation: drift 36s var(--ease) infinite alternate-reverse; }
@keyframes drift { to { transform: translate(8vmax, 6vmax) scale(1.08); } }

/* ---------- glass ---------- */
.glass {
  background: var(--glass); box-shadow: var(--rim), var(--shadow-sm);
  -webkit-backdrop-filter: blur(24px) saturate(160%); backdrop-filter: blur(24px) saturate(160%);
}
.glass--strong { background: var(--glass-2); box-shadow: var(--rim), var(--shadow); }
@media (prefers-reduced-transparency: reduce) { .glass, .glass--strong { background: var(--bg-2); -webkit-backdrop-filter: none; backdrop-filter: none; } }

/* ---------- buttons (pills) ---------- */
.btn {
  --h: 48px;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); padding: 0 22px; border-radius: var(--r-pill); border: 0; cursor: pointer;
  font: 600 .95rem/1 var(--font); letter-spacing: -.005em; text-decoration: none; white-space: nowrap;
  transition: transform var(--t-mid) var(--spring), background-color var(--t-fast), color var(--t-fast), box-shadow var(--t-mid), opacity var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.96); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn--primary { background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-sm); }
.btn--primary:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.btn--glass { background: var(--glass); color: var(--fg); box-shadow: var(--rim), var(--shadow-sm); -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%); }
.btn--glass:hover { background: var(--glass-2); }
.btn--ghost { background: transparent; color: var(--fg-2); }
.btn--ghost:hover { color: var(--fg); background: var(--glass-hi); }
.btn--danger { background: transparent; color: var(--err); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn--sm { --h: 38px; padding: 0 16px; font-size: .88rem; }
.btn--icon { width: var(--h); padding: 0; }
.btn .spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- moving pill (nav, tabs, segmented toggles) ---------- */
.pills { position: relative; display: inline-flex; align-items: center; gap: 2px; padding: 4px; border-radius: var(--r-pill); isolation: isolate; }
.pills > :is(a, button) {
  position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px;
  border: 0; border-radius: var(--r-pill); background: none; cursor: pointer; text-decoration: none; white-space: nowrap;
  font: 500 .9rem/1 var(--font); color: var(--fg-2); transition: color var(--t-mid) var(--ease);
}
.pills > :is(a, button):hover { color: var(--fg); }
.pills > .is-active { color: var(--fg); }
.pills .pill-indicator {
  position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: var(--r-pill);
  background: var(--glass-hi); box-shadow: var(--rim);
  transition: transform .55s var(--spring), width .55s var(--spring), opacity var(--t-fast);
}
.pills--solid .pill-indicator { background: var(--primary); box-shadow: var(--shadow-sm); }
.pills--solid > .is-active { color: var(--on-primary); }
.pills--scroll { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.pills--scroll::-webkit-scrollbar { display: none; }

/* ---------- fields ---------- */
.field { display: grid; gap: 8px; font: 500 .9rem/1.3 var(--font); color: var(--fg-2); }
.input, .field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 12px 16px; border-radius: var(--r-sm); border: 0;
  background: var(--glass-hi); color: var(--fg); font: 400 1rem/1.4 var(--font);
  box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow var(--t-fast), background-color var(--t-fast);
}
.input:focus, .field :is(input, select, textarea):focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--fg); background: transparent; }
.field textarea { resize: vertical; min-height: 110px; }
.check { display: grid; grid-template-columns: 22px 1fr; gap: 10px; font-size: .9rem; color: var(--fg-2); line-height: 1.45; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--fg); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- sheet: bottom on phones, centered on desktop ---------- */
dialog.sheet {
  border: 0; padding: 0; margin: 0; max-width: none; max-height: none; background: transparent; color: var(--fg);
  position: fixed; inset: auto 0 0 0; width: 100%;
}
dialog.sheet::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transition: opacity var(--t-mid) var(--ease); }
dialog.sheet[open]::backdrop { opacity: 1; }
.sheet__body {
  position: relative; max-height: 88dvh; overflow: auto; overscroll-behavior: contain;
  border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 12px 22px calc(26px + env(safe-area-inset-bottom));
  background: var(--glass-2); box-shadow: var(--rim), var(--shadow);
  -webkit-backdrop-filter: blur(30px) saturate(170%); backdrop-filter: blur(30px) saturate(170%);
  transform: translateY(100%); transition: transform .5s var(--ease);
}
dialog.sheet[open] .sheet__body { transform: none; }
dialog.sheet.is-closing .sheet__body { transform: translateY(100%); transition: transform .28s var(--exit); }
dialog.sheet.is-closing::backdrop { opacity: 0; }
@starting-style { dialog.sheet[open] .sheet__body { transform: translateY(100%); } dialog.sheet[open]::backdrop { opacity: 0; } }
.sheet__grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 0 auto 14px; }
.sheet__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.sheet__head h2 { margin: 0; font: 700 1.5rem/1.15 var(--display); letter-spacing: -.02em; }
.sheet__head p { margin: 6px 0 0; color: var(--fg-2); }
@media (min-width: 720px) {
  dialog.sheet { inset: 0; margin: auto; width: min(560px, calc(100% - 48px)); height: fit-content; }
  .sheet__body { border-radius: var(--r-lg); padding: 26px 28px 28px; transform: translateY(16px) scale(.96); opacity: 0; transition: transform .45s var(--spring), opacity .25s var(--ease); }
  dialog.sheet[open] .sheet__body { transform: none; opacity: 1; }
  dialog.sheet.is-closing .sheet__body { transform: translateY(8px) scale(.97); opacity: 0; transition: transform .2s var(--exit), opacity .2s var(--exit); }
  @starting-style { dialog.sheet[open] .sheet__body { transform: translateY(16px) scale(.96); opacity: 0; } }
  .sheet__grab { display: none; }
  dialog.sheet--wide { width: min(880px, calc(100% - 48px)); }
}

/* ---------- toast ---------- */
.toasts { position: fixed; z-index: 100; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100% - 32px)); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-radius: var(--r-md); pointer-events: auto;
  background: var(--glass-2); color: var(--fg); box-shadow: var(--rim), var(--shadow); font-weight: 500;
  -webkit-backdrop-filter: blur(24px) saturate(170%); backdrop-filter: blur(24px) saturate(170%);
  animation: toast-in .5s var(--spring) both;
}
.toast.is-leaving { animation: toast-out .25s var(--exit) forwards; }
.toast--err { box-shadow: var(--rim), var(--shadow), inset 3px 0 0 var(--err); }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- menu ---------- */
.menu-wrap { position: relative; }
.menu {
  position: absolute; z-index: 60; top: calc(100% + 8px); right: 0; min-width: 200px; padding: 6px; border-radius: var(--r-md);
  background: var(--glass-2); box-shadow: var(--rim), var(--shadow);
  -webkit-backdrop-filter: blur(28px) saturate(170%); backdrop-filter: blur(28px) saturate(170%);
  transform-origin: top right; opacity: 0; transform: scale(.94) translateY(-4px); pointer-events: none; visibility: hidden;
  transition: opacity var(--t-fast) var(--ease), transform var(--t-mid) var(--spring), visibility 0s linear var(--t-mid);
}
.menu.is-open { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition: opacity var(--t-fast) var(--ease), transform var(--t-mid) var(--spring), visibility 0s; }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 12px; background: none; color: var(--fg); font: 500 .92rem/1.2 var(--font); text-align: left; cursor: pointer; text-decoration: none; }
.menu :is(button, a):hover, .menu :is(button, a):focus-visible { background: var(--glass-hi); outline: none; }
.menu [aria-checked="true"]::after { content: "✓"; margin-left: auto; }
.menu .is-danger { color: var(--err); }
.menu hr { border: 0; height: 1px; background: var(--line); margin: 6px 4px; }

/* ---------- skeleton ---------- */
.skeleton { position: relative; overflow: hidden; background: var(--skeleton); border-radius: 10px; color: transparent !important; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, var(--skeleton-hi), transparent); animation: shimmer 1.4s var(--ease) infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* ---------- reveal on scroll (transform/opacity only: no layout shift) ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s var(--ease), transform .7s var(--ease); transition-delay: calc(var(--i, 0) * 70ms); }
.reveal.is-in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

/* ---------- page transitions ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out .22s var(--exit) both; }
::view-transition-new(root) { animation: vt-in .4s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(8px); } }
.page-enter { animation: vt-in .5s var(--ease) both; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}
