/* ============================================================
   Scammeter — فهرست هشدار (public advisory page)
   Aesthetic: official advisory bulletin — warm paper, saffron
   accent, hazard-stripe motif. RTL-first, light + dark themes.
   ============================================================ */

@font-face {
  font-family: 'Vazirmatn'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/bale/watchlist/static/fonts/Vazirmatn-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Vazirmatn'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('/bale/watchlist/static/fonts/Vazirmatn-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'Vazirmatn'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('/bale/watchlist/static/fonts/Vazirmatn-Bold.woff2') format('woff2');
}
@font-face {
  font-family: 'Vazirmatn'; font-style: normal; font-weight: 900; font-display: swap;
  src: url('/bale/watchlist/static/fonts/Vazirmatn-Black.woff2') format('woff2');
}

/* ---------- tokens ---------- */
:root, :root[data-theme="light"] {
  --bg: #faf6ef;
  --bg-glow: #f5e9d4;
  --surface: #fffdf8;
  --surface-2: #f6efe2;
  --line: #e8dec9;
  --line-strong: #cdbfa3;
  --ink: #241d12;
  --muted: #7c6f59;
  --accent: #b45309;
  --accent-bright: #d97706;
  --accent-ink: #8a3d03;
  --accent-soft: #f7e8d1;
  --danger: #b3261e;       --danger-bg: #f9e3e0;
  --warn:   #9a6a00;       --warn-bg:   #f7ecca;
  --calm:   #5f7327;       --calm-bg:   #ecf0d8;
  --shadow: 0 1px 2px rgba(64,48,22,.06), 0 10px 30px rgba(64,48,22,.08);
  --shadow-lift: 0 2px 6px rgba(64,48,22,.10), 0 14px 38px rgba(64,48,22,.12);
}
:root[data-theme="dark"] {
  --bg: #171310;
  --bg-glow: #241a0e;
  --surface: #1f1914;
  --surface-2: #281f17;
  --line: #3a2f23;
  --line-strong: #55462f;
  --ink: #f1e8d8;
  --muted: #a3927a;
  --accent: #e8993f;
  --accent-bright: #f3ad55;
  --accent-ink: #f3ad55;
  --accent-soft: #33261596;
  --danger: #ef7d72;       --danger-bg: #43201c;
  --warn:   #e3b341;       --warn-bg:   #3b2e10;
  --calm:   #b5cb6b;       --calm-bg:   #2b3217;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 34px rgba(0,0,0,.45);
  --shadow-lift: 0 2px 6px rgba(0,0,0,.5), 0 16px 44px rgba(0,0,0,.55);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
  font-size: 15.5px;
  line-height: 1.9;
  color: var(--ink);
  background:
    radial-gradient(1100px 480px at 85% -120px, var(--bg-glow), transparent 70%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }
:focus-visible { outline: 2.5px solid var(--accent-bright); outline-offset: 3px; border-radius: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; inset-inline-start: 12px; top: -48px; z-index: 100;
  background: var(--ink); color: var(--bg); padding: 8px 16px; border-radius: 0 0 10px 10px;
  transition: top .2s ease;
}
.skip:focus { top: 0; }

/* ---------- hazard ribbon ---------- */
.hazard {
  height: 7px;
  background: repeating-linear-gradient(
    -45deg,
    var(--accent-bright) 0 14px,
    var(--ink) 14px 28px
  );
  opacity: .9;
}

/* ---------- shell ---------- */
.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 26px clamp(14px, 4vw, 28px) 56px;
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  padding: clamp(18px, 4vw, 34px) 0 6px;
  overflow: clip;
  text-align: center;
}
/* faint oversized warning watermark */
.hero::after {
  content: '⚠';
  position: absolute;
  inset-inline-end: -28px;
  top: -38px;
  font-size: clamp(150px, 26vw, 260px);
  line-height: 1;
  opacity: .05;
  pointer-events: none;
  user-select: none;
}
.kicker {
  display: inline-flex; align-items: center; gap: 9px;
  margin: 0 0 14px;
  font-size: 12.5px; font-weight: 500;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border: 1px solid var(--line);
  padding: 5px 14px; border-radius: 999px;
}
.kicker-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-bright);
  box-shadow: 0 0 0 0 var(--accent-bright);
}
.display {
  margin: 0 0 12px;
  font-weight: 900;
  font-size: clamp(1.45rem, 3.4vw + .4rem, 2.3rem);
  line-height: 1.35;
  letter-spacing: -.5px;
}
.display em {
  font-style: normal;
  color: var(--accent);
  /* hand-drawn underline */
  background: linear-gradient(to top, var(--accent-soft) 0 .32em, transparent .32em);
  border-radius: 4px;
  padding-inline: 2px;
}
.lede {
  margin: 0 auto 18px;
  max-width: 56ch;
  font-size: clamp(1rem, 1.5vw + .6rem, 1.13rem);
  color: var(--muted);
}
.facts {
  margin: 0 auto 18px; padding: 0;
  list-style: none;
  max-width: 70ch;
}
.facts li {
  margin-bottom: 8px;
}
.facts li::before {
  content: '◆';
  display: inline-block;
  margin-inline-end: 9px;
  color: var(--accent-bright);
  font-size: 11px;
  vertical-align: 2px;
}
.crit-title { margin: 0 0 10px; font-weight: 700; }
.chips {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center;
  margin: 0 0 22px; padding: 0; list-style: none;
}
.chip {
  font-size: 13px; font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px dashed var(--line-strong);
  padding: 5px 14px; border-radius: 999px;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}
.chip:hover {
  border-color: var(--accent-bright); border-style: solid;
  background: var(--accent-soft);
  transform: translateY(-1px);
}
.hero-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px;
  justify-content: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.updated { color: var(--muted); font-size: 13px; }

/* buttons */
.btn-solid, .btn-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-weight: 700; font-size: 14.5px;
  padding: 11px 22px; border-radius: 12px;
  border: 1.5px solid transparent;
  cursor: pointer; text-decoration: none !important;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
}
.btn-solid {
  background: linear-gradient(140deg, var(--accent-bright), var(--accent));
  color: #fff8ec;
  box-shadow: var(--shadow);
}
.btn-solid:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.btn-solid:active { transform: translateY(0); }
.btn-ghost {
  color: var(--accent-ink);
  border-color: var(--line-strong);
  background: var(--surface);
}
.btn-ghost:hover { border-color: var(--accent-bright); background: var(--accent-soft); }

/* theme toggle */
.theme-btn {
  position: absolute; top: 16px; inset-inline-end: 0; z-index: 5;
  width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 18px; cursor: pointer; box-shadow: var(--shadow);
  display: grid; place-items: center;
  transition: transform .15s ease, border-color .2s ease;
}
.theme-btn:hover { transform: rotate(12deg) scale(1.06); border-color: var(--accent-bright); }
:root[data-theme="dark"] .ico-moon { display: none; }
:root:not([data-theme="dark"]) .ico-sun { display: none; }

/* ---------- toolbar ---------- */
.toolbar {
  position: sticky; top: 10px; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  margin: 22px 0 16px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.search { position: relative; flex: 1; display: flex; align-items: center; }
.search-ico {
  position: absolute; inset-inline-start: 14px;
  font-size: 15px; opacity: .55; pointer-events: none;
}
.search input {
  width: 100%;
  font: inherit; color: var(--ink);
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  border-radius: 11px;
  padding: 10px 42px;
  transition: border-color .2s ease, background .2s ease;
}
.search input::placeholder { color: var(--muted); }
.search input:focus {
  outline: none;
  border-color: var(--accent-bright);
  background: var(--surface);
}
.search input::-webkit-search-cancel-button { display: none; }
.clear-btn {
  position: absolute; inset-inline-end: 8px;
  width: 28px; height: 28px; border-radius: 8px;
  border: none; background: var(--surface);
  color: var(--muted); font-size: 13px; cursor: pointer;
  display: grid; place-items: center;
}
.clear-btn:hover { color: var(--danger); background: var(--danger-bg); }
.count {
  flex-shrink: 0;
  font-size: 13px; font-weight: 500; color: var(--accent-ink);
  background: var(--accent-soft);
  border-radius: 999px; padding: 4px 14px;
  white-space: nowrap;
}

/* ---------- list ---------- */
.list-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: start;
  font-size: 12.5px; font-weight: 700;
  color: var(--muted);
  background: var(--surface-2);
  padding: 13px 18px;
  border-bottom: 2px solid var(--line-strong);
}
tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: var(--accent-soft); }
.c-name { font-weight: 700; min-width: 160px; }
.c-act { color: var(--muted); }
.nil { color: var(--muted); opacity: .6; }

/* risk badges */
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 700;
  padding: 3px 12px; border-radius: 999px;
  white-space: nowrap;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.r-high { color: var(--danger); background: var(--danger-bg); }
.r-med  { color: var(--warn);   background: var(--warn-bg); }
.r-low  { color: var(--calm);   background: var(--calm-bg); }

/* discussion link */
.btn-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500;
  color: var(--accent-ink);
  border: 1.5px solid var(--line-strong);
  border-radius: 9px;
  padding: 4px 14px;
  text-decoration: none !important;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.btn-link:hover {
  border-color: var(--accent-bright);
  background: var(--accent-soft);
  transform: translateY(-1px);
}
.btn-link .ext { font-size: 11px; opacity: .7; }

.empty {
  margin: 0; padding: 38px 20px;
  text-align: center; color: var(--muted);
}

/* ---------- full guide ---------- */
.guide {
  margin-top: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.guide summary {
  list-style: none;
  cursor: pointer;
  padding: 15px 20px;
  font-weight: 700;
  position: relative;
  transition: background .15s ease;
}
.guide summary::-webkit-details-marker { display: none; }
.guide summary::after {
  content: '▾';
  position: absolute; inset-inline-end: 20px;
  color: var(--accent-bright);
  transition: transform .25s ease;
}
.guide[open] summary::after { transform: rotate(180deg); }
.guide summary:hover { background: var(--accent-soft); }
.guide-body {
  padding: 4px 20px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.guide-body ul { padding-inline-start: 22px; }

/* ---------- footer ---------- */
.foot {
  margin-top: 30px;
  text-align: center;
}
.foot .small {
  margin-top: 14px;
  font-size: 12.5px; color: var(--muted);
}

/* ============================================================
   responsive: table → cards
   ============================================================ */
@media (max-width: 640px) {
  thead { display: none; }
  table, tbody { display: block; }
  .list-card {
    background: transparent; border: none; box-shadow: none; border-radius: 0;
    overflow: visible;
  }
  tbody tr {
    display: block;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 16px 16px 12px;
    margin-bottom: 12px;
    transition: transform .15s ease, box-shadow .2s ease;
  }
  tbody tr:hover { background: var(--surface); transform: translateY(-2px); box-shadow: var(--shadow-lift); }
  tbody td {
    display: block;
    padding: 0;
    border-bottom: none;
  }
  .c-name { font-size: 16.5px; margin-bottom: 8px; }
  .c-act, .c-risk {
    display: flex; align-items: baseline; gap: 10px;
    margin-bottom: 7px;
  }
  .c-act::before, .c-risk::before {
    content: attr(data-label);
    flex-shrink: 0;
    font-size: 11.5px; font-weight: 500;
    color: var(--muted);
    min-width: 108px;
  }
  .c-risk { align-items: center; }
  .c-link { margin-top: 10px; }
  .c-link .btn-link {
    width: 100%; justify-content: center;
    padding: 9px 14px;
  }
  .c-link .nil { display: none; }

  .toolbar { flex-wrap: wrap; gap: 10px; top: 8px; }
  .count { margin-inline-start: auto; }
  .hero-actions .btn-solid { width: 100%; justify-content: center; }
}

/* ============================================================
   motion (opt-in)
   ============================================================ */
@media (prefers-reduced-motion: no-preference) {
  @keyframes rise {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
  }
  @keyframes fade {
    from { opacity: 0; }
    to   { opacity: 1; }
  }
  @keyframes pulse {
    0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-bright) 55%, transparent); }
    70%  { box-shadow: 0 0 0 9px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
  }
  .kicker, .display, .lede, .facts, .crit-title, .chips, .hero-actions {
    animation: rise .55s cubic-bezier(.22,.9,.3,1) both;
  }
  .display      { animation-delay: .06s; }
  .lede         { animation-delay: .12s; }
  .facts        { animation-delay: .18s; }
  .crit-title   { animation-delay: .24s; }
  .chips        { animation-delay: .28s; }
  .hero-actions { animation-delay: .34s; }
  .toolbar      { animation: rise .55s cubic-bezier(.22,.9,.3,1) .4s both; }
  tbody tr      { animation: fade .5s ease both; animation-delay: calc(.45s + var(--i, 0) * 45ms); }
  .kicker-dot   { animation: pulse 2.4s ease-out infinite .8s; }
}
@media (max-width: 640px) and (prefers-reduced-motion: no-preference) {
  tbody tr { animation-name: rise; }
}

/* ============================================================
   print
   ============================================================ */
@media print {
  .hazard, .toolbar, .theme-btn, .skip, .hero-actions .btn-solid, .foot .btn-ghost { display: none !important; }
  body { background: #fff; color: #000; }
  .list-card, tbody tr { box-shadow: none; border-color: #bbb; }
  .hero::after { display: none; }
}
