/* fmbthali.com — the one stylesheet. Tokens are the brief's (docs/DESIGN.md);
   no colour, size, space or duration appears below except as a token. */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-latin-ext.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308,
    U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113,
    U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Kanz al-Marjaan";
  src: url("../fonts/kanz-al-marjaan.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}

:root {
  /* Palette: steel-rice, tawa black, one haldi accent */
  --ground: #F3F4F2;
  --surface: #FFFFFF;
  --tint: #E9EBE8;
  --ink: #16181B;
  --ink-2: #2E3236;
  --muted: #5B6168;
  --line: #D9DCDF;
  --edge: #7D838A;
  --haldi: #F0B323;
  --haldi-ink: #7A5700;
  --haldi-pale: #FCF1D6;
  --night: var(--ink);
  --night-text: var(--ground);
  --night-muted: #A9AFB5;
  --night-line: #3A3F45;
  --leaf: #2F6B3F;
  --chilli: #B42318;

  /* Type: Archivo, its width axis carrying the voice */
  --font: "Archivo", "Segoe UI", system-ui, sans-serif;
  --font-arabic: "Kanz al-Marjaan", "Segoe UI", sans-serif;
  --wd-display: 118%;
  --fw-text: 400;
  --fw-strong: 600;
  --fw-display: 750;
  --fs-label: 0.8125rem;   /* 13 */
  --fs-small: 0.9375rem;   /* 15 */
  --fs-body: 1.0625rem;    /* 17 */
  --fs-lead: 1.3125rem;    /* 21 */
  --fs-title: 2.0625rem;   /* 33 */
  --fs-hero: 2.5rem;       /* 40 */
  --lh-display: 1.15;
  --lh-text: 1.5;
  --lh-arabic: 1.6;
  --track-label: 0.08em;

  /* Space and shape */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;
  --s-10: 128px;
  --radius: 4px;
  --radius-round: 999px;
  --control: 44px;
  --wrap: 1200px;
  --gutter: var(--s-6);
  --header-h: 64px;
  --node: 24px;

  /* Motion */
  --t-fast: 120ms;
  --t-norm: 240ms;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
/* The sticky masthead never covers an anchor target or a focused control. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + var(--s-4)); }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-body);
  font-weight: var(--fw-text);
  line-height: var(--lh-text);
  font-variant-numeric: lining-nums tabular-nums;
}
h1, h2, h3 {
  margin: 0;
  font-weight: var(--fw-display);
  font-stretch: var(--wd-display);
  line-height: var(--lh-display);
  text-wrap: balance;
}
p, ul, ol, dl, dd { margin: 0; }
p { text-wrap: pretty; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.stage--night :focus-visible { outline-color: var(--night-text); }
main:focus { outline: none; }

.wrap {
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.label {
  font-size: var(--fs-label);
  font-weight: var(--fw-strong);
  font-stretch: var(--wd-display);
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  color: var(--muted);
}
.arabic { font-family: var(--font-arabic); font-weight: var(--fw-text); }
.icon { flex: none; }

.skip {
  position: absolute;
  display: inline-flex;
  align-items: center;
  min-height: var(--control);
  left: var(--s-4);
  top: var(--s-2);
  z-index: 20;
  padding: var(--s-2) var(--s-4);
  background: var(--ink);
  color: var(--ground);
  border-radius: var(--radius);
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

/* ---- Buttons and links ---------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: var(--control);
  padding: 0 var(--s-5);
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: var(--fs-small);
  font-weight: var(--fw-strong);
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}
.btn .icon { transition: transform var(--t-fast) var(--ease); }
.btn:hover .icon { transform: translateX(2px); }
.btn--ink { background: var(--ink); color: var(--ground); }
.btn--ink:hover { background: var(--ink-2); }
.btn--line { border-color: var(--edge); color: var(--ink); }
.btn--line:hover, .btn--line[aria-current="page"] { background: var(--surface); border-color: var(--ink); }
.textlink {
  display: inline-flex;
  align-items: center;
  min-height: var(--control);
  gap: var(--s-2);
  font-weight: var(--fw-strong);
  text-decoration: underline;
  text-decoration-color: var(--edge);
  text-underline-offset: 4px;
}
.textlink:hover { text-decoration-color: currentColor; }

/* ---- Masthead ------------------------------------------------------------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--ground);
  border-bottom: 1px solid var(--line);
}
.masthead__row { display: flex; align-items: center; gap: var(--s-6); height: var(--header-h); }
.brand {
  display: inline-flex;
  align-items: center;
  min-height: var(--control);
  gap: var(--s-3);
  font-size: var(--fs-lead);
  font-weight: var(--fw-display);
  font-stretch: var(--wd-display);
  text-decoration: none;
  white-space: nowrap;
}
.brand__mark {
  width: var(--node);
  height: var(--node);
  background: var(--ink);
  -webkit-mask: url("../img/rosette.svg") center / var(--node) var(--node) no-repeat;
  mask: url("../img/rosette.svg") center / var(--node) var(--node) no-repeat;
}
.nav { display: flex; gap: var(--s-5); margin-left: auto; }
.nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--control);
  font-size: var(--fs-small);
  font-weight: var(--fw-strong);
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}
.nav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 6px; }

.notice { background: var(--tint); border-bottom: 1px solid var(--line); }
.notice__row {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  min-height: var(--control);
  font-size: var(--fs-small);
  text-decoration: none;
}
.notice__label,
.eyebrow {
  font-size: var(--fs-label);
  font-weight: var(--fw-strong);
  font-stretch: var(--wd-display);
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  color: var(--muted);
}
.notice__title { font-weight: var(--fw-strong); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notice__date { color: var(--muted); white-space: nowrap; margin-left: auto; }
.notice__row:hover .notice__title { text-decoration: underline; text-underline-offset: 4px; }

/* ---- Hero and the day line (the signature) -------------------------------- */
.hero { padding-block: var(--s-8); }
.hero__letterhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-6);
  padding-bottom: var(--s-4);
  margin-bottom: var(--s-7);
  border-bottom: 1px solid var(--line);
}
.hero__barakat { font-size: var(--fs-small); color: var(--muted); }
.hero h1 { font-size: var(--fs-hero); }
.hero__lead { margin-top: var(--s-5); font-size: var(--fs-lead); max-width: 36em; }
.hero__today { margin-top: var(--s-5); color: var(--muted); }
.hero__today .label { color: var(--ink); margin-right: var(--s-2); }
.hero__actions { margin-top: var(--s-6); }
.hero__arabic { font-size: var(--fs-title); line-height: var(--lh-arabic); white-space: nowrap; }

.dayline { margin-top: var(--s-8); }
.dayline__frame { position: relative; }
.dayline > .label { margin-bottom: var(--s-5); }
.dayline__track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}
/* The rail: from the first node's centre to the last's. */
.dayline__track::before,
.dayline__run {
  position: absolute;
  top: calc(var(--node) / 2 - 1px);
  left: 10%;
  right: 10%;
  height: 2px;
}
.dayline__track::before { content: ""; background: var(--line); }
.dayline__stop { position: relative; z-index: 1; text-align: center; }
.dayline__stop a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-1);
  padding-bottom: var(--s-2);
  text-decoration: none;
  border-radius: var(--radius);
}
.dayline__node {
  position: relative;
  width: calc(var(--node) + var(--s-3));
  height: var(--node);
  margin-bottom: var(--s-3);
  background: var(--ground);
}
.dayline__node::before,
.dayline__node::after {
  content: "";
  position: absolute;
  inset: 0;
  -webkit-mask: url("../img/rosette.svg") center / var(--node) var(--node) no-repeat;
  mask: url("../img/rosette.svg") center / var(--node) var(--node) no-repeat;
}
.dayline__node::before { background: var(--edge); }
.dayline__node::after { background: var(--haldi); }
.dayline__name { font-weight: var(--fw-strong); }
.dayline__short { display: none; }
.dayline__note { font-size: var(--fs-small); color: var(--muted); }
.dayline__stop a:hover .dayline__name { text-decoration: underline; text-underline-offset: 4px; }

/* The marker's trail: a haldi line as wide as the rail, slid in from the left. */
.dayline__run { z-index: 0; overflow: hidden; }
.dayline__runner { position: absolute; inset: 0; background: var(--haldi); }

/* The one orchestrated moment: the day is walked once, node by node. The
   resting state is the finished day; the animation only plays up to it. */
@media (prefers-reduced-motion: no-preference) {
  .dayline__runner {
    animation: dayline-walk calc(var(--t-norm) * 8) var(--ease) var(--t-norm) both;
  }
  .dayline__node::after { animation: dayline-light var(--t-norm) var(--ease) both; }
  /* Each node finishes lighting as the line arrives: 240ms, then every 480ms. */
  .dayline__stop:nth-child(1) .dayline__node::after { animation-delay: 0ms; }
  .dayline__stop:nth-child(2) .dayline__node::after { animation-delay: calc(var(--t-norm) * 2); }
  .dayline__stop:nth-child(3) .dayline__node::after { animation-delay: calc(var(--t-norm) * 4); }
  .dayline__stop:nth-child(4) .dayline__node::after { animation-delay: calc(var(--t-norm) * 6); }
  .dayline__stop:nth-child(5) .dayline__node::after { animation-delay: calc(var(--t-norm) * 8); }
}
@keyframes dayline-walk {
  0%   { transform: translateX(-100%); }
  25%  { transform: translateX(-75%); }
  50%  { transform: translateX(-50%); }
  75%  { transform: translateX(-25%); }
  100% { transform: translateX(0); }
}
@keyframes dayline-light {
  from { opacity: 0; transform: scale(.6); }
  to   { opacity: 1; transform: none; }
}

/* ---- Story sections ------------------------------------------------------- */
.stage {
  padding-block: var(--s-8);
  border-top: 1px solid var(--line);
}
.stage__grid { display: grid; grid-template-columns: 5fr 7fr; gap: var(--s-8); align-items: start; }
.stage__lead { max-width: 30em; }
.stage__lead h2 { font-size: var(--fs-title); }
.stage__lead > p:not(.eyebrow) { margin-top: var(--s-5); }
.eyebrow { display: flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-4); }
.eyebrow__node {
  width: var(--s-4);
  height: var(--s-4);
  background: currentColor;
  -webkit-mask: url("../img/rosette.svg") center / var(--s-4) var(--s-4) no-repeat;
  mask: url("../img/rosette.svg") center / var(--s-4) var(--s-4) no-repeat;
}
.stage__link { display: flex; align-items: baseline; gap: var(--s-3); flex-wrap: wrap; }
.stage__hint { font-size: var(--fs-small); color: var(--muted); }

.facts { display: grid; grid-template-columns: repeat(2, 1fr); column-gap: var(--s-6); }
.facts__row { padding-block: var(--s-5); border-top: 1px solid var(--line); }
.facts dt { font-weight: var(--fw-strong); }
.facts dd { margin-top: var(--s-1); color: var(--muted); }

.stage--night { background: var(--night); color: var(--night-text); border-top-color: var(--night); }
.stage--night .eyebrow,
.stage--night .facts dd { color: var(--night-muted); }
.stage--night .facts__row { border-top-color: var(--night-line); }

/* Beyond the day: the books, the mohallas and the API, side by side. */
.band { padding-block: var(--s-8); border-top: 1px solid var(--line); }
.band h2 { font-size: var(--fs-title); }
/* A subgrid, so each column's heading, text, list and link line up across all three. */
.band__cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(4, auto);
  column-gap: var(--s-6);
  margin-top: var(--s-7);
}
.band__col {
  display: grid;
  grid-row: span 4;
  grid-template-rows: subgrid;
  row-gap: 0;
  align-content: start;
  padding-top: var(--s-5);
  border-top: 1px solid var(--line);
}
.band__col h3 { font-size: var(--fs-lead); }
.band__col > p { margin-top: var(--s-3); }
.band__link { margin-top: var(--s-5); }
.ticks { margin-top: var(--s-5); }
.ticks li {
  display: flex;
  align-items: baseline;
  min-height: var(--s-7);
  padding-block: var(--s-3);
  border-top: 1px solid var(--line);
  font-weight: var(--fw-strong);
  white-space: nowrap;
}
.ticks__method {
  width: 4em;
  flex: none;
  font-size: var(--fs-label);
  font-stretch: var(--wd-display);
  letter-spacing: var(--track-label);
  color: var(--muted);
}

.roster { margin-top: var(--s-8); }
.roster > .label { margin-bottom: var(--s-3); }
.roster__list {
  display: grid;
  grid-template-columns: minmax(0, max-content) minmax(0, 1fr) max-content;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
/* Rows share the list's columns (subgrid), so names, places and years align. */
.roster__row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  column-gap: var(--s-6);
  align-items: center;
  min-height: var(--s-7);
  padding-inline: var(--s-5);
  white-space: nowrap;
}
.roster__row + .roster__row { border-top: 1px solid var(--line); }
.roster__name { font-weight: var(--fw-strong); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.roster__place { color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.roster__since { font-size: var(--fs-small); color: var(--muted); }

.news { display: grid; }
.news__item { padding-block: var(--s-5); border-top: 1px solid var(--line); }
.news__meta { display: flex; gap: var(--s-3); font-size: var(--fs-small); color: var(--muted); }
.news__item h3 { margin-top: var(--s-2); font-size: var(--fs-lead); }
.news__body { margin-top: var(--s-3); max-width: 65ch; }
.news__body p + p,
.faq__answer p + p { margin-top: var(--s-3); }

.faq details { border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-4);
  min-height: var(--s-8);
  padding-block: var(--s-3);
  font-weight: var(--fw-strong);
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary:hover > span { text-decoration: underline; text-underline-offset: 4px; }
.faq summary .icon { color: var(--muted); transition: transform var(--t-fast) var(--ease); }
.faq details[open] summary .icon { transform: rotate(180deg); }
.faq__answer { padding-bottom: var(--s-5); max-width: 65ch; color: var(--muted); }

/* ---- Bring your mohalla --------------------------------------------------- */
.join { padding-block: var(--s-9); border-top: 1px solid var(--line); }
.join__panel {
  padding: var(--s-8);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.join__panel h2 { font-size: var(--fs-title); }
.join__lead { margin-top: var(--s-5); max-width: 40em; }
.join__steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-6);
  margin-top: var(--s-7);
}
.join__steps li { padding-top: var(--s-5); border-top: 2px solid var(--ink); }
.join__num {
  display: block;
  font-size: var(--fs-title);
  font-weight: var(--fw-display);
  font-stretch: var(--wd-display);
  line-height: 1;
}
.join__steps h3 { margin-top: var(--s-4); font-size: var(--fs-lead); }
.join__steps p { margin-top: var(--s-2); color: var(--muted); }
.join__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-4); margin-top: var(--s-7); }
.join__address { font-weight: var(--fw-strong); user-select: all; }
.join__pending { margin-top: var(--s-7); color: var(--muted); }

/* ---- Inner pages: sign in, errors ----------------------------------------- */
.page { padding-block: var(--s-9) var(--s-10); }
.page h1 { font-size: var(--fs-hero); }
.page__lead { margin-top: var(--s-5); font-size: var(--fs-lead); max-width: 36em; text-wrap: balance; }
.page__ref { margin-top: var(--s-4); font-size: var(--fs-small); color: var(--muted); }
.page__actions { display: flex; flex-wrap: wrap; gap: var(--s-4); margin-top: var(--s-7); }
.callout {
  margin-top: var(--s-6);
  max-width: 48em;
  padding: var(--s-4) var(--s-5);
  background: var(--haldi-pale);
  border-left: 4px solid var(--haldi-ink);
  border-radius: var(--radius);
}
.doors { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-6); margin-top: var(--s-7); }
.door {
  display: flex;
  flex-direction: column;
  padding: var(--s-6);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.door h2 { font-size: var(--fs-lead); }
.door > p:not(.eyebrow) { margin-top: var(--s-3); color: var(--muted); }
.door .door__action { margin-top: auto; padding-top: var(--s-6); }

/* ---- Footer --------------------------------------------------------------- */
.foot { border-top: 1px solid var(--line); padding-block: var(--s-7); }
.foot__row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-6); flex-wrap: wrap; }
.foot__name { font-size: var(--fs-small); color: var(--muted); }
.foot__name .arabic { font-size: var(--fs-lead); color: var(--ink); line-height: var(--lh-arabic); text-align: left; }
.foot__links { display: flex; flex-wrap: wrap; column-gap: var(--s-5); font-size: var(--fs-small); }
.foot__links a { display: inline-flex; align-items: center; justify-content: center; min-height: var(--control); min-width: var(--control); text-decoration: none; }
.foot__links a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---- Narrower screens ----------------------------------------------------- */
@media (max-width: 960px) {
  .stage__grid { grid-template-columns: 1fr; gap: var(--s-6); }
  .band__cols { grid-template-columns: 1fr; grid-template-rows: none; row-gap: var(--s-6); }
  .band__col { grid-row: auto; grid-template-rows: none; }
  .nav { display: none; }
  .masthead__signin { margin-left: auto; }
  .dayline__long {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .dayline__short { display: inline; }
  .dayline__note { display: none; }
}
@media (max-width: 720px) {
  /* Touch screens: a 48px target for every control and link. */
  :root { --gutter: var(--s-4); --control: 48px; }
  .hero { padding-block: var(--s-7); }
  .hero__arabic { display: none; }
  .hero__letterhead { margin-bottom: var(--s-6); }
  .hero h1, .page h1 { font-size: var(--fs-title); }
  .join { padding-block: var(--s-8); }
  .facts { grid-template-columns: 1fr; }
  .join__panel { padding: var(--s-5); }
  .join__steps, .doors { grid-template-columns: 1fr; }
  .dayline { margin-top: var(--s-8); }
  .dayline__short { font-size: var(--fs-small); }
  /* Two thin lines per mohalla (declared on the list): name and year, then the city. */
  .roster__list { grid-template-columns: minmax(0, 1fr) max-content; }
  .roster__row { column-gap: var(--s-4); padding: var(--s-2) var(--s-4); }
  .roster__name { grid-row: 1; grid-column: 1; }
  .roster__since { grid-row: 1; grid-column: 2; }
  .roster__place { grid-row: 2; grid-column: 1 / -1; font-size: var(--fs-small); }
}

/* ---- High contrast and forced colours ------------------------------------- */
@media (prefers-contrast: more) {
  :root { --line: var(--edge); --muted: var(--ink-2); }
}
@media (forced-colors: active) {
  .btn { border-color: ButtonText; }
  .brand__mark, .eyebrow__node, .dayline__node::before, .dayline__node::after, .dayline__runner {
    background: CanvasText;
    forced-color-adjust: none;
  }
}
