/* GovAI.pk
   One idea carries the identity: the seam, a single vertical rule where English
   and Urdu meet. Both scripts align towards it. Everything else stays quiet.
   All spacing uses logical properties so the same CSS serves LTR and RTL. */

:root {
  --paper: #f5f6f8;
  --surface: #ffffff;
  --ink: #15203b;
  --ink-soft: #4a5468;
  --line: #d4d9e2;
  --accent: #1c5b47;
  --accent-soft: #e2eee8;
  --civil: #e4e9f3;
  --civil-edge: #15203b;
  --buff: #ecdfbf;
  --buff-ink: #57420e;
  --banner: #fbf1d4;

  --font-latin: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, sans-serif;
  --font-urdu: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Urdu Typesetting", serif;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3rem;
  --step-2: 1.65rem;
  --step-3: clamp(1.9rem, 1.4rem + 2.2vw, 2.6rem);
  --step-4: clamp(2.1rem, 1.3rem + 3.8vw, 3.75rem);

  --gutter: clamp(1rem, 4vw, 2.5rem);
  --measure: 68ch;
  --radius: 6px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #10141d;
    --surface: #171c27;
    --ink: #e9ecf2;
    --ink-soft: #a6afc0;
    --line: #2b3242;
    --accent: #7cc7a9;
    --accent-soft: #19302a;
    --civil: #1b2232;
    --civil-edge: #c9d2e6;
    --buff: #463c22;
    --buff-ink: #f1dfae;
    --banner: #3a321b;
  }
}
:root[data-theme="dark"] {
  --paper: #10141d;
  --surface: #171c27;
  --ink: #e9ecf2;
  --ink-soft: #a6afc0;
  --line: #2b3242;
  --accent: #7cc7a9;
  --accent-soft: #19302a;
  --civil: #1b2232;
  --civil-edge: #c9d2e6;
  --buff: #463c22;
  --buff-ink: #f1dfae;
  --banner: #3a321b;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-latin);
  font-size: var(--step-0);
  line-height: 1.6;
  font-kerning: normal;
}

/* Urdu: Nastaliq needs more size and far more line height than Latin text,
   or its descenders collide and clip. Applied once, never compounded. */
/* :where() keeps these at zero specificity, so any component size wins over them. */
:where(:lang(ur)) {
  font-family: var(--font-urdu);
  line-height: 2.15;
}
:where(html:not([lang="ur"]) [lang="ur"]) { font-size: 1.08em; }
html[lang="ur"] body { font-size: calc(var(--step-0) * 1.08); }
:where(:lang(en), [lang="ur-Latn"]) { font-family: var(--font-latin); line-height: 1.6; }
:where(html[lang="ur"] [lang="en"]) { font-size: 0.93em; }

h1, h2, h3 { line-height: 1.15; margin: 0 0 0.5em; font-weight: 700; text-wrap: balance; }
:is(h1, h2, h3):lang(ur) { line-height: 1.95; font-weight: 600; }
:is(h1, h2, h3):lang(en) { line-height: 1.15; }
h1 { font-size: var(--step-4); letter-spacing: -0.015em; }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
p { margin: 0 0 1em; text-wrap: pretty; }

a { color: var(--accent); text-decoration-thickness: 0.08em; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 0.14em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.wrap { width: min(100% - 2 * var(--gutter), 72rem); margin-inline: auto; }

.skip {
  position: absolute;
  inset-inline-start: 1rem;
  inset-block-start: -10rem;
  background: var(--ink);
  color: var(--paper);
  padding: 0.5rem 1rem;
  z-index: 10;
}
.skip:focus { inset-block-start: 1rem; }

.preview-banner {
  margin: 0;
  padding: 0.5rem var(--gutter);
  background: var(--banner);
  color: var(--buff-ink);
  font-size: var(--step--1);
  text-align: center;
}

/* ---------- Header ---------- */

.site-header { border-block-end: 1px solid var(--line); background: var(--surface); }
.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.75rem;
  padding-block: 0.9rem;
}
.wordmark {
  font-family: var(--font-latin);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.wordmark .tld { color: var(--accent); }
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav a {
  color: var(--ink-soft);
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.22em;
  padding-block: 0.25rem;
}
.nav a:hover { color: var(--ink); text-decoration-thickness: 0.14em; }
.nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration-color: var(--accent);
  text-decoration-thickness: 0.14em;
}
.lang-switch {
  margin-inline-start: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.1rem 0.8rem;
  color: var(--ink);
  text-decoration: none;
  line-height: 2;
}
.lang-switch:hover { border-color: var(--accent); }
@media (max-width: 44rem) {
  .header-inner nav { order: 3; flex-basis: 100%; }
}

/* ---------- The seam ---------- */

.seam-pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  column-gap: clamp(1rem, 3vw, 2.5rem);
  align-items: center;
  margin-block-end: 1.5rem;
}
.seam-pair > :is(h1, h2, h3, p) { margin: 0; text-align: end; }
.seam-line {
  align-self: stretch;
  inline-size: 3px;
  background: var(--accent);
  border-radius: 2px;
}
.seam-secondary { color: var(--ink-soft); }
.seam-pair > :lang(en) { line-height: 1.2; }
.seam-pair > :lang(ur) { line-height: 1.95; }

.hero { padding-block: clamp(2.5rem, 8vw, 6rem) clamp(2rem, 5vw, 3.5rem); }
.hero-pair { margin-block-end: 2rem; }
.hero-pair .seam-primary { font-size: var(--step-4); }
.hero-pair .seam-secondary { font-size: calc(var(--step-4) * 0.72); font-weight: 400; }
.hero .lede { max-inline-size: 46ch; margin-inline: auto; text-align: center; }

.lede { font-size: var(--step-1); color: var(--ink-soft); max-inline-size: var(--measure); }

@media (max-width: 44rem) {
  .seam-pair { grid-template-columns: 1fr; row-gap: 0.75rem; }
  html[dir="ltr"] .seam-pair > * { text-align: left; }
  html[dir="rtl"] .seam-pair > * { text-align: right; }
  .seam-line { inline-size: 3rem; block-size: 3px; }
  .hero .lede { text-align: start; margin-inline: 0; }
}

/* ---------- Front doors on the home page ---------- */

.doors {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: clamp(1rem, 2.5vw, 1.75rem);
  padding-block-end: clamp(2.5rem, 6vw, 4rem);
}
.door {
  display: block;
  padding: clamp(1.25rem, 3vw, 2rem);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  border-block-start: 6px solid;
  transition: transform 160ms ease;
}
.door h2 { font-size: var(--step-3); margin-block-end: 0.15em; }
.door h2 { text-decoration: underline; text-decoration-thickness: 0.08em; text-underline-offset: 0.18em; }
.door:hover h2 { text-decoration-thickness: 0.14em; }
.door-other { color: var(--ink-soft); margin-block-end: 1rem; }
/* Text in the other script follows the page's alignment, not its own. */
html[dir="ltr"] :is(.door-other, .item-other, .independence-other) { text-align: left; }
html[dir="rtl"] :is(.door-other, .item-other, .independence-other) { text-align: right; }
.door-civil { background: var(--civil); border-color: var(--civil-edge); }
.door-public { background: var(--accent-soft); border-color: var(--accent); }
.door-cta { color: var(--accent); font-weight: 600; }
.door:hover .door-cta .cta-main { text-decoration-thickness: 0.14em; }
.door:hover { transform: translateY(-2px); }

/* ---------- Glossary teaser ---------- */

.teaser {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
  padding-block: clamp(2rem, 5vw, 3.5rem) clamp(3rem, 7vw, 5rem);
  border-block-start: 1px solid var(--line);
}
@media (max-width: 52rem) { .teaser { grid-template-columns: 1fr; } }
/* Calls to action: the page language first, the other language underneath. */
.door-cta, .text-cta {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
  text-decoration: none;
  font-weight: 600;
}
.cta-main { text-decoration: underline; text-decoration-thickness: 0.08em; text-underline-offset: 0.18em; }
.text-cta:hover .cta-main { text-decoration-thickness: 0.14em; }
.cta-other { font-weight: 400; font-size: 0.95em; }

/* ---------- Page heads ---------- */

.page-head { padding-block: clamp(2rem, 6vw, 4rem) 1.5rem; }
.page-head h1 { font-size: var(--step-3); }
.door-pair .seam-primary { font-size: var(--step-3); }
.door-pair .seam-secondary { font-size: calc(var(--step-3) * 0.75); }

/* ---------- Handling marks ---------- */

.mark {
  display: inline-block;
  font-size: 0.78rem;
  line-height: 1.5;
  padding: 0.05rem 0.5rem;
  border-radius: 3px;
  border: 1px solid;
  white-space: nowrap;
  font-weight: 600;
}
:lang(ur) .mark, .mark:lang(ur) { font-size: 0.8rem; line-height: 1.9; padding-block: 0; }
.mark-established { color: var(--accent); border-color: var(--accent); }
.mark-transliterate { color: var(--ink-soft); border-color: var(--line); border-style: dashed; }
.mark-proposed { background: var(--buff); color: var(--buff-ink); border-color: transparent; }

.legend { display: grid; gap: 0.5rem; margin: 1.5rem 0 0; max-inline-size: var(--measure); }
.legend-item { display: grid; grid-template-columns: 8.5rem 1fr; gap: 1rem; align-items: baseline; }
.legend dt, .legend dd { margin: 0; }
.legend dd { color: var(--ink-soft); font-size: var(--step--1); }
@media (max-width: 30rem) { .legend-item { grid-template-columns: 1fr; gap: 0.1rem; } }

/* ---------- Glossary list ---------- */

.glossary { padding-block-end: 4rem; }
.filter { margin-block: 0.5rem 2rem; max-inline-size: 34rem; }
.filter label { display: block; font-weight: 600; margin-block-end: 0.35rem; }
.filter input {
  inline-size: 100%;
  font: inherit;
  font-family: var(--font-latin), var(--font-urdu);
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}
.filter input:focus-visible { border-color: var(--accent); }
.filter-count { color: var(--ink-soft); font-size: var(--step--1); margin: 0.4rem 0 0; }

.term-section { margin-block-end: 2.75rem; scroll-margin-block-start: 1.5rem; }
.section-pair { margin-block-end: 0.75rem; }
.section-pair .seam-primary { font-size: var(--step-1); }
.section-pair .seam-secondary { font-size: var(--step-0); }

.term-list { list-style: none; margin: 0; padding: 0; border-block-start: 1px solid var(--line); }
.term-row a {
  display: grid;
  grid-template-columns: 1fr 7.5rem 1fr;
  align-items: center;
  gap: 1rem;
  padding-block: 0.55rem;
  border-block-end: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  background: linear-gradient(var(--line), var(--line)) center / 1px 100% no-repeat;
}
.term-row a:hover { background-color: var(--surface); }
.term-row a:hover .term-primary { text-decoration: underline; text-decoration-color: var(--accent); }
.term-word { text-align: end; }
.term-primary { font-weight: 600; }
.term-mid { text-align: center; }
.term-mid .mark { background-color: var(--paper); }
.term-mid .mark-proposed { background-color: var(--buff); }
.term-list-compact .term-row a { grid-template-columns: 1fr 6.5rem 1fr; }

@media (max-width: 38rem) {
  .term-row a {
    grid-template-columns: 1fr auto;
    grid-template-areas: "a m" "b m";
    row-gap: 0;
    background: none;
  }
  .term-primary { grid-area: a; }
  .term-secondary { grid-area: b; }
  .term-mid { grid-area: m; }
  html[dir="ltr"] .term-word { text-align: left; }
  html[dir="rtl"] .term-word { text-align: right; }
}

.empty-state {
  padding: 1rem 1.25rem;
  border-inline-start: 3px solid var(--accent);
  background: var(--surface);
  max-inline-size: var(--measure);
}

/* ---------- Single term ---------- */

.term { padding-block: clamp(1.5rem, 4vw, 3rem) 4rem; }
.crumb { color: var(--ink-soft); font-size: var(--step--1); margin-block-end: 2rem; }
.term-pair { margin-block-end: 1.25rem; }
.term-pair .seam-primary { font-size: var(--step-4); }
.term-pair .seam-secondary { font-size: calc(var(--step-4) * 0.8); color: var(--ink); }
.term-roman, .term-handling { text-align: center; color: var(--ink-soft); }
.term-roman .label { font-size: var(--step--1); }
.term-handling { max-inline-size: 50ch; margin-inline: auto; margin-block-end: 2.5rem; }
@media (max-width: 44rem) { .term-roman, .term-handling { text-align: start; margin-inline: 0; } }

.defs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-block: 1px solid var(--line);
  margin-block-end: 2rem;
}
.def { padding: 1.5rem clamp(1rem, 3vw, 2rem); }
.def:first-child { border-inline-end: 3px solid var(--accent); }
.def h2 { font-size: var(--step--1); color: var(--ink-soft); font-weight: 600; margin-block-end: 0.5rem; }
.def p { font-size: var(--step-1); margin: 0; }
@media (max-width: 44rem) {
  .defs { grid-template-columns: 1fr; }
  .def:first-child { border-inline-end: 0; }
  .def + .def { border-block-start: 3px solid var(--accent); }
}

.term-extra { max-inline-size: var(--measure); margin-block-end: 1.5rem; }
.term-extra h2 { font-size: var(--step-0); margin-block-end: 0.25rem; }
.review-note { padding: 0.75rem 1rem; background: var(--banner); border-radius: var(--radius); }

.review { color: var(--ink-soft); font-size: var(--step--1); }
.badge {
  display: inline-block;
  background: var(--banner);
  color: var(--buff-ink);
  padding: 0 0.45rem;
  border-radius: 3px;
  font-weight: 600;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-block-start: 3rem;
  padding-block-start: 1rem;
  border-block-start: 1px solid var(--line);
}
.pager a[rel="prev"]::before { content: "\2039\00a0"; }
.pager a[rel="next"]::after { content: "\00a0\203A"; }
[dir="rtl"] .pager a[rel="prev"]::before { content: "\203A\00a0"; }
[dir="rtl"] .pager a[rel="next"]::after { content: "\00a0\2039"; }

/* ---------- Front door pages ---------- */

.door-head { border-block-end: 1px solid var(--line); margin-block-end: 2.5rem; }
.door-body { display: grid; gap: 2.5rem; padding-block-end: 4rem; }
.door-body > section { max-inline-size: 52rem; }
.door-head .lede { margin-inline: auto; text-align: center; }
@media (max-width: 44rem) { .door-head .lede { margin-inline: 0; text-align: start; } }
.door-body h2 { font-size: var(--step-1); }
.plain-list, .road-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { margin-block-end: 1rem; }
.plain-list a { font-weight: 600; font-size: var(--step-1); }
.item-detail { color: var(--ink-soft); margin: 0.1rem 0 0; }
.road-item {
  padding: 1rem 0;
  border-block-start: 1px solid var(--line);
}
.road-item h3 { font-size: var(--step-1); margin: 0; }
.road-item h3 span { color: var(--ink); }
.item-other { color: var(--ink-soft); margin: 0.15rem 0 0; }
.status {
  display: inline-block;
  margin: 0.5rem 0 0;
  font-size: var(--step--1);
  color: var(--ink-soft);
  border: 1px dashed var(--line);
  border-radius: 3px;
  padding: 0 0.5rem;
}

/* ---------- Prose ---------- */

.prose { max-inline-size: var(--measure); padding-block-end: 3rem; }
.article .prose:has(table) { max-inline-size: 60rem; }
.prose h2 { font-size: var(--step-2); margin-block-start: 2rem; }
.prose li { margin-block-end: 0.5rem; }
.prose blockquote { margin-inline: 0; padding-inline-start: 1rem; border-inline-start: 3px solid var(--accent); color: var(--ink-soft); }
.table-wrap { overflow-x: auto; margin-block: 1.5rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.prose table { border-collapse: collapse; inline-size: 100%; font-size: var(--step--1); }
.prose th, .prose td { text-align: start; vertical-align: top; padding: 0.6rem 0.8rem; border-block-end: 1px solid var(--line); }
.prose th { font-weight: 600; background: var(--paper); }
.prose tr:last-child td { border-block-end: 0; }
.prose pre { overflow-x: auto; background: var(--surface); padding: 1rem; border-radius: var(--radius); border: 1px solid var(--line); }

/* Prompt boxes: wrap like prose, in the reading font, with a copy button added by script. */
.prose pre.prompt { position: relative; white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; font-size: var(--step-0); line-height: 1.6; padding-block-start: 2.75rem; border-inline-start: 4px solid var(--accent); }
.prose pre.prompt code { font-family: inherit; }
:where(:lang(ur)) .prose pre.prompt { line-height: 2.2; }
.copy-btn { position: absolute; inset-block-start: 0.5rem; inset-inline-end: 0.5rem; font: inherit; font-size: var(--step--1); padding: 0.25rem 0.75rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); color: var(--ink); cursor: pointer; }
.copy-btn:hover, .copy-btn:focus-visible { border-color: var(--accent); }
.prompt-safety { max-inline-size: var(--measure); padding: 0.75rem 1rem; border-inline-start: 4px solid var(--accent); background: var(--surface); border-radius: var(--radius); font-size: var(--step--1); }
.more h2 { margin-block-start: 2.5rem; }
.prompt-audience h2 { margin-block-start: 2.5rem; font-size: var(--step-2); }
.prompt-cap { margin-block: 1.5rem 0.25rem; font-size: var(--step-0); color: var(--ink-soft); text-transform: none; }
.article { padding-block: clamp(1.5rem, 4vw, 3rem) 3rem; }
.article h1 { font-size: var(--step-3); }
.modules-title { font-size: var(--step-2); margin-block-start: 1rem; }
.module-list { padding-inline-start: 1.5rem; max-inline-size: var(--measure); }
.module-list li { margin-block-end: 1rem; padding-inline-start: 0.25rem; }
.module-list li::marker { color: var(--accent); font-weight: 700; }
.module-list a { font-weight: 600; font-size: var(--step-1); }
.module-list p { margin: 0.2rem 0 0; color: var(--ink-soft); }
.article .pager { max-inline-size: var(--measure); }
.sources { font-size: var(--step--1); color: var(--ink-soft); }
.sources a, .source a { unicode-bidi: isolate; direction: ltr; overflow-wrap: anywhere; }
/* Nastaliq is never slanted: show emphasis in Urdu text by colour instead of italics. */
:lang(ur) em, em:lang(ur) { font-style: normal; color: var(--accent); }

.not-found { padding-block: 3rem 1rem; }

/* ---------- Footer ---------- */

.site-footer { border-block-start: 1px solid var(--line); background: var(--surface); margin-block-start: 2rem; }
.footer-inner { padding-block: 2rem; color: var(--ink-soft); font-size: var(--step--1); }
.independence { color: var(--ink); max-inline-size: var(--measure); }
.independence-other { max-inline-size: var(--measure); }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; list-style: none; padding: 0; margin: 0; }
.footer-contact { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin: 1rem 0 0; padding-block-start: 1rem; border-block-start: 1px solid var(--line); }
.footer-domains { display: inline-flex; gap: 1rem; }
.footer-copyright { margin: 1rem 0 0; }

/* The whole footer is centred, in both languages. */
.footer-inner { text-align: center; }
.footer-inner :is(.independence, .independence-other) { margin-inline: auto; }
html[dir] .footer-inner .independence-other { text-align: center; }
.footer-links, .footer-contact { justify-content: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- About page ---------- */

.about-prose { margin-inline: auto; padding-block-end: 1rem; }
.about-explore { padding-block: 1.5rem 1rem; }
.about-explore > h2 { font-size: var(--step-2); text-align: center; margin-block-end: 1.5rem; }
.explore { grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); padding-block-end: 1.5rem; }
.explore-box h3 { font-size: var(--step-1); margin-block: 0 0.15em; }
.explore-box h3 { text-decoration: underline; text-decoration-thickness: 0.08em; text-underline-offset: 0.18em; }
.explore-box:hover h3 { text-decoration-thickness: 0.14em; }
.explore-box p:last-child { margin-block-end: 0; }
.door-plain { background: var(--surface); border-color: var(--accent); }
@media (max-width: 44rem) { .about-explore > h2 { text-align: start; } }
.footer-join { max-inline-size: var(--measure); margin-inline: auto; }
/* Flex so a short last row sits in the middle. */
.explore { display: flex; flex-wrap: wrap; justify-content: center; }
.explore > .explore-box { flex: 0 1 calc((100% - 2 * clamp(1rem, 2.5vw, 1.75rem)) / 3); min-inline-size: min(100%, 18rem); }
@media (max-width: 62rem) { .explore > .explore-box { flex-basis: calc((100% - clamp(1rem, 2.5vw, 1.75rem)) / 2); } }
@media (max-width: 40rem) { .explore > .explore-box { flex-basis: 100%; } }

/* ---------- Press page ---------- */

.press-stats { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: clamp(1rem, 2.5vw, 1.75rem); }
.press-stats li { background: var(--surface); border-block-start: 6px solid var(--accent); border-radius: var(--radius); padding: 1.25rem; text-align: center; }
.press-num { display: block; font-size: var(--step-3); font-weight: 700; color: var(--ink); line-height: 1.1; }
.press-label { color: var(--ink-soft); }
.press-founder { display: flex; gap: 1.5rem; align-items: flex-start; }
.press-founder img { border-radius: var(--radius); flex: none; object-fit: cover; }
@media (max-width: 40rem) { .press-founder { flex-direction: column; } }
.about-head > h1 { text-align: center; }
@media (max-width: 44rem) { .about-head > h1 { text-align: start; } }
