/* Xyvira design system: tokens, liquid glass, shared components. */
@font-face { font-family: 'Anek Latin'; src: url(/assets/fonts/AnekLatin-Variable.woff) format('woff'); font-weight: 100 800; font-stretch: 75% 125%; font-display: swap; }
@font-face { font-family: 'Marcellus'; src: url(/assets/fonts/Marcellus-Regular.woff) format('woff'); font-weight: 400; font-display: swap; }

:root {
  /* palette, from the brand banner and the saree itself */
  --kumkum: #5e0e26;      /* brand maroon */
  --kumkum-2: #7b1834;
  --kasavu: #c9a35f;      /* zari gold */
  --kasavu-deep: #8e6a2c;
  --jasmine: #fffaf3;
  --sandal: #f1e6d6;
  --ink: #2b1117;         /* text */
  --ink-2: #6e4d53;       /* secondary text */
  --ink-3: #9a7f83;
  --saffron: #d8772e;
  --rani: #b0186a;
  --leaf: #2e6b46;
  --danger: #b3261e;
  --warn: #9a5a00;

  --line: rgba(94, 14, 38, 0.12);
  --line-strong: rgba(94, 14, 38, 0.22);
  --focus: 0 0 0 3px var(--jasmine), 0 0 0 5px var(--kasavu-deep);

  /* liquid glass */
  --glass-fill: linear-gradient(150deg, rgba(255, 252, 247, 0.70), rgba(255, 246, 236, 0.44));
  --glass-fill-strong: linear-gradient(150deg, rgba(255, 252, 248, 0.88), rgba(255, 248, 240, 0.74));
  --glass-blur: blur(20px) saturate(175%);
  --glass-blur-thin: blur(9px) saturate(180%); /* thin bars and plates: large radii get dropped by some renderers */
  --glass-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    inset 0 -1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -14px 28px -18px rgba(94, 14, 38, 0.18),
    0 24px 60px -28px rgba(62, 10, 26, 0.45),
    0 2px 8px rgba(62, 10, 26, 0.06);

  --r-xl: 32px; --r-lg: 26px; --r-md: 18px; --r-sm: 12px; --r-xs: 8px;
  --serif: 'Marcellus', 'Cormorant Garamond', Georgia, serif;
  --sans: 'Anek Latin', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* type scale, 1.25 ratio on a 17px base */
  --t-xs: 0.8rem; --t-sm: 0.9rem; --t-md: 1.0625rem; --t-lg: 1.33rem; --t-xl: 1.66rem; --t-2xl: 2.07rem; --t-3xl: 2.6rem; --t-4xl: 3.25rem; --t-5xl: 4.06rem;
  --gutter: clamp(16px, 3.2vw, 40px);
  --max: 1240px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--sans); font-size: var(--t-md); line-height: 1.55; color: var(--ink);
  font-stretch: 98%; background: var(--sandal); min-height: 100vh; overflow-x: hidden;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
/* Lamp-lit backdrop behind every page, so the glass always has warm colour to bend. */
.backdrop { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; background: var(--sandal); }
.backdrop::before { content: ''; position: absolute; inset: -6%; background: url(/assets/img/ambient.jpg) center / cover no-repeat; opacity: 0.55; }
.backdrop::after {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(60vmax 45vmax at 8% 12%, rgba(216, 119, 46, 0.28), transparent 60%),
    radial-gradient(50vmax 40vmax at 92% 8%, rgba(201, 163, 95, 0.32), transparent 62%),
    radial-gradient(55vmax 50vmax at 85% 95%, rgba(176, 24, 106, 0.14), transparent 60%),
    radial-gradient(60vmax 50vmax at 10% 100%, rgba(94, 14, 38, 0.16), transparent 60%),
    linear-gradient(180deg, rgba(255, 250, 243, 0.35), rgba(241, 230, 214, 0.55));
}

img { max-width: 100%; display: block; }
address { font-style: normal; }
a { color: inherit; text-decoration-color: rgba(94, 14, 38, 0.35); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 400; line-height: 1.12; margin: 0 0 0.4em; letter-spacing: 0.005em; color: var(--kumkum); text-wrap: balance; }
h1 { font-size: var(--t-4xl); } h2 { font-size: var(--t-2xl); } h3 { font-size: var(--t-lg); } h4 { font-size: var(--t-md); }
p { margin: 0 0 0.9em; text-wrap: pretty; }
small, .muted { color: var(--ink-2); }
.tnum { font-variant-numeric: tabular-nums; }
/* Marcellus draws 1 and 0 like I and O, so codes in headings use the sans */
.code { font-family: var(--sans); font-weight: 600; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 200; padding: 10px 16px; border-radius: 12px; background: var(--kumkum); color: var(--jasmine); text-decoration: none; }
.skip:focus { top: 12px; }
.wrap { width: min(var(--max), 100% - 2 * var(--gutter)); margin-inline: auto; }
.i { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- liquid glass ---------- */
.glass {
  position: relative; isolation: isolate;
  background: var(--glass-fill);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border-radius: var(--r-lg);
  box-shadow: var(--glass-shadow);
}
/* rim light: a bright edge that fades round the shape, like light caught in thick glass */
.glass::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; z-index: 1;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.18) 32%, rgba(255, 255, 255, 0) 55%, rgba(255, 255, 255, 0.45) 85%, rgba(255, 255, 255, 0.8));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
/* specular sheen that follows the pointer */
.glass::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  background: radial-gradient(240px 160px at var(--mx, 18%) var(--my, -10%), rgba(255, 255, 255, 0.55), transparent 70%);
  opacity: 0.8; transition: opacity 0.3s;
}
.glass.strong { background: var(--glass-fill-strong); }
.glass.thin { -webkit-backdrop-filter: var(--glass-blur-thin); backdrop-filter: var(--glass-blur-thin); }
.glass.dark {
  background: linear-gradient(150deg, rgba(94, 14, 38, 0.62), rgba(60, 8, 24, 0.5)); color: var(--jasmine);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 0 -1px 0 rgba(255, 255, 255, 0.08), 0 24px 60px -28px rgba(30, 4, 12, 0.6);
}
.glass.dark::before { background: linear-gradient(155deg, rgba(255, 230, 200, 0.65), rgba(255, 255, 255, 0.05) 40%, rgba(255, 255, 255, 0) 60%, rgba(201, 163, 95, 0.55)); }
.glass.dark::after { background: radial-gradient(240px 160px at var(--mx, 18%) var(--my, -10%), rgba(255, 220, 180, 0.22), transparent 70%); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: rgba(255, 250, 244, 0.94); }
  .glass.dark { background: rgba(80, 12, 32, 0.95); }
}

/* the kasavu band: a woven gold border, used only where a section meets an edge */
.kasavu {
  height: 9px; border: 0; margin: 0;
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55) 50%, transparent) 0 0 / 220px 100% repeat-x,
    linear-gradient(180deg, var(--kasavu) 0 2px, transparent 2px 3.5px, #dcbd7f 3.5px 5.5px, transparent 5.5px 7px, var(--kasavu-deep) 7px 9px);
}

/* ---------- buttons ---------- */
.btn {
  --b-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 250, 243, 0.5));
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  min-height: 48px; padding: 0.7em 1.45em; border-radius: 999px; border: 0; cursor: pointer;
  font-weight: 600; font-size: var(--t-md); letter-spacing: 0.01em; text-decoration: none; white-space: nowrap;
  color: var(--kumkum); background: var(--b-bg);
  -webkit-backdrop-filter: blur(7px) saturate(160%); backdrop-filter: blur(7px) saturate(160%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 0 0 1px rgba(94, 14, 38, 0.14), 0 8px 22px -12px rgba(62, 10, 26, 0.4);
  transition: transform 0.18s cubic-bezier(.2, .8, .2, 1.2), box-shadow 0.2s, filter 0.2s;
}
.btn:hover { filter: brightness(1.04); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), inset 0 0 0 1px rgba(94, 14, 38, 0.22), 0 12px 26px -12px rgba(62, 10, 26, 0.45); }
.btn:active { transform: scale(0.97); }
.btn.primary {
  color: var(--jasmine);
  background:
    radial-gradient(120px 40px at var(--mx, 30%) 0%, rgba(255, 220, 190, 0.35), transparent 70%),
    linear-gradient(180deg, #86203c, #5a0c23 60%, #4b0a1d);
  box-shadow: inset 0 1px 0 rgba(255, 220, 200, 0.55), inset 0 -2px 6px rgba(20, 0, 6, 0.35), inset 0 0 0 1px rgba(60, 6, 20, 0.6), 0 12px 26px -12px rgba(94, 14, 38, 0.7);
}
.btn.gold { color: #3a2508; background: linear-gradient(180deg, #e6cb93, #c79d55 60%, #b0873f); box-shadow: inset 0 1px 0 rgba(255, 248, 225, 0.9), inset 0 -2px 6px rgba(90, 55, 10, 0.3), 0 12px 26px -12px rgba(140, 100, 30, 0.6); }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); -webkit-backdrop-filter: none; backdrop-filter: none; }
.btn.danger { color: #fff; background: linear-gradient(180deg, #c8372e, #9f1f18); box-shadow: inset 0 1px 0 rgba(255, 200, 190, 0.5), 0 10px 22px -12px rgba(160, 30, 20, 0.6); }
.btn.small { min-height: 38px; padding: 0.4em 1em; font-size: var(--t-sm); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn[aria-busy='true'] { color: transparent !important; }
.btn[aria-busy='true']::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--kasavu) transparent var(--kasavu) transparent; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: transparent; color: var(--kumkum); cursor: pointer; transition: background 0.2s; text-decoration: none;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.55); }
.icon-btn .i { width: 22px; height: 22px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--kumkum); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-weight: 500; }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label, .label { font-size: var(--t-sm); font-weight: 600; color: var(--ink); }
.field .hint { font-size: var(--t-xs); color: var(--ink-2); margin: 0; }
.input, .field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 0.65em 0.9em; border-radius: var(--r-sm); border: 0;
  background: rgba(255, 255, 255, 0.72); color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line-strong), inset 0 2px 4px rgba(62, 10, 26, 0.05);
  transition: box-shadow 0.2s, background 0.2s;
}
.field textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; background: #fff; box-shadow: inset 0 0 0 1.5px var(--kasavu-deep), 0 0 0 4px rgba(201, 163, 95, 0.25); }
[aria-invalid='true'] { box-shadow: inset 0 0 0 1.5px var(--danger) !important; }
.field-error { color: var(--danger); font-size: var(--t-sm); margin: 0; }
.form-error { background: rgba(179, 38, 30, 0.08); color: var(--danger); border-radius: var(--r-sm); padding: 0.7em 0.9em; margin: 0 0 14px; font-weight: 500; }
.form-error:focus { outline: none; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .row-2, .row-3 { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--kumkum); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { appearance: none; width: 44px; height: 26px; border-radius: 99px; background: rgba(94, 14, 38, 0.18); position: relative; cursor: pointer; transition: background 0.2s; flex: none; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.2s; }
.switch input:checked { background: var(--leaf); }
.switch input:checked::after { transform: translateX(18px); }
.switch input:focus-visible { box-shadow: var(--focus); }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 52px !important; }
.password-wrap .icon-btn { position: absolute; right: 2px; top: 2px; }

/* ---------- pieces ---------- */
.price { font-weight: 650; font-variant-numeric: tabular-nums; color: var(--ink); }
.mrp { color: var(--ink-3); text-decoration: line-through; font-variant-numeric: tabular-nums; font-weight: 400; }
.off { color: var(--leaf); font-weight: 600; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 0.2em 0.65em; border-radius: var(--r-xs); font-size: var(--t-xs); font-weight: 600; background: rgba(94, 14, 38, 0.08); color: var(--kumkum); white-space: nowrap; }
.badge.ok { background: rgba(46, 107, 70, 0.12); color: var(--leaf); }
.badge.warn { background: rgba(216, 119, 46, 0.16); color: var(--warn); }
.badge.bad { background: rgba(179, 38, 30, 0.1); color: var(--danger); }
.badge.gold { background: rgba(201, 163, 95, 0.25); color: #6a4a12; }
.badge.info { background: rgba(60, 90, 160, 0.12); color: #2b4a8a; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }
.empty { text-align: center; padding: 48px 20px; color: var(--ink-2); }
.empty h3 { color: var(--kumkum); }
.skeleton { background: linear-gradient(90deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.35)) 0 0 / 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--r-md); }
@keyframes shimmer { to { background-position: -200% 0; } }
.qty { display: inline-flex; align-items: center; border-radius: 999px; background: rgba(255, 255, 255, 0.7); box-shadow: inset 0 0 0 1px var(--line-strong); }
.qty button { width: 40px; height: 40px; border: 0; background: none; cursor: pointer; color: var(--kumkum); display: grid; place-items: center; border-radius: 50%; }
.qty button:disabled { opacity: 0.35; cursor: not-allowed; }
.qty output { min-width: 28px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

.sum { display: grid; gap: 6px; font-variant-numeric: tabular-nums; }
.sum div { display: flex; justify-content: space-between; gap: 12px; }
.sum .total { font-size: var(--t-lg); font-weight: 650; padding-top: 8px; border-top: 1px solid var(--line); margin-top: 4px; }
.notice { display: flex; gap: 12px; align-items: start; padding: 14px 16px; border-radius: var(--r-md); background: rgba(201, 163, 95, 0.18); color: #5b4113; font-size: var(--t-sm); margin-bottom: 16px; }
.notice .i { flex: none; margin-top: 2px; }
.addr { font-style: normal; line-height: 1.6; }

/* ---------- dialog ---------- */
.modal { border: 0; padding: 0; width: min(520px, calc(100% - 32px)); max-height: calc(100vh - 48px); color: var(--ink); background: var(--glass-fill-strong); overflow: auto; }
.modal.wide { width: min(860px, calc(100% - 32px)); }
.modal::backdrop { background: rgba(40, 6, 16, 0.38); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal[open] { animation: pop 0.28s cubic-bezier(.2, .9, .25, 1.15); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 20px 0 24px; }
.modal-head h2 { margin: 0; font-size: var(--t-xl); }
.modal-body { padding: 14px 24px 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 24px 22px; flex-wrap: wrap; }

/* ---------- toast ---------- */
#toasts { position: fixed; z-index: 1000; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 10px; width: min(440px, calc(100% - 32px)); pointer-events: none; }
.toast { padding: 14px 18px; border-radius: 18px; font-weight: 500; background: var(--glass-fill-strong); animation: pop 0.3s; pointer-events: auto; }
.toast-error { color: var(--danger); }
.toast.out { opacity: 0; transform: translateY(8px); transition: 0.35s; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.data th { text-align: left; font-size: var(--t-xs); font-weight: 600; color: var(--ink-2); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; }
table.data tbody tr { transition: background 0.15s; }
table.data tbody tr:hover { background: rgba(255, 255, 255, 0.45); }
.thumb { width: 48px; height: 60px; object-fit: cover; border-radius: 10px; background: var(--sandal); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
@media (max-width: 720px) {
  :root { --t-4xl: 2.45rem; --t-5xl: 2.9rem; --t-3xl: 2.1rem; --t-2xl: 1.7rem; }
}

/* Small product photos show whole, on white */
.thumb { object-fit: contain; background: #fff; }
