/* Madrasa-e-Riyazul Banath (Niswan) – website
   Colours come from the madrasa logo: blue and copper. */
:root {
  --blue: #0258a4;
  --blue-deep: #013f78;
  --copper: #c86e42;
  --ink: #0f2a4a;
  --muted: #55667c;
  --mist: #eef3f9;
  --line: #d6e0ec;
  --paper: #ffffff;

  --latin: "Literata", "Noto Naskh Arabic", Georgia, "Times New Roman", serif;
  --naskh: "Noto Naskh Arabic", "Noto Nastaliq Urdu", serif;
  --nastaliq: "Noto Nastaliq Urdu", "Noto Naskh Arabic", serif;
  --telugu: "Noto Serif Telugu", "Literata", "Noto Naskh Arabic", serif;

  --wrap: 1120px;
  --gap: clamp(1.25rem, 3vw, 2.5rem);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--latin);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--ink);
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}
html[lang="ur"] body { font-family: var(--naskh); line-height: 2; }
html[lang="te"] body { font-family: var(--telugu); line-height: 1.85; }

img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue); }
a:focus-visible, button:focus-visible { outline: 3px solid var(--copper); outline-offset: 3px; border-radius: 4px; }

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

.skip { position: absolute; inset-inline-start: -9999px; top: 0; background: var(--ink); color: #fff; padding: .5rem 1rem; z-index: 50; }
.skip:focus { inset-inline-start: 1rem; top: 1rem; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: saturate(1.2) blur(6px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.top-row { display: flex; align-items: center; gap: 1.25rem; min-height: 64px; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); font-weight: 700; }
.brand img { width: 44px; height: auto; }
.brand-name { font-size: 1.05rem; letter-spacing: .01em; white-space: nowrap; }
.nav { display: flex; gap: 1.1rem; margin-inline-start: auto; }
.nav a { color: var(--ink); text-decoration: none; font-size: .98rem; padding: .3rem 0; border-bottom: 2px solid transparent; }
.nav a:hover { border-bottom-color: var(--copper); }
.langs { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; flex: none; }
.langs button {
  font: inherit; font-size: .85rem; border: 0; background: transparent; color: var(--muted);
  padding: .3rem .7rem; cursor: pointer; line-height: 1.6;
}
.langs .ur-btn { font-family: var(--naskh); font-size: .95rem; }
.langs button[lang="te"] { font-family: var(--telugu); }
.langs button[aria-pressed="true"] { background: var(--blue); color: #fff; }
.menu { display: none; }

/* ---------- hero: the arch ---------- */
.hero {
  background: var(--blue);
  color: #fff;
  padding: clamp(2.5rem, 6vw, 4.5rem) 0 0;
  overflow: hidden;
}
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: var(--gap); align-items: end; }
.hero-text { padding-bottom: clamp(2rem, 5vw, 3.5rem); }
.hero h1 { margin: 0; font-weight: 400; }
.name-ur {
  display: block;
  font-family: var(--nastaliq);
  font-weight: 700;
  font-size: clamp(2.4rem, 5.6vw, 4.4rem);
  line-height: 2.1;
  color: #fff;
}
.name-en {
  display: block;
  font-family: var(--latin);
  font-weight: 600;
  font-size: clamp(1.25rem, 2.3vw, 1.7rem);
  line-height: 1.3;
  margin-top: .2rem;
  color: #fff;
}
html[lang="te"] .name-en { font-family: var(--telugu); }
html[lang="ur"] .name-en { font-family: var(--naskh); }
.lead { max-width: 34ch; font-size: clamp(1.05rem, 1.7vw, 1.25rem); margin: 1.25rem 0 1.75rem; color: #e6eef8; }
html[lang="ur"] .lead { max-width: 40ch; }

/* a pointed (mihrab) arch: a copper outline around a light window that holds the logo */
.arch {
  --arch: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 130' preserveAspectRatio='none'%3E%3Cpath d='M0 130 V52 C0 26 30 10 50 0 C70 10 100 26 100 52 V130 Z' fill='black'/%3E%3C/svg%3E");
  position: relative;
  justify-self: center;
  width: min(100%, 420px);
  aspect-ratio: 100 / 130;
  background: var(--copper);
  -webkit-mask: var(--arch) center / 100% 100% no-repeat;
  mask: var(--arch) center / 100% 100% no-repeat;
}
.arch-window {
  position: absolute;
  inset: 6px 6px 0 6px;
  background: var(--paper);
  -webkit-mask: var(--arch) center / 100% 100% no-repeat;
  mask: var(--arch) center / 100% 100% no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22% 12% 8%;
}
.arch-window img { width: 100%; }

.facts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 0;
  margin-bottom: 0;
  padding: 1.25rem 0 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, .25);
}
.facts > div { padding-inline-end: 1rem; }
.facts dt { font-size: .85rem; color: #b9cde6; }
.facts dd { margin: 0; font-weight: 600; font-size: 1.02rem; }

/* ---------- buttons ---------- */
.actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.btn {
  display: inline-block; text-decoration: none; font-weight: 600; font-size: 1rem;
  padding: .7rem 1.35rem; border-radius: 6px; border: 2px solid transparent; line-height: 1.4;
}
.btn-light { background: #fff; color: var(--blue); }
.btn-light:hover { background: var(--mist); }
.btn-line { border-color: rgba(255, 255, 255, .7); color: #fff; }
.btn-line:hover { background: rgba(255, 255, 255, .1); }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: var(--blue-deep); }
.btn-line-blue { border-color: var(--blue); color: var(--blue); }
.btn-line-blue:hover { background: var(--mist); }

/* ---------- sections ---------- */
.block { padding: clamp(3rem, 7vw, 5rem) 0; }
.block.tint { background: var(--mist); }
.two { display: grid; grid-template-columns: 1fr 2fr; gap: var(--gap); align-items: start; }
h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  line-height: 1.25;
  font-weight: 700;
  color: var(--ink);
}
html[lang="ur"] h2 { font-family: var(--nastaliq); font-weight: 700; line-height: 2; }
h2::after { content: ""; display: block; width: 2.5rem; height: 3px; background: var(--copper); margin-top: .6rem; }
h3 { margin: 0; font-size: 1.2rem; line-height: 1.35; }
.sub { margin: 2rem 0 .6rem; font-size: 1.1rem; }
.prose p { margin: 0 0 1rem; max-width: 62ch; }
.note { color: var(--muted); margin: 1.5rem 0 0; max-width: 62ch; }

/* courses */
.courses { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); margin-top: .5rem; }
.courses article { border-top: 3px solid var(--blue); padding-top: 1rem; }
.courses .ur-name { font-family: var(--nastaliq); font-size: 1.35rem; line-height: 2; margin: .1rem 0 .2rem; color: var(--blue); }
.courses p { margin: 0; max-width: 46ch; }

/* admissions: a real sequence, so numbered */
.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; }
.steps li {
  counter-increment: step;
  display: grid; grid-template-columns: 2.6rem 1fr; column-gap: 1rem;
  padding: 0 0 1.25rem;
}
.steps li::before {
  content: counter(step);
  grid-row: span 2;
  width: 2.2rem; height: 2.2rem; border-radius: 50%;
  border: 2px solid var(--copper); color: var(--copper);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-family: var(--latin); line-height: 1;
}
.steps strong { font-size: 1.08rem; }
.steps span { color: var(--muted); }
.docs { margin: 0; padding-inline-start: 1.2rem; }
.docs li { margin: .25rem 0; }

/* contact */
.contact { border-top: 1px solid var(--line); }
.contact-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: var(--gap); }
.contact-grid .sub { margin-top: 0; }
address { font-style: normal; max-width: 34ch; margin-bottom: .6rem; }
.phones { display: flex; flex-direction: column; margin: 0 0 .6rem; font-size: 1.15rem; font-weight: 600; }
.phones a { text-decoration: none; color: var(--ink); }
.phones a:hover { color: var(--blue); }
html[dir="rtl"] .phones { align-items: flex-end; }
.link { font-weight: 600; }

/* footer */
.foot { background: var(--ink); color: #c9d6e6; padding: 2rem 0 calc(2rem + env(safe-area-inset-bottom, 0px)); font-size: .95rem; }
.foot-row { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; align-items: center; justify-content: space-between; }
.foot-ur { font-family: var(--nastaliq); font-size: 1.3rem; line-height: 2; color: #fff; }

/* ---------- smaller screens ---------- */
@media (max-width: 900px) {
  .nav { display: none; }
  .nav.open {
    display: flex; flex-direction: column; gap: 0;
    position: absolute; inset-inline: 0; top: 100%;
    background: #fff; border-bottom: 1px solid var(--line); padding: .5rem var(--gap) 1rem;
  }
  .nav.open a { padding: .7rem 0; border-bottom: 1px solid var(--mist); }
  .langs { margin-inline-start: auto; }
  .menu {
    display: flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; padding: 0 10px;
  }
  .menu span { display: block; height: 2px; background: var(--ink); border-radius: 2px; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-text { padding-bottom: 0; }
  .arch { width: min(78%, 340px); margin-top: .5rem; }
  .facts { grid-template-columns: repeat(2, 1fr); row-gap: 1rem; }
  .two, .courses, .contact-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .brand-name { display: none; }
  .langs button { padding: .3rem .55rem; }
}

/* the Urdu course names under English titles are not needed when the page is in Urdu */
html[lang="ur"] .courses .ur-name { display: none; }
html[lang="ur"] .courses h3 { font-family: var(--nastaliq); font-weight: 700; line-height: 2; color: var(--blue); }

/* On English and Telugu pages, Urdu lines start on the same side as the text around them */
html[dir="ltr"] .name-ur,
html[dir="ltr"] .ur-name,
html[dir="ltr"] .foot-ur { text-align: left; }
.name-ur { line-height: 1.95; }

/* Section 1: the Urdu name always on one line, as large as its column allows.
   Measured on the page: the name is about 11.1 times as wide as its font size, so the font is the column width
   divided by 11.7 (a small margin for other phones' fonts). */
.name-ur {
  white-space: nowrap;
  font-size: min(2.7rem, calc((100vw - 2.5rem) / 11.9)); /* older browsers */
}
@supports (font-size: 1cqi) {
  .hero-text { container-type: inline-size; }
  .name-ur { font-size: min(2.7rem, 8.55cqi); }
}
/* Chosen by the madrasa: Noto Naskh Arabic for the name at the top only (the rest of the site is unchanged) */
.hero .name-ur {
  font-family: "Noto Naskh Arabic", "Noto Nastaliq Urdu", serif;
  font-weight: 700;
  line-height: 1.6;
  margin-bottom: .35rem;
}

/* Section 3: course duration and the Momina course stages (a real sequence, so numbered) */
.courses .duration {
  display: inline-block;
  margin: .1rem 0 .6rem;
  padding: .05rem .6rem;
  border: 1px solid var(--copper);
  border-radius: 999px;
  color: var(--copper);
  font-size: .9rem;
  font-weight: 600;
}
.stages {
  margin: .6rem 0 0;
  padding-inline-start: 1.4rem;
}
.stages li { margin: .3rem 0; padding-inline-start: .2rem; }
.stages li::marker { color: var(--copper); font-weight: 700; }
html[lang="ur"] .stages li::marker { font-family: var(--naskh); }

/* Urdu words inside English or Telugu text */
.ur-inline { font-family: var(--naskh); font-weight: inherit; }

/* three courses side by side on wide screens */
.courses { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .courses { grid-template-columns: 1fr; } }

/* Courses: tree diagram (Nazira first, then Hifz or Momina) */
.path-lead { max-width: 62ch; margin: 0 0 1.25rem; }
.path { max-width: 640px; margin: 0 auto 2.75rem; }
.path-top { display: flex; justify-content: center; }
.node {
  display: flex; flex-direction: column; align-items: center; gap: .1rem;
  min-width: 11rem; padding: .7rem 1rem .8rem;
  background: var(--paper); border: 2px solid var(--blue); border-radius: 10px;
  text-decoration: none; color: var(--ink); text-align: center;
}
.node:hover { background: #f5f9fd; }
.node-start { border-color: var(--copper); }
.node-t { font-weight: 700; font-size: 1.05rem; line-height: 1.35; }
.node-u { font-family: var(--nastaliq); color: var(--blue); font-size: 1.15rem; line-height: 1.9; }
html[lang="ur"] .node-u { display: none; }
html[lang="ur"] .node-t { font-family: var(--nastaliq); line-height: 2; }
.node-d { font-size: .82rem; font-weight: 600; color: var(--copper); }
/* connectors: down from Nazira, across, and down into each course */
.path-branches { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; padding-top: 2.6rem; }
.path-branches::before { content: ""; position: absolute; top: 0; left: 50%; width: 2px; height: 1.3rem; background: var(--copper); transform: translateX(-1px); }
.path-branches::after { content: ""; position: absolute; top: 1.3rem; left: 25%; right: 25%; height: 2px; background: var(--copper); }
.branch { position: relative; display: flex; justify-content: center; }
.branch::before { content: ""; position: absolute; top: -1.3rem; left: 50%; width: 2px; height: 1.3rem; background: var(--copper); transform: translateX(-1px); }
.path-or {
  position: absolute; top: calc(1.3rem - .8em); left: 50%; transform: translateX(-50%); z-index: 1;
  background: var(--mist); padding: 0 .5rem; font-size: .9rem; color: var(--muted); line-height: 1.6;
}
@media (max-width: 520px) {
  .node { min-width: 0; width: 100%; padding: .6rem .5rem .7rem; }
  .node-t { font-size: .98rem; }
}

/* Admissions: documents and fees (contact the administration) */
.adm-info {
  margin-top: 2rem;
  padding: 1rem 1.25rem 1.1rem;
  background: var(--mist);
  border-inline-start: 4px solid var(--copper);
  border-radius: 0 8px 8px 0;
}
html[dir="rtl"] .adm-info { border-radius: 8px 0 0 8px; }
.adm-info .sub { margin-top: 0; }
.adm-info p { margin: 0 0 1rem; max-width: 60ch; }


/* =====================================================================
   FINAL DESIGN (approved): "Geometric night"
   Deep navy top with a fine Islamic star pattern, copper accents,
   white rounded course cards. These rules refine the base styles above.
   ===================================================================== */
.hero {
  background-color: #0f2a4a;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.09'%3E%3Crect x='17' y='17' width='30' height='30'/%3E%3Crect x='17' y='17' width='30' height='30' transform='rotate(45 32 32)'/%3E%3Ccircle cx='32' cy='32' r='5'/%3E%3Cpath d='M0 0L17 17M64 0L47 17M0 64L17 47M64 64L47 47'/%3E%3C/g%3E%3C/svg%3E");
}
.hero .lead { color: #cfd9e6; }
.btn-light { color: #0f2a4a; }
.facts { border-top-color: rgba(200, 110, 66, .55); }
.facts dt { color: #e9a77f; }
.top { border-bottom: 2px solid var(--copper); }
.langs button[aria-pressed="true"] { background: #0f2a4a; }
h2::after { width: 4rem; height: 2px; }
.block.tint { background: #f3f5f8; }
.node { border-color: #0f2a4a; }
.btn-blue { background: #0f2a4a; }
.btn-blue:hover { background: #0a1d33; }
.btn-line-blue { border-color: #0f2a4a; color: #0f2a4a; }
.foot { background: #0f2a4a; border-top: 3px solid var(--copper); }

/* Courses: design 5's cards and rounded tree boxes */
.courses article { border: 1px solid var(--line); border-top: 4px solid var(--blue); border-radius: 12px; padding: 1.1rem 1.2rem 1.3rem; background: var(--paper); }
.node { border-radius: 14px; }

/* Support: bank and UPI details */
.bank { margin: 1.5rem 0; padding: 1rem 1.25rem 1.25rem; border: 1px solid var(--line); border-top: 4px solid var(--copper); border-radius: 12px; background: var(--paper); max-width: 34rem; }
.bank .sub { margin-top: 0; }
.bank dl { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.25rem; margin: 0 0 1rem; }
.bank dl > div { display: contents; }
.bank dt { color: var(--muted); }
.bank dd { margin: 0; font-weight: 700; font-family: var(--latin); word-break: break-word; user-select: all; }
.upi-qr { width: 200px; height: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: #fff; }
.bank .note { margin: .75rem 0 0; }