/* Halotaz — web
 *
 * The palette and type are taken from docs/concept/02-system-detail.html:
 * paper tones, ink, verdigris, rubric, ochre. Not a stylistic accident --
 * the concept document sets a manuscript register on purpose, and a
 * corpus of classical texts read differently in a dark product chrome.
 *
 * One rule runs through this file: a citation is never decoration. It
 * gets real space, real contrast, and never collapses to a tooltip.
 */

:root {
  --paper:   #E7EAE8;
  --paper2:  #F1F4F3;
  --panel:   #FBFCFB;
  --ink:     #141F24;
  --ink2:    #3D4B50;
  --muted:   #77848A;
  --verdigris: #2C5E58;   /* structure, links, resolved things */
  --rubric:  #A33520;     /* refusals, unidentified, empty states */
  --ochre:   #8A6E2F;     /* disagreement, caveats, "read this twice" */
  --line:    #C7CECB;
  --hair:    #DBE0DD;

  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --body:    "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono:    "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ar:      "Amiri", "Scheherazade New", "Traditional Arabic", serif;

  --measure: 68ch;
  --radius: 3px;          /* nearly square: printed, not app-like */
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.65;
  font-feature-settings: "kern" 1;
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------------ */
/* Arabic                                                              */
/* Larger, looser, and always with its own direction. Arabic set at    */
/* Latin body size is unreadable; this is not a stylistic preference.  */
/* ------------------------------------------------------------------ */
.ar {
  font-family: var(--ar);
  font-size: 1.42rem;
  line-height: 2.15;
  direction: rtl;
  text-align: right;
  color: var(--ink);
}
.ar-sm { font-size: 1.12rem; line-height: 1.95; }
.ar-inline { font-family: var(--ar); font-size: 1.1em; direction: rtl; unicode-bidi: isolate; }

/* ------------------------------------------------------------------ */
/* Shell                                                               */
/* ------------------------------------------------------------------ */
header.top {
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky; top: 0; z-index: 40;
}
.top-in {
  max-width: 1100px; margin: 0 auto; padding: 0 24px;
  height: 60px; display: flex; align-items: center; gap: 28px;
}
.brand {
  font-family: var(--display);
  font-weight: 600; font-size: 1.22rem; letter-spacing: -0.01em;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.brand span { color: var(--verdigris); }
nav.main { display: flex; gap: 22px; margin-inline-start: auto; }
nav.main a {
  color: var(--ink2); text-decoration: none; font-size: 0.9rem;
  padding: 4px 0; border-bottom: 2px solid transparent;
}
nav.main a:hover { color: var(--ink); }
nav.main a.on { color: var(--verdigris); border-bottom-color: var(--verdigris); }

main { max-width: 1100px; margin: 0 auto; padding: 34px 24px 90px; }
.narrow { max-width: var(--measure); }

/* ------------------------------------------------------------------ */
/* Type                                                                */
/* ------------------------------------------------------------------ */
h1 {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(1.9rem, 4vw, 2.6rem); line-height: 1.15;
  letter-spacing: -0.02em; margin: 0 0 10px;
}
h2 {
  font-family: var(--display); font-weight: 600;
  font-size: 1.32rem; margin: 34px 0 12px; letter-spacing: -0.01em;
}
h3 { font-size: 1rem; font-weight: 650; margin: 0 0 6px; }
.lede { font-size: 1.06rem; color: var(--ink2); margin: 0 0 26px; max-width: var(--measure); }

.eyebrow {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 7px;
}

/* ------------------------------------------------------------------ */
/* Citation — the load-bearing element of this whole interface         */
/* ------------------------------------------------------------------ */
.cite {
  font-family: var(--mono); font-size: 0.735rem; line-height: 1.6;
  color: var(--ink2); border-top: 1px solid var(--hair);
  padding-top: 9px; margin-top: 14px;
}
.cite + .cite { border-top: 0; padding-top: 2px; margin-top: 2px; }
.cite b { font-weight: 600; color: var(--ink); }

/* ------------------------------------------------------------------ */
/* Surfaces                                                            */
/* ------------------------------------------------------------------ */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 14px;
}
.card.tight { padding: 14px 16px; }
a.card { display: block; text-decoration: none; color: inherit; }
a.card:hover { border-color: var(--verdigris); }

.grid { display: grid; gap: 14px; }
@media (min-width: 760px) { .grid.two { grid-template-columns: 1fr 1fr; } }

/* ------------------------------------------------------------------ */
/* Controls                                                            */
/* ------------------------------------------------------------------ */
.field { display: flex; gap: 10px; margin-bottom: 20px; }
input[type=text], textarea {
  flex: 1; font-family: var(--body); font-size: 1rem;
  padding: 13px 15px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--panel); color: var(--ink);
}
textarea { resize: vertical; min-height: 92px; line-height: 1.6; }
input[type=text]:focus, textarea:focus {
  outline: 2px solid var(--verdigris); outline-offset: -1px; border-color: transparent;
}
button {
  font-family: var(--body); font-size: 0.94rem; font-weight: 600;
  padding: 13px 22px; border: 1px solid var(--verdigris);
  background: var(--verdigris); color: #fff;
  border-radius: var(--radius); cursor: pointer; white-space: nowrap;
}
button:hover { background: #24504b; }
button.ghost { background: transparent; color: var(--verdigris); }
button.ghost:hover { background: rgba(44,94,88,.07); }
button:disabled { opacity: .45; cursor: default; }

/* ------------------------------------------------------------------ */
/* Pills                                                               */
/* ------------------------------------------------------------------ */
.pill {
  display: inline-block; font-family: var(--mono);
  font-size: 0.665rem; letter-spacing: 0.055em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 2px; border: 1px solid;
  white-space: nowrap;
}
.pill.ok   { color: var(--verdigris); border-color: rgba(44,94,88,.4);  background: rgba(44,94,88,.07); }
.pill.warn { color: var(--ochre);     border-color: rgba(138,110,47,.42); background: rgba(138,110,47,.09); }
.pill.bad  { color: var(--rubric);    border-color: rgba(163,53,32,.38); background: rgba(163,53,32,.07); }
.pill.flat { color: var(--muted);     border-color: var(--line); }

/* ------------------------------------------------------------------ */
/* Chain — bottom-to-top, gaps visible                                 */
/* ------------------------------------------------------------------ */
.chain { margin: 18px 0 0; }
.link { display: grid; grid-template-columns: 26px 1fr; }
.rail { position: relative; }
.rail::before {                       /* the connecting line */
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0;
  width: 1px; background: var(--line); transform: translateX(-.5px);
}
.link:first-child .rail::before { top: 22px; }
.link:last-child  .rail::before { bottom: calc(100% - 22px); }
.dot {
  position: absolute; left: 50%; top: 17px; width: 9px; height: 9px;
  border-radius: 50%; transform: translateX(-50%);
  background: var(--verdigris); border: 1px solid var(--verdigris);
}
/* Hollow, and in the refusal colour: an unidentified link is a hole in
   what we know, and it should read as one at a glance. */
.dot.unknown { background: var(--paper); border-color: var(--rubric); }
.link-body { padding: 10px 0 16px 14px; }
.mode {
  font-family: var(--mono); font-size: 0.68rem; color: var(--muted);
  letter-spacing: .03em;
}
.who { color: var(--ink2); font-size: 0.86rem; line-height: 1.5; margin-top: 3px; }
.death { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); }

.verdicts { margin-top: 10px; border-top: 1px solid var(--hair); padding-top: 8px; }
.verdict-row {
  display: grid; grid-template-columns: minmax(150px, 260px) 1fr;
  gap: 12px; font-size: 0.82rem; padding: 2px 0;
}
.verdict-row .critic { color: var(--muted); font-family: var(--mono); font-size: 0.71rem; }
.disagree {
  color: var(--ochre); font-size: 0.77rem; font-weight: 600;
  margin-bottom: 5px; display: flex; align-items: center; gap: 6px;
}

/* ------------------------------------------------------------------ */
/* Notices                                                             */
/* ------------------------------------------------------------------ */
.notice {
  border-inline-start: 3px solid var(--ochre);
  background: rgba(138,110,47,.06);
  padding: 13px 16px; margin: 16px 0; border-radius: 0 var(--radius) var(--radius) 0;
}
.notice.stop { border-color: var(--rubric); background: rgba(163,53,32,.05); }
.notice.calm { border-color: var(--line); background: var(--paper2); }
.notice h3 {
  font-family: var(--mono); font-size: 0.69rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ochre); margin: 0 0 5px;
}
.notice.stop h3 { color: var(--rubric); }
.notice.calm h3 { color: var(--muted); }
.notice p { margin: 0; font-size: 0.88rem; line-height: 1.6; color: var(--ink2); }

/* ------------------------------------------------------------------ */
/* Coverage bars — the honesty surface                                 */
/* ------------------------------------------------------------------ */
.cov { display: grid; grid-template-columns: 96px 1fr 46px; gap: 11px; align-items: center; margin-bottom: 7px; }
.cov-name { font-size: 0.8rem; color: var(--ink2); }
.bar { height: 5px; background: var(--hair); border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--verdigris); }
.cov-pct { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); text-align: right; }

/* ------------------------------------------------------------------ */
/* Result lists                                                        */
/* ------------------------------------------------------------------ */
.result { border-bottom: 1px solid var(--hair); padding: 17px 0; }
.result:last-child { border-bottom: 0; }
.result .work { color: var(--verdigris); font-size: 0.83rem; font-weight: 650; }
.result .heading { color: var(--muted); font-size: 0.8rem; margin-top: 1px; }
mark { background: rgba(138,110,47,.22); color: inherit; padding: 0 1px; }

/* A translation is a reading of the text, not the text. It reads in a
   quieter voice than the Arabic it sits under, and always names who
   produced it. */
.translation {
  margin-top: 10px; padding-inline-start: 12px;
  border-inline-start: 2px solid var(--hair);
}
.translation .small { color: var(--ink2); line-height: 1.6; }

.muted { color: var(--muted); }
.small { font-size: 0.83rem; }
.mono  { font-family: var(--mono); }
.row   { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.stack > * + * { margin-top: 14px; }

.spinner {
  width: 15px; height: 15px; border: 2px solid var(--line);
  border-top-color: var(--verdigris); border-radius: 50%;
  display: inline-block; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

footer.foot {
  border-top: 1px solid var(--line); margin-top: 60px;
  padding: 26px 24px 48px; color: var(--muted); font-size: 0.8rem;
}
footer.foot .foot-in { max-width: 1100px; margin: 0 auto; }
a { color: var(--verdigris); }

@media (max-width: 620px) {
  .top-in { gap: 14px; padding: 0 16px; }
  nav.main { gap: 14px; font-size: 0.85rem; }
  main { padding: 24px 16px 70px; }
  .verdict-row { grid-template-columns: 1fr; gap: 1px; }
  .field { flex-direction: column; }
}
