/* ============================================================
   PERPEXITY Design System v2
   McKinsey-inspired editorial system: serif display, sharp
   geometry, thin rules, generous whitespace. Single plum accent.
   ============================================================ */

:root {
  /* Colour: LOCKED to the client's palette (perpexity.sa original tokens).
     Do not add colours. Verify with: node tools/check-palette.mjs */
  --ink: #3e3739;                        /* client --text */
  --ink-soft: rgba(62, 55, 57, 0.92);    /* client --text-soft */
  --muted: rgba(118, 104, 95, 0.72);       /* client --muted */
  --plum-deep: #3e3739;                  /* client --purple-base (dark bands) */
  --band-dark: #5d4e45;                  /* client brown; pre-footer band, lifted off the footer */
  --plum: #c6924a;                       /* client --accent (primary) */
  --plum-bright: #a5762f;                /* client --link */
  --plum-hover: #6f4e1c;                 /* client --link-hover */
  --plum-highlight: #c6924a;             /* client --purple-highlight */
  --plum-wash: rgba(93, 78, 69, 0.08);   /* client nav hover tint */
  --canvas: #fdfbf7;                      /* DRAFT: warm paper base */
  --canvas-alt: #f7f4ee;                 /* client --bg */
  --band: #e8ddcf;                       /* client --bg-muted-band */
  --rule: rgba(62, 55, 57, 0.09);        /* client --line */
  --rule-strong: rgba(62, 55, 57, 0.14); /* client --line-strong */
  --rule-dark: rgba(255, 255, 255, 0.22);
  --on-dark-accent: #d9b877;             /* client dark-theme --link */
  --surface: #ffffff;                    /* panels/inputs; flips in dark mode */

  /* Type */
  --serif: "Source Serif 4", "IBM Plex Sans Arabic", Georgia, serif;
  --sans: "Inter", "IBM Plex Sans Arabic", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Layout */
  --wrap: 1200px;
  --wrap-narrow: 760px;
  --gutter: clamp(20px, 4vw, 48px);
  --section-y: clamp(64px, 9vw, 128px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }

a { color: var(--plum-bright); text-decoration: none; }
a:hover { color: var(--plum-hover); }

::selection { background: var(--plum); color: #fff; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding-inline: var(--gutter); }
.wrap-narrow { max-width: var(--wrap-narrow); margin: 0 auto; padding-inline: var(--gutter); }

/* ---------- Typography ---------- */

.eyebrow {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--plum);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.eyebrow::before {
  content: "";
  width: 28px;
  height: 2px;
  background: var(--plum);
  flex: none;
}
.on-dark .eyebrow { color: var(--on-dark-accent); }
.on-dark .eyebrow::before { background: var(--on-dark-accent); }

h1, h2, h3, .display { font-family: var(--serif); font-weight: 600; line-height: 1.12; letter-spacing: -0.01em; }

.display-1 { font-size: clamp(40px, 6vw, 72px); }
.display-2 { font-size: clamp(30px, 4vw, 48px); }
.display-3 { font-size: clamp(22px, 2.6vw, 30px); line-height: 1.25; }

.lede {
  font-size: clamp(18px, 1.6vw, 21px);
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 46em;
}
.on-dark .lede { color: rgba(255, 255, 255, 0.82); }

.small { font-size: 14px; color: var(--muted); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  padding: 15px 28px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
  min-height: 48px;
}
.btn .arrow { transition: transform 0.18s ease; }
.btn:hover .arrow { transform: translateX(4px); }

.btn-primary { background: var(--plum); border-color: var(--plum); color: #fff; }
.btn-primary:hover { background: var(--plum-deep); border-color: var(--plum-deep); color: #fff; }

.btn-ghost:hover { background: var(--ink); color: #fff; }

.on-dark .btn-ghost { border-color: rgba(255,255,255,0.55); color: #fff; }
.on-dark .btn-ghost:hover { background: #fff; color: var(--ink); }

.btn-light { background: #fff; border-color: #fff; color: var(--plum-deep); }
.btn-light:hover { background: var(--plum-wash); border-color: var(--plum-wash); color: var(--plum-deep); }

.text-link {
  font-weight: 600;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
}
.text-link .arrow { transition: transform 0.18s ease; }
.text-link:hover .arrow { transform: translateX(4px); }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 32px;
  height: 72px;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand-name {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.brand-tag { display: block; font-size: 10px; letter-spacing: 0.08em; color: var(--muted); font-weight: 500; text-transform: none; }

.site-nav { display: flex; gap: 4px; margin-inline-start: auto; }
.site-nav .lang-mobile { display: none; }
.site-nav a {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-soft);
  padding: 10px 14px;
  border-radius: 2px;
}
.site-nav a:hover { color: var(--plum); background: var(--plum-wash); }
.site-nav a[aria-current="page"] { color: var(--plum); font-weight: 600; box-shadow: inset 0 -2px 0 var(--plum); border-radius: 0; }

.header-cta { display: flex; align-items: center; gap: 16px; }
.lang-link { font-size: 15px; font-weight: 600; color: var(--ink-soft); font-family: var(--sans); }
.header-cta .btn { padding: 11px 20px; min-height: 42px; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  margin-inline-start: auto;
}
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--ink); margin: 5px 0; transition: transform 0.2s ease, opacity 0.2s ease; }

/* ---------- Hero ---------- */

.hero { padding: clamp(56px, 8vw, 110px) 0 clamp(48px, 6vw, 88px); position: relative; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(32px, 5vw, 80px); align-items: center; }
.hero h1 { margin-bottom: 24px; }
.hero h1 em { font-style: normal; color: var(--plum); }
.hero .lede { margin-bottom: 36px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }

.hero-art { position: relative; min-height: 320px; }

/* Home hero with photographic background (draft) */
.hero-home { padding: clamp(96px, 15vw, 190px) 0 clamp(72px, 10vw, 140px); }
.hero-home .hero-bg {
  position: absolute; inset: 0; z-index: 0;
  background-image:
    linear-gradient(90deg, rgba(43, 37, 35, 0.9) 0%, rgba(43, 37, 35, 0.72) 42%, rgba(43, 37, 35, 0.34) 100%),
    linear-gradient(0deg, rgba(43, 37, 35, 0.55) 0%, rgba(43, 37, 35, 0) 58%),
    url("/assets/img/hero-riyadh.webp");
  background-size: cover; background-position: center 42%; background-repeat: no-repeat;
}
.hero-home .wrap { position: relative; z-index: 1; }
.hero-home-inner { max-width: 60ch; }
.hero-home h1 { color: #fff; margin-bottom: 24px; }
.hero-home h1 em { color: var(--on-dark-accent); }
.hero-home .lede { margin-bottom: 36px; }

/* Stat strip */
.stat-strip { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: var(--canvas); }
.stat-strip-inner { display: grid; grid-template-columns: repeat(4, 1fr); }
.stat { padding: 28px 24px; border-inline-start: 1px solid var(--rule); }
.stat:first-child { border-inline-start: none; padding-inline-start: 0; }
.stat b { font-family: var(--serif); font-size: 30px; font-weight: 600; color: var(--plum); display: block; line-height: 1.1; }
.stat span { font-size: 13.5px; color: var(--muted); }

/* ---------- Sections ---------- */

.section { padding: var(--section-y) 0; }
.section-alt { background: var(--canvas-alt); }
.section-dark { background: var(--plum-deep); color: #fff; }
.section-dark h2, .section-dark h3 { color: #fff; }
.section-wash { background: var(--plum-wash); }

.section-head { max-width: 780px; margin-bottom: clamp(36px, 5vw, 64px); }
.section-head h2 { margin-bottom: 18px; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 5vw, 88px); align-items: start; }
.split-contact { grid-template-columns: 1fr 1.2fr; }

/* ---------- Cards ---------- */

.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(20px, 3vw, 40px); }
.card-grid-2 { grid-template-columns: repeat(2, 1fr); }
.card-grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  border-top: 2px solid var(--ink);
  padding-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: var(--ink);
  position: relative;
}
.card:hover { color: var(--ink); }
a.card:hover { border-top-color: var(--plum); }
a.card:hover h3 { color: var(--plum); }
.card .num { font-family: var(--serif); font-size: 15px; color: var(--plum); font-weight: 600; letter-spacing: 0.06em; }
.card h3 { font-size: 22px; transition: color 0.15s ease; }
.card p { color: var(--ink-soft); font-size: 15.5px; }
.card .text-link { margin-top: auto; }

.on-dark .card { border-top-color: var(--rule-dark); color: #fff; }
.on-dark .card p { color: rgba(255,255,255,0.75); }

/* ---------- Editorial quote band ---------- */

.quote-band blockquote {
  font-family: var(--serif);
  font-size: clamp(26px, 3.4vw, 42px);
  line-height: 1.3;
  font-weight: 500;
  max-width: 20em;
}
.quote-band cite { display: block; margin-top: 28px; font-style: normal; font-size: 14px; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255,255,255,0.65); }

/* ---------- Method / numbered steps ---------- */

.steps { counter-reset: step; border-top: 1px solid var(--rule); }
.step {
  display: grid;
  grid-template-columns: 90px 1fr 1.4fr;
  gap: clamp(16px, 3vw, 48px);
  padding: 32px 0;
  border-bottom: 1px solid var(--rule);
  align-items: baseline;
}
.step-num { font-family: var(--serif); font-size: 34px; color: var(--plum); font-weight: 600; }
.step h3 { font-size: 21px; }
.step p { color: var(--ink-soft); font-size: 15.5px; }

/* ---------- People ---------- */

.person { background: var(--surface); border: 1px solid var(--rule); border-radius: 2px; padding: 32px 28px; display: flex; flex-direction: column; align-items: flex-start; }
.person-avatar { width: 96px; height: 96px; border-radius: 50%; overflow: hidden; position: relative; background: var(--band); display: grid; place-items: center; margin-bottom: 20px; box-shadow: 0 0 0 1px var(--rule-strong); }
.person-avatar span { font-family: var(--serif); font-size: 34px; font-weight: 600; color: var(--plum); text-transform: uppercase; }
.person-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.person .role { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--plum); font-weight: 600; margin: 4px 0 14px; }
.person h3 { font-size: 22px; }
.person p { color: var(--ink-soft); font-size: 15.5px; }
.person .focus { margin-top: 14px; font-size: 14px; color: var(--muted); }
.person .focus b { color: var(--ink); font-weight: 600; }
/* Role/bio/focus always render (see personCard() in tools/build.mjs) so a
   currently-blank CMS field has an element to be filled into later; collapse
   it visually until then. */
.person .role:has(span:empty),
.person p:has(span:empty) { display: none; }
.person-linkedin { display: inline-flex; align-items: center; gap: 8px; margin-top: 20px; font-size: 14px; font-weight: 600; color: var(--plum-bright); }
.person-linkedin svg { width: 18px; height: 18px; flex: none; }
.person-linkedin:hover { color: var(--plum-hover); }

/* ---------- Insights ---------- */

.insight-card { border-top: 2px solid var(--ink); padding-top: 20px; color: var(--ink); display: flex; flex-direction: column; gap: 10px; }
.insight-card .kicker { font-size: 12px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--plum); }
.insight-card h3 { font-size: 21px; line-height: 1.3; transition: color 0.15s ease; }
.insight-card:hover h3 { color: var(--plum); }
.insight-card p { font-size: 15px; color: var(--ink-soft); }
.insight-card .meta { font-size: 13px; color: var(--muted); margin-top: auto; }

/* Article */
.article-hero { padding: clamp(48px, 6vw, 88px) 0 clamp(28px, 4vw, 48px); }
.article-body { padding-bottom: var(--section-y); }
.article-body p { margin-bottom: 24px; font-size: 17.5px; line-height: 1.75; color: rgba(62, 55, 57, 0.92); }
.article-body h2 { font-size: clamp(24px, 2.8vw, 32px); margin: 44px 0 18px; }
.article-body ul, .article-body ol { margin-block: 0 24px; margin-inline: 22px 0; color: rgba(62, 55, 57, 0.92); }
.article-body li { margin-bottom: 10px; font-size: 17px; }
.article-body .pull {
  font-family: var(--serif);
  font-size: clamp(22px, 2.6vw, 28px);
  line-height: 1.4;
  color: var(--plum);
  border-inline-start: 3px solid var(--plum);
  padding-block: 8px;
  padding-inline: 28px 0;
  margin: 36px 0;
}

/* ---------- CTA band ---------- */

.cta-band { background: var(--band-dark); color: #fff; }
.cta-band-inner { display: grid; grid-template-columns: 1.5fr 1fr; gap: 48px; align-items: center; padding: clamp(48px, 6vw, 88px) 0; }
.cta-band h2 { color: #fff; margin-bottom: 16px; }
.cta-band p { color: rgba(255,255,255,0.8); max-width: 36em; }
.cta-band .actions { display: flex; gap: 16px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- Footer ---------- */

.site-footer { background: #332d2b; color: rgba(255,255,255,0.75); font-size: 15px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1.3fr; gap: clamp(28px, 4vw, 64px); padding: clamp(48px, 6vw, 80px) 0; }
.site-footer h4 { color: #fff; font-family: var(--sans); font-size: 12.5px; letter-spacing: 0.16em; text-transform: uppercase; margin-bottom: 18px; }
.site-footer ul { list-style: none; }
.site-footer li { margin-bottom: 10px; }
.site-footer a { color: rgba(255,255,255,0.75); }
.site-footer a:hover { color: #fff; }
.footer-brand .brand-name { color: #fff; }
.footer-brand p { margin-top: 16px; max-width: 30em; font-size: 14.5px; line-height: 1.7; }
.footer-legal { border-top: 1px solid rgba(255,255,255,0.14); padding: 22px 0; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 13.5px; color: rgba(255,255,255,0.5); }

/* ---------- Breadcrumb ---------- */

.crumbs { padding: 18px 0 0; font-size: 13.5px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--plum); }
.crumbs span[aria-current] { color: var(--ink); font-weight: 500; }

/* ---------- Detail lists (service pages) ---------- */

.detail-list { border-top: 1px solid var(--rule); }
.detail-item { display: grid; grid-template-columns: minmax(200px, 1fr) 2fr; gap: clamp(16px, 3vw, 48px); padding: 28px 0; border-bottom: 1px solid var(--rule); }
.detail-item h3 { font-size: 20px; }
.detail-item p { color: var(--ink-soft); font-size: 15.5px; }

.check-list { list-style: none; }
.check-list li { padding-inline-start: 30px; position: relative; margin-bottom: 14px; color: var(--ink-soft); }
.check-list li::before { content: ""; position: absolute; inset-inline-start: 0; top: 8px; width: 14px; height: 14px; background: var(--plum); clip-path: polygon(0 45%, 12% 32%, 38% 58%, 88% 0, 100% 12%, 38% 84%); }

/* ---------- Audit tool ---------- */

.audit-shell { max-width: 860px; margin: 0 auto; }
.audit-panel { background: #fff; border: 1px solid var(--rule); border-top: 3px solid var(--plum); padding: clamp(28px, 4vw, 56px); }
.audit-progress { display: flex; align-items: center; gap: 16px; margin-bottom: 32px; }
.audit-progress .bar { flex: 1; height: 4px; background: var(--rule); position: relative; overflow: hidden; }
.audit-progress .bar i { position: absolute; inset: 0; transform-origin: left; background: var(--plum); transition: transform 0.35s ease; }
.audit-progress .count { font-size: 13px; font-weight: 600; letter-spacing: 0.08em; color: var(--muted); white-space: nowrap; }

.audit-dim { font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--plum); margin-bottom: 14px; }
.audit-q { font-family: var(--serif); font-size: clamp(21px, 2.6vw, 27px); line-height: 1.35; margin-bottom: 28px; }

.audit-opts { display: grid; gap: 12px; }
.audit-opt {
  text-align: start;
  font-family: var(--sans);
  font-size: 16px;
  padding: 16px 20px;
  background: var(--canvas-alt);
  border: 1px solid var(--rule);
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  color: var(--ink);
}
.audit-opt:hover { border-color: var(--plum); background: var(--plum-wash); }
.audit-opt.selected { border-color: var(--plum); background: var(--plum-wash); box-shadow: inset 0 0 0 1px var(--plum); }
.audit-opt .key {
  flex: none; width: 26px; height: 26px; border: 1px solid var(--muted); border-radius: 2px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 600; color: var(--muted);
}
.audit-opt:hover .key, .audit-opt.selected .key { border-color: var(--plum); color: var(--plum); }
.audit-opt small { display: block; color: var(--muted); font-size: 13.5px; margin-top: 2px; }

.audit-nav { display: flex; justify-content: space-between; margin-top: 32px; }
.audit-back { background: none; border: none; color: var(--muted); font-size: 14.5px; font-weight: 600; cursor: pointer; padding: 10px 0; font-family: var(--sans); }
.audit-back:hover { color: var(--plum); }

/* Audit results */
.score-hero { display: grid; grid-template-columns: auto 1fr; gap: clamp(28px, 4vw, 56px); align-items: center; margin-bottom: 40px; }
.score-ring { width: 168px; height: 168px; position: relative; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring .val { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score-ring .val b { font-family: var(--serif); font-size: 44px; line-height: 1; }
.score-ring .val span { font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.maturity-label { font-family: var(--serif); font-size: clamp(24px, 3vw, 34px); margin-bottom: 10px; }

.dim-bars { display: grid; gap: 18px; margin: 36px 0; }
.dim-bar .top { display: flex; justify-content: space-between; font-size: 14.5px; font-weight: 600; margin-bottom: 8px; }
.dim-bar .top span:last-child { color: var(--muted); font-weight: 500; }
.dim-bar .track { height: 8px; background: var(--rule); overflow: hidden; }
.dim-bar .track i { display: block; height: 100%; background: var(--plum); transform-origin: left; transition: transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1); }
.dim-bar.weak .track i { background: var(--plum-highlight); }

.audit-reco { border-top: 1px solid var(--rule); padding-top: 28px; margin-top: 8px; }
.audit-reco h3 { font-size: 20px; margin-bottom: 12px; }
.audit-reco p { color: var(--ink-soft); font-size: 15.5px; margin-bottom: 20px; }

/* ---------- Advisor (scoping agent) ---------- */

.advisor { background: #fff; border: 1px solid var(--rule); border-top: 3px solid var(--plum); }
.advisor-head { display: flex; align-items: center; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--rule); }
.advisor-head .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--plum-bright); flex: none; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.advisor-head b { font-size: 14.5px; }
.advisor-head span { font-size: 13px; color: var(--muted); }
.advisor-body { padding: 24px; min-height: 300px; display: flex; flex-direction: column; gap: 16px; }
.advisor-msg { max-width: 88%; padding: 14px 18px; font-size: 15px; line-height: 1.55; border-radius: 2px; }
.advisor-msg.bot { background: var(--canvas-alt); border: 1px solid var(--rule); align-self: flex-start; }
.advisor-msg.user { background: var(--plum); color: #fff; align-self: flex-end; }
.advisor-choices { display: flex; flex-wrap: wrap; gap: 10px; }
.advisor-choice {
  font-family: var(--sans); font-size: 14.5px; font-weight: 500;
  padding: 11px 18px; border: 1px solid var(--plum); color: var(--plum);
  background: #fff; border-radius: 2px; cursor: pointer; min-height: 44px;
  transition: background 0.14s ease, color 0.14s ease;
}
.advisor-choice:hover { background: var(--plum); color: #fff; }
.advisor-result { border: 1px solid var(--rule); border-inline-start: 3px solid var(--plum); padding: 20px; background: var(--plum-wash); }
.advisor-result h4 { font-family: var(--serif); font-size: 19px; margin-bottom: 8px; }
.advisor-result p { font-size: 14.5px; color: var(--ink-soft); margin-bottom: 14px; }

/* ---------- Ask Perpexity (site-wide assistant) ---------- */

.ask-fab {
  position: fixed;
  inset-inline-end: 20px;
  inset-block-end: 20px;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--plum);
  color: #fff;
  border: 1px solid var(--plum);
  border-radius: 2px;
  cursor: pointer;
  font-family: var(--sans);
  text-align: start;
  box-shadow: 0 10px 28px rgba(62, 55, 57, 0.22);
  transition: background 0.18s ease, border-color 0.18s ease;
}
.ask-fab:hover { background: var(--plum-deep); border-color: var(--plum-deep); }
.ask-fab svg { flex: none; }
.ask-fab-text b { display: block; font-size: 14px; font-weight: 600; line-height: 1.2; }
.ask-fab-text small { display: block; font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--on-dark-accent); margin-top: 2px; }
.ask-fab.hidden { display: none; }

.ask-panel {
  position: fixed;
  inset-inline-end: 20px;
  inset-block-end: 20px;
  z-index: 75;
  width: min(400px, calc(100vw - 32px));
  max-height: min(620px, calc(100vh - 96px));
  background: #fff;
  border: 1px solid var(--rule-strong);
  border-top: 3px solid var(--plum);
  display: none;
  flex-direction: column;
  box-shadow: 0 24px 56px rgba(62, 55, 57, 0.22);
}
.ask-panel.open { display: flex; }
.ask-head { flex: none; }
.ask-close {
  margin-inline-start: auto;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 26px;
  line-height: 1;
  width: 40px;
  height: 40px;
  cursor: pointer;
  border-radius: 2px;
}
.ask-close:hover { color: var(--plum); background: var(--plum-wash); }
.ask-body { flex: 1; overflow-y: auto; min-height: 240px; }
.ask-input-wrap { flex: none; border-top: 1px solid var(--rule); padding: 12px; background: #fff; }
.ask-powered { margin-top: 8px; font-size: 11.5px; letter-spacing: 0.02em; color: var(--muted); text-align: center; }
.audit-powered { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--rule); text-align: center; }
.ask-powered a, .audit-powered a { color: inherit; text-decoration: none; }
.ask-powered a:hover, .audit-powered a:hover { color: var(--plum); text-decoration: underline; }
.footer-legal a { color: inherit; }
.footer-legal a:hover { color: #fff; }
.ask-input { display: flex; gap: 10px; }
.ask-input input {
  flex: 1;
  min-width: 0;
  font-family: var(--sans);
  font-size: 15px;
  padding: 11px 14px;
  border: 1px solid rgba(62, 55, 57, 0.28);
  border-radius: 2px;
  color: var(--ink);
}
.ask-input input:focus { outline: none; border-color: var(--plum); box-shadow: 0 0 0 3px rgba(198, 146, 74, 0.16); }
.ask-input .btn { padding: 10px 18px; min-height: 44px; }
.ask-links { display: flex; flex-wrap: wrap; gap: 10px; }
a.advisor-choice { display: inline-flex; align-items: center; gap: 8px; }
.ask-human { font-weight: 600; background: var(--plum-wash); }

.ask-page-shell { max-width: 760px; margin: 0 auto; background: #fff; border: 1px solid var(--rule); border-top: 3px solid var(--plum); }
.ask-page-shell .ask-body { min-height: 380px; max-height: 60vh; }
.ask-page-shell .ask-input-wrap { padding: 16px; }

/* ---------- Insights subscribe band ---------- */

.subscribe-band { background: var(--band); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.subscribe-inner {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: clamp(24px, 4vw, 64px);
  align-items: center;
  padding: clamp(36px, 5vw, 64px) 0;
}
.subscribe-band h2 { margin-bottom: 10px; }
.subscribe-band .sub-text { color: var(--ink-soft); font-size: 15.5px; max-width: 34em; }
.subscribe-form { display: flex; gap: 10px; }
.subscribe-form input {
  flex: 1;
  min-width: 0;
  font-family: var(--sans);
  font-size: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(62, 55, 57, 0.28);
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
}
.subscribe-form input:focus { outline: none; border-color: var(--plum); box-shadow: 0 0 0 3px rgba(198, 146, 74, 0.16); }
.subscribe-note { font-size: 13px; color: var(--muted); margin-top: 10px; }
.subscribe-status { font-size: 14px; font-weight: 600; color: var(--plum); margin-top: 10px; min-height: 1em; }

/* ---------- Forms ---------- */

.form-grid { display: grid; gap: 20px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.field label .opt { color: var(--muted); font-weight: 400; }
.field input, .field textarea, .field select {
  width: 100%;
  font-family: var(--sans);
  font-size: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(62, 55, 57, 0.28);
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--plum);
  box-shadow: 0 0 0 3px rgba(198, 146, 74, 0.16);
}
.field .hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.field .error-msg { display: none; font-size: 13.5px; color: var(--plum-hover); font-weight: 600; margin-top: 6px; }
.field.invalid input, .field.invalid textarea { border-color: var(--plum-hover); }
.field.invalid .error-msg { display: block; }

.contact-channels { display: grid; gap: 4px; }
.channel { display: flex; align-items: center; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--rule); color: var(--ink); }
.channel:hover .channel-val { color: var(--plum-hover); }
.channel .icon { width: 42px; height: 42px; border: 1px solid var(--rule); border-radius: 2px; display: flex; align-items: center; justify-content: center; color: var(--plum); flex: none; }
.channel b { display: block; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.channel-val { font-size: 17px; font-weight: 600; color: var(--ink); direction: ltr; }

/* ---------- Utility ---------- */

.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; } .mt-48 { margin-top: 48px; } .mt-64 { margin-top: 64px; }
.mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; } .mb-32 { margin-bottom: 32px; } .mb-48 { margin-bottom: 48px; }

.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.55s ease, transform 0.55s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

.skip-link { position: absolute; inset-inline-start: -9999px; top: 0; background: var(--plum); color: #fff; padding: 12px 20px; z-index: 100; }
.skip-link:focus { inset-inline-start: 0; color: #fff; }

/* Sticky mobile CTA */
.mobile-cta {
  display: none;
  position: fixed;
  bottom: 0;
  inset-inline: 0;
  z-index: 55;
  background: rgba(255,255,255,0.97);
  border-top: 1px solid var(--rule);
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
}
.mobile-cta .btn { width: 100%; justify-content: center; }

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
  .card-grid, .card-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .step { grid-template-columns: 64px 1fr; }
  .step p { grid-column: 2; }
}

@media (max-width: 800px) {
  body { font-size: 16px; }
  .site-nav, .header-cta .btn, .lang-desktop { display: none; }
  .nav-toggle { display: block; }
  .site-nav.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 72px;
    inset-inline: 0;
    background: #fff;
    border-bottom: 1px solid var(--rule);
    padding: 12px var(--gutter) 24px;
    gap: 2px;
    box-shadow: 0 18px 30px rgba(62, 55, 57, 0.08);
  }
  .site-nav.open a { padding: 14px 8px; font-size: 17px; border-bottom: 1px solid var(--rule); }
  .site-nav.open .lang-mobile { display: block; color: var(--plum); font-weight: 600; border-bottom: none; }
  .split, .split-contact, .card-grid, .card-grid-2, .card-grid-4 { grid-template-columns: 1fr; }
  .stat-strip-inner { grid-template-columns: 1fr 1fr; }
  .stat { border: none; padding: 18px 0; }
  .cta-band-inner { grid-template-columns: 1fr; }
  .cta-band .actions { justify-content: flex-start; }
  .footer-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .detail-item { grid-template-columns: 1fr; gap: 8px; }
  .score-hero { grid-template-columns: 1fr; justify-items: start; }
  .mobile-cta.active { display: block; }
  body.has-mobile-cta { padding-bottom: 76px; }
  .ask-fab { padding: 14px; inset-inline-end: 14px; inset-block-end: 14px; }
  .ask-fab-text { display: none; }
  body.has-mobile-cta .ask-fab { inset-block-end: calc(76px + env(safe-area-inset-bottom) + 12px); }
  .ask-panel { inset-inline: 10px; inset-block-end: 10px; width: auto; max-height: 78vh; }
  body.has-mobile-cta .ask-panel { inset-block-end: calc(76px + env(safe-area-inset-bottom) + 8px); }
  .subscribe-inner { grid-template-columns: 1fr; }
  .subscribe-form { flex-wrap: wrap; }
  .subscribe-form .btn { width: 100%; justify-content: center; }
}

/* ---------- RTL readiness ---------- */
[dir="rtl"] body, [dir="rtl"] { font-family: var(--sans); }
[dir="rtl"] .audit-progress .bar i, [dir="rtl"] .dim-bar .track i { transform-origin: right; }

/* Arabic script: no Latin tracking (it breaks cursive joining), looser leading for diacritics */
[dir="rtl"] .eyebrow, [dir="rtl"] .insight-card .kicker, [dir="rtl"] .audit-dim,
[dir="rtl"] .person .role, [dir="rtl"] .channel b, [dir="rtl"] .site-footer h4,
[dir="rtl"] .quote-band cite, [dir="rtl"] .card .num, [dir="rtl"] .audit-progress .count,
[dir="rtl"] .score-ring .val span { letter-spacing: 0; }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] .display-1,
[dir="rtl"] .display-2, [dir="rtl"] .display-3 { line-height: 1.35; letter-spacing: 0; }

/* Arrow hover nudges forward in reading direction */
[dir="rtl"] .btn:hover .arrow, [dir="rtl"] .text-link:hover .arrow { transform: translateX(-4px); }

/* ---------- Focus visibility ---------- */
:focus-visible { outline: 2px solid var(--plum); outline-offset: 2px; }
.on-dark :focus-visible, .cta-band :focus-visible, .site-footer :focus-visible { outline-color: var(--on-dark-accent); }

/* Hamburger open state */
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Print (audit scorecard) ---------- */
@media print {
  .site-header, .site-footer, .mobile-cta, .audit-nav, .cta-band, .no-print,
  .ask-fab, .ask-panel, .subscribe-band { display: none !important; }
  .audit-panel { border: none; padding: 0; }
}

/* ============================================================
   Brand logo (theme-swapped) + theme toggle
   ============================================================ */
.brand-logo { height: 42px; width: auto; display: block; }
.brand-logo-dark { display: none; }
[data-theme="dark"] .brand-logo-light { display: none; }
[data-theme="dark"] .brand-logo-dark { display: block; }
.site-footer .brand-logo { height: 92px; }

.theme-toggle {
  width: 42px; height: 42px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}
.theme-toggle:hover { border-color: var(--plum); color: var(--plum); background: var(--plum-wash); }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ============================================================
   Dark mode — client's own dark-theme tokens (perpexity.sa)
   Added as overrides only; the light rules above are untouched.
   ============================================================ */
[data-theme="dark"] {
  --ink: #f7f4ee;                        /* client dark --text */
  --ink-soft: rgba(232, 221, 207, 0.88); /* client dark --text-soft */
  --muted: rgba(207, 194, 177, 0.72);    /* client dark --muted */
  --canvas: #2b2523;                     /* client dark --bg */
  --canvas-alt: #332d2b;                 /* client dark --surface */
  --band: #3a3330;                       /* client dark --surface-muted */
  --surface: #332d2a;                    /* client dark --surface-card */
  --rule: rgba(255, 255, 255, 0.09);
  --rule-strong: rgba(255, 255, 255, 0.14);
  --plum: #c6924a;                       /* accent that works as a button fill on dark */
  --plum-bright: #d9b877;                /* client dark --link */
  --plum-hover: #ecd6a6;                 /* client dark --link-hover */
  --plum-deep: #3e3739;                  /* bands stay dark */
  --plum-wash: rgba(198, 146, 74, 0.2);  /* plum tint on dark */
  --on-dark-accent: #d9b877;
}
[data-theme="dark"] .eyebrow { color: var(--on-dark-accent); }
[data-theme="dark"] .eyebrow::before { background: var(--on-dark-accent); }
[data-theme="dark"] .site-header { background: rgba(43, 37, 35, 0.9); }
[data-theme="dark"] .mobile-cta { background: rgba(43, 37, 35, 0.95); }
[data-theme="dark"] .audit-panel,
[data-theme="dark"] .advisor,
[data-theme="dark"] .advisor-choice,
[data-theme="dark"] .ask-panel,
[data-theme="dark"] .ask-input-wrap,
[data-theme="dark"] .ask-page-shell,
[data-theme="dark"] .site-nav.open,
[data-theme="dark"] .field input,
[data-theme="dark"] .field textarea,
[data-theme="dark"] .field select,
[data-theme="dark"] .subscribe-form input { background: var(--surface); }
[data-theme="dark"] .field input,
[data-theme="dark"] .field textarea,
[data-theme="dark"] .field select,
[data-theme="dark"] .ask-input input,
[data-theme="dark"] .subscribe-form input { border-color: rgba(255, 255, 255, 0.2); }
[data-theme="dark"] .btn-ghost:hover { color: var(--canvas); }
[data-theme="dark"] .on-dark .btn-ghost:hover { color: #3e3739; }
[data-theme="dark"] .card { border-top-color: var(--rule-strong); }

/* Refined dark: soft plum glow + plum-gradient buttons + lilac accents,
   matching the original perpexity.sa dark styling (not flat black + saturated purple) */
[data-theme="dark"] body {
  background-color: #2b2523;
  background-image:
    radial-gradient(90% 55% at 15% 0%, rgba(138, 106, 58, 0.20) 0%, rgba(0, 0, 0, 0) 55%),
    radial-gradient(70% 45% at 92% 4%, rgba(138, 106, 58, 0.16) 0%, rgba(0, 0, 0, 0) 50%);
  background-repeat: no-repeat;
}
[data-theme="dark"] .btn-primary {
  background: linear-gradient(120deg, #3e3739 0%, #8a6a3a 55%, #2b1f14 100%);
  border-color: #3e3739;
}
[data-theme="dark"] .btn-primary:hover {
  background: linear-gradient(120deg, #2b1f14 0%, #3e3739 55%, #2b1f14 100%);
  border-color: #2b1f14;
}
[data-theme="dark"] .hero h1 em,
[data-theme="dark"] .card .num,
[data-theme="dark"] .step-num,
[data-theme="dark"] .audit-dim,
[data-theme="dark"] .person .role,
[data-theme="dark"] .insight-card .kicker,
[data-theme="dark"] .stat b,
[data-theme="dark"] .subscribe-status { color: var(--on-dark-accent); }
[data-theme="dark"] .site-nav a[aria-current="page"] {
  color: var(--plum-bright);
  box-shadow: inset 0 -2px 0 var(--plum-bright);
}

@media (max-width: 800px) {
  .header-cta { margin-inline-start: auto; gap: 10px; }
  .nav-toggle { margin-inline-start: 4px; }
}
