@font-face {
  font-family: Thmanyah;
  src: url(fonts/thmanyahsans-Regular.woff2) format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: Thmanyah;
  src: url(fonts/thmanyahsans-Bold.woff2) format("woff2");
  font-weight: 700;
  font-display: swap;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Thmanyah, Tahoma, sans-serif;
  font-size: calc(1rem * var(--reader-scale, .88));
  transition: background .2s, color .2s;
}
button, input { font: inherit; }
button { cursor: pointer; color: inherit; }
button:disabled { opacity: .35; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 3px;
}
a { color: inherit; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 13px max(16px, 5vw);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
  transition: transform .25s;
}
.site-header.hidden { transform: translateY(-110%); }
.brand {
  border: 0;
  background: none;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  white-space: nowrap;
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 7px 22px color-mix(in srgb, var(--accent) 25%, transparent);
}
.brand-title { font-size: .78rem; letter-spacing: -.02em; }
nav, .tools { display: flex; gap: 5px; }
nav { justify-content: center; }
nav button, .tools button {
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 10px;
}
.tools button {
  min-width: 35px;
  border: 1px solid var(--line);
}
nav button.active { background: var(--soft); font-weight: 700; }

.home, .ritual {
  max-width: 1160px;
  margin: auto;
  padding: clamp(26px, 5vw, 68px) max(16px, 5vw);
}
.hero {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 6vw;
  align-items: center;
  min-height: 52vh;
}
.eyebrow {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--soft);
  font-size: .76em;
}
.hero h1, .ritual-head h1 {
  font-size: clamp(2.35rem, 6vw, 5.2rem);
  line-height: 1.08;
  letter-spacing: -.045em;
  margin: 16px 0;
}
.hero p, .ritual-head p {
  font-size: 1em;
  line-height: 1.85;
  max-width: 640px;
}
.hero-actions { display: flex; gap: 9px; margin-top: 22px; }
.hero-actions button { border-radius: 12px; padding: 11px 16px; }
.primary {
  background: var(--accent);
  color: var(--accent-text);
  border: 1px solid var(--accent);
  box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 20%, transparent);
}
.secondary { background: transparent; border: 1px solid var(--line); }
.hero-art { width: 100%; height: auto; border-radius: 28px; }

.routes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-top: 42px;
}
.route {
  text-align: right;
  border: 1px solid var(--line);
  background: var(--card);
  padding: 24px;
  border-radius: var(--radius);
  min-height: 215px;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.route:hover { transform: translateY(-4px); }
.route-num { opacity: .48; }
.route h2 { font-size: 1.85em; margin: 28px 0 8px; }
.route p { line-height: 1.75; }
.route-go { display: flex; justify-content: space-between; margin-top: 22px; }

.ritual-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
}
.ritual-head h1 { font-size: clamp(2.25rem, 5.5vw, 4.7rem); }
.progress { min-width: 155px; }
.progress span { display: block; margin-bottom: 7px; font-size: .88em; }
.progress i {
  height: 7px;
  border-radius: 8px;
  display: block;
  background: var(--soft);
  overflow: hidden;
}
.progress b { height: 100%; display: block; background: var(--accent); }

.hajj-modes {
  margin-top: 28px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) * .72);
  background: color-mix(in srgb, var(--card) 92%, var(--soft));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  box-shadow: 0 12px 35px color-mix(in srgb, var(--text) 7%, transparent);
}
.hajj-modes h2 { margin: 4px 0 0; font-size: 1.2em; }
.mode-kicker { color: var(--accent); font-size: .78em; font-weight: 700; }
.mode-buttons { display: flex; gap: 7px; }
.mode-buttons button {
  min-width: 92px;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 11px;
  padding: 10px 14px;
  transition: .2s;
}
.mode-buttons button:hover { border-color: var(--accent); transform: translateY(-2px); }
.mode-buttons button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
}

.ritual-grid {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 20px;
  margin-top: 30px;
}
.stage-nav { display: grid; align-content: start; gap: 7px; }
.stage-nav button {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 80%, var(--card));
  border-radius: 12px;
  padding: 10px;
  text-align: right;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: transform .18s, background .18s, border-color .18s;
}
.stage-nav button:hover { transform: translateX(-3px); border-color: var(--accent); }
.stage-nav button span {
  flex: 0 0 auto;
  width: 31px;
  height: 31px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--soft);
}
.stage-nav button.active {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 24%, transparent);
}

.stage-content {
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stage-copy { padding: clamp(21px, 4vw, 42px); }
.stage-kicker { color: var(--accent); font-weight: 700; font-size: .82em; }
.stage-content h2 {
  font-size: clamp(1.85rem, 4vw, 3.15rem);
  margin: 11px 0 20px;
}
.ritual-figure {
  position: relative;
  margin: 0;
  height: clamp(180px, 28vw, 275px);
  overflow: hidden;
  background: linear-gradient(135deg, var(--art-a), var(--art-b));
  border-bottom: 1px solid var(--line);
}
.ritual-figure svg { width: 100%; height: 100%; display: block; }
.ritual-figure .art-bg { fill: color-mix(in srgb, var(--card) 65%, transparent); }
.ritual-figure .art-lines {
  fill: none;
  stroke: var(--text);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ritual-figure figcaption {
  position: absolute;
  inset-inline-end: 18px;
  bottom: 16px;
  border-radius: 999px;
  padding: 6px 11px;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  font-size: .74em;
  font-weight: 700;
  backdrop-filter: blur(8px);
}
.verbatim p {
  font-size: 1em;
  line-height: 1.95;
  margin: 0;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}
.source-link {
  display: inline-grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  border: 1px solid currentColor;
  vertical-align: middle;
  margin-inline-start: 6px;
  text-decoration: none;
  opacity: .72;
  transition: opacity .15s, transform .15s;
}
.source-link:hover { opacity: 1; transform: scale(1.06); }
.source-link svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}
.mode-empty {
  padding: 22px;
  border: 1px dashed var(--accent);
  border-radius: 13px;
  background: var(--soft);
}
.mode-empty h3 { margin: 0 0 6px; }
.mode-empty p { margin: 0; line-height: 1.8; }

.questions { margin-top: 24px; }
.questions-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 0;
  border-radius: 12px;
  padding: 13px 15px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
}
.chevron { transition: .25s; }
.questions-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .35s;
}
.questions-body > div { overflow: hidden; }
.questions-body.open { grid-template-rows: 1fr; }
.question { padding: 19px 2px; border-bottom: 1px solid var(--line); }
.question h3 { line-height: 1.7; font-size: 1.05em; }
.question p { line-height: 1.95; }

.stage-actions {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  margin-top: 24px;
}
.stage-actions button, footer button {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 10px;
  padding: 10px 13px;
}
.stage-actions button:last-child { justify-self: end; }

footer {
  max-width: 1160px;
  margin: 20px auto 0;
  padding: 24px max(16px, 5vw) 34px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
}
footer div { display: flex; gap: 8px; }

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #0008;
  display: grid;
  place-items: start center;
  padding: 10vh 15px;
}
.search-box {
  width: min(650px, 100%);
  background: var(--card);
  border-radius: 21px;
  padding: 21px;
  box-shadow: 0 30px 90px #0005;
}
.search-box > button {
  float: left;
  border: 0;
  background: var(--soft);
  border-radius: 50%;
  width: 34px;
  height: 34px;
}
.search-box input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  padding: 12px;
  border-radius: 11px;
}
.results {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  max-height: 50vh;
  overflow: auto;
}
.results button {
  text-align: right;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 11px;
  padding: 11px;
}
.results small { display: block; opacity: .65; margin-top: 4px; }

@media (max-width: 800px) {
  .site-header {
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 10px 13px;
  }
  .site-header nav {
    grid-column: 1 / -1;
    grid-row: 2;
    overflow-x: auto;
    justify-content: stretch;
  }
  .site-header nav button { flex: 1; }
  .brand-title { display: inline; font-size: .72rem; }
  .tools { justify-content: flex-end; }
  .tools button { padding: 7px 6px; min-width: 31px; }
  .home, .ritual { padding-top: 26px; }
  .hero { grid-template-columns: 1fr; text-align: center; min-height: 0; }
  .hero-copy { display: grid; justify-items: center; }
  .hero-visual { order: -1; }
  .hero-art { width: min(280px, 86%); }
  .hero h1 { font-size: clamp(2.2rem, 13vw, 3.4rem); }
  .hero-actions { width: 100%; }
  .hero-actions button { flex: 1; }
  .routes { grid-template-columns: 1fr; margin-top: 32px; }
  .route { min-height: 190px; }
  .ritual-head { align-items: center; }
  .ritual-head h1 { font-size: 2.6rem; }
  .progress { min-width: 90px; }
  .hajj-modes { align-items: stretch; flex-direction: column; padding: 15px; }
  .mode-buttons { display: grid; grid-template-columns: repeat(3, 1fr); }
  .mode-buttons button { min-width: 0; padding-inline: 7px; }
  .ritual-grid { grid-template-columns: 1fr; }
  .stage-nav {
    display: flex;
    overflow-x: auto;
    padding: 2px 2px 8px;
    scrollbar-width: thin;
  }
  .stage-nav button { min-width: max-content; }
  .stage-nav button:hover { transform: none; }
  .ritual-figure { height: 185px; }
  .stage-content h2 { font-size: 2rem; }
  .stage-actions { grid-template-columns: repeat(2, 1fr); }
  .stage-actions button:nth-child(2) { display: none; }
  .stage-actions button:last-child { justify-self: stretch; }
  footer { justify-content: stretch; }
  footer div { width: 100%; }
  footer button { flex: 1; }
}

@media (max-width: 390px) {
  .brand-title { max-width: 88px; white-space: normal; line-height: 1.1; }
  .tools { gap: 3px; }
  .tools button { min-width: 29px; }
  .hero-actions { flex-direction: column; }
  .mode-buttons { gap: 5px; }
}

@media print {
  .site-header, .stage-nav, .stage-actions, .questions-toggle, .tools, footer, .hajj-modes {
    display: none !important;
  }
  .ritual { max-width: none; padding: 0; }
  .ritual-grid { display: block; }
  .questions-body { grid-template-rows: 1fr; }
  .stage-content { box-shadow: none; border: 0; }
  .ritual-figure { height: 180px; break-inside: avoid; }
  .source-link { display: none !important; }
}

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