/* ==========================================================================
   Miftah Islamiyat — layout  (visual redesign, Stage 2)
   Header, navigation, breadcrumbs, footer, page wrappers.
   ========================================================================== */

.wrap         { width: min(100% - 2.5rem, 78rem); margin-inline: auto; }
.wrap--lesson { width: min(100% - 2.5rem, 62rem); }
.wrap--narrow { width: min(100% - 2.5rem, 48rem); }

.section        { padding-block: var(--s8); }
.section--tight { padding-block: var(--s7); }
.section--tint  {
  background: var(--paper-sunk);
  border-block: 1px solid var(--rule);
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: relative;
  background: var(--ink-strong);
  color: #eef2f5;
  border-bottom: 3px solid var(--pine);
}

/* A hairline of gold under the pine — small, but it reads as considered. */
.site-header::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -3px;
  height: 3px; pointer-events: none;
  background: linear-gradient(90deg, var(--gold) 0 22%, transparent 22%);
}

.site-header__inner {
  display: flex; align-items: center; gap: var(--s5);
  padding-block: var(--s4);
  flex-wrap: wrap;
}

.brand {
  display: flex; align-items: center; gap: var(--s3);
  text-decoration: none; color: inherit;
}
.brand:hover { color: inherit; }

.brand__mark {
  width: 2.75rem; height: 2.75rem; flex: none;
  display: grid; place-items: center;
  font-family: var(--font-ar); font-size: 1.7rem; line-height: 1;
  color: #fff;
  background: linear-gradient(150deg, var(--pine) 0%, var(--pine-deep) 100%);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}

.brand__text { display: flex; flex-direction: column; gap: 1px; }
.brand__name {
  font-family: var(--font-ui); font-weight: 680; font-size: var(--t-1);
  letter-spacing: -0.018em; color: #fff;
}
.brand__subtitle {
  font-family: var(--font-ui); font-size: 0.72rem; line-height: 1.35;
  color: #9fb0bd; max-width: 24ch; letter-spacing: .005em;
}

/* ==========================================================================
   Navigation
   ========================================================================== */
.nav { margin-left: auto; }
.nav__list {
  display: flex; align-items: center; gap: 2px;
  list-style: none; margin: 0; padding: 0;
}
.nav__list > li { margin: 0; max-width: none; }
.nav__item { position: relative; }

.nav__link {
  display: inline-flex; align-items: center; gap: var(--s2);
  font-family: var(--font-ui); font-size: 0.875rem; font-weight: 550;
  color: #cbd6de; text-decoration: none;
  padding: 0.5rem 0.75rem; border-radius: var(--radius);
  background: none; border: 0; cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav__link:hover,
.nav__link[aria-expanded="true"] { background: rgba(255,255,255,.10); color: #fff; }

.nav__link--accent {
  background: var(--pine); color: #fff; font-weight: 620;
  margin-left: var(--s2);
}
.nav__link--accent:hover { background: var(--pine-deep); color: #fff; }

.nav__chev {
  width: 0; height: 0; opacity: .7;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  transition: transform .15s var(--ease);
}
.nav__link[aria-expanded="true"] .nav__chev { transform: rotate(180deg); }

.nav__menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 60;
  min-width: 23rem;
  list-style: none; margin: 0; padding: var(--s2);
  background: var(--paper-raised); color: var(--ink);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.nav__menu li { margin: 0; max-width: none; }
.nav__menu a {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--s4);
  padding: 0.5rem 0.7rem; border-radius: var(--radius-sm);
  font-family: var(--font-ui); font-size: 0.875rem;
  text-decoration: none; color: var(--ink);
}
.nav__menu a:hover { background: var(--pine-tint); color: var(--pine-deep); }
.nav__menu li:first-child a {
  border-bottom: 1px solid var(--rule);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  margin-bottom: var(--s1); padding-bottom: var(--s3);
}
.nav__count { font-size: 0.72rem; color: var(--ink-faint); flex: none; }

.nav-toggle { display: none; }

/* ==========================================================================
   Breadcrumbs
   ========================================================================== */
.breadcrumbs {
  background: var(--paper-sunk);
  border-bottom: 1px solid var(--rule);
}
.breadcrumbs__list {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2);
  list-style: none; margin: 0; padding: 0.65rem 0;
  font-family: var(--font-ui); font-size: 0.8rem;
}
.breadcrumbs__item { margin: 0; max-width: none; color: var(--ink-faint); }
.breadcrumbs__item + .breadcrumbs__item::before {
  content: "›"; margin-right: var(--s2); color: var(--rule-strong);
}
.breadcrumbs__item a { color: var(--ink-soft); text-decoration: none; }
.breadcrumbs__item a:hover { color: var(--pine-deep); text-decoration: underline; }
.breadcrumbs__item [aria-current] { color: var(--ink-strong); font-weight: 600; }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: linear-gradient(200deg, var(--pine-deep) 0%, #141c40 100%);
  color: #a9b1d6;
  margin-top: var(--s9);
  padding-block: var(--s8) var(--s5);
  font-family: var(--font-ui); font-size: 0.875rem;
  border-top: 3px solid var(--gold-edge);
}

/* Brand lockup at the head of the footer, so the mark bookends the page. */
.site-footer__brand {
  display: flex; align-items: center; gap: var(--s3);
  margin-bottom: var(--s7);
  padding-bottom: var(--s5);
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.site-footer__mark {
  width: 2.4rem; height: 2.4rem; flex: none;
  color: var(--gold-edge);
  --mark-void: #17224f;
}
.site-footer__mark svg { display: block; width: 100%; height: 100%; }
.site-footer__brand strong {
  display: block;
  font-family: var(--font-display); font-weight: 600; font-size: 1.15rem;
  color: #fff;
}
.site-footer__brand > span > span { display: block; font-size: 0.76rem; color: #a9b1d6; }
.site-footer__cols {
  display: grid; gap: var(--s6);
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  margin-bottom: var(--s7);
}
.site-footer__heading {
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .15em;
  color: var(--gold-edge); margin-bottom: var(--s3);
}
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin: 0 0 var(--s2); max-width: none; }
.site-footer a { color: #d6dcf2; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }

.disclaimer {
  border-top: 1px solid rgba(255,255,255,.12);
  padding-top: var(--s5);
  font-size: 0.78rem; line-height: 1.65; color: #8b98a4;
}
.disclaimer p { max-width: 78ch; margin-bottom: var(--s2); }
.disclaimer__alignment { color: #c3c9e6; font-weight: 500; }
.disclaimer__meta { color: #7d84ad; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 64rem) {
  .nav-toggle {
    display: inline-flex; align-items: center; gap: var(--s3);
    margin-left: auto; cursor: pointer;
    background: rgba(255,255,255,.10); border: 0; color: #fff;
    font-family: var(--font-ui); font-weight: 620; font-size: 0.875rem;
    padding: 0.55rem 0.85rem; border-radius: var(--radius);
  }
  .nav-toggle__bars,
  .nav-toggle__bars::before,
  .nav-toggle__bars::after {
    display: block; width: 17px; height: 2px; border-radius: 2px;
    background: currentColor; position: relative;
  }
  .nav-toggle__bars::before { content: ""; position: absolute; top: -6px; }
  .nav-toggle__bars::after  { content: ""; position: absolute; top: 6px; }

  .nav { flex-basis: 100%; margin-left: 0; display: none; }
  .nav.is-open { display: block; }
  .nav__list { flex-direction: column; align-items: stretch; padding-bottom: var(--s4); }
  .nav__link { width: 100%; justify-content: space-between; }
  .nav__link--accent { margin: var(--s2) 0 0; justify-content: center; }
  .nav__menu {
    position: static; min-width: 0; box-shadow: none;
    background: rgba(255,255,255,.05);
    border-color: rgba(255,255,255,.12);
    margin: var(--s1) 0 var(--s2);
  }
  .nav__menu a { color: #cbd6de; }
  .nav__menu a:hover { background: rgba(255,255,255,.10); color: #fff; }
  .nav__menu li:first-child a { border-bottom-color: rgba(255,255,255,.12); }
  .nav__count { color: #8b98a4; }
}

@media (max-width: 40rem) {
  .brand__subtitle { display: none; }
  .brand__mark { width: 2.4rem; height: 2.4rem; font-size: 1.45rem; }
  .section { padding-block: var(--s7); }
  .wrap, .wrap--lesson, .wrap--narrow { width: min(100% - 1.75rem, 78rem); }
}

/* ========================================================================== 
   Compact footer variant for recovery and system pages
   ========================================================================== */
.site-footer--compact {
  margin-top: 0;
  padding-block: var(--s4);
  border-top-width: 2px;
}
.site-footer--compact .disclaimer {
  border-top: 0;
  padding-top: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s2) var(--s4);
  font-size: 0.72rem;
  line-height: 1.5;
}
.site-footer--compact .disclaimer p { margin: 0; max-width: none; }
.site-footer--compact .disclaimer__alignment { color: #c4d0d8; }
.site-footer--compact .disclaimer__text { color: #8f9ca7; }
.site-footer--compact .disclaimer__meta { display: none; }

/* Keep the 404 recovery card vertically balanced between header and footer. */
body.page-404-recovery {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body.page-404-recovery main {
  flex: 1 0 auto;
  display: grid;
  align-items: center;
}
body.page-404-recovery .breadcrumbs { flex: 0 0 auto; }

@media (max-width: 48rem) {
  .site-footer--compact .disclaimer { display: block; }
  .site-footer--compact .disclaimer p + p { margin-top: var(--s1); }
}
