/* =========================================================================
   دليل مجلس الشعب السوري
   A civic register, not a social directory. The palette is drawn from official
   paper and olive rather than flag colours, which would read as partisan on a
   page that has to stay neutral about its 210 subjects.
   ========================================================================= */

:root {
  --paper:     #EFF1EC;
  --paper-2:   #E6EAE3;
  --ink:       #14201C;
  --olive:     #4A6B4D;   /* documented */
  --brass:     #B08A3E;   /* not yet researched — the call to action */
  --stone:     #6F7A74;   /* secondary text */
  --vacant:    #C3CABF;
  --line:      #D6DCD3;
  --focus:     #1F5C8C;

  --display: 'Noto Kufi Arabic', 'Damascus', 'Geeza Pro', 'Segoe UI Arabic', Tahoma, sans-serif;
  --body:    'IBM Plex Sans Arabic', 'Damascus', 'Geeza Pro', 'Segoe UI Arabic', Tahoma, sans-serif;
  --mono:    'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --seat: 14px;
  --gap: 3px;
  --radius: 3px;
  --measure: 62rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:   #121714;
    --paper-2: #1A211C;
    --ink:     #E8EDE7;
    --olive:   #7FA383;
    --brass:   #D4A855;
    --stone:   #93A096;
    --vacant:  #333C36;
    --line:    #2A322C;
    --focus:   #74B4E8;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body { overflow-x: clip; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.7;
  font-feature-settings: 'kern';
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  inset-inline-start: -999px;
}
.skip:focus {
  inset-inline-start: 1rem;
  top: 1rem;
  z-index: 10;
  background: var(--ink);
  color: var(--paper);
  padding: .5rem .9rem;
  border-radius: var(--radius);
}

/* --- top bar ------------------------------------------------------------ */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.topbar__mark {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: .95rem;
  text-decoration: none;
}

/* Four marks: three documented, one still open — the site's whole premise, at 12px. */
.topbar__glyph {
  width: 12px;
  height: 12px;
  flex: none;
  background:
    linear-gradient(var(--olive) 0 0) 0 0 / 5px 5px no-repeat,
    linear-gradient(var(--olive) 0 0) 7px 0 / 5px 5px no-repeat,
    linear-gradient(var(--olive) 0 0) 0 7px / 5px 5px no-repeat,
    linear-gradient(var(--brass) 0 0) 7px 7px / 5px 5px no-repeat;
}

.topbar__nav { display: flex; gap: 1.25rem; font-size: .9rem; }
.topbar__nav a { color: var(--stone); text-decoration: none; }
.topbar__nav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }

/* --- hero --------------------------------------------------------------- */

.hero {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 3.5rem 1.25rem 2rem;
}

.eyebrow {
  margin: 0 0 1.1rem;
  font-family: var(--body);
  font-size: .8rem;
  font-weight: 500;
  color: var(--stone);
}

.hero__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2rem, 6vw, 3.4rem);
  line-height: 1.55;
  margin: 0 0 1rem;
}

.hero__lede {
  max-width: 46ch;
  margin: 0 0 2.5rem;
  font-size: clamp(1rem, 2.2vw, 1.12rem);
  color: var(--stone);
}

/* --- the tally: 210 seats, coloured by what we know about each ---------- */

.tally { display: grid; gap: 1.75rem; margin-bottom: 1.5rem; }

.tally__group { overflow-x: clip; }

.tally__label {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  margin: 0 0 .7rem;
  font-family: var(--body);
  font-size: .8rem;
  font-weight: 600;
  color: var(--stone);
}
.tally__label span { font-variant-numeric: tabular-nums; }
.tally__label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.tally__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, var(--seat));
  gap: var(--gap);
  justify-content: start;
}

.seat {
  position: relative;
  width: var(--seat);
  height: var(--seat);
  background: var(--olive);
  border-radius: 1px;
  transition: transform .12s ease, opacity .18s ease;
}
.seat[data-status='not_reviewed']      { background: var(--brass); }
.seat[data-status='reviewed_no_account'] { background: transparent; box-shadow: inset 0 0 0 1.5px var(--olive); }
.seat[data-status='not_applicable']    { background: var(--vacant); pointer-events: none; }

.seat:hover, .seat:focus-visible { transform: scale(1.45); z-index: 3; }
.seat.is-dimmed { opacity: .16; }

.seat__tip {
  position: absolute;
  bottom: calc(100% + 7px);
  inset-inline-start: 50%;
  transform: translateX(50%) scale(.72);
  transform-origin: bottom center;
  white-space: nowrap;
  background: var(--ink);
  color: var(--paper);
  font-size: .8rem;
  padding: .25rem .5rem;
  border-radius: var(--radius);
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
}
.seat:hover .seat__tip, .seat:focus-visible .seat__tip { opacity: 1; }

/* Load-in: the record fills itself in, once, quickly. */
@media (prefers-reduced-motion: no-preference) {
  .tally__grid .seat { animation: seat-in .35s ease both; }
  .tally__grid .seat:nth-child(n+40)  { animation-delay: .04s; }
  .tally__grid .seat:nth-child(n+80)  { animation-delay: .08s; }
  .tally__grid .seat:nth-child(n+120) { animation-delay: .12s; }
  @keyframes seat-in { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }
}

/* --- legend doubles as a status filter ---------------------------------- */

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .34rem .7rem;
  font-family: var(--body);
  font-size: .84rem;
  color: var(--stone);
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
}
.legend__item:hover { border-color: var(--line); color: var(--ink); }
.legend__item[aria-pressed='true'] {
  border-color: var(--ink);
  color: var(--ink);
  background: var(--paper-2);
}
.legend__item b { font-family: var(--mono); font-weight: 500; font-variant-numeric: tabular-nums; }

.key { width: 10px; height: 10px; border-radius: 1px; flex: none; }
.key--found   { background: var(--olive); }
.key--pending { background: var(--brass); }
.key--none    { box-shadow: inset 0 0 0 1.5px var(--olive); }
.key--vacant  { background: var(--vacant); }

/* --- finder ------------------------------------------------------------- */

.finder {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

.section-title {
  font-family: var(--body);
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0 0 1.25rem;
}

.controls {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: .85rem;
  align-items: end;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.control { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.control label {
  font-family: var(--body);
  font-size: .78rem;
  font-weight: 500;
  color: var(--stone);
}

.control input, .control select {
  font-family: var(--body);
  font-size: .95rem;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .6rem .75rem;
  width: 100%;
}
.control input:focus, .control select:focus { border-color: var(--focus); }

.control__reset {
  grid-column: 1 / -1;
  justify-self: start;
  background: none;
  border: 0;
  padding: 0;
  font-family: var(--body);
  font-size: .85rem;
  color: var(--stone);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.resultline {
  font-family: var(--body);
  font-size: .85rem;
  color: var(--stone);
  font-variant-numeric: tabular-nums;
  margin: 1rem 0 .5rem;
}

/* --- member rows -------------------------------------------------------- */

.list { list-style: none; margin: 0; padding: 0; }

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem 1.25rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}
.row[hidden] { display: none; }
.row--vacant { opacity: .55; }

.row__main { min-width: 0; flex: 1 1 18rem; }

.row__name {
  font-family: var(--body);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.4;
}
.row__name a { text-decoration: none; }
.row__name a:hover { text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; }

.row__meta { margin: .15rem 0 0; font-size: .875rem; color: var(--stone); }

.row__links { display: flex; flex-wrap: wrap; gap: .35rem; }

.chip {
  font-size: .8rem;
  line-height: 1;
  padding: .38rem .6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  white-space: nowrap;
  color: var(--stone);
}
.chip:hover { border-color: var(--ink); color: var(--ink); }

.chip--disputed { border-color: var(--brass); color: var(--brass); }
.chip--gap      { border-style: dashed; border-color: var(--brass); color: var(--brass); }
.chip--muted    { border-style: dashed; }
.chip--edit     { border-color: transparent; color: var(--stone); text-decoration: underline; text-underline-offset: 3px; }
.chip--edit:hover { color: var(--ink); }

.empty {
  padding: 2.5rem 0;
  text-align: center;
  color: var(--stone);
}

/* --- footer ------------------------------------------------------------- */

.foot {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
  border-top: 1px solid var(--line);
  font-size: .85rem;
  color: var(--stone);
}
.foot p { margin: 0 0 .4rem; }
.foot__note { font-size: .8rem; }

/* --- narrow screens ----------------------------------------------------- */

@media (pointer: coarse) {
  :root { --seat: 20px; --gap: 4px; }
}

@media (max-width: 40rem) {
  .hero { padding-top: 2.25rem; }
  .controls { grid-template-columns: 1fr 1fr; }
  .control--search { grid-column: 1 / -1; }
  .row { align-items: flex-start; flex-direction: column; }
}

/* =========================================================================
   Member, help, and data pages
   ========================================================================= */

.member, .page {
  max-width: 44rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

.member__back {
  display: inline-block;
  margin-bottom: 2rem;
  font-size: .85rem;
  color: var(--stone);
  text-decoration: none;
}
.member__back:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }

.member__name, .page__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.75rem, 5vw, 2.6rem);
  line-height: 1.4;
  margin: 0 0 .35rem;
}

.member__latin {
  margin: 0 0 1rem;
  font-family: var(--mono);
  font-size: .85rem;
  color: var(--stone);
}

.member__lede, .page__lede {
  font-size: 1.05rem;
  color: var(--ink);
  margin: 1rem 0 2rem;
  max-width: 40ch;
}
.page__lede { color: var(--stone); max-width: 46ch; }

.member__h2, .page__h2 {
  font-family: var(--body);
  font-size: .82rem;
  font-weight: 600;
  color: var(--stone);
  margin: 2.75rem 0 .9rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--line);
}

/* --- fact list ---------------------------------------------------------- */

.facts { margin: 0 0 1rem; padding: 0; }
.facts > div {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: .75rem;
  padding: .55rem 0;
  border-bottom: 1px solid var(--line);
}
.facts--wide > div { grid-template-columns: 1fr; gap: .2rem; padding: .9rem 0; }
.facts dt { font-size: .85rem; color: var(--stone); }
.facts dd { margin: 0; font-size: .95rem; }
.facts--wide dt { font-family: var(--mono); font-size: .8rem; direction: ltr; unicode-bidi: isolate; text-align: start; }

code {
  font-family: var(--mono);
  font-size: .85em;
  background: var(--paper-2);
  padding: .1em .35em;
  border-radius: 2px;
}

/* --- accounts ----------------------------------------------------------- */

.accounts { list-style: none; margin: 0; padding: 0; }

.account {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: .5rem 1rem;
  align-items: baseline;
  padding: .7rem 0;
  border-bottom: 1px solid var(--line);
}
.account__platform { font-size: .85rem; color: var(--stone); }
.account__url {
  font-family: var(--mono);
  font-size: .9rem;
  direction: ltr;
  text-align: start;
  unicode-bidi: isolate;
  overflow-wrap: anywhere;
}
.account--disputed { border-inline-start: 2px solid var(--brass); padding-inline-start: .75rem; }
.account__warn {
  grid-column: 1 / -1;
  margin: .3rem 0 0;
  font-size: .85rem;
  color: var(--brass);
}

.note {
  margin: 0;
  padding: 1rem 1.1rem;
  background: var(--paper-2);
  border-radius: var(--radius);
  font-size: .95rem;
}
.note--open { border-inline-start: 2px solid var(--brass); }
.note--calm { border-inline-start: 2px solid var(--stone); }

.member__source { font-size: .9rem; overflow-wrap: anywhere; }
.member__stamp { display: inline-block; margin-top: .5rem; font-size: .8rem; color: var(--stone); }

/* --- suggest form ------------------------------------------------------- */

.suggest { margin-top: 3.5rem; }
.suggest__intro { margin: 0 0 1.5rem; font-size: .95rem; color: var(--stone); }

.form { display: grid; gap: 1.1rem; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label { font-size: .9rem; }
.field .opt { color: var(--stone); font-size: .85em; }
.field__hint { margin: .1rem 0 0; font-size: .82rem; color: var(--stone); }

.field input, .field select, .field textarea {
  font-family: var(--body);
  font-size: .95rem;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .65rem .75rem;
  width: 100%;
  resize: vertical;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--focus); }

.hp { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }

.btn {
  justify-self: start;
  font-family: var(--body);
  font-size: .95rem;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  padding: .7rem 1.4rem;
  cursor: pointer;
}
.btn:hover { background: var(--olive); border-color: var(--olive); }
.btn[disabled] { opacity: .5; cursor: progress; }

.form__status { margin: 0; font-size: .9rem; min-height: 1.4em; }
.form__status[data-tone='ok']   { color: var(--olive); }
.form__status[data-tone='bad']  { color: var(--brass); }

/* --- progress meter ----------------------------------------------------- */

.meter { margin: 2rem 0 1rem; }
.meter__bar {
  block-size: 10px;
  background: var(--vacant);
  border-radius: 2px;
  overflow: hidden;
}
.meter__fill { display: block; block-size: 100%; background: var(--olive); }
.meter__caption { margin: .6rem 0 0; font-size: .85rem; color: var(--stone); }
.meter__caption b { font-family: var(--mono); color: var(--ink); }
.meter__gap { color: var(--brass); }

/* --- steps, lists ------------------------------------------------------- */

.steps { margin: 0; padding-inline-start: 1.2rem; }
.steps li { margin-bottom: .6rem; font-size: .95rem; }
.steps b { font-weight: 600; }

.page__aside { font-size: .92rem; color: var(--stone); max-width: 52ch; }

.prose-list { margin: 0; padding-inline-start: 1.2rem; font-size: .95rem; }
.prose-list li { margin-bottom: .5rem; }

.gaplist { list-style: none; margin: 1rem 0 0; padding: 0; }
.gaplist li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .25rem 1rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--line);
}
.gaplist a { font-size: .98rem; text-decoration: none; }
.gaplist a:hover { text-decoration: underline; text-underline-offset: 4px; }
.gaplist span { font-size: .85rem; color: var(--stone); }

/* --- downloads ---------------------------------------------------------- */

.downloads { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; margin: 2rem 0; }

.download {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  padding: 1.1rem 1.2rem;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
}
.download:hover { border-color: var(--ink); }
.download__fmt { font-family: var(--mono); font-size: .95rem; font-weight: 500; }
.download__desc { font-size: .85rem; color: var(--stone); }

@media (max-width: 40rem) {
  .facts > div, .account { grid-template-columns: 1fr; gap: .15rem; }
  .downloads { grid-template-columns: 1fr; }
}

/* =========================================================================
   Review queue (/admin/, behind Cloudflare Access)
   ========================================================================= */

.admin { max-width: 52rem; }

.admin__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.5rem 0 .75rem;
}

.admin__tabs { display: flex; flex-wrap: wrap; gap: .35rem; }

.admin__tab {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .7rem;
  font-family: var(--body);
  font-size: .85rem;
  color: var(--stone);
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
}
.admin__tab:hover { border-color: var(--line); color: var(--ink); }
.admin__tab[aria-pressed='true'] { border-color: var(--ink); color: var(--ink); background: var(--paper-2); }
.admin__tab b { font-family: var(--mono); font-weight: 500; }

.admin__hint { margin: 0 0 1.25rem; font-size: .85rem; color: var(--stone); max-width: 52ch; }

.admin__bulk[hidden] { display: none; }

.admin__bulk {
  position: sticky;
  top: .75rem;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: 1rem;
  padding: .6rem .9rem;
  background: var(--paper-2);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  font-size: .88rem;
}
.admin__bulk #bulk-count { font-family: var(--mono); }

.btn--sm { padding: .35rem .8rem; font-size: .85rem; }
.btn--quiet { background: none; color: var(--stone); border-color: var(--line); }
.btn--quiet:hover { background: none; color: var(--ink); border-color: var(--ink); }

.queue { list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem; }

.card {
  padding: 1rem 1.1rem;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .35rem 1rem;
  margin-bottom: .8rem;
}
.card__pick { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; }
.card__member { font-weight: 600; }
.card__meta { font-size: .74rem; color: var(--stone); }
.card__meta time, .card__meta span { font-family: var(--mono); unicode-bidi: isolate; }

/* Old and new side by side: the reviewer's whole job is comparing these two. */
.diff { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: .8rem; }
.diff__side { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.diff__tag { font-size: .72rem; color: var(--stone); }
.diff__val {
  font-family: var(--body);
  font-size: .88rem;
  padding: .45rem .55rem;
  background: var(--paper);
  border-radius: 2px;
  overflow-wrap: anywhere;
  border-inline-start: 2px solid var(--line);
}
.diff__val--none   { color: var(--stone); }
.diff__val--url    { font-family: var(--mono); font-size: .82rem; direction: ltr; unicode-bidi: isolate; text-align: start; }
.diff__val--new    { border-inline-start-color: var(--olive); }
.diff__val--remove { border-inline-start-color: var(--brass); color: var(--brass); }

.card__row { margin: .3rem 0; font-size: .85rem; overflow-wrap: anywhere; }
.card__row--weak { color: var(--stone); }
.card__row a { direction: ltr; unicode-bidi: isolate; }

.card__actions { display: flex; gap: .4rem; margin-top: .9rem; }

@media (max-width: 40rem) {
  .diff { grid-template-columns: 1fr; }
}
