*{box-sizing:border-box}:root{--green:#073f2e;--green2:#0d5942;--gold:#c9a227;--line:#b49335;--cream:#f5f0df;--cream2:#ebe2c9;--ink:#263d32;--muted:#6c756b;--card:#fffdf6}
html{scroll-behavior:smooth}body{margin:0;background:var(--cream);color:var(--ink);font-family:Georgia,'Times New Roman',serif;line-height:1.55}a{color:inherit}
.site-header{background:linear-gradient(120deg,var(--green),var(--green2));color:#fff9e9;border-bottom:4px solid var(--gold)}.header-inner{max-width:1500px;margin:auto;padding:22px 28px;display:flex;align-items:center;gap:16px}.logo-mark{width:54px;height:54px;border:2px solid var(--gold);border-radius:50%;display:grid;place-items:center;color:var(--gold);font-size:29px;font-weight:bold}.site-header h1{margin:0;font-size:30px}.site-header p{margin:2px 0 0;color:#e8dfc7}
.main-nav{background:#0a392b}.nav-inner{max-width:1500px;margin:auto;padding:0 28px;display:flex;flex-wrap:wrap;gap:4px}.nav-inner a{padding:13px 17px;color:#fff8e8;text-decoration:none}.nav-inner a:hover{background:#17563f;color:#f1d77b}
.search-strip{background:var(--cream2);padding:15px 24px;text-align:center;border-bottom:1px solid #d9cba8}.search-form{display:flex;justify-content:center;gap:8px;max-width:700px;margin:auto}.search-form input{flex:1;min-width:0;padding:12px 15px;border:1px solid #c5b58e;border-radius:5px;background:#fffdf7;font-size:15px}.search-form button{padding:0 22px;border:0;border-radius:5px;background:var(--green);color:white;font-weight:bold}.search-form :disabled{opacity:.72;cursor:not-allowed}.search-note{margin:5px 0 0;color:var(--muted);font:12px Arial,sans-serif}
.page-layout{max-width:1500px;margin:24px auto;padding:0 22px;display:grid;grid-template-columns:280px minmax(0,1fr);gap:22px;align-items:start}.sidebar{width:280px;background:#eee5cf;border:1px solid #d8c9a5;border-radius:8px;padding:21px;position:sticky;top:16px}.sidebar h2{margin:0 0 12px;color:var(--green);font-size:21px}.sidebar ul{list-style:none;padding:0;margin:0}.sidebar li{border-bottom:1px solid #d8c9a5}.sidebar li a{display:block;padding:9px 2px;text-decoration:none}.sidebar-info{margin-top:22px;padding:14px;background:#f8f3e5;border-left:3px solid var(--gold)}.sidebar-info h3{margin:0 0 5px;font-size:16px}.sidebar-info p{margin:0;font-size:14px}
.main-content{min-width:0}.tree-section,.future-section{background:#fbf8ed;border:1px solid #dfd3b6;border-radius:8px;padding:24px;margin-bottom:22px}.section-heading{text-align:center;margin-bottom:24px}.eyebrow{color:#8c6c12;font:bold 11px Arial,sans-serif;letter-spacing:2px}.section-heading h2{color:var(--green);font-size:30px;margin:3px 0}.section-heading>p:last-child{color:var(--muted);margin:0}
.tree-scroll{overflow-x:auto;padding:12px 12px 40px;scroll-padding-left:12px}.tree-root{display:flex;justify-content:flex-start;min-width:max-content;width:max-content}.family-branch{display:flex;flex-direction:column;align-items:center;position:relative}.tree-person{position:relative;z-index:1;min-width:220px;max-width:360px;padding:12px 15px;background:var(--card);border:1px solid #c9b477;border-top:3px solid var(--gold);border-radius:7px;text-align:center;box-shadow:0 2px 7px rgba(45,54,34,.07)}.generation-label{display:block;color:#8a6b16;font:bold 10px Arial,sans-serif;letter-spacing:.7px;text-transform:uppercase;margin-bottom:5px}.person-name{display:block;color:var(--green);font-weight:bold;text-decoration:none;line-height:1.4;overflow-wrap:anywhere}.person-name:hover,.person-name:focus{color:#9b7410;text-decoration:underline}.person-note{display:block;margin-top:5px;color:#6c756b;font:11px/1.4 Arial,sans-serif}
.family-children{display:flex;justify-content:center;align-items:flex-start;gap:35px;margin-top:40px;padding-top:35px;position:relative}.family-branch>.tree-person+.family-children:before{content:'';position:absolute;left:50%;top:-40px;height:40px;border-left:2px solid var(--line)}.child-branch{display:flex;flex-direction:column;align-items:center;position:relative}.child-branch:before{content:'';position:absolute;left:50%;top:-35px;height:35px;border-left:2px solid var(--line)}.family-children>.child-branch:after{content:'';position:absolute;top:-35px;height:2px;background:var(--line);left:-17.5px;right:-17.5px}.family-children>.child-branch:first-child:after{left:50%;right:auto;width:calc(50% + 17.5px)}.family-children>.child-branch:last-child:after{left:-17.5px;right:auto;width:calc(50% + 17.5px)}.family-children>.child-branch:only-child:after{display:none}
.future-section h2{color:var(--green);margin-top:0}.ad-slot,.affiliate-section{display:none}.site-footer{background:var(--green);color:#e9dfc4;text-align:center;padding:18px;border-top:3px solid var(--gold)}.site-footer p{margin:0;font-size:13px}
@media(max-width:850px){.page-layout{grid-template-columns:1fr}.sidebar{width:100%;position:static}.sidebar ul{display:flex;flex-wrap:wrap;gap:8px 18px}.sidebar li{border:0}}
@media(max-width:560px){.header-inner{padding:18px 16px}.site-header h1{font-size:24px}.nav-inner{padding:0 8px}.nav-inner a{padding:11px 10px;font-size:13px}.search-strip{padding:12px}.search-form button{padding:0 14px}.page-layout{padding:0 10px;margin:14px auto}.tree-section,.future-section{padding:15px 10px}.tree-person{min-width:190px;max-width:270px;padding:10px}.family-children{gap:24px}}


/* Sidebar Information panel */
.sidebar-info {
  background: #f7f1df;
  border: 1px solid #c6a45b;
  border-radius: 10px;
  padding: 16px;
  color: #234b38;
  line-height: 1.65;
}
.sidebar-info h2 {
  color: #b18a3b;
  margin: 0 0 12px;
  font-size: 1.15rem;
  border-bottom: 1px solid #d8c28e;
  padding-bottom: 8px;
}
.sidebar-info p {
  margin: 0 0 12px;
  font-size: 0.92rem;
}
.sidebar-info p:last-child {
  margin-bottom: 0;
  font-weight: 600;
}


/* Start the genealogy at Generation 1 instead of centering the full-width tree */
.tree-scroll {
  direction: ltr;
  text-align: left;
}
.tree-root {
  justify-content: flex-start;
  margin-left: 0;
  margin-right: auto;
}


/* Keep the two Generation 2 names close together beneath Generation 1.
   The deep Ali lineage is allowed to extend below its fixed-width first-level column,
   so its descendants do not push Fatma to the far edge of the page. */
.tree-root > .family-branch > .family-children {
  display: grid;
  grid-template-columns: 260px 260px;
  justify-content: center;
  align-items: start;
  column-gap: 22px;
  width: 542px;
  min-width: 542px;
  margin-left: auto;
  margin-right: auto;
}
.tree-root > .family-branch > .family-children > .child-branch {
  width: 260px;
  min-width: 260px;
}
.tree-root > .family-branch > .family-children > .child-branch > .family-branch {
  width: 260px;
  min-width: 260px;
}
.tree-root > .family-branch > .family-children > .child-branch .family-children {
  width: max-content;
}


/* Version 6: make the family tree horizontally scrollable and the scrollbar visible */
.tree-section {
  min-width: 0;
  overflow: visible;
}
.tree-scroll {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: scroll !important;
  overflow-y: visible;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: auto;
  scrollbar-color: #9a7926 #e8dfc9;
  padding-bottom: 28px;
  touch-action: pan-x pan-y;
  cursor: grab;
}
.tree-scroll:active {
  cursor: grabbing;
}
.tree-scroll::-webkit-scrollbar {
  height: 16px;
  display: block;
}
.tree-scroll::-webkit-scrollbar-track {
  background: #e8dfc9;
  border: 1px solid #c9b477;
  border-radius: 10px;
}
.tree-scroll::-webkit-scrollbar-thumb {
  background: #9a7926;
  border: 3px solid #e8dfc9;
  border-radius: 10px;
}
.tree-scroll::-webkit-scrollbar-thumb:hover {
  background: #735814;
}
.tree-root {
  display: flex;
  width: max-content;
  min-width: max-content;
  max-width: none;
  justify-content: flex-start;
  align-items: flex-start;
}
.tree-root .family-branch,
.tree-root .child-branch {
  flex-shrink: 0;
}
.tree-root .family-children {
  flex-shrink: 0;
}


/* Version 7: constrain the scroll viewport to the content column.
   Keep the complete nested genealogy inside one genuine horizontal scroller. */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}
.page-layout,
.main-content,
.tree-section {
  min-width: 0;
  max-width: 100%;
}
.tree-section {
  overflow: hidden;
}
.tree-scroll {
  display: block !important;
  position: relative;
  box-sizing: border-box;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  padding: 12px 18px 34px !important;
  margin: 0;
  direction: ltr;
  scrollbar-width: auto !important;
  scrollbar-color: #8a6b16 #e8dfc9 !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.tree-scroll::-webkit-scrollbar {
  height: 18px !important;
  display: block !important;
}
.tree-scroll::-webkit-scrollbar-track {
  background: #e8dfc9;
  border: 1px solid #b49335;
  border-radius: 9px;
}
.tree-scroll::-webkit-scrollbar-thumb {
  background: #8a6b16;
  border: 3px solid #e8dfc9;
  border-radius: 9px;
}
.tree-root {
  display: flex !important;
  flex: 0 0 auto;
  width: max-content !important;
  min-width: max-content !important;
  max-width: none !important;
  justify-content: flex-start !important;
  align-items: flex-start;
  margin: 0 !important;
  padding: 0 12px 12px 0;
}
.tree-root .family-branch,
.tree-root .child-branch {
  flex: 0 0 auto;
  width: max-content;
  max-width: none;
}
.tree-root .family-children {
  display: flex;
  flex: 0 0 auto;
  width: max-content;
  min-width: max-content;
  justify-content: center;
  align-items: flex-start;
}
.tree-root .tree-person {
  flex: 0 0 auto;
}


/* Cross-browser genealogy viewport correction */
.tree-scroll {
  position: relative;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  max-width: 100%;
  min-width: 0;
  scrollbar-gutter: stable;
}
.tree-root {
  position: relative;
  will-change: transform;
}
.tree-scroll, .tree-root, .family-branch, .child-branch {
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
}
@media (max-width: 850px) {
  .tree-scroll { touch-action: pan-x pan-y; }
}

/* Generation 25 short family notes */
.person-note{display:block;font-size:.72rem;line-height:1.35;margin-top:5px;color:#6b6252;font-weight:400;max-width:220px}


/* Noor-ul-Ain biography tree: prevent ancestor and first Generation 25 cards from being clipped */
.noor-ul-ain-page .tree-scroll {
  padding-left: 36px !important;
  padding-right: 36px !important;
  scroll-padding-left: 36px;
}
.noor-ul-ain-page .tree-root .tree-person {
  box-sizing: border-box;
  min-width: 290px;
  max-width: 460px;
  width: 340px;
  overflow: visible;
}
.noor-ul-ain-page .tree-root .person-name {
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: auto;
}
.noor-ul-ain-page .person-note {
  max-width: 360px;
  white-space: normal;
}
@media (max-width: 560px) {
  .noor-ul-ain-page .tree-scroll { padding-left: 24px !important; padding-right: 24px !important; }
  .noor-ul-ain-page .tree-root .tree-person { min-width: 270px; width: 290px; max-width: 320px; }
  .noor-ul-ain-page .person-note { max-width: 270px; }
}


/* Final Noor-ul-Ain page-only correction: always expose the complete left edge
   and keep all five Generation 25 branches inside the horizontal scroll area. */
.noor-ul-ain-page .tree-section,
.noor-ul-ain-page .generation-tree-section {
  min-width: 0 !important;
  max-width: 100% !important;
  overflow: visible !important;
}
.noor-ul-ain-page .tree-scroll {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  padding-left: 28px !important;
  padding-right: 28px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scroll-padding-inline-start: 28px;
  overflow-anchor: none;
  direction: ltr !important;
  scroll-behavior: auto !important;
}
.noor-ul-ain-page .tree-root {
  width: max-content !important;
  min-width: max-content !important;
  max-width: none !important;
  margin-inline: 0 !important;
  padding-left: 8px !important;
  padding-right: 32px !important;
  transform: none !important;
}
.noor-ul-ain-page .tree-root > .family-branch {
  flex: 0 0 auto !important;
  min-width: max-content !important;
}
.noor-ul-ain-page .tree-root .family-children {
  flex: 0 0 auto !important;
  width: max-content !important;
  min-width: max-content !important;
}
.noor-ul-ain-page .tree-root .child-branch {
  flex: 0 0 auto !important;
}
.noor-ul-ain-page .tree-root .tree-person {
  box-sizing: border-box !important;
  flex: 0 0 340px !important;
  width: 340px !important;
  min-width: 290px !important;
  max-width: 340px !important;
  overflow: visible !important;
}
.noor-ul-ain-page .tree-root .person-name {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: normal !important;
}
.noor-ul-ain-page .tree-root .person-note {
  max-width: 300px !important;
  white-space: normal !important;
}
@media (max-width: 560px) {
  .noor-ul-ain-page .tree-scroll { padding-left: 18px !important; padding-right: 18px !important; }
  .noor-ul-ain-page .tree-root .tree-person {
    flex-basis: 290px !important; width: 290px !important;
    min-width: 270px !important; max-width: 310px !important;
  }
  .noor-ul-ain-page .tree-root .person-note { max-width: 260px !important; }
}


/* Noor-ul-Ain page: centered vertical lineage and non-overlapping Generation 2 */
.noor-ul-ain-page .tree-scroll {
  padding-left: 0 !important;
  padding-right: 24px !important;
  scroll-padding-left: 0 !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
}
.noor-ul-ain-page .tree-root {
  box-sizing: content-box !important;
  padding-left: var(--noor-tree-centering, 0px) !important;
  padding-right: 32px !important;
  margin: 0 !important;
  width: max-content !important;
  min-width: max-content !important;
  justify-content: flex-start !important;
}
/* Generation 1 is centered in the visible tree area; the descendants continue below it. */
.noor-ul-ain-page .tree-root > .family-branch > .tree-person {
  width: 340px !important;
  min-width: 340px !important;
  max-width: 340px !important;
}
/* Two Generation 2 cards each get their full width, preventing the previous overlap. */
.noor-ul-ain-page .tree-root > .family-branch > .family-children {
  display: grid !important;
  grid-template-columns: 340px 340px !important;
  column-gap: 35px !important;
  width: 715px !important;
  min-width: 715px !important;
  justify-content: center !important;
  align-items: start !important;
}
.noor-ul-ain-page .tree-root > .family-branch > .family-children > .child-branch,
.noor-ul-ain-page .tree-root > .family-branch > .family-children > .child-branch > .family-branch {
  width: 340px !important;
  min-width: 340px !important;
}
.noor-ul-ain-page .tree-root .tree-person {
  box-sizing: border-box !important;
  width: 340px !important;
  min-width: 300px !important;
  max-width: 340px !important;
  flex: 0 0 340px !important;
}
.noor-ul-ain-page .tree-root .person-name {
  white-space: normal !important;
  overflow-wrap: break-word !important;
  word-break: normal !important;
}
.noor-ul-ain-page .tree-root .person-note { max-width: 300px !important; }
@media (max-width: 560px) {
  .noor-ul-ain-page .tree-root > .family-branch > .tree-person,
  .noor-ul-ain-page .tree-root .tree-person {
    width: 290px !important;
    min-width: 270px !important;
    max-width: 290px !important;
    flex-basis: 290px !important;
  }
  .noor-ul-ain-page .tree-root > .family-branch > .family-children {
    grid-template-columns: 290px 290px !important;
    column-gap: 24px !important;
    width: 604px !important;
    min-width: 604px !important;
  }
  .noor-ul-ain-page .tree-root > .family-branch > .family-children > .child-branch,
  .noor-ul-ain-page .tree-root > .family-branch > .family-children > .child-branch > .family-branch {
    width: 290px !important;
    min-width: 290px !important;
  }
  .noor-ul-ain-page .tree-root .person-note { max-width: 260px !important; }
}


/* Noor-ul-Ain: anchor the five Generation 25 cards from the left edge of
   Generation 24. This prevents the first two branches falling into negative
   horizontal overflow while keeping the parent connector centred on card 1. */
.noor-ul-ain-page .tree-root .generation-25-row {
  display: grid !important;
  grid-template-columns: repeat(5, 340px) !important;
  column-gap: 35px !important;
  width: 1840px !important;
  min-width: 1840px !important;
  justify-content: start !important;
  align-items: start !important;
  align-self: flex-start !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}
.noor-ul-ain-page .tree-root .generation-25-row > .child-branch {
  width: 340px !important;
  min-width: 340px !important;
  margin: 0 !important;
}
.noor-ul-ain-page .tree-root .generation-25-row > .child-branch > .family-branch {
  width: 340px !important;
  min-width: 340px !important;
}
@media (max-width: 560px) {
  .noor-ul-ain-page .tree-root .generation-25-row {
    grid-template-columns: repeat(5, 290px) !important;
    column-gap: 24px !important;
    width: 1546px !important;
    min-width: 1546px !important;
  }
  .noor-ul-ain-page .tree-root .generation-25-row > .child-branch,
  .noor-ul-ain-page .tree-root .generation-25-row > .child-branch > .family-branch {
    width: 290px !important;
    min-width: 290px !important;
  }
}


/* Definitive Noor-ul-Ain page-only left safety gutter.
   Keep the Generation 1 centering calculation, but add a real positive
   start gutter so no nested ancestor or first Generation 25 card begins
   underneath the clipped edge of the horizontal viewport. */
.noor-ul-ain-page .tree-section {
  overflow: hidden !important;
}
.noor-ul-ain-page .tree-scroll {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  padding-left: 56px !important;
  padding-right: 40px !important;
  scroll-padding-left: 56px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  direction: ltr !important;
}
.noor-ul-ain-page .tree-root {
  box-sizing: content-box !important;
  padding-left: calc(var(--noor-tree-centering, 0px) + 56px) !important;
  padding-right: 48px !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  transform: none !important;
}
.noor-ul-ain-page .tree-root .tree-person {
  box-sizing: border-box !important;
  overflow: visible !important;
}
.noor-ul-ain-page .tree-root .person-name,
.noor-ul-ain-page .tree-root .person-note {
  box-sizing: border-box !important;
  max-width: 100% !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}
@media (max-width: 560px) {
  .noor-ul-ain-page .tree-scroll {
    padding-left: 32px !important;
    padding-right: 24px !important;
    scroll-padding-left: 32px !important;
  }
  .noor-ul-ain-page .tree-root {
    padding-left: calc(var(--noor-tree-centering, 0px) + 32px) !important;
  }
}


/* Clean final override for Noor-ul-Ain page only.
   Reset accidental vertical flex-basis heights and provide a positive start
   gutter for the five Generation 25 cards. */
.noor-ul-ain-page .tree-root .tree-person {
  flex: 0 0 auto !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  align-self: center !important;
  padding: 12px 15px !important;
}
.noor-ul-ain-page .tree-root .generation-25-row {
  display: grid !important;
  grid-template-columns: repeat(5, 300px) !important;
  grid-auto-rows: max-content !important;
  align-items: start !important;
  justify-content: start !important;
  column-gap: 28px !important;
  width: max-content !important;
  min-width: max-content !important;
  height: auto !important;
  min-height: 0 !important;
  padding-left: 360px !important;
  padding-right: 30px !important;
  box-sizing: content-box !important;
  margin: 0 !important;
  align-self: flex-start !important;
}
.noor-ul-ain-page .tree-root .generation-25-row > .child-branch,
.noor-ul-ain-page .tree-root .generation-25-row > .child-branch > .family-branch {
  width: 300px !important;
  min-width: 300px !important;
  max-width: 300px !important;
  height: auto !important;
  min-height: 0 !important;
  align-items: center !important;
}
.noor-ul-ain-page .tree-root .generation-25-row .tree-person {
  width: 300px !important;
  min-width: 300px !important;
  max-width: 300px !important;
  flex: 0 0 auto !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
}
.noor-ul-ain-page .tree-root .person-name,
.noor-ul-ain-page .tree-root .person-note {
  max-width: 100% !important;
  white-space: normal !important;
  overflow-wrap: break-word !important;
  word-break: normal !important;
}
.noor-ul-ain-page .tree-scroll {
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scroll-behavior: auto !important;
  scroll-padding-left: 20px !important;
}
@media (max-width: 850px) {
  .noor-ul-ain-page .tree-root .generation-25-row {
    grid-template-columns: repeat(5, 270px) !important;
    column-gap: 22px !important;
    /* Reserve a mobile-only left start gutter so card 1 begins inside
       the scroll viewport at scrollLeft=0; cards 2-5 continue to the right. */
    padding-left: 420px !important;
  }
  /* Keep the parent-to-children vertical connector aligned with the
     original parent centre after adding the extra 300px start gutter. */
  .noor-ul-ain-page .tree-root .family-branch > .tree-person + .family-children.generation-25-row::before {
    left: calc(50% - 150px) !important;
  }
  .noor-ul-ain-page .tree-root .generation-25-row > .child-branch,
  .noor-ul-ain-page .tree-root .generation-25-row > .child-branch > .family-branch,
  .noor-ul-ain-page .tree-root .generation-25-row .tree-person {
    width: 270px !important;
    min-width: 270px !important;
    max-width: 270px !important;
  }
}


/* Generation 24 -> Generation 25 vertical connector.
   The Generation 25 row is the .family-children element immediately
   following Generation 24's .tree-person. */
.noor-ul-ain-page .tree-root .family-branch > .tree-person + .family-children.generation-25-row {
  position: relative !important;
}
.noor-ul-ain-page .tree-root .family-branch > .tree-person + .family-children.generation-25-row::before {
  content: "" !important;
  display: block !important;
  position: absolute !important;
  left: 50% !important;
  top: -40px !important;
  height: 40px !important;
  width: 0 !important;
  border-left: 2px solid var(--line) !important;
  transform: translateX(-1px) !important;
  z-index: 3 !important;
  pointer-events: none !important;
}
.noor-ul-ain-page .generation-25-row > .child-branch:first-child .person-name {
  pointer-events: none !important;
  cursor: default !important;
  text-decoration: none !important;
}
.noor-ul-ain-page .generation-25-row > .child-branch:first-child .person-name:hover,
.noor-ul-ain-page .generation-25-row > .child-branch:first-child .person-name:focus {
  color: var(--green) !important;
  text-decoration: none !important;
}

/* Keep a clear gap below Generation 24 so its connector starts
   at the card's bottom edge, not inside the card. The existing
   40px connector then spans this gap to the Generation 25 branch. */
.noor-ul-ain-page .tree-root .family-branch > .tree-person + .family-children.generation-25-row {
  margin-top: 40px !important;
}
.noor-ul-ain-page .tree-root .family-branch > .tree-person + .family-children.generation-25-row::before {
  top: -40px !important;
  height: 40px !important;
}


/* Mobile correction v2: remove accumulated artificial left gutters on the
   Generation 25 row. Keep the first child at the true start of the row. */
@media (max-width: 560px) {
  .noor-ul-ain-page .tree-root .generation-25-row {
    padding-left: 0 !important;
    margin-left: 0 !important;
    grid-template-columns: repeat(5, 270px) !important;
    width: max-content !important;
    min-width: max-content !important;
    column-gap: 22px !important;
    justify-content: start !important;
    direction: ltr !important;
  }
  .noor-ul-ain-page .tree-root .generation-25-row > .child-branch:first-child {
    grid-column: 1 !important;
    justify-self: start !important;
  }
  .noor-ul-ain-page .tree-root .generation-25-row > .child-branch,
  .noor-ul-ain-page .tree-root .generation-25-row > .child-branch > .family-branch,
  .noor-ul-ain-page .tree-root .generation-25-row .tree-person {
    width: 270px !important; min-width: 270px !important; max-width: 270px !important;
  }
}


/* Final mobile start-position correction: Noor-ul-Ain page only.
   Give the full tree a safe left runway so Generation 25 child 1 is never
   positioned at a negative scroll coordinate. */
@media (max-width: 560px) {
  .noor-ul-ain-page .tree-scroll {
    direction: ltr !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    scroll-behavior: auto !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  .noor-ul-ain-page .tree-root {
    padding-left: calc(var(--noor-tree-centering, 0px) + 720px) !important;
    padding-right: 24px !important;
    margin-left: 0 !important;
    transform: none !important;
    width: max-content !important;
    min-width: max-content !important;
  }
  .noor-ul-ain-page .tree-root .generation-25-row {
    display: grid !important;
    grid-template-columns: repeat(5, 270px) !important;
    grid-auto-flow: column !important;
    width: max-content !important;
    min-width: max-content !important;
    padding-left: 0 !important;
    padding-right: 24px !important;
    margin-left: 0 !important;
    column-gap: 22px !important;
    justify-content: start !important;
    direction: ltr !important;
  }
  .noor-ul-ain-page .tree-root .generation-25-row > .child-branch,
  .noor-ul-ain-page .tree-root .generation-25-row > .child-branch > .family-branch,
  .noor-ul-ain-page .tree-root .generation-25-row .tree-person {
    width: 270px !important;
    min-width: 270px !important;
    max-width: 270px !important;
  }
}


/* Prominent bilingual instruction above the genealogy tree. */
.noor-ul-ain-page .tree-view-instruction {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 14px 0 8px;
  padding: 12px 16px;
  border: 1px solid #c9a227;
  border-left: 5px solid #c9a227;
  border-radius: 8px;
  background: #f5edcf;
  color: #073f2e;
  text-align: center;
  font-family: Arial, sans-serif;
  line-height: 1.45;
}
.noor-ul-ain-page .tree-view-instruction strong {
  font-size: 15px;
  font-weight: 700;
}
.noor-ul-ain-page .tree-view-instruction span {
  font-size: 14px;
  font-weight: 600;
}

/* Desktop-only left breathing room: the five Generation 25 cards begin
   slightly inside the scroll viewport instead of clipping at its left edge.
   Mobile positioning is intentionally left unchanged. */
@media (min-width: 561px) {
  .noor-ul-ain-page .tree-root {
    padding-left: 220px !important;
  }
}
@media (max-width: 560px) {
  .noor-ul-ain-page .tree-view-instruction {
    margin: 10px 0 6px;
    padding: 10px 8px;
  }
  .noor-ul-ain-page .tree-view-instruction strong { font-size: 13px; }
  .noor-ul-ain-page .tree-view-instruction span { font-size: 12px; }
}


/* Desktop correction: start Generation 25 at the leftmost card.
   The five-card row is wider than its parent; centering it placed card 1
   outside the viewport. Shift the row right by half its total width.
   Mobile layout is deliberately unchanged. */
@media (min-width: 561px) {
  .noor-ul-ain-page .tree-root .generation-25-row {
    position: relative !important;
    transform: translateX(920px) !important;
  }
  .noor-ul-ain-page .tree-root .family-branch > .tree-person + .family-children.generation-25-row::before {
    left: 0 !important;
  }
}


/* Connector alignment after shifting the Generation 25 row on desktop.
   Draw the vertical stem from the bottom-centre of Generation 24 itself,
   so it remains aligned with the Generation 24 card even though the
   five Generation 25 cards are shifted right for visibility. */
@media (min-width: 561px) {
  .noor-ul-ain-page .tree-root .tree-person:has(+ .family-children.generation-25-row)::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 100%;
    height: 40px;
    width: 0;
    border-left: 2px solid var(--line);
    transform: translateX(-1px);
    z-index: 4;
    pointer-events: none;
  }

  .noor-ul-ain-page .tree-root .family-branch > .tree-person + .family-children.generation-25-row::before {
    display: none !important;
    content: none !important;
  }
}


/* Requested desktop-only test: adjust Generation 25 row padding to 110px.
   Keep the 220px tree-root offset and all mobile settings unchanged. */
@media (min-width: 851px) {
  .noor-ul-ain-page .tree-root .generation-25-row {
    padding-left: 110px !important;
  }
}


/* Requested desktop spacing test:
   Generations 1–24 tree root padding = 300px;
   Generation 25 row padding = 50px.
   Mobile layout remains unchanged. */
@media (min-width: 851px) {
  .noor-ul-ain-page .tree-root {
    padding-left: 300px !important;
  }

  .noor-ul-ain-page .tree-root .generation-25-row {
    padding-left: 20px !important;
  }
}


/* Requested desktop spacing test:
   Generations 1–24 tree-root additional left padding = 800px;
   Generation 25 row left padding remains 20px.
   Mobile layout remains unchanged. */
@media (min-width: 851px) {
  .noor-ul-ain-page .tree-root {
    padding-left: 800px !important;
  }

  .noor-ul-ain-page .tree-root .generation-25-row {
    padding-left: 20px !important;
  }
}


/* Compensation for Generation 25:
   The tree-root was increased from 300px to 800px (+500px).
   Offset Generation 25 by 500px so it does not follow that extra shift.
   Existing 920px row translation becomes 420px on desktop.
   Mobile remains unchanged. */
@media (min-width: 851px) {
  .noor-ul-ain-page .tree-root .generation-25-row {
    transform: translateX(420px) !important;
    padding-left: 20px !important;
  }
}


/* Staircase layout test v1 — desktop only, Noor-ul-Ain page.
   Generation 1 begins with a small left gutter. Each nested child branch
   advances 18px to the right, creating a progressive staircase through
   Generation 24. Generation 25's five-card row remains together and its
   existing 24→25 connector is preserved. Mobile rules are untouched. */
@media (min-width: 851px) {
  .noor-ul-ain-page .tree-root {
    padding-left: 12px !important;
    padding-right: 32px !important;
  }

  .noor-ul-ain-page .tree-root .child-branch {
    transform: translateX(18px) !important;
  }

  /* Keep the five Generation 25 cards as one aligned row. */
  .noor-ul-ain-page .tree-root .generation-25-row > .child-branch {
    transform: none !important;
  }
  .noor-ul-ain-page .tree-root .generation-25-row {
    transform: none !important;
    padding-left: 0 !important;
  }

  /* Shift each ordinary parent-to-children vertical connector to the
     new child-column centre and bridge the 18px offset from card centre. */
  .noor-ul-ain-page .tree-root .family-branch > .tree-person:has(+ .family-children:not(.generation-25-row))::after {
    content: "" !important;
    display: block !important;
    position: absolute !important;
    left: 50% !important;
    top: 100% !important;
    width: 18px !important;
    height: 0 !important;
    border-top: 2px solid var(--line) !important;
    transform: none !important;
    z-index: 4 !important;
    pointer-events: none !important;
  }
  .noor-ul-ain-page .tree-root .family-branch > .tree-person + .family-children:not(.generation-25-row)::before {
    left: calc(50% + 18px) !important;
  }
}


/* Staircase layout test v2 — desktop only.
   Requested spacing: every next generation advances 50px to the right.
   Generation 1 keeps the minimum left gutter; Generation 25 remains a
   single five-card row. Mobile styling is intentionally unchanged. */
@media (min-width: 851px) {
  .noor-ul-ain-page .tree-root {
    padding-left: 12px !important;
    padding-right: 32px !important;
  }

  .noor-ul-ain-page .tree-root .child-branch {
    transform: translateX(50px) !important;
  }

  /* Keep all five Generation 25 cards together without shifting cards
     individually inside their shared row. */
  .noor-ul-ain-page .tree-root .generation-25-row > .child-branch {
    transform: none !important;
  }
  .noor-ul-ain-page .tree-root .generation-25-row {
    transform: none !important;
    padding-left: 0 !important;
  }

  /* Match the parent-to-child connector bridge to the 50px staircase step. */
  .noor-ul-ain-page .tree-root .family-branch > .tree-person:has(+ .family-children:not(.generation-25-row))::after {
    width: 50px !important;
  }
  .noor-ul-ain-page .tree-root .family-branch > .tree-person + .family-children:not(.generation-25-row)::before {
    left: calc(50% + 50px) !important;
  }
}


/* Staircase layout test v3 — mobile and tablet.
   Apply the same 50px progressive shift to each successive generation.
   Generation 25 remains a single five-card row, and its mobile start
   position/scroll behavior are preserved. */
@media (max-width: 850px) {
  .noor-ul-ain-page .tree-root .child-branch {
    transform: translateX(50px) !important;
  }

  .noor-ul-ain-page .tree-root .generation-25-row {
    transform: none !important;
  }
  .noor-ul-ain-page .tree-root .generation-25-row > .child-branch {
    transform: none !important;
  }

  .noor-ul-ain-page .tree-root .family-branch > .tree-person:has(+ .family-children:not(.generation-25-row))::after {
    content: "" !important;
    display: block !important;
    position: absolute !important;
    left: 50% !important;
    top: 100% !important;
    width: 50px !important;
    height: 0 !important;
    border-top: 2px solid var(--line) !important;
    transform: none !important;
    z-index: 4 !important;
    pointer-events: none !important;
  }
  .noor-ul-ain-page .tree-root .family-branch > .tree-person + .family-children:not(.generation-25-row)::before {
    left: calc(50% + 50px) !important;
  }
}


/* Mobile v4: center Generation 1 at the initial scroll position.
   Remove the oversized runway and keep the 50px staircase offsets. */
@media (max-width: 850px) {
  .noor-ul-ain-page .tree-scroll {
    touch-action: pan-x pan-y pinch-zoom !important;
    overflow-anchor: none !important;
    scroll-behavior: auto !important;
  }
  .noor-ul-ain-page .tree-root {
    padding-left: max(0px, calc((100vw - 290px) / 2 - 12px)) !important;
    padding-right: 24px !important;
    margin-left: 0 !important;
    transform: none !important;
  }
  .noor-ul-ain-page .tree-root .child-branch {
    transform: translateX(50px) !important;
  }
  .noor-ul-ain-page .tree-root .generation-25-row,
  .noor-ul-ain-page .tree-root .generation-25-row > .child-branch {
    transform: none !important;
  }
}


/* Husain Qattal's five sons (Shamsuddin, Hasan, Husain, Fareed, Ahmad).
   Each son gets a fixed-width column, so the very wide Husain subtree no
   longer pushes Fareed and Ahmad far to the right. Husain's descendants
   simply spread out below the row (there is nothing under his siblings). */
.tree-root .family-children.sons-row {
  --son-w: 260px;
  --son-gap: 24px;
  display: grid;
  grid-template-columns: repeat(5, var(--son-w));
  column-gap: var(--son-gap);
  justify-content: center;
  align-items: start;
  width: calc(5 * var(--son-w) + 4 * var(--son-gap));
  min-width: calc(5 * var(--son-w) + 4 * var(--son-gap));
  gap: 0 var(--son-gap);
}
.tree-root .family-children.sons-row > .child-branch,
.tree-root .family-children.sons-row > .child-branch > .family-branch {
  width: var(--son-w);
  min-width: var(--son-w);
  max-width: var(--son-w);
}
.tree-root .family-children.sons-row > .child-branch > .family-branch > .tree-person {
  width: var(--son-w);
  min-width: var(--son-w);
  max-width: var(--son-w);
}
/* Deeper branches keep their natural width and may extend beyond the column. */
.tree-root .family-children.sons-row > .child-branch .family-children {
  width: max-content;
}
/* Horizontal connector bar, recalculated for the new column gap. */
.tree-root .family-children.sons-row > .child-branch:after {
  left: calc(var(--son-gap) / -2);
  right: calc(var(--son-gap) / -2);
}
.tree-root .family-children.sons-row > .child-branch:first-child:after {
  left: 50%;
  right: auto;
  width: calc(50% + var(--son-gap) / 2);
}
.tree-root .family-children.sons-row > .child-branch:last-child:after {
  left: calc(var(--son-gap) / -2);
  right: auto;
  width: calc(50% + var(--son-gap) / 2);
}
@media (max-width: 560px) {
  .tree-root .family-children.sons-row {
    --son-w: 230px;
    --son-gap: 20px;
  }
}
