/* Site design for ruqyai.github.io and ruqyai.github.io/ar.
   Layout: one 68rem column; every section is a two-track grid (label rail + content) that stacks to one column on phones.
   The same file serves both sites; [dir="rtl"] at the bottom adapts it for Arabic. */
/* Layout: one 68rem column; every section is a two-track grid (label rail + content) that stacks to one column on phones. */
:root {
  --paper: #F3F6F4;
  --surface: #FFFFFF;
  --ink: #14211C;
  --muted: #56655F;
  --line: #D5DED9;
  --accent: #0D6B59;
  --accent-soft: #DCEEE8;
  --heat: #F0A53A;
  --heat-max: 0.85;

  --f-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", "Helvetica Neue", Arial, system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --f-arabic: "Aref Ruqaa", "Geeza Pro", "Noto Naskh Arabic", serif;
  --f-latin: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;

  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: 1.1875rem;
  --step-2: 1.5rem;
  --step-3: clamp(1.75rem, 1.2rem + 2.2vw, 2.4rem);
  --step-4: clamp(2.6rem, 1.4rem + 5.4vw, 4.75rem);

  --radius: 14px;
  --gutter: clamp(16px, 4vw, 40px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0D1412;
    --surface: #131D1A;
    --ink: #E3EBE7;
    --muted: #9AABA4;
    --line: #26332F;
    --accent: #5FC8AE;
    --accent-soft: #173029;
    --heat: #E49A2C;
    --heat-max: 0.55;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0D1412;
  --surface: #131D1A;
  --ink: #E3EBE7;
  --muted: #9AABA4;
  --line: #26332F;
  --accent: #5FC8AE;
  --accent-soft: #173029;
  --heat: #E49A2C;
  --heat-max: 0.55;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
a:focus-visible, button:focus-visible, .tok:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; margin: 0; }
p { margin: 0; }

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

/* ---------- top bar ---------- */
.bar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
  background: color-mix(in oklab, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.bar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  flex-wrap: wrap;
  padding-block: 12px;
}
.mark {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: var(--step-1);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.mark span { color: var(--accent); }
.home main { display: block; }
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  font-size: var(--step--1);
  font-weight: 500;
}
.nav a { text-decoration: none; color: var(--muted); padding-block: 4px; }
.nav a:hover { color: var(--ink); }
.nav .alt { font-family: var(--f-arabic); font-size: 1.05rem; color: var(--accent); line-height: 1.2; }

/* ---------- hero ---------- */
.hero { padding-block: clamp(40px, 7vw, 88px) clamp(32px, 5vw, 56px); }
.hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 15rem;
  gap: clamp(28px, 5vw, 64px);
  align-items: start;
}
.eyebrow {
  font-family: var(--f-mono);
  font-size: var(--step--1);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.hero h1 {
  font-size: var(--step-4);
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin-top: 14px;
}
.alt-name {
  font-family: var(--f-arabic);
  font-size: clamp(1.9rem, 1.3rem + 2.6vw, 2.9rem);
  color: var(--accent);
  line-height: 1.5;
  margin-top: 6px;
  text-align: left;
}

/* activation strip: the signature element */
.acts {
  margin: 28px 0 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px 14px;
  max-width: 44rem;
}
.acts-head {
  display: flex;
  justify-content: space-between;
  gap: 8px 16px;
  flex-wrap: wrap;
  font-family: var(--f-mono);
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.03em;
}
.acts-line {
  margin-top: 12px;
  font-size: clamp(1.15rem, 1rem + 0.8vw, 1.45rem);
  line-height: 1.75;
  font-weight: 500;
}
.tok {
  --a: 0;
  background: color-mix(in oklab, var(--heat) calc(var(--a) * var(--heat-max) * 100%), transparent);
  border-radius: 4px;
  padding: 1px 3px;
  margin-inline: -1px;
  cursor: default;
  transition: box-shadow .15s ease;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.tok:hover, .tok.is-on { box-shadow: inset 0 -2px 0 var(--ink); }
.acts-read {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--f-mono);
  font-size: 0.75rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.scale {
  flex: 0 0 auto;
  width: 84px;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, transparent, color-mix(in oklab, var(--heat) calc(var(--heat-max) * 100%), transparent));
  border: 1px solid var(--line);
}
.acts-read b { color: var(--ink); font-weight: 500; }

.bio {
  margin-top: 24px;
  max-width: 38rem;
  font-size: var(--step-1);
  line-height: 1.6;
  color: var(--ink);
}
.bio em { font-style: normal; color: var(--accent); font-weight: 600; }

.actions {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--step--1);
  font-weight: 600;
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color .15s ease, transform .15s ease;
}
.btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); }
.btn svg { width: 16px; height: 16px; flex: 0 0 auto; }

.portrait { display: grid; gap: 12px; }
.portrait img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 22px;
  display: block;
  background: var(--accent-soft);
}
.facts {
  display: grid;
  gap: 2px;
  font-family: var(--f-mono);
  font-size: 0.75rem;
  color: var(--muted);
}
.facts b { color: var(--ink); font-weight: 500; }

/* ---------- sections ---------- */
.sec { border-top: 1px solid var(--line); padding-block: clamp(40px, 6vw, 72px); }
.sec .wrap {
  display: grid;
  grid-template-columns: 13rem minmax(0, 1fr);
  gap: 20px clamp(24px, 4vw, 56px);
}
.sec-label { display: grid; gap: 8px; align-content: start; }
.sec-label h2 { font-size: var(--step-3); line-height: 1.05; letter-spacing: -0.02em; }
.sec-label p { color: var(--muted); font-size: var(--step--1); max-width: 22ch; }

/* now */
.now { display: grid; gap: 0; }
.now-row {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  gap: 6px 24px;
  padding-block: 18px;
  border-bottom: 1px solid var(--line);
}
.now-row:first-child { padding-top: 0; }
.now-row:last-child { border-bottom: 0; padding-bottom: 0; }
.when {
  font-family: var(--f-mono);
  font-size: var(--step--1);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: 3px;
}
.now-row h3 { font-size: var(--step-1); font-weight: 600; letter-spacing: -0.01em; }
.now-row h3 small { font-family: var(--f-body); font-weight: 400; color: var(--muted); font-size: var(--step-0); }
.now-row p { color: var(--muted); margin-top: 4px; max-width: 60ch; }
.live {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--f-mono); font-size: 0.6875rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft);
  padding: 2px 8px; border-radius: 999px; margin-inline-start: 8px; vertical-align: 3px;
}
.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* work cards */
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.card {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 8px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color .15s ease, transform .15s ease;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.kind {
  font-family: var(--f-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.card h3 { font-size: var(--step-1); line-height: 1.2; letter-spacing: -0.01em; }
.card p { color: var(--muted); font-size: 0.9375rem; line-height: 1.5; }
.card .go {
  font-family: var(--f-mono);
  font-size: 0.75rem;
  color: var(--muted);
  padding-top: 8px;
  overflow-wrap: anywhere;
}
.card:hover .go { color: var(--ink); }

/* experience */
.xp { display: grid; gap: 28px; }
.xp-item { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 6px 24px; }
.xp-item h3 { font-size: var(--step-1); font-weight: 600; letter-spacing: -0.01em; }
.xp-item .org { color: var(--muted); font-weight: 400; }
.xp-item p { color: var(--muted); margin-top: 4px; max-width: 60ch; }
.ladder {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 0;
}
.ladder li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
  padding-block: 7px;
  position: relative;
}
.ladder li::before {
  content: "";
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--paper);
  transform: translateY(1px);
  position: relative;
  z-index: 1;
}
.ladder li:last-child::before { background: var(--accent); }
.ladder li:not(:last-child)::after {
  content: "";
  position: absolute;
  inset-inline-start: 5.5px;
  top: calc(7px + 0.8em);
  bottom: calc(-7px - 0.2em);
  width: 2px;
  background: var(--line);
}
.ladder .role { font-weight: 500; }
.ladder .dates { font-family: var(--f-mono); font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* recognition */
.honors {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 32px;
}
.honor {
  padding-block: 14px;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 2px;
}
.honor b { font-weight: 600; }
.honor span { color: var(--muted); font-size: 0.9375rem; }
.honor a { color: var(--accent); text-underline-offset: 3px; }

/* lists: writing & talks */
.list { display: grid; }
.li {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 4px 20px;
  padding-block: 14px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.li:first-child { padding-top: 0; }
.li .t { font-weight: 500; font-size: 1.0625rem; line-height: 1.4; transition: color .15s ease; }
.li:hover .t { color: var(--accent); }
.li .m { color: var(--muted); font-size: 0.875rem; margin-top: 2px; }
.more {
  margin-top: 18px;
  font-family: var(--f-mono);
  font-size: var(--step--1);
  color: var(--accent);
  text-underline-offset: 4px;
  display: inline-block;
}
.split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 36px; }
.split h3 { font-size: var(--step--1); font-family: var(--f-mono); font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.courses .li { grid-template-columns: 3.5rem minmax(0, 1fr); }

/* closing */
.close {
  background: var(--ink);
  color: var(--paper);
  border-radius: 24px;
  padding: clamp(28px, 5vw, 56px);
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 28px;
  align-items: end;
}
.close h2 { font-size: var(--step-3); line-height: 1.05; letter-spacing: -0.02em; }
.close p { opacity: 0.78; margin-top: 12px; max-width: 46ch; }
.close .actions { margin-top: 0; justify-content: flex-end; }
.close .btn { background: transparent; color: var(--paper); border-color: color-mix(in oklab, var(--paper) 35%, transparent); }
.close .btn:hover { border-color: var(--paper); }
.close .btn.primary { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.close .btn.primary:hover { background: var(--accent-soft); border-color: var(--accent-soft); }

.foot { padding-block: 28px 40px; }
.foot .wrap {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  font-family: var(--f-mono); font-size: 0.75rem; color: var(--muted);
}
.foot a { text-underline-offset: 3px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sec .wrap { grid-template-columns: minmax(0, 1fr); }
  .sec-label p { max-width: none; }
  .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .hero .wrap { grid-template-columns: minmax(0, 1fr); }
  .portrait { grid-template-columns: 96px minmax(0, 1fr); align-items: center; order: -1; gap: 16px; }
  .portrait img { border-radius: 18px; }
  .honors { grid-template-columns: minmax(0, 1fr); }
  .close { grid-template-columns: minmax(0, 1fr); }
  .close .actions { justify-content: flex-start; }
}
@media (max-width: 560px) {
  .cards { grid-template-columns: minmax(0, 1fr); }
  .now-row, .xp-item, .li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .when { padding-top: 0; }
  .acts { padding: 14px 14px 12px; }
  .nav { gap: 2px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Arabic (right-to-left) ---------- */
[dir="rtl"] {
  --f-display: "Readex Pro", "IBM Plex Sans Arabic", "Geeza Pro", system-ui, sans-serif;
  --f-body: "IBM Plex Sans Arabic", "IBM Plex Sans", "Geeza Pro", Tahoma, system-ui, sans-serif;
}
[dir="rtl"] body { line-height: 1.8; }
[dir="rtl"] .nav .alt { font-family: var(--f-latin); font-size: inherit; }
[dir="rtl"] .hero h1 {
  font-family: var(--f-arabic);
  font-weight: 700;
  font-size: clamp(3rem, 1.8rem + 5.6vw, 5.4rem);
  line-height: 1.35;
  letter-spacing: 0;
  margin-top: 6px;
}
[dir="rtl"] .alt-name {
  font-family: var(--f-latin);
  font-weight: 700;
  font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-top: 0;
}
[dir="rtl"] .acts-line { font-size: clamp(1.2rem, 1rem + 0.9vw, 1.55rem); line-height: 2; }
[dir="rtl"] .scale { background: linear-gradient(to left, transparent, color-mix(in oklab, var(--heat) calc(var(--heat-max) * 100%), transparent)); }
[dir="rtl"] .card .go { direction: ltr; text-align: right; }
/* Arabic is never letter-spaced or uppercased: it breaks the joins between letters */
[dir="rtl"] :is(.eyebrow, .kind, .live, .split h3, .when, .facts, .acts-head, .acts-read, .ladder .dates, .more, .foot) {
  font-family: var(--f-body);
  letter-spacing: 0;
  text-transform: none;
}
[dir="rtl"] :is(.eyebrow, .split h3) { font-size: 0.875rem; }
[dir="rtl"] :is(.kind, .live) { font-size: 0.75rem; font-weight: 600; }
[dir="rtl"] :is(.sec-label h2, .close h2, .card h3, .now-row h3, .xp-item h3, .mark) { letter-spacing: 0; }

/* ---------- theme toggle ---------- */
.bar-end { display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap; }
.theme-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: border-color .15s ease;
}
.theme-btn:hover { border-color: var(--accent); }
.theme-btn svg { width: 16px; height: 16px; }
.theme-btn .sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .sun { display: block; }
  :root:not([data-theme="light"]) .theme-btn .moon { display: none; }
}
:root[data-theme="dark"] .theme-btn .sun { display: block; }
:root[data-theme="dark"] .theme-btn .moon { display: none; }

.sec .wrap.one { grid-template-columns: minmax(0, 1fr); }
