:root {
  --aladdin-profile-green: #1f6f3a;
  --aladdin-profile-green-deep: #0f3f24;
  --aladdin-profile-gold: #d6a735;
  --aladdin-profile-gold-soft: #f8e8b2;
  --aladdin-profile-silver: #eef1f4;
  --aladdin-profile-silver-line: #cfd6de;
  --aladdin-profile-ink: #1b261f;
  --aladdin-profile-muted: #607167;
  --aladdin-profile-surface: rgba(255, 255, 255, 0.88);
  --aladdin-profile-shadow: 0 24px 80px rgba(15, 63, 36, 0.14);
  --aladdin-profile-radius-xl: 30px;
  --aladdin-profile-radius-lg: 22px;
  --aladdin-profile-radius-md: 14px;
}

.aladdin-project-profile,
.aladdin-project-profile * { box-sizing: border-box; }

.aladdin-project-profile {
  position: relative;
  max-width: 1440px;
  margin: 0 auto 56px;
  padding: clamp(18px, 3vw, 40px);
  color: var(--aladdin-profile-ink);
  font-family: inherit;
  isolation: isolate;
}

.aladdin-project-profile a { color: var(--aladdin-profile-green); }

.aladdin-profile-hero {
  position: relative;
  overflow: hidden;
  min-height: 360px;
  display: grid;
  align-items: center;
  border: 1px solid rgba(214, 167, 53, 0.42);
  border-radius: var(--aladdin-profile-radius-xl);
  background:
    radial-gradient(circle at 14% 20%, rgba(214, 167, 53, 0.35), transparent 26%),
    radial-gradient(circle at 88% 15%, rgba(238, 241, 244, 0.92), transparent 34%),
    linear-gradient(135deg, #0e371f 0%, #1f6f3a 48%, #f5f7f1 100%);
  box-shadow: var(--aladdin-profile-shadow);
}

[dir="rtl"] .aladdin-profile-hero {
  background:
    radial-gradient(circle at 86% 20%, rgba(214, 167, 53, 0.35), transparent 26%),
    radial-gradient(circle at 12% 15%, rgba(238, 241, 244, 0.92), transparent 34%),
    linear-gradient(225deg, #0e371f 0%, #1f6f3a 48%, #f5f7f1 100%);
}

.aladdin-profile-hero__orb {
  position: absolute;
  width: 270px;
  height: 270px;
  inset-inline-end: 7%;
  top: 48px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.45);
  background:
    radial-gradient(circle at 38% 30%, rgba(255,255,255,0.9), transparent 0 9%, rgba(214,167,53,0.72) 11%, transparent 32%),
    linear-gradient(145deg, rgba(255,255,255,0.44), rgba(255,255,255,0.12));
  box-shadow: inset 0 0 60px rgba(255,255,255,0.28), 0 22px 80px rgba(0,0,0,0.16);
  backdrop-filter: blur(10px);
}

.aladdin-profile-hero__content {
  position: relative;
  z-index: 1;
  max-width: 820px;
  padding: clamp(32px, 7vw, 78px);
  color: white;
}

.aladdin-profile-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.28);
  color: #fff8df;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.aladdin-profile-hero h1 {
  margin: 0;
  max-width: 760px;
  color: white;
  font-size: clamp(2.25rem, 6vw, 5.25rem);
  line-height: .95;
  letter-spacing: -0.055em;
}

[dir="rtl"] .aladdin-profile-hero h1 { letter-spacing: 0; }

.aladdin-profile-lede {
  max-width: 720px;
  margin: 22px 0 0;
  color: rgba(255,255,255,0.88);
  font-size: clamp(1.04rem, 2vw, 1.35rem);
  line-height: 1.75;
}

.aladdin-profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.aladdin-profile-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 13px;
  border-radius: 999px;
  color: #16371f;
  background: linear-gradient(180deg, #fff8d7, var(--aladdin-profile-gold-soft));
  border: 1px solid rgba(214, 167, 53, 0.7);
  font-weight: 800;
  font-size: .84rem;
}

.aladdin-profile-language {
  position: sticky;
  top: var(--wp-admin--admin-bar--height, 0px);
  z-index: 12;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
  padding: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(207,214,222,0.72);
  box-shadow: 0 14px 40px rgba(15,63,36,0.08);
  backdrop-filter: blur(16px);
}

.aladdin-profile-language a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--aladdin-profile-green-deep);
  font-weight: 750;
  font-size: .88rem;
  border: 1px solid transparent;
}

.aladdin-profile-language a:hover,
.aladdin-profile-language a:focus-visible,
.aladdin-profile-language a.is-active {
  color: #142217;
  background: linear-gradient(180deg, #fff7dc, #f3d776);
  border-color: rgba(214,167,53,.65);
  outline: none;
}

.aladdin-profile-shell {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

[dir="rtl"] .aladdin-profile-shell { grid-template-columns: minmax(0, 1fr) minmax(240px, 300px); }
[dir="rtl"] .aladdin-profile-document { grid-column: 1; grid-row: 1; }
[dir="rtl"] .aladdin-profile-toc { grid-column: 2; grid-row: 1; }

.aladdin-profile-toc {
  position: sticky;
  top: calc(var(--wp-admin--admin-bar--height, 0px) + 76px);
  max-height: calc(100vh - 120px);
  overflow: auto;
  padding: 22px;
  border-radius: var(--aladdin-profile-radius-lg);
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(248,250,247,.86));
  border: 1px solid rgba(207,214,222,.75);
  box-shadow: 0 18px 52px rgba(15,63,36,.08);
}

.aladdin-profile-toc p {
  margin: 0 0 12px;
  color: var(--aladdin-profile-green-deep);
  font-weight: 900;
}

.aladdin-profile-toc ol {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-inline-start: 18px;
}

.aladdin-profile-toc li { color: var(--aladdin-profile-muted); }
.aladdin-profile-toc li.is-level-2 { margin-inline-start: 10px; font-size: .92rem; }
.aladdin-profile-toc li.is-level-3 { margin-inline-start: 20px; font-size: .86rem; }
.aladdin-profile-toc a { text-decoration: none; font-weight: 680; }
.aladdin-profile-toc a:hover { text-decoration: underline; }

.aladdin-profile-document {
  overflow: hidden;
  padding: clamp(24px, 4vw, 56px);
  border-radius: var(--aladdin-profile-radius-xl);
  background:
    linear-gradient(180deg, rgba(255,255,255,.96), rgba(253,253,249,.92)),
    radial-gradient(circle at 0 0, rgba(214,167,53,.12), transparent 28%);
  border: 1px solid rgba(207,214,222,.78);
  box-shadow: 0 20px 70px rgba(15,63,36,.09);
}

.aladdin-profile-document h1,
.aladdin-profile-document h2,
.aladdin-profile-document h3,
.aladdin-profile-document h4,
.aladdin-profile-document h5,
.aladdin-profile-document h6 {
  scroll-margin-top: 96px;
  color: var(--aladdin-profile-green-deep);
  letter-spacing: -0.018em;
  line-height: 1.2;
}

[dir="rtl"] .aladdin-profile-document h1,
[dir="rtl"] .aladdin-profile-document h2,
[dir="rtl"] .aladdin-profile-document h3,
[dir="rtl"] .aladdin-profile-document h4,
[dir="rtl"] .aladdin-profile-document h5,
[dir="rtl"] .aladdin-profile-document h6 { letter-spacing: 0; }

.aladdin-profile-document h1 {
  position: relative;
  margin: 0 0 18px;
  padding-bottom: 20px;
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.aladdin-profile-document h1::after {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  bottom: 0;
  width: 124px;
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--aladdin-profile-gold), var(--aladdin-profile-green));
}

.aladdin-profile-document h2 {
  margin-top: 44px;
  padding: 18px 20px;
  border-radius: 18px;
  background: linear-gradient(90deg, rgba(214,167,53,.14), rgba(31,111,58,.08));
  border: 1px solid rgba(214,167,53,.24);
  font-size: clamp(1.45rem, 2.4vw, 2.1rem);
}

.aladdin-profile-document h3 { margin-top: 34px; font-size: clamp(1.18rem, 2vw, 1.55rem); }
.aladdin-profile-document h4 { margin-top: 28px; font-size: 1.05rem; }

.aladdin-profile-document p,
.aladdin-profile-document li {
  color: #314337;
  font-size: clamp(1rem, 1.18vw, 1.075rem);
  line-height: 1.86;
}

.aladdin-profile-document p { margin: 16px 0; }
.aladdin-profile-document strong { color: #152b1a; }
.aladdin-profile-document em { color: #4f624f; }
.aladdin-profile-document ul,
.aladdin-profile-document ol { padding-inline-start: 1.5em; margin: 15px 0 22px; }
.aladdin-profile-document li + li { margin-top: 7px; }
.aladdin-profile-document hr { border: 0; height: 1px; margin: 34px 0; background: linear-gradient(90deg, transparent, rgba(214,167,53,.6), transparent); }

.aladdin-profile-table-wrap {
  overflow-x: auto;
  margin: 22px 0;
  border: 1px solid rgba(207,214,222,.9);
  border-radius: 18px;
  box-shadow: 0 12px 32px rgba(15,63,36,.07);
}

.aladdin-profile-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
  background: white;
}

.aladdin-profile-table th,
.aladdin-profile-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(207,214,222,.72);
  text-align: start;
  vertical-align: top;
  line-height: 1.6;
}

.aladdin-profile-table th {
  color: #142217;
  background: linear-gradient(180deg, #fff9df, #f5e4a6);
  font-weight: 900;
}

.aladdin-profile-top {
  position: fixed;
  inset-inline-end: 24px;
  bottom: 24px;
  z-index: 20;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(214,167,53,.7);
  border-radius: 999px;
  color: #17361f;
  background: linear-gradient(180deg, #fff8dd, #e6c35c);
  box-shadow: 0 16px 36px rgba(15,63,36,.18);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
}

.aladdin-profile-top.is-visible { opacity: 1; pointer-events: auto; transform: translateY(0); }

.aladdin-profile-empty {
  border: 1px solid rgba(214,167,53,.4);
  border-radius: 18px;
  background: #fff9e8;
}

.aladdin-profile-admin code {
  display: inline-block;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f7f7f7;
  border: 1px solid #dcdcde;
}

@media (max-width: 960px) {
  .aladdin-profile-shell,
  [dir="rtl"] .aladdin-profile-shell { grid-template-columns: 1fr; }
  [dir="rtl"] .aladdin-profile-document,
  [dir="rtl"] .aladdin-profile-toc { grid-column: auto; grid-row: auto; }
  .aladdin-profile-toc { position: relative; top: auto; max-height: 280px; }
  .aladdin-profile-hero { min-height: 320px; }
  .aladdin-profile-hero__orb { width: 190px; height: 190px; opacity: .72; }
}

@media (max-width: 640px) {
  .aladdin-project-profile { padding: 12px; }
  .aladdin-profile-hero__content { padding: 28px 22px 42px; }
  .aladdin-profile-language { border-radius: 22px; }
  .aladdin-profile-language a { flex: 1 1 auto; }
  .aladdin-profile-document { padding: 22px 18px; }
  .aladdin-profile-document h2 { padding: 14px; }
  .aladdin-profile-top { inset-inline-end: 14px; bottom: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .aladdin-profile-top { transition: none; }
}

/* v1.0.1 remediation: isolate RTL selectors to this add-on and support no-TOC / checklist states. */
.aladdin-project-profile[dir="rtl"] .aladdin-profile-hero {
  background:
    radial-gradient(circle at 86% 20%, rgba(214, 167, 53, 0.35), transparent 26%),
    radial-gradient(circle at 12% 15%, rgba(238, 241, 244, 0.92), transparent 34%),
    linear-gradient(225deg, #0e371f 0%, #1f6f3a 48%, #f5f7f1 100%);
}

.aladdin-project-profile[dir="rtl"] .aladdin-profile-shell { grid-template-columns: minmax(0, 1fr) minmax(240px, 300px); }
.aladdin-project-profile[dir="rtl"] .aladdin-profile-document { grid-column: 1; grid-row: 1; }
.aladdin-project-profile[dir="rtl"] .aladdin-profile-toc { grid-column: 2; grid-row: 1; }
.aladdin-project-profile[dir="rtl"] .aladdin-profile-hero h1,
.aladdin-project-profile[dir="rtl"] .aladdin-profile-document h1,
.aladdin-project-profile[dir="rtl"] .aladdin-profile-document h2,
.aladdin-project-profile[dir="rtl"] .aladdin-profile-document h3,
.aladdin-project-profile[dir="rtl"] .aladdin-profile-document h4,
.aladdin-project-profile[dir="rtl"] .aladdin-profile-document h5,
.aladdin-project-profile[dir="rtl"] .aladdin-profile-document h6 { letter-spacing: 0; }

.aladdin-profile-shell--no-toc { grid-template-columns: minmax(0, 1fr); }
.aladdin-profile-shell--no-toc .aladdin-profile-document { grid-column: 1; }
.aladdin-project-profile[dir="rtl"] .aladdin-profile-shell--no-toc { grid-template-columns: minmax(0, 1fr); }
.aladdin-project-profile[dir="rtl"] .aladdin-profile-shell--no-toc .aladdin-profile-document { grid-column: 1; }

.aladdin-profile-checklist { list-style: none; padding-inline-start: 0; }
.aladdin-profile-checkitem { display: flex; gap: 10px; align-items: flex-start; }
.aladdin-profile-check {
  flex: 0 0 auto;
  width: 1.05em;
  height: 1.05em;
  margin-top: .42em;
  border-radius: 5px;
  border: 1px solid rgba(31,111,58,.48);
  background: linear-gradient(180deg, #fff, #f7f9f2);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.8);
}
.aladdin-profile-check.is-checked {
  background: linear-gradient(180deg, #f8e8b2, #d6a735);
  border-color: rgba(214,167,53,.82);
}
.aladdin-profile-check.is-checked::after {
  content: "✓";
  display: block;
  color: #12361f;
  font-weight: 900;
  font-size: .76em;
  line-height: 1.25;
  text-align: center;
}

.aladdin-profile-language a[aria-current="true"] { cursor: default; }
.aladdin-profile-document a:focus-visible,
.aladdin-profile-toc a:focus-visible,
.aladdin-profile-top:focus-visible {
  outline: 3px solid rgba(214,167,53,.58);
  outline-offset: 3px;
}

@supports not ((backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px))) {
  .aladdin-profile-language,
  .aladdin-profile-hero__orb {
    background: rgba(255,255,255,.94);
  }
}

@media (max-width: 960px) {
  .aladdin-project-profile[dir="rtl"] .aladdin-profile-shell,
  .aladdin-project-profile[dir="rtl"] .aladdin-profile-shell--no-toc { grid-template-columns: 1fr; }
  .aladdin-project-profile[dir="rtl"] .aladdin-profile-document,
  .aladdin-project-profile[dir="rtl"] .aladdin-profile-toc { grid-column: auto; grid-row: auto; }
}

@media print {
  .aladdin-profile-language,
  .aladdin-profile-toc,
  .aladdin-profile-top { display: none !important; }
  .aladdin-project-profile { max-width: none; padding: 0; }
  .aladdin-profile-document { box-shadow: none; border: 0; }
}

/* ── Native integration inside the Aladdin Homepage shell ──────────────────
 * On the plugin-owned profile shell the document is wrapped by the homepage
 * .ah-wrap container and sits between the shared header and footer. The in-
 * document language nav is suppressed on this surface — the shared header
 * switcher owns language. All overrides below are scoped to .aladdin-profile-
 * page so the marketing homepage look is never affected. [PILLAR II] */
.aladdin-profile-page .aladdin-project-profile {
  margin-block: 6px clamp(28px, 4vw, 48px);
  padding-inline: 0;
}

/* Use the page width: the marketing column (1100px) is too narrow for a long
 * manuscript and left large empty side margins. Widen the reading container on
 * this surface only. */
.aladdin-profile-page .ah-wrap { max-width: 1400px; }

/* Restore the sticky document map WITHOUT creating a second scrollbar.
 * position:sticky is disabled by an ancestor with overflow:hidden, so the
 * marketing wrapper's clip must be relaxed here. But plain overflow:visible let
 * child horizontal overflow reach <body> (which has overflow-x:hidden →
 * computed overflow-y:auto), producing a SECOND vertical scrollbar and a mobile
 * layout shift. overflow-x:clip clips the horizontal spill without establishing
 * a scroll container, so sticky keeps working and only the window scrolls. */
.aladdin_homepage.aladdin-profile-page {
  overflow-x: clip;
  overflow-y: visible;
}
.aladdin_homepage.aladdin-profile-page::before,
.aladdin_homepage.aladdin-profile-page::after { display: none; }

/* Belt-and-braces: nothing on this surface may exceed the viewport width
 * (the .ah-wrap keeps its 1400px reading cap from the rule above). */
.aladdin-profile-page,
.aladdin-profile-page .aladdin-project-profile { max-width: 100%; }

/* Compact, refined header band — reclaim the vertical space the marketing-sized
 * nav wasted on a reading surface. */
.aladdin-profile-page.ah-wrap,
.aladdin-profile-page .ah-wrap { padding-top: 12px; }
.aladdin-profile-page .ah-topnav { margin-bottom: 12px; }
.aladdin-profile-page .ah-home-link,
.aladdin-profile-page .ah-lang-btn {
  padding: 7px 14px;
  font-size: .8rem;
  font-weight: 650;
  letter-spacing: .015em;
}
.aladdin-profile-page .ah-home-ico { font-size: .95em; }
.aladdin-profile-page .ah-lang-item { font-size: .82em; padding: 10px 16px; }

/* Hero is a document masthead here, not a full-bleed marketing hero: scale it
 * down so the manuscript itself is visible within the first screen. */
.aladdin-profile-page .aladdin-profile-hero {
  min-height: 200px;
  border-radius: 22px;
}
.aladdin-profile-page .aladdin-profile-hero__content { padding: clamp(22px, 3.4vw, 40px); }
.aladdin-profile-page .aladdin-profile-hero h1 {
  font-size: clamp(1.65rem, 3.2vw, 2.85rem);
  line-height: 1.06;
}
.aladdin-profile-page .aladdin-profile-lede {
  margin-top: 14px;
  font-size: clamp(.96rem, 1.4vw, 1.12rem);
  line-height: 1.6;
}
.aladdin-profile-page .aladdin-profile-eyebrow {
  margin-bottom: 14px;
  font-size: .72rem;
  padding: 7px 12px;
}
.aladdin-profile-page .aladdin-profile-hero__orb { width: 168px; height: 168px; top: 30px; }
.aladdin-profile-page .aladdin-profile-meta { margin-top: 20px; }
.aladdin-profile-page .aladdin-profile-meta span { font-size: .78rem; min-height: 32px; padding: 6px 11px; }

.aladdin-profile-page .aladdin-profile-document h1,
.aladdin-profile-page .aladdin-profile-document h2,
.aladdin-profile-page .aladdin-profile-document h3 { scroll-margin-top: 96px; }

/* ── Professional document map (TOC) ───────────────────────────────────────
 * The manuscript headings already carry their own "1.1" numbering, so the
 * ordered-list counter produced a confusing double number ("1.1 … 7."). Drop
 * the counter and lean on clean indentation + a refined, restrained card. */
.aladdin-profile-toc {
  padding: 20px 18px;
  border-radius: 18px;
}
.aladdin-profile-toc p {
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(207, 214, 222, 0.7);
  color: var(--aladdin-profile-green-deep);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.aladdin-profile-toc ol {
  list-style: none;
  padding-inline-start: 0;
  gap: 1px;
}
.aladdin-profile-toc li,
.aladdin-profile-toc li.is-level-2,
.aladdin-profile-toc li.is-level-3 { margin: 0; font-size: inherit; }
.aladdin-profile-toc a {
  display: block;
  padding: 7px 10px;
  border-radius: 9px;
  color: #314337;
  font-weight: 650;
  font-size: 0.9rem;
  line-height: 1.5;
  border-inline-start: 2px solid transparent;
  transition: background-color 0.18s ease, color 0.18s ease;
}
.aladdin-profile-toc a:hover,
.aladdin-profile-toc a:focus-visible {
  background: rgba(214, 167, 53, 0.12);
  color: var(--aladdin-profile-green-deep);
  text-decoration: none;
}
.aladdin-profile-toc li.is-level-2 a { padding-inline-start: 22px; font-size: 0.84rem; color: #4a5a4e; }
.aladdin-profile-toc li.is-level-3 a { padding-inline-start: 34px; font-size: 0.8rem; color: #65766b; }
.aladdin-profile-toc a.is-current {
  background: rgba(214, 167, 53, 0.16);
  border-inline-start-color: var(--aladdin-profile-gold);
  color: var(--aladdin-profile-green-deep);
}
