/* لُقطة · newsprint stock-page look: paper, ink, and colour only where prices move. */
:root {
  --paper: oklch(0.955 0.014 85);
  --paper-2: oklch(0.925 0.018 82);
  --ink: oklch(0.22 0.012 60);
  --ink-2: oklch(0.42 0.014 60);
  --ink-3: oklch(0.58 0.014 65);
  --rule: oklch(0.22 0.012 60 / 0.16);
  --rule-strong: oklch(0.22 0.012 60 / 0.85);
  --down: oklch(0.5 0.13 152);      /* price fell: good news */
  --down-bg: oklch(0.5 0.13 152 / 0.1);
  --up: oklch(0.52 0.18 27);        /* price rose */
  --up-bg: oklch(0.52 0.18 27 / 0.09);
  --spot: oklch(0.6 0.16 50);       /* the one brand spot colour, used sparingly */
  --focus: oklch(0.55 0.16 250);
  --font: "Alexandria", "Segoe UI", Tahoma, system-ui, sans-serif;
  --mast: "Aref Ruqaa", serif;
  --wrap: 1180px;
  --pad: clamp(16px, 4vw, 40px);
  color-scheme: light;
}
[data-theme="dark"] {
  --paper: oklch(0.185 0.008 70);
  --paper-2: oklch(0.23 0.01 70);
  --ink: oklch(0.93 0.012 85);
  --ink-2: oklch(0.76 0.012 80);
  --ink-3: oklch(0.6 0.012 75);
  --rule: oklch(0.93 0.012 85 / 0.13);
  --rule-strong: oklch(0.93 0.012 85 / 0.75);
  --down: oklch(0.76 0.14 152);
  --down-bg: oklch(0.76 0.14 152 / 0.12);
  --up: oklch(0.72 0.15 27);
  --up-bg: oklch(0.72 0.15 27 / 0.12);
  --spot: oklch(0.72 0.14 55);
  --focus: oklch(0.75 0.12 250);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 15px/1.6 var(--font); font-variant-numeric: tabular-nums;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; inset-inline-start: 12px; top: -40px; background: var(--ink); color: var(--paper); padding: 6px 12px; z-index: 9; }
.skip:focus { top: 8px; }
.muted { color: var(--ink-3); }
.num-en, .ltr { direction: ltr; unicode-bidi: isolate; }

main, .mast, .foot { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--pad); }

/* ---------------- masthead ---------------- */
.mast { padding-top: 14px; text-align: center; }
.mast-line {
  display: flex; align-items: center; gap: 16px; justify-content: space-between;
  font-size: 12.5px; color: var(--ink-2);
  border-bottom: 1px solid var(--rule); padding-bottom: 10px;
}
.status { display: inline-flex; align-items: center; gap: 7px; margin-inline-start: auto; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.status.live .dot { background: var(--down); box-shadow: 0 0 0 3px var(--down-bg); }
.status.stale .dot { background: var(--spot); }
.status.down .dot { background: var(--up); }
.theme { border: 0; background: none; padding: 4px; cursor: pointer; color: var(--ink-2); display: grid; }
.theme svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.theme:hover { color: var(--ink); }

.masthead {
  display: inline-block; text-decoration: none;
  font: 700 clamp(64px, 13vw, 128px)/1.6 var(--mast); letter-spacing: 0;
  margin: -0.12em 0 0; padding-bottom: 0.1em; color: var(--ink);
}
.masthead::after { /* the spot-colour dot under the qaf, like a price sticker */
  content: ""; display: inline-block; width: 0.11em; height: 0.11em; border-radius: 50%;
  background: var(--spot); margin-inline-start: 0.06em; vertical-align: 0.05em;
}
.mast-sub {
  margin: 0 auto; padding: 18px 0 14px; max-width: 78ch; text-wrap: balance; color: var(--ink-2); font-size: 14.5px;
  border-bottom: 3px double var(--rule-strong);
}
.mast-sub b { color: var(--ink); font-weight: 600; }

/* ---------------- section heads ---------------- */
section { padding-block: clamp(28px, 5vw, 48px) 0; }
.head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 20px; margin-bottom: 14px; }
.head h2 { margin: 0; font-size: clamp(21px, 2.4vw, 26px); font-weight: 700; letter-spacing: -0.005em; }
.head p { margin: 0; color: var(--ink-2); font-size: 13.5px; max-width: 70ch; }

/* ---------------- price index ---------------- */
.index-cols {
  columns: 2 360px; column-gap: 40px; column-rule: 1px solid var(--rule);
  border-top: 2px solid var(--rule-strong);
}
.ix-group { break-inside: avoid; padding-top: 10px; }
.ix-group h3 {
  margin: 0 0 2px; font-size: 12.5px; font-weight: 600; color: var(--ink-3);
  border-bottom: 1px solid var(--rule); padding-bottom: 4px;
}
.ix-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 76px; align-items: baseline; gap: 4px 14px;
  width: 100%; padding: 9px 4px; border: 0; border-bottom: 1px dotted var(--rule); background: none;
  text-align: start; cursor: pointer; transition: background-color 160ms ease-out;
}
.ix-row:hover { background: var(--paper-2); }
.ix-name { font-weight: 600; direction: ltr; text-align: right; unicode-bidi: isolate; font-size: 14.5px; }
.ix-price { font-weight: 700; font-size: 17px; }
.ix-price small { font-weight: 400; font-size: 11.5px; color: var(--ink-3); margin-inline-start: 3px; }
.ix-chg { font-size: 12.5px; font-weight: 600; text-align: end; white-space: nowrap; }
.ix-chg.down { color: var(--down); }
.ix-chg.up { color: var(--up); }
.ix-chg.flat { color: var(--ink-3); font-weight: 400; }
.ix-where { grid-column: 1 / -1; font-size: 12px; color: var(--ink-3); display: flex; gap: 10px; flex-wrap: wrap; }
.ix-where b { color: var(--ink-2); font-weight: 500; }
.ix-low { color: var(--down); }

/* ---------------- biggest drops ---------------- */
.drops-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--rule); background: none; border-radius: 999px; padding: 3px 12px;
  font-size: 13px; cursor: pointer; color: var(--ink-2); transition: background-color 160ms ease-out, color 160ms ease-out;
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.switch { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; color: var(--ink-2); }
.switch input, .check input { accent-color: var(--ink); width: 15px; height: 15px; margin: 0; }

.drop-list { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--rule-strong); counter-reset: drop; }
.drop {
  display: grid; grid-template-columns: 2.2em 5.2em minmax(0, 1fr) auto; align-items: center; gap: 2px 16px;
  padding: 11px 4px; border-bottom: 1px solid var(--rule); text-decoration: none;
  transition: background-color 160ms ease-out;
}
.drop:hover { background: var(--paper-2); }
.drop-rank { color: var(--ink-3); font-size: 13px; }
.drop-pct { font-weight: 700; font-size: 22px; color: var(--down); direction: ltr; text-align: right; }
.drop-main { min-width: 0; }
.drop-title { display: block; font-weight: 500; direction: ltr; text-align: right; unicode-bidi: plaintext; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop-meta { font-size: 12.5px; color: var(--ink-3); display: flex; gap: 10px; flex-wrap: wrap; }
.drop-prices { text-align: end; white-space: nowrap; }
.drop-now { display: block; font-weight: 700; font-size: 16px; }
.drop-was { font-size: 12.5px; color: var(--ink-3); text-decoration: line-through; text-decoration-thickness: 1px; }
.real {
  display: inline-block; font-size: 11.5px; font-weight: 600; color: var(--down);
  background: var(--down-bg); border-radius: 3px; padding: 0 6px; line-height: 1.7;
}
.claimed { font-size: 11.5px; color: var(--ink-3); }
.note { font-size: 12.5px; color: var(--ink-3); margin: 12px 0 0; max-width: 80ch; }
.empty { padding: 22px 4px; color: var(--ink-2); border-bottom: 1px solid var(--rule); }

/* ---------------- alerts ---------------- */
.head p b { color: var(--ink); font-weight: 600; }
.alert-ways {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 0 40px;
  border-top: 2px solid var(--rule-strong);
}
.way { padding: 14px 0 6px; }
.way + .way { border-inline-start: 1px solid var(--rule); padding-inline-start: 40px; }
.way h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.way p { margin: 0 0 12px; color: var(--ink-2); font-size: 13.5px; max-width: 52ch; }
.way a { text-underline-offset: 3px; }
.btn {
  border: 0; border-radius: 4px; background: var(--ink); color: var(--paper); font-weight: 600; font-size: 14px;
  padding: 9px 18px; cursor: pointer; transition: opacity 160ms ease-out;
}
.btn:hover { opacity: 0.88; }
.btn.off { background: none; color: var(--ink-2); border: 1px solid var(--rule); font-weight: 500; }
.btn:disabled { opacity: 0.5; cursor: wait; }
.way-note { font-size: 12.5px !important; color: var(--ink-3) !important; margin-top: 10px !important; }
.steps { margin: 0; padding-inline-start: 20px; font-size: 13.5px; color: var(--ink-2); display: grid; gap: 8px; }
.steps b { color: var(--ink); }
.topic { display: inline-flex; align-items: center; gap: 10px; margin-inline-start: 4px; }
.topic code {
  direction: ltr; font: 600 14px/1 ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--ink);
  background: var(--paper-2); padding: 5px 8px; border-radius: 3px;
}

/* ---------------- explore ---------------- */
.filters { display: grid; gap: 10px; margin-bottom: 4px; }
.search {
  display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--ink); border-radius: 4px;
  padding: 0 14px; background: var(--paper);
}
.search svg { width: 19px; height: 19px; fill: none; stroke: var(--ink-2); stroke-width: 2; flex: none; }
.search input { border: 0; background: none; width: 100%; padding: 12px 0; font-size: 16px; outline: none; }
.search:focus-within { box-shadow: 0 0 0 3px oklch(from var(--focus) l c h / 0.25); }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 13.5px; color: var(--ink-2); }
.filter-row select, .filter-row input[type="number"] {
  border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); padding: 5px 8px; font-size: 13.5px;
}
.filter-row select:hover, .filter-row input[type="number"]:hover { border-color: var(--ink-3); }
.filter-row input[type="number"] { width: 6.5em; }
.num, .check { display: inline-flex; align-items: center; gap: 6px; }
.link { border: 0; background: none; padding: 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; color: var(--ink-2); font-size: 13.5px; }
.link:hover { color: var(--ink); }
.part-filter { margin: 0; font-size: 13.5px; }
.part-filter .link { margin-inline-start: 8px; }
.part-filter b { direction: ltr; unicode-bidi: isolate; }

.table-wrap { overflow-x: auto; border-top: 2px solid var(--rule-strong); margin-top: 8px; }
.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid th {
  font-size: 12px; font-weight: 600; color: var(--ink-3); text-align: start; padding: 9px 10px;
  border-bottom: 1px solid var(--rule); cursor: pointer; white-space: nowrap; user-select: none;
}
.grid th:hover { color: var(--ink); }
.grid th[aria-sort]::after { content: " ↓"; }
.grid th[aria-sort="ascending"]::after { content: " ↑"; }
.grid td { padding: 9px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.grid .n { text-align: end; white-space: nowrap; }
.grid tbody tr:hover { background: var(--paper-2); }
.grid .title a { text-decoration: none; direction: ltr; unicode-bidi: plaintext; display: block; text-align: right; }
.grid .title a:hover { text-decoration: underline; text-underline-offset: 3px; }
.grid .kind { display: block; font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.grid .store { white-space: nowrap; color: var(--ink-2); }
.grid .price { font-weight: 700; }
.grid .was { color: var(--ink-3); text-decoration: line-through; text-decoration-thickness: 1px; }
.grid .pct { font-weight: 600; color: var(--down); }
.grid .pct.claimed { font-weight: 400; color: var(--ink-3); font-size: 13px; }
.grid tr.out td { opacity: 0.55; }
.grid .out-tag { font-size: 11.5px; color: var(--up); margin-inline-start: 6px; }
.grid .empty-row td { padding: 28px 10px; color: var(--ink-2); text-align: center; }

.pager { display: flex; justify-content: center; gap: 4px; padding: 16px 0 0; flex-wrap: wrap; }
.pager button {
  min-width: 36px; height: 36px; border: 1px solid var(--rule); background: none; border-radius: 4px; cursor: pointer; font-size: 13.5px;
}
.pager button:hover:not(:disabled) { border-color: var(--ink-3); }
.pager button[aria-current="page"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pager button:disabled { opacity: 0.4; cursor: default; }

/* ---------------- stores ---------------- */
.store-list { list-style: none; margin: 0; padding: 0; columns: 4 210px; column-gap: 32px; border-top: 2px solid var(--rule-strong); padding-top: 8px; }
.store-list li { break-inside: avoid; display: flex; align-items: baseline; gap: 8px; padding: 6px 0; border-bottom: 1px dotted var(--rule); font-size: 13.5px; }
.s-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--down); flex: none; transform: translateY(-2px); }
.s-dot.warn { background: var(--spot); }
.s-dot.bad { background: var(--up); }
.s-name { font-weight: 500; }
.s-meta { margin-inline-start: auto; color: var(--ink-3); font-size: 12px; white-space: nowrap; }

/* ---------------- footer ---------------- */
.foot { text-align: center; padding-block: 48px 40px; margin-top: 48px; border-top: 3px double var(--rule-strong); font-size: 13.5px; color: var(--ink-2); }
.foot p { margin: 4px 0; }
.foot-mark { font: 700 40px/1.2 var(--mast); color: var(--ink); }
.foot strong { color: var(--ink); }

/* ---------------- loading ---------------- */
.skel { height: 52px; border-bottom: 1px dotted var(--rule); background: linear-gradient(90deg, transparent, var(--paper-2), transparent) 0 0 / 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------------- small screens ---------------- */
@media (max-width: 720px) {
  body { font-size: 14.5px; }
  .mast-line #dateline { display: none; }
  .way + .way { border-inline-start: 0; padding-inline-start: 0; border-top: 1px solid var(--rule); }
  .drop { grid-template-columns: 4.4em minmax(0, 1fr) auto; }
  .drop-rank { display: none; }
  .drop-pct { font-size: 19px; }
  .drop-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .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: 10px 2px; border-bottom: 1px solid var(--rule); }
  .grid td { border: 0; padding: 0; }
  .grid td.title { grid-column: 1 / -1; }
  .grid td.store { grid-row: 2; }
  .grid td.price { grid-row: 2; grid-column: 2; }
  .grid td.was { grid-row: 3; grid-column: 2; }
  .grid td.disc { grid-row: 3; grid-column: 1; text-align: start; }
  .grid tr.empty-row { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
