/* אבני אור: mobile-first app shell. Top bar, one scrolling view, bottom tab bar. */
:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --fg: #121821;
  --muted: #5b6676;
  --line: #dce1e8;
  --accent: #23447a;
  --accent-fg: #ffffff;
  --tray: #0e1525;
  --tray-2: #1b2741;
  --ok: #1b7a50;
  --warn: #a5650c;
  --bad: #b3352b;
  --font-display: "Bellefair", "Frank Ruhl Libre", "David", Georgia, serif;
  --font-body: "Assistant", "Segoe UI", system-ui, Arial, sans-serif;
  --radius: 12px;
  --tabbar: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f17; --surface: #141a25; --fg: #e8ecf3; --muted: #9ba6b8; --line: #263043;
    --accent: #95b4e8; --accent-fg: #0b0f17; --tray: #060a12; --tray-2: #131c30;
    --ok: #5fcf9c; --warn: #e6b05c; --bad: #ef7d72;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 16px; line-height: 1.5; min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; margin: 0; line-height: 1.15; text-wrap: balance; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.label { font-size: 12px; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }

/* shell */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px; display: flex; align-items: center; gap: 10px; }
.topbar .logo { width: 30px; height: 30px; border-radius: 50%; background: var(--tray); display: grid; place-items: center; flex: none; }
.topbar .logo svg { width: 22px; }
.topbar h1 { font-size: 24px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { background: none; border: 0; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--fg); }
.icon-btn svg { width: 22px; height: 22px; }
.demo-bar { background: color-mix(in srgb, var(--warn) 15%, var(--bg)); color: var(--fg); font-size: 13px; padding: 6px 16px; text-align: center; }

main { max-width: 1100px; margin: 0 auto; padding: 16px 16px calc(var(--tabbar) + env(safe-area-inset-bottom, 0px) + 24px); }

.tabbar { position: fixed; bottom: 0; inset-inline: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, 1fr); padding-bottom: env(safe-area-inset-bottom, 0px); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: var(--tabbar); color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600; position: relative; }
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--accent); }
.tabbar .count { position: absolute; top: 8px; inset-inline-start: calc(50% + 6px); background: var(--accent); color: var(--accent-fg); border-radius: 999px; min-width: 18px; height: 18px; font-size: 11px; display: grid; place-items: center; padding-inline: 4px; }

/* search */
.hero { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.hero h2 { font-size: clamp(28px, 7vw, 44px); }
.hero p { margin: 0; color: var(--muted); }
.shape-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-inline: -16px; padding-inline: 16px; scrollbar-width: none; }
.shape-row::-webkit-scrollbar { display: none; }
.shape { flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 72px; padding: 8px 4px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: 12px; font-weight: 600; }
.shape .g { width: 40px; height: 40px; border-radius: 50%; background: var(--tray); display: grid; place-items: center; }
.shape .g svg { width: 30px; }
.shape[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; color: var(--accent); }
.toolbar { display: flex; gap: 8px; align-items: center; margin-block: 12px; flex-wrap: wrap; }
.toolbar .count-label { margin-inline-end: auto; }
.select, .btn-outline { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: 14px; }
.btn-outline .dot { display: inline-block; min-width: 18px; height: 18px; border-radius: 999px; background: var(--accent); color: var(--accent-fg); font-size: 11px; text-align: center; line-height: 18px; margin-inline-start: 6px; padding-inline: 4px; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.visual { background: radial-gradient(circle at 50% 45%, var(--tray-2), var(--tray) 75%); display: grid; place-items: center; position: relative; overflow: hidden; aspect-ratio: 1; }
.visual svg { width: 56%; }
.visual img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #fff; }
.visual .tag { position: absolute; top: 8px; inset-inline-start: 8px; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 4px; background: rgba(255,255,255,.9); color: #121821; z-index: 1; }
.card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card h3 { font-size: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.grade { font-size: 11px; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; color: var(--muted); }
.card .price { margin-top: auto; padding-top: 6px; font-weight: 700; font-size: 17px; }
.more { display: flex; justify-content: center; padding: 20px; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); grid-column: 1 / -1; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.skeleton { background: linear-gradient(90deg, var(--surface), var(--line), var(--surface)); background-size: 200% 100%; animation: sk 1.2s linear infinite; border-radius: var(--radius); aspect-ratio: 0.72; }
@keyframes sk { to { background-position: -200% 0; } }

/* sheet */
.sheet-bg { position: fixed; inset: 0; background: rgba(4, 8, 16, .5); z-index: 40; }
.sheet { position: fixed; inset-inline: 0; bottom: 0; z-index: 41; background: var(--surface); border-radius: 18px 18px 0 0; max-height: 86dvh; overflow-y: auto; padding: 8px 16px calc(env(safe-area-inset-bottom, 0px) + 16px); display: flex; flex-direction: column; gap: 18px; max-width: 640px; margin: 0 auto; }
.sheet .grip { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 4px auto 0; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head h2 { font-size: 26px; }
.fgroup { display: flex; flex-direction: column; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 5px 13px; font-size: 14px; font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.input { border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 10px 12px; width: 100%; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.sheet-actions { position: sticky; bottom: 0; background: var(--surface); display: flex; gap: 10px; padding-top: 8px; }

/* buttons */
.btn { background: var(--accent); color: var(--accent-fg); border: 0; border-radius: 12px; padding: 13px 18px; font-weight: 700; font-size: 16px; text-align: center; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--fg); border: 1px solid var(--line); }
.btn:disabled { opacity: .5; cursor: default; }

/* stone detail */
.detail { display: grid; gap: 18px; }
@media (min-width: 760px) { .detail { grid-template-columns: 1fr 1fr; align-items: start; } }
.detail .visual { border-radius: var(--radius); }
.detail .visual svg { width: 60%; }
.detail h2 { font-size: 32px; }
.specs { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.specs dt { color: var(--muted); }
.specs dd { margin: 0; overflow-wrap: anywhere; }
.price-big { font-size: 32px; font-weight: 700; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-weight: 600; margin-bottom: 10px; }
.links { display: flex; gap: 16px; flex-wrap: wrap; }
.links a { color: var(--accent); font-weight: 600; }

/* cart & forms */
.lines { display: flex; flex-direction: column; gap: 10px; }
.line { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; }
.line .visual { border-radius: 8px; }
.line .visual svg { width: 72%; }
.line .visual .tag { display: none; }
.line small { display: block; color: var(--muted); }
.link { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; font-size: 13px; }
.totals { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; border-top: 1px solid var(--line); margin-top: 6px; }
.totals div { display: flex; justify-content: space-between; }
.totals .grand { font-size: 20px; font-weight: 700; }
.form { display: flex; flex-direction: column; gap: 12px; max-width: 520px; }
.err { color: var(--bad); font-size: 14px; min-height: 1.2em; }
.note { font-size: 13px; color: var(--muted); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.success h2 { color: var(--ok); }
.page-title { font-size: 34px; margin-bottom: 14px; }

.install { position: fixed; inset-inline: 12px; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom, 0px) + 12px); z-index: 35; background: var(--fg); color: var(--bg); border-radius: 14px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; max-width: 520px; margin: 0 auto; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.install p { margin: 0; flex: 1; font-size: 14px; }
.install button { background: var(--bg); color: var(--fg); border: 0; border-radius: 8px; padding: 7px 12px; font-weight: 700; }
.install .x { background: none; color: var(--bg); padding: 4px 8px; }
.toast { position: fixed; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom, 0px) + 16px); inset-inline-start: 50%; transform: translateX(50%); background: var(--fg); color: var(--bg); padding: 9px 18px; border-radius: 999px; z-index: 60; font-weight: 600; font-size: 14px; }

.twinkle { animation: tw 2.6s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
@keyframes tw { 0%, 100% { opacity: 0; transform: scale(.4); } 50% { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .twinkle, .skeleton { animation: none; } }
