/* Radar: a personal Persian morning paper on AI and dev tools.
   Persian-tile palette: lapis ink on cool paper, turquoise only for "why it matters to you",
   saffron only for importance and deadlines. One typeface: Yekan Bakh (variable 100-1000), self-hosted.
   Contrast checked: every text pair >= 4.5:1 in both themes. */
@font-face {
  font-family: "Yekan Bakh";
  src: url("fonts/YekanBakh-VF.woff2") format("woff2");
  font-weight: 100 1000;
  font-display: swap;
}
:root {
  --paper: #f6f7fa; --surface: #ffffff; --sunk: #eef1f6; --ink: #14203a; --muted: #4f5b74; --rule: #dbe1ea; --rule-strong: #c3ccda;
  --teal: #0b6b67; --teal-soft: #e2f2f0; --saffron: #8f5a00; --saffron-ui: #c27c0e; --saffron-soft: #fbefd6;
  --lapis: #2448a8; --danger: #a3261d; --danger-soft: #fbe9e7; --mark: #ffe9a8;
  --face: "Yekan Bakh", Vazirmatn, "Segoe UI", Tahoma, sans-serif;
  --bar-h: 3.5rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0d1321; --surface: #131b2d; --sunk: #182236; --ink: #e7ecf5; --muted: #a3aec4; --rule: #263049; --rule-strong: #34405c;
    --teal: #4fd1c9; --teal-soft: #0f2a2f; --saffron: #f3b453; --saffron-ui: #f3b453; --saffron-soft: #2c2414;
    --lapis: #93b0ff; --danger: #ff9a8f; --danger-soft: #34181a; --mark: #5a4710;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0d1321; --surface: #131b2d; --sunk: #182236; --ink: #e7ecf5; --muted: #a3aec4; --rule: #263049; --rule-strong: #34405c;
  --teal: #4fd1c9; --teal-soft: #0f2a2f; --saffron: #f3b453; --saffron-ui: #f3b453; --saffron-soft: #2c2414;
  --lapis: #93b0ff; --danger: #ff9a8f; --danger-soft: #34181a; --mark: #5a4710;
  color-scheme: dark;
}

/* --- base and browser surfaces --- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bar-h) + 1rem); }
body { margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink); font: 400 1rem/1.9 var(--face);
       caret-color: var(--teal); scrollbar-color: var(--rule-strong) var(--paper); }
::selection { background: var(--teal); color: var(--paper); }
a { color: inherit; text-decoration: none; text-underline-offset: .3em; }
a:hover { color: var(--lapis); }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
code, pre { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .85em; }
.num, td, .bars .n, .chips b { font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: no-preference) { a, button { transition: color .15s ease-out, background-color .15s ease-out, border-color .15s ease-out; } }

/* --- top bar --- */
.bar { position: sticky; top: 0; z-index: 5; height: var(--bar-h); display: flex; align-items: center; gap: 1.8rem;
       padding: 0 clamp(1rem, 4vw, 3rem); border-bottom: 1px solid var(--rule);
       background: color-mix(in srgb, var(--paper) 90%, transparent); backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 900; font-size: 1.15rem; }
.brand:hover { color: var(--ink); }
.mark { width: 26px; height: 26px; color: var(--teal); flex: none; }
.bar nav { display: flex; gap: 1.4rem; overflow-x: auto; scrollbar-width: none; font-size: .9375rem; }
.bar nav a { color: var(--muted); font-weight: 500; white-space: nowrap; padding: .35rem 0; }
.bar nav a:hover { color: var(--ink); }
.bar nav a[aria-current="page"] { color: var(--ink); font-weight: 750; box-shadow: inset 0 -2px 0 var(--teal); }
.bar .quick { margin-inline-start: auto; }
.bar .quick input { width: 16rem; border-radius: 999px; padding-inline: 1rem; }
.bar .out { color: var(--muted); font-size: .8125rem; }

main { max-width: 1240px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 3rem) 3rem; }

/* --- form controls (one vocabulary for every page) --- */
input, select, textarea, button { font: inherit; color: var(--ink); }
input, select, textarea { min-height: 2.5rem; padding: .35rem .75rem; border: 1px solid var(--rule-strong); border-radius: 8px;
                          background: var(--surface); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; border-color: var(--teal); }
button, .btn { min-height: 2.5rem; padding: .35rem 1.1rem; border-radius: 8px; border: 1px solid var(--rule-strong);
               background: var(--surface); font-weight: 650; cursor: pointer; }
button:hover, .btn:hover { border-color: var(--ink); color: var(--ink); }
button:active { transform: translateY(1px); }
button:disabled, button[aria-busy="true"] { opacity: .65; cursor: progress; }
.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.primary:hover { background: var(--lapis); border-color: var(--lapis); color: #fff; }
label { display: inline-flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .9375rem; }

/* --- page heads (search, catalog, saved) --- */
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
             padding: 2rem 0 1rem; border-bottom: 3px solid var(--ink); }
.page-head h1 { font-size: 2rem; font-weight: 900; line-height: 1.3; }
.page-head p { color: var(--muted); font-size: .9375rem; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: 1.2rem 0; border-bottom: 1px solid var(--rule); }
.filters .grow { flex: 1 1 14rem; }
.btns { display: flex; flex-wrap: wrap; gap: .6rem; }
.btns button { flex: 1 0 auto; }

/* --- the paper --- */
.mast { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem;
        padding: 2rem 0 1rem; border-bottom: 3px solid var(--ink); }
.mast h1 { font-size: clamp(3.5rem, 9vw, 6rem); font-weight: 1000; line-height: .95; letter-spacing: -.01em; }
.mast .about { text-align: end; color: var(--muted); font-size: .9375rem; line-height: 1.8; }
.mast .date { display: block; color: var(--ink); font-weight: 800; font-size: 1.25rem; }
.issue { display: flex; justify-content: space-between; align-items: center; padding: .55rem 0; color: var(--muted);
         font-size: .875rem; border-bottom: 1px solid var(--rule); }
.issue a { padding: .2rem 0; }
.issue a:hover { color: var(--teal); }
.notice { margin-top: 1.2rem; padding: .8rem 1rem; border-radius: 10px; background: var(--saffron-soft); color: var(--saffron); }

.front { display: grid; grid-template-columns: minmax(0, 1fr) 20.5rem; grid-template-areas: "lead side" "second side";
         grid-template-rows: auto 1fr; column-gap: 3rem; padding-top: 2rem; }
.lead { grid-area: lead; padding-bottom: 2rem; border-bottom: 1px solid var(--rule); }
.second { grid-area: second; display: grid; grid-template-columns: 1fr 1fr; column-gap: 2.4rem; align-content: start; }
.side { grid-area: side; }

.lead h2 { font-size: clamp(1.9rem, 3.4vw, 2.75rem); font-weight: 850; line-height: 1.4; }
.lead .what { font-size: 1.1875rem; margin-top: .9rem; max-width: 44rem; }
.lead .why { font-size: 1.0625rem; max-width: 44rem; }
.story { padding: 1.5rem 0; border-bottom: 1px solid var(--rule); }
.story h3 { font-size: 1.25rem; font-weight: 800; line-height: 1.6; }
.story .what, .brief .what { margin-top: .35rem; color: var(--muted); font-size: .96875rem; line-height: 1.9; }
.why { margin-top: .75rem; padding: .6rem .9rem; border-radius: 10px; background: var(--teal-soft); color: var(--teal);
       font-size: .9375rem; line-height: 1.85; }
.why b { font-weight: 800; }

.meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1rem; margin-top: .7rem; color: var(--muted); font-size: .8125rem; }
.meta-row .growth { color: var(--saffron); font-weight: 700; }
.meta-row .more { border-bottom: 1px dotted var(--muted); }
.meta-row .more:hover { color: var(--teal); border-color: var(--teal); }
.imp { display: inline-flex; gap: 3px; }
.imp i { width: 14px; height: 5px; border-radius: 3px; background: var(--rule-strong); }
.imp i.on { background: var(--saffron-ui); }
.flag { color: var(--saffron); font-weight: 700; }

.side > section { padding: 1.3rem 0; border-bottom: 1px solid var(--rule); }
.side > section:first-child { padding-top: 0; }
.side > section:last-child { border-bottom: 0; }
.side h2 { font-size: 1rem; font-weight: 850; margin-bottom: .75rem; display: flex; justify-content: space-between; align-items: baseline; }
.side h2 small { color: var(--muted); font-weight: 400; font-size: .75rem; }
.bars { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.bars li { display: grid; grid-template-columns: 7.5rem 1fr 2.5rem; align-items: center; gap: .7rem; font-size: .875rem; }
.bars .track { display: block; height: 8px; border-radius: 4px; background: var(--rule); overflow: hidden; }
.bars .fill { display: block; height: 100%; border-radius: 4px; background: var(--teal); }
.bars .n { color: var(--muted); text-align: end; font-size: .8125rem; }
.deadline { display: grid; grid-template-columns: 3.5rem 1fr; gap: .85rem; align-items: start; padding: .4rem 0; }
.deadline .day { text-align: center; border-radius: 10px; background: var(--saffron-soft); color: var(--saffron); padding: .3rem 0; line-height: 1.25; }
.deadline .day b { display: block; font-size: 1.375rem; font-weight: 900; }
.deadline .day span { font-size: .75rem; font-weight: 650; }
.deadline a { font-size: .90625rem; font-weight: 650; line-height: 1.7; }
.deadline small { display: block; color: var(--muted); font-size: .75rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chips a { display: inline-flex; gap: .35rem; align-items: center; min-height: 2rem; padding: .1rem .75rem; border-radius: 999px;
           border: 1px solid var(--rule); background: var(--surface); font-size: .84375rem; }
.chips a:hover { border-color: var(--teal); color: var(--teal); }
.chips b { font-weight: 700; color: var(--muted); }
.chips a.hot b { color: var(--saffron); }
.quiet { display: block; margin-top: .6rem; color: var(--muted); font-size: .78125rem; }
.tips { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.tips li { position: relative; padding-inline-start: 1rem; font-size: .90625rem; line-height: 1.85; }
.tips li::before { content: ""; position: absolute; inset-inline-start: 0; top: .75em; width: 6px; height: 6px; border-radius: 50%; background: var(--teal); }

.cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 2.4rem; margin-top: 2.8rem; }
.col > h2 { font-size: 1.125rem; font-weight: 900; padding-top: .8rem; border-top: 3px solid var(--ink); }
.brief { padding: 1rem 0; border-bottom: 1px solid var(--rule); }
.brief h3 { font-size: 1.03125rem; font-weight: 750; line-height: 1.7; }
.brief .why { font-size: .875rem; padding: .45rem .75rem; }
.col .empty-note { color: var(--muted); font-size: .875rem; padding: 1rem 0; }

.colophon { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: .8125rem; }

/* --- lists: search results, saved, live search --- */
.list { list-style: none; padding: 0; margin: 0; }
.row { padding: 1.1rem 0; border-bottom: 1px solid var(--rule); }
.row .t { font-size: 1.0625rem; font-weight: 750; line-height: 1.7; }
.row .snip { margin-top: .3rem; color: var(--muted); font-size: .9375rem; max-width: 46rem; }
.row .note { margin-top: .5rem; padding: .45rem .75rem; border-radius: 8px; background: var(--sunk); font-size: .875rem; }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 .1em; }
.section-title { font-size: 1.25rem; font-weight: 900; margin: 2rem 0 .2rem; }
.live { margin-top: 1.5rem; padding: 1.2rem 1.4rem; border-radius: 14px; background: var(--sunk); }
.live > p { color: var(--muted); font-size: .875rem; }
.live h3 { display: flex; align-items: baseline; gap: .7rem; margin-top: 1.3rem; font-size: 1rem; font-weight: 850; }
.live h3 small { color: var(--muted); font-weight: 500; font-size: .8125rem; }
.live h3 small.err { color: var(--danger); }
.live .row { border-color: var(--rule-strong); }
/* --- ask: the answer sits on the sunk surface like live search; numbered chips link to the source list --- */
.answer { margin-top: 1.5rem; padding: 1.2rem 1.4rem; border-radius: 14px; background: var(--sunk); }
.answer .section-title { margin-top: 0; }
.answer-body { max-width: 46rem; margin-top: .6rem; font-size: 1.0625rem; }
.answer-body > * + * { margin-top: .6rem; }
.answer-body ul { margin-bottom: 0; padding-inline-start: 1.2rem; }
.answer-body li + li { margin-top: .35rem; }
.cite { display: inline-grid; place-items: center; min-width: 1.4rem; height: 1.4rem; margin-inline-start: .25rem; padding: 0 .35rem;
        border-radius: 999px; background: var(--teal-soft); color: var(--teal); font-size: .75rem; font-weight: 800;
        line-height: 1; vertical-align: .1em; }
a.cite:hover { background: var(--teal); color: var(--paper); }
.searched { margin-top: 1rem; color: var(--muted); font-size: .8125rem; }
.sources .row .cite { margin-inline: 0 .5rem; }
.sources .row:target .t { color: var(--teal); }
.empty { padding: 2.5rem 0; color: var(--muted); max-width: 40rem; }
.empty strong { display: block; color: var(--ink); font-size: 1.125rem; margin-bottom: .4rem; }
.empty .chips { margin-top: .8rem; }
.empty .filters { border: 0; padding-bottom: 0; }

/* --- repo and skill catalog --- */
.catalog { width: 100%; border-collapse: collapse; margin-top: .5rem; font-size: .9375rem; }
.catalog th { position: sticky; top: var(--bar-h); z-index: 1; background: var(--paper); text-align: start; font-weight: 750;
              color: var(--muted); font-size: .8125rem; padding: .7rem .6rem; border-bottom: 1px solid var(--rule-strong); }
.catalog td { padding: .9rem .6rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.catalog .repo a { font-weight: 750; direction: ltr; unicode-bidi: isolate; }
.catalog .repo .flag { display: block; font-size: .78125rem; }
.catalog .kind { color: var(--muted); font-size: .78125rem; }
.catalog .desc { color: var(--muted); max-width: 30rem; }
.catalog .growth { color: var(--saffron); font-weight: 700; white-space: nowrap; }
.catalog td.n { white-space: nowrap; }

/* --- item page --- */
.entry { max-width: 46rem; padding-top: 2rem; }
.entry h1 { font-size: 2rem; font-weight: 850; line-height: 1.45; }
.entry .orig { margin-top: .4rem; color: var(--muted); font-size: .9375rem; unicode-bidi: plaintext; }
.entry .lede { margin-top: 1rem; font-size: 1.1875rem; }
.entry .body-en { margin-top: 1.2rem; color: var(--muted); font-size: .9375rem; unicode-bidi: plaintext; }
.entry .chips { margin-top: 1.2rem; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.6rem 0 .8rem; }
.note-form { display: grid; gap: .6rem; }
.note-form textarea { width: 100%; min-height: 6rem; resize: vertical; }
.note-form button { justify-self: start; }
details { margin-top: 1.6rem; color: var(--muted); font-size: .875rem; }
summary { cursor: pointer; padding: .3rem 0; }
pre { overflow-x: auto; padding: 1rem; border-radius: 10px; background: var(--sunk); color: var(--ink); }

/* --- login --- */
.login { min-height: 100vh; display: grid; place-content: center; padding: 1.5rem; }
.login-box { width: min(24rem, calc(100vw - 3rem)); }
.login-box .brand { font-size: 2.5rem; gap: .7rem; }
.login-box .brand .mark { width: 44px; height: 44px; }
.login-box p { color: var(--muted); margin: .4rem 0 1.6rem; }
.login-box form { display: grid; gap: 1rem; }
.login-box label { display: grid; gap: .35rem; color: var(--ink); font-weight: 650; }
.login-box input { width: 100%; }
.login-box button { margin-top: .4rem; }
.alert { padding: .7rem 1rem; border-radius: 10px; background: var(--danger-soft); color: var(--danger); margin-bottom: 1rem; }

/* --- tablet and phone --- */
@media (max-width: 900px) {
  .front { grid-template-columns: 1fr; grid-template-areas: "lead" "second" "side"; }
  .side { margin-top: 1.6rem; padding-top: 1.4rem; border-top: 3px solid var(--ink); }
  .cols { grid-template-columns: 1fr; margin-top: 2rem; }
  .bar { gap: 1.1rem; }
  .bar .quick, .bar .out { display: none; }
}
@media (max-width: 640px) {
  .mast { flex-direction: column; align-items: flex-start; gap: .6rem; padding-top: 1.4rem; }
  .mast .about { text-align: start; }
  .second { grid-template-columns: 1fr; }
  .bars li { grid-template-columns: 6.5rem 1fr 2.2rem; }
  .page-head h1 { font-size: 1.625rem; }
  .filters > * { flex: 1 1 100%; }
  .filters label input { flex: 1; }
  /* the catalog becomes one card per repo */
  .catalog thead { display: none; }
  .catalog, .catalog tbody, .catalog tr, .catalog td { display: block; }
  .catalog tr { padding: 1rem 0; border-bottom: 1px solid var(--rule); }
  .catalog td { border: 0; padding: .1rem 0; }
  .catalog td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .8125rem; }
  .catalog td.n { display: inline-block; margin-inline-end: 1rem; }
}
