/* saada.tech — one shared stylesheet. No @import, no external URL. See BUILD spec §3. */

/* ── Fonts ────────────────────────────────────────────────────────────── */

@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/SourceSerif4-subset.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Nastaliq Urdu";
  src: url("fonts/NotoNastaliqUrdu-subset.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ── Tokens ───────────────────────────────────────────────────────────── */

:root {
  --paper:       #FDFDFB;
  --paper-sunk:  #F2F1EC;
  --rule:        #CFCCC2;
  --rule-strong: #8A867B;
  --ink:         #1A1A18;
  --muted:       #55534C;
  --rubric:      #8C1D18;
  color-scheme: light;

  --font-text: "Source Serif 4", ui-serif, Georgia, "Times New Roman", serif;
  --font-urdu: "Noto Nastaliq Urdu", serif;

  --measure: 66ch;
}

/* ── Reset / base ─────────────────────────────────────────────────────── */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 18px;
  line-height: 1.65;
}

img, svg { max-width: 100%; display: block; }

a { color: inherit; }

/* ── Skip link ────────────────────────────────────────────────────────── */

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--rule-strong);
  padding: 0.5rem 1rem;
  z-index: 10;
  transition: top 120ms;
}

.skip-link:focus {
  top: 1rem;
}

@media (prefers-reduced-motion: reduce) {
  .skip-link { transition: none; }
}

/* ── Focus ────────────────────────────────────────────────────────────── */

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

/* ── Headings / scale ─────────────────────────────────────────────────── */

h1, h2, h3 {
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.6em;
}

h1 { font-size: clamp(2rem, 5vw, 2.75rem); }
h2 { font-size: 1.5rem; margin-top: 2.5em; }
h3 { font-size: 1.175rem; }

.meta {
  font-size: 0.875rem;
  color: var(--muted);
}

.label,
th {
  font-variant-caps: small-caps;
  letter-spacing: 0.04em;
}

/* ── Layout shell ─────────────────────────────────────────────────────── */

.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1rem;
}

/* ── Header ───────────────────────────────────────────────────────────── */

.site-header {
  border-bottom: 1px solid var(--rule-strong);
}

.site-header .page {
  max-width: none;
  width: 100%;
  padding: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.wordmark {
  font-size: 1.125rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: 0.35em;
  min-height: 44px;
}

.wordmark .ur {
  font-family: var(--font-urdu);
  font-weight: 400;
  line-height: 2.1;
  padding-block: 0.1em;
}

.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
}

.site-nav a {
  text-decoration: none;
  min-height: 44px;
  padding-inline: 0.4rem;
  display: inline-flex;
  align-items: center;
}

.site-nav a:hover {
  color: var(--rubric);
  transition: color 120ms;
}

@media (prefers-reduced-motion: reduce) {
  .site-nav a:hover { transition: none; }
}

/* ── Footer ───────────────────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--rule-strong);
  margin-top: 4rem;
}

.site-footer .page {
  max-width: none;
  width: 100%;
  padding: 1.5rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.site-footer a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  padding-block: 1rem;
  padding-inline: 0.2rem;
}

/* ── Prose ────────────────────────────────────────────────────────────── */

.prose {
  max-width: var(--measure);
}

.prose p {
  margin: 0 0 1.2em;
}

.prose a {
  text-decoration-color: var(--rule-strong);
  text-underline-offset: 0.15em;
  padding-block: 1rem;
  padding-inline: 0.2rem;
}

.urdu-gloss {
  font-family: var(--font-urdu);
  direction: rtl;
  line-height: 2.1;
  padding-block: 0.15em;
}

/* ── The Absence Ledger ───────────────────────────────────────────────── */

.ledger {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9375rem;
}

.ledger caption {
  text-align: left;
  font-variant-caps: small-caps;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.ledger th,
.ledger td {
  border: 1px solid var(--rule-strong);
  padding: 0.6rem 0.75rem;
  text-align: left;
  vertical-align: top;
}

.ledger thead th {
  background: var(--paper-sunk);
}

.ledger tbody tr:nth-child(even) td {
  background: var(--paper-sunk);
}

.ledger .exception {
  color: var(--rubric);
}

@media (min-width: 640px) and (max-width: 900px) {
  .ledger-scroll {
    overflow-x: auto;
    border-right: 1px solid var(--rule);
  }
}

@media (max-width: 639px) {
  .ledger { display: none; }

  .ledger-stack {
    display: block;
  }

  .ledger-stack dl {
    border-top: 1px solid var(--rule-strong);
    margin: 0 0 1.5rem;
    padding-top: 0.75rem;
  }

  .ledger-stack dt {
    font-variant-caps: small-caps;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin-top: 0.5rem;
  }

  .ledger-stack dd {
    margin: 0.1rem 0 0;
  }

  .ledger-stack dd.exception {
    color: var(--rubric);
  }
}

@media (min-width: 640px) {
  .ledger-stack { display: none; }
}

/* ── Home-entry sketches ──────────────────────────────────────────────── */

.entry-sketch {
  margin: 0.75rem 0 1.25rem;
}

.entry-sketch svg {
  width: 100%;
  height: auto;
  max-width: 280px;
}

.entry-sketch .mark {
  stroke: var(--rule-strong);
  fill: none;
}

.entry-sketch .rubric-mark {
  stroke: var(--rubric);
  fill: none;
}

.entry-sketch .fill {
  fill: var(--ink);
  stroke: none;
}

/* ── Misc ─────────────────────────────────────────────────────────────── */

.todo {
  color: var(--rubric);
  font-size: 0.875rem;
}

hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2rem 0;
}

/* ── Reduced motion (global fallback) ────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
