/* Sayed Deals — hardware price board. Warm paper + brand red/orange, numbers first. */
:root {
  --hue: 35;
  --paper: oklch(96.5% 0.018 var(--hue));
  --paper-2: oklch(93.5% 0.022 var(--hue));
  --ink: oklch(23% 0.025 40);
  --ink-2: oklch(42% 0.03 40);
  --ink-3: oklch(58% 0.03 40);
  --line: oklch(86% 0.025 var(--hue));
  --brand: oklch(60% 0.2 25);        /* #e63946-ish */
  --brand-2: oklch(77% 0.17 65);     /* #ff9f1c-ish */
  --brand-ink: oklch(45% 0.17 25);
  --good: oklch(52% 0.13 150);
  --hot-bg: oklch(93% 0.06 60);
  --tag-bg: oklch(99% 0.006 var(--hue));
  --shadow: 0 1px 0 oklch(80% 0.03 var(--hue)), 0 8px 24px -16px oklch(40% 0.06 40 / .35);
  --radius: 10px;
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --display: "Reem Kufi", "IBM Plex Sans Arabic", sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --pad: clamp(16px, 4vw, 48px);
  color-scheme: light;
}
[data-theme="dark"] {
  --paper: oklch(19% 0.014 40);
  --paper-2: oklch(23% 0.016 40);
  --ink: oklch(94% 0.012 var(--hue));
  --ink-2: oklch(78% 0.02 var(--hue));
  --ink-3: oklch(63% 0.02 var(--hue));
  --line: oklch(32% 0.02 40);
  --brand: oklch(68% 0.19 28);
  --brand-2: oklch(80% 0.16 65);
  --brand-ink: oklch(78% 0.15 35);
  --good: oklch(74% 0.14 150);
  --hot-bg: oklch(30% 0.06 50);
  --tag-bg: oklch(22% 0.016 40);
  --shadow: 0 1px 0 oklch(28% 0.02 40), 0 10px 30px -18px oklch(0% 0 0 / .8);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.6 var(--font); font-feature-settings: "tnum";
  background-image: radial-gradient(oklch(70% 0.05 var(--hue) / .10) 1px, transparent 1px);
  background-size: 22px 22px;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip:focus { position: fixed; top: 8px; inset-inline-start: 8px; z-index: 50; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 8px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.num-en { direction: ltr; unicode-bidi: isolate; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 10px var(--pad);
  background: color-mix(in oklch, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { border-radius: 50%; }
.brand-text { display: grid; line-height: 1.15; direction: ltr; text-align: left; }
.brand-text strong { font: 700 1.05rem/1.1 var(--display); letter-spacing: .01em; }
.brand-text small { font-size: .72rem; color: var(--ink-3); letter-spacing: .02em; }
.status { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--ink-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.status.live .dot { background: var(--good); box-shadow: 0 0 0 0 color-mix(in oklch, var(--good) 60%, transparent); animation: pulse 2.4s var(--ease) infinite; }
.status.stale .dot { background: var(--brand-2); }
.status.down .dot { background: var(--brand); }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px transparent; } }
.theme { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: transparent; cursor: pointer; }
.theme svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.theme:hover { border-color: var(--brand); }

/* ---------- ticker ---------- */
.ticker { overflow: hidden; border-bottom: 1px solid var(--line); background: var(--ink); color: var(--paper); }
.ticker-track { display: flex; gap: 36px; width: max-content; padding: 8px 0; animation: tick 90s linear infinite; }
.ticker:hover .ticker-track { animation-play-state: paused; }
.tick { display: inline-flex; gap: 8px; align-items: baseline; white-space: nowrap; font-size: .88rem; text-decoration: none; }
.tick b { color: var(--brand-2); font-weight: 700; direction: ltr; unicode-bidi: isolate; }
.tick span { opacity: .75; }
@keyframes tick { to { transform: translateX(50%); } }
@media (prefers-reduced-motion: reduce) { .ticker-track { animation: none; overflow-x: auto; } }

main { padding: 0 var(--pad); max-width: 1320px; margin: 0 auto; }
section { margin-block: clamp(36px, 6vw, 72px); }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px; margin-bottom: 18px; }
.section-head h2 { margin: 0; font: 700 clamp(1.35rem, 2.6vw, 1.85rem)/1.2 var(--display); }
.section-head p { margin: 0; color: var(--ink-3); font-size: .92rem; }

/* ---------- lead ---------- */
.lead { display: grid; grid-template-columns: 1.5fr 1fr; gap: clamp(24px, 5vw, 72px); align-items: end; margin-top: clamp(28px, 5vw, 60px); }
.eyebrow { margin: 0 0 6px; color: var(--brand-ink); font-weight: 600; font-size: .9rem; letter-spacing: .02em; }
.lead h1 { margin: 0; font: 700 clamp(2.2rem, 6.4vw, 4.6rem)/1.05 var(--display); letter-spacing: -.01em; }
.lead h1 #deal-count { color: var(--brand); }
.lead-sub { margin: 14px 0 0; max-width: 46ch; color: var(--ink-2); font-size: clamp(1rem, 1.4vw, 1.12rem); }
.facts { margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 2px solid var(--ink); }
.facts div { padding: 14px 0 0; }
.facts div + div { padding-inline-start: 16px; border-inline-start: 1px solid var(--line); }
.facts dt { font-size: .8rem; color: var(--ink-3); }
.facts dd { margin: 2px 0 0; font: 600 clamp(1.5rem, 3vw, 2.2rem)/1.1 var(--font); }

/* ---------- my parts board ---------- */
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--tag-bg); box-shadow: var(--shadow); }
.spec { padding: 18px 20px; border-bottom: 1px solid var(--line); border-inline-end: 1px solid var(--line); display: grid; gap: 6px; align-content: start; }
.spec-name { font-weight: 600; font-size: .92rem; color: var(--ink-2); }
.spec-price { font: 700 1.9rem/1 var(--font); }
.spec-price small { font-size: .9rem; font-weight: 500; color: var(--ink-3); }
.spec-where { font-size: .85rem; color: var(--ink-2); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spec-where:hover { color: var(--brand-ink); text-decoration: underline; }
.spec-meta { display: flex; gap: 10px; font-size: .78rem; color: var(--ink-3); }
.spec-meta .down { color: var(--good); font-weight: 600; }
.spec.empty .spec-price { color: var(--ink-3); font-size: 1.1rem; }

/* ---------- price tags ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-inline-start: auto; }
.chip { border: 1px solid var(--line); background: transparent; border-radius: 99px; padding: 4px 12px; font-size: .85rem; cursor: pointer; transition: background .2s var(--ease), border-color .2s var(--ease); }
.chip[aria-selected="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip:hover:not([aria-selected="true"]) { border-color: var(--brand); }
.tags { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 18px 16px; }
.tag {
  position: relative; display: grid; grid-template-rows: auto 1fr auto; gap: 10px;
  padding: 16px 18px 16px 18px; padding-inline-start: 30px;
  background: var(--tag-bg); border: 1px solid var(--line); border-radius: 4px var(--radius) var(--radius) 4px;
  box-shadow: var(--shadow); text-decoration: none;
  transition: transform .35s var(--ease), border-color .2s;
  opacity: 0; transform: translateY(8px); animation: rise .6s var(--ease) forwards;
}
[dir="rtl"] .tag { border-radius: var(--radius) 4px 4px var(--radius); }
.tag::before { /* the punched hole of a price tag */
  content: ""; position: absolute; inset-inline-start: 11px; top: 50%; width: 9px; height: 9px; margin-top: -4.5px;
  border-radius: 50%; background: var(--paper); box-shadow: inset 0 1px 2px oklch(40% 0.05 40 / .35);
}
.tag:hover { transform: translateY(-3px); border-color: var(--brand); }
.tag-top { display: flex; justify-content: space-between; gap: 8px; font-size: .78rem; color: var(--ink-3); padding-inline-end: 64px; }
.tag-title { font-size: .92rem; line-height: 1.45; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; direction: ltr; text-align: right; }
.tag-prices { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.tag-now { font: 700 1.5rem/1 var(--font); }
.tag-was { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--brand); font-size: .9rem; }
.stamp {
  position: absolute; top: -10px; inset-inline-end: 12px;
  font: 700 .95rem/1 var(--font); color: oklch(98% 0.01 60); background: var(--brand);
  padding: 7px 9px; border-radius: 6px; transform: rotate(-4deg); direction: ltr; unicode-bidi: isolate;
  box-shadow: 0 6px 14px -6px color-mix(in oklch, var(--brand) 70%, transparent);
}
.stamp.mid { background: var(--brand-2); color: oklch(25% 0.05 50); }
@keyframes rise { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .tag { animation: none; opacity: 1; transform: none; } }

/* ---------- explorer ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px; margin-bottom: 14px; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); position: sticky; top: 61px; z-index: 10; }
.filters select, .filters input[type=number], .search { height: 38px; border: 1px solid var(--line); border-radius: 8px; background: var(--tag-bg); padding: 0 10px; }
.search { flex: 1 1 260px; display: flex; align-items: center; gap: 8px; }
.search svg { width: 17px; height: 17px; fill: none; stroke: var(--ink-3); stroke-width: 2; flex: none; }
.search input { border: 0; outline: 0; background: transparent; width: 100%; height: 100%; }
.search:focus-within { border-color: var(--brand); }
.num { display: flex; align-items: center; gap: 6px; font-size: .88rem; color: var(--ink-2); }
.num input { width: 84px; }
.check { display: flex; align-items: center; gap: 6px; font-size: .88rem; cursor: pointer; }
.check input { accent-color: var(--brand); width: 16px; height: 16px; }
.ghost { height: 38px; padding: 0 14px; border: 1px solid transparent; background: transparent; color: var(--brand-ink); cursor: pointer; border-radius: 8px; }
.ghost:hover { border-color: var(--line); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--tag-bg); }
.grid { width: 100%; border-collapse: collapse; font-size: .9rem; }
.grid th { position: sticky; top: 0; text-align: start; font-weight: 600; font-size: .8rem; color: var(--ink-3); padding: 12px 14px; border-bottom: 2px solid var(--ink); cursor: pointer; white-space: nowrap; user-select: none; background: var(--tag-bg); }
.grid th:hover { color: var(--ink); }
.grid th[aria-sort]::after { content: " ↓"; color: var(--brand); }
.grid th[aria-sort="ascending"]::after { content: " ↑"; }
.grid td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid tr:last-child td { border-bottom: 0; }
.grid tbody tr { transition: background .15s; }
.grid tbody tr:hover { background: var(--paper-2); }
.grid .n { text-align: end; white-space: nowrap; }
.grid td.title a { text-decoration: none; direction: ltr; unicode-bidi: plaintext; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 54ch; }
.grid td.title a:hover { color: var(--brand-ink); text-decoration: underline; }
.grid tr.out td { color: var(--ink-3); }
.grid .price { font-weight: 700; }
.grid .was { color: var(--ink-3); text-decoration: line-through; }
.pct { display: inline-block; min-width: 44px; text-align: center; padding: 2px 7px; border-radius: 5px; font-weight: 700; font-size: .82rem; }
.pct.hot { background: var(--brand); color: oklch(98% 0.01 60); }
.pct.warm { background: var(--hot-bg); color: var(--brand-ink); }
.star { color: var(--brand-2); margin-inline-end: 4px; }
.kind { font-size: .8rem; color: var(--ink-2); white-space: nowrap; }
.empty-row td { text-align: center; padding: 40px; color: var(--ink-3); }
.pager { display: flex; justify-content: center; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.pager button { min-width: 38px; height: 36px; border: 1px solid var(--line); background: var(--tag-bg); border-radius: 8px; cursor: pointer; }
.pager button[aria-current="page"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pager button:disabled { opacity: .4; cursor: default; }

/* ---------- stores ---------- */
.store-list { list-style: none; margin: 0; padding: 0; columns: 3 240px; column-gap: 32px; }
.store-list li { break-inside: avoid; display: flex; align-items: baseline; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: .92rem; }
.store-list .s-name { font-weight: 600; direction: ltr; }
.store-list .s-meta { margin-inline-start: auto; color: var(--ink-3); font-size: .8rem; white-space: nowrap; }
.store-list .s-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); flex: none; align-self: center; }
.store-list .s-dot.warn { background: var(--brand-2); }
.store-list .s-dot.bad { background: var(--brand); }

/* ---------- footer ---------- */
.foot { display: grid; justify-items: center; gap: 4px; padding: 36px var(--pad) 48px; border-top: 1px solid var(--line); text-align: center; font-size: .9rem; }
.foot img { border-radius: 50%; }
.foot p { margin: 0; }
.muted { color: var(--ink-3); font-size: .82rem; }

/* ---------- loading skeleton ---------- */
.skel { background: linear-gradient(90deg, var(--paper-2), var(--line), var(--paper-2)); background-size: 200% 100%; animation: skel 1.4s linear infinite; border-radius: 6px; min-height: 120px; }
@keyframes skel { to { background-position: -200% 0; } }

/* ---------- mobile ---------- */
@media (max-width: 860px) {
  .lead { grid-template-columns: 1fr; }
  .status #status-text { font-size: .78rem; }
  .filters { position: static; }
  .grid thead { display: none; }
  .grid, .grid tbody, .grid tr, .grid td { display: block; }
  .grid tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .grid td { border: 0; padding: 0; }
  .grid td.title { grid-column: 1 / -1; }
  .grid td.title a { max-width: none; }
  .grid td.c-store, .grid td.c-kind { font-size: .8rem; color: var(--ink-3); }
  .grid td.c-first { display: none; }
  .grid td.n { text-align: start; }
}
@media (max-width: 520px) {
  .brand-text small { display: none; }
  .status #status-text { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .facts { grid-template-columns: repeat(3, auto); }
}
