/* docs.marriage.pk — Marriage.pk Engineering Docs
   Identity: the platform's own service-color language becomes the site's
   organizing system. Every service carries its rail color everywhere.
   Display: Fraunces · Body: Hanken Grotesk · Labels/code: JetBrains Mono */

:root {
  --paper: #f5f7f6;
  --card: #ffffff;
  --ink: #182420;
  --muted: #5b6b64;
  --line: #dce4e0;
  --jade: #166b4e;      /* brand + marriageAI */
  --amber: #b4711a;     /* outreachAI */
  --emerald: #0e8a72;   /* whatsappGateway */
  --cyan: #0f7e93;      /* matchmakingAI */
  --purple: #6d4fa3;    /* learning pipelines */
  --slate: #4e5d6b;     /* coreAPI / platform */
  --bad: #a63a2b;
  --ok-bg: #e7f2ec;
  --warn-bg: #f7edd8;
  --bad-bg: #f6e3de;
  --radius: 10px;
  --display: "Fraunces", Georgia, serif;
  --body: "Hanken Grotesk", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", Consolas, monospace;
}

* { 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: 16.5px;
  line-height: 1.65;
}

/* ── top bar ─────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  background: rgba(245, 247, 246, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.topbar .wordmark {
  font-family: var(--display); font-weight: 600; font-size: 17px;
  color: var(--jade); text-decoration: none; letter-spacing: 0.01em;
  white-space: nowrap;
}
.topbar .crumb { color: var(--muted); font-size: 13.5px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.topbar .crumb a { color: var(--muted); text-decoration: none; }
.topbar .crumb a:hover { color: var(--ink); }
.topbar .spacer { flex: 1; }
.topbar .who { font-family: var(--mono); font-size: 11.5px; color: var(--muted);
  white-space: nowrap; }
.topbar button.logout {
  font: 12px var(--mono); color: var(--muted);
  background: none; border: 1px solid var(--line); border-radius: 6px;
  padding: 4px 10px; cursor: pointer;
}
.topbar button.logout:hover { color: var(--bad); border-color: var(--bad); }

/* ── page scaffold ───────────────────────────────────────────────── */
.wrap { max-width: 880px; margin: 0 auto; padding: 28px 18px 80px; }
.eyebrow {
  font-family: var(--mono); font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 8px;
}
.eyebrow::before { content: ""; width: 22px; height: 2px; background: currentColor; }
h1 {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(28px, 6vw, 40px); line-height: 1.15;
  margin: 10px 0 8px; letter-spacing: -0.01em;
}
.lede { font-size: 18px; color: var(--muted); margin: 0 0 26px; max-width: 62ch; }
h2 {
  font-family: var(--body); font-weight: 700; font-size: 21px;
  margin: 40px 0 10px; letter-spacing: -0.005em;
}
h3 { font-size: 17px; font-weight: 700; margin: 26px 0 6px; }
p { margin: 10px 0; max-width: 70ch; }
li { margin: 5px 0; max-width: 66ch; }
strong { font-weight: 700; }
code {
  font-family: var(--mono); font-size: 0.86em;
  background: #ecf1ef; border-radius: 4px; padding: 1px 5px;
}

/* ── cards, callouts, rails ──────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; margin: 14px 0;
}
.rail { border-left: 3px solid var(--rail, var(--jade)); }
.callout {
  display: flex; gap: 10px; align-items: flex-start;
  border-radius: var(--radius); padding: 12px 14px; margin: 14px 0;
  font-size: 15.5px;
}
.callout .ico { flex: none; font-size: 17px; line-height: 1.5; }
.callout.ok   { background: var(--ok-bg); }
.callout.warn { background: var(--warn-bg); }
.callout.bad  { background: var(--bad-bg); }
.callout.note { background: #edf0f4; }

/* ── status chips ────────────────────────────────────────────────── */
.chip {
  display: inline-block; font-family: var(--mono); font-size: 11px;
  font-weight: 600; letter-spacing: 0.04em;
  border-radius: 999px; padding: 2px 10px; white-space: nowrap;
}
.chip.on   { background: var(--ok-bg); color: var(--jade); }
.chip.off  { background: var(--bad-bg); color: var(--bad); }
.chip.hold { background: var(--warn-bg); color: var(--amber); }

/* ── tables ──────────────────────────────────────────────────────── */
.tablewrap { overflow-x: auto; margin: 14px 0; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--card); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); text-align: left;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
}
td { padding: 10px 14px; border-bottom: 1px solid #ecf1ef; vertical-align: top; }
tr:last-child td { border-bottom: none; }

/* ── diagrams ────────────────────────────────────────────────────── */
.diagram {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px; margin: 16px 0;
  overflow-x: auto;
}
.diagram .caption {
  font-family: var(--mono); font-size: 11.5px; color: var(--muted);
  margin: 6px 4px 0;
}
.diagram pre.mermaid { margin: 0; display: flex; justify-content: center; }

/* ── the homepage folder grid ────────────────────────────────────── */
.grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 20px 0; }
@media (min-width: 640px) { .grid { grid-template-columns: 1fr 1fr; } }
a.folder {
  display: block; text-decoration: none; color: inherit;
  background: var(--card); border: 1px solid var(--line);
  border-left: 4px solid var(--rail, var(--jade));
  border-radius: var(--radius); padding: 16px 18px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
a.folder:hover, a.folder:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(24, 36, 32, 0.08);
}
a.folder .f-eyebrow { font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--rail, var(--jade)); }
a.folder .f-title { font-family: var(--display); font-weight: 600;
  font-size: 20px; margin: 4px 0 6px; }
a.folder .f-desc { font-size: 14.5px; color: var(--muted); margin: 0; }
a.folder .f-count { font-family: var(--mono); font-size: 11px; color: var(--muted);
  margin-top: 10px; }

/* per-service rail colors */
.svc-marriageai { --rail: var(--jade); }
.svc-outreach   { --rail: var(--amber); }
.svc-gateway    { --rail: var(--emerald); }
.svc-matchmaking{ --rail: var(--cyan); }
.svc-learning   { --rail: var(--purple); }
.svc-platform   { --rail: var(--slate); }

/* ── page footer stamp ───────────────────────────────────────────── */
.stamp {
  margin-top: 48px; padding-top: 14px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 11.5px; color: var(--muted);
}

/* ── login gate ──────────────────────────────────────────────────── */
#gate {
  position: fixed; inset: 0; z-index: 100;
  background: var(--paper);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  /* body gets .gated (visibility:hidden) while locked, and visibility is
     INHERITED — without this override the login panel itself was invisible
     and the site rendered as a blank page. */
  visibility: visible;
}
#gate .panel {
  width: 100%; max-width: 360px; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; padding: 28px 26px;
}
#gate .brand { font-family: var(--display); font-weight: 600; font-size: 22px;
  color: var(--jade); margin: 0 0 2px; }
#gate .sub { font-size: 13.5px; color: var(--muted); margin: 0 0 20px; }
#gate label { display: block; font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  margin: 12px 0 4px; }
#gate input {
  width: 100%; font: 15px var(--body); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  background: var(--paper);
}
#gate input:focus-visible { outline: 2px solid var(--jade); outline-offset: 1px; }
#gate button.go {
  width: 100%; margin-top: 18px; padding: 11px;
  font: 600 15px var(--body); color: #fff;
  background: var(--jade); border: none; border-radius: 8px; cursor: pointer;
}
#gate button.go:hover { filter: brightness(1.08); }
#gate button.go[disabled] { opacity: 0.6; cursor: wait; }
#gate .err { color: var(--bad); font-size: 13.5px; min-height: 20px; margin: 10px 0 0; }
.gated { visibility: hidden; }

/* ── a11y + motion + print ───────────────────────────────────────── */
:focus-visible { outline: 2px solid var(--jade); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
@media print {
  .topbar, #gate { display: none !important; }
  .gated { visibility: visible !important; }
  body { background: #fff; font-size: 12pt; }
  .card, .diagram, .tablewrap { border-color: #bbb; break-inside: avoid; }
  a.folder { break-inside: avoid; }
}
