/* Manal Alsuwat — portfolio */
:root {
  --paper: #fbfaf7;
  --paper-2: #f3f2ee;
  --ink: #1b1a18;
  --ink-2: #3d3a36;
  --muted: #625d57;
  --line: rgba(27, 26, 24, .13);
  --line-strong: rgba(27, 26, 24, .3);
  --accent: #7a1f3d;
  --accent-ink: #6a1b36;
  --accent-soft: rgba(27, 26, 24, .055);
  --shadow: 0 1px 0 rgba(28, 25, 23, .04), 0 10px 30px -18px rgba(28, 25, 23, .25);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #1f1d1b;
  --paper-2: #2a2724;
  --ink: #f0ede7;
  --ink-2: #d9d4cc;
  --muted: #aba59d;
  --line: rgba(240, 237, 231, .15);
  --line-strong: rgba(240, 237, 231, .34);
  --accent: #d4a96a;
  --accent-ink: #e2bd84;
  --accent-soft: rgba(212, 169, 106, .12);
  --shadow: 0 1px 0 rgba(0, 0, 0, .2), 0 10px 30px -18px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { font-size: 17px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html[dir="rtl"] { font-size: 17.5px; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.6;
  font-feature-settings: "kern", "liga", "calt";
}
html[dir="rtl"] body { font-family: "Noto Sans Arabic", "Figtree", system-ui, sans-serif; line-height: 1.9; }
h1, h2, h3, .display { font-family: "Newsreader", Georgia, "Times New Roman", serif; font-weight: 500; }
html[dir="rtl"] h1, html[dir="rtl"] h2, html[dir="rtl"] h3, html[dir="rtl"] .display { font-family: "Noto Naskh Arabic", "Newsreader", serif; font-weight: 600; }
[lang="en"] { font-family: "Figtree", system-ui, sans-serif; }
a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3, p, dl, dd, ul { margin-top: 0; }
img, svg { max-width: 100%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* skip link */
.skip { position: absolute; inset-inline-start: -999px; top: 1rem; z-index: 10; background: var(--ink); color: var(--paper); padding: .5rem 1rem; border-radius: 6px; }
.skip:focus { inset-inline-start: 1rem; }

/* top bar */
.top { position: sticky; top: 0; z-index: 30; background: var(--paper); background: color-mix(in srgb, var(--paper) 86%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; gap: 1.5rem; max-width: 1120px; margin: 0 auto; padding: .8rem 1.25rem; }
.mark { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); font-weight: 600; letter-spacing: .01em; }
.mark .logo { width: 2rem; height: 2rem; flex: none; }
.mark .word { line-height: 1.1; }
.mark small { display: block; color: var(--muted); font-weight: 400; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
html[dir="rtl"] .mark small { letter-spacing: 0; text-transform: none; font-size: .8rem; }
.nav { display: flex; gap: 1.1rem; margin-inline-start: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--muted); text-decoration: none; white-space: nowrap; font-size: .95rem; padding: .2rem 0; border-bottom: 1px solid transparent; }
.nav a:hover { color: var(--ink); border-bottom-color: var(--accent); }
.controls { display: flex; align-items: center; gap: .5rem; }
.lang, .theme { display: inline-flex; align-items: center; justify-content: center; height: 2.15rem; padding: 0 .8rem; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--ink); text-decoration: none; cursor: pointer; font: inherit; font-size: .9rem; }
.lang:hover, .theme:hover { border-color: var(--ink); }
.theme { width: 2.15rem; padding: 0; }
.theme svg { width: 1.05rem; height: 1.05rem; }
.theme .sun { display: none; }
:root[data-theme="dark"] .theme .sun { display: inline; }
:root[data-theme="dark"] .theme .moon { display: none; }

/* layout */
main { max-width: 1120px; margin: 0 auto; padding: 0 1.25rem 3rem; }

/* hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); gap: 3.5rem; align-items: start; padding: 4rem 0 3.5rem; }
.hero-logo { width: 84px; height: 84px; margin-bottom: 1.5rem; display: block; }
.eyebrow { color: var(--accent-ink); font-size: .82rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; margin: 0 0 .6rem; }
html[dir="rtl"] .eyebrow { letter-spacing: 0; text-transform: none; font-size: .95rem; }
h1 { font-size: clamp(2.4rem, 5vw, 3.9rem); line-height: 1.02; letter-spacing: -.015em; margin-bottom: 1.1rem; }
html[dir="rtl"] h1 { letter-spacing: 0; line-height: 1.4; font-size: clamp(2.2rem, 4.6vw, 3.4rem); }
.lede { font-size: clamp(1.05rem, 1.7vw, 1.25rem); color: var(--ink-2); margin-bottom: 1.4rem; }
.lede .sep { color: var(--accent); margin: 0 .35em; }
.statement { font-size: 1.04rem; max-width: 60ch; color: var(--ink-2); margin-bottom: 1.6rem; }
.facts { display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; margin: 0 0 1.75rem; }
.facts div { display: grid; gap: .05rem; }
.facts dt { color: var(--muted); font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; }
html[dir="rtl"] .facts dt { letter-spacing: 0; text-transform: none; font-size: .88rem; }
.facts dd { margin: 0; font-weight: 500; }
.ctas { display: flex; flex-wrap: wrap; gap: .6rem; margin: 0; }
.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .6rem 1.05rem; border: 1px solid var(--line-strong); border-radius: 999px; font-weight: 500; color: var(--ink); text-decoration: none; font-size: .95rem; transition: border-color .15s, background .15s, color .15s; }
.btn:hover { border-color: var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
:root[data-theme="dark"] .btn-primary { color: #1a1510; }
.ico { display: block; flex: none; width: 1.1rem; height: 1.1rem; }
.btn-icon { justify-content: center; width: 2.6rem; padding: 0; }

/* hero card */
.card { background: var(--paper-2); border: 1px solid var(--line); border-radius: 16px; padding: 1.5rem 1.6rem; box-shadow: var(--shadow); }
.card h2 { font-size: 1.05rem; margin: 0 0 1rem; color: var(--ink); }
.focus { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.focus li { display: grid; grid-template-columns: 2.2rem minmax(0, 1fr); gap: .6rem; align-items: baseline; padding: .65rem 0; border-top: 1px solid var(--line); }
.focus li:first-child { border-top: 0; padding-top: 0; }
.focus .n { color: var(--accent-ink); font-family: "Newsreader", Georgia, serif; font-style: italic; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.focus .t { font-weight: 500; line-height: 1.4; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1.25rem; margin: 1.35rem 0 0; padding-top: 1.2rem; border-top: 1px solid var(--line-strong); }
.stats div { display: grid; gap: 0; }
.stats dd { margin: 0; font-family: "Newsreader", Georgia, serif; font-size: 1.9rem; line-height: 1.05; color: var(--ink); font-variant-numeric: tabular-nums; }
html[dir="rtl"] .stats dd { font-family: "Noto Naskh Arabic", serif; }
.stats dt { color: var(--muted); font-size: .82rem; order: 2; }

/* sections */
.section { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 2rem; padding: 3rem 0; border-top: 1px solid var(--line); scroll-margin-top: 4.75rem; }
.section > header { position: sticky; top: 4.6rem; align-self: start; }
.section .num { display: block; color: var(--accent-ink); font-family: "Newsreader", Georgia, serif; font-style: italic; font-size: .95rem; margin-bottom: .15rem; }
.section h2 { font-size: 1.3rem; margin: 0; line-height: 1.25; }
.body { max-width: 72ch; }
.intro { color: var(--muted); margin-bottom: 1.5rem; }

/* generic items */
.items { list-style: none; margin: 0; padding: 0; }
.items > li { padding: 1.15rem 0; border-top: 1px solid var(--line); }
.items > li:first-child { border-top: 0; padding-top: 0; }
.items h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .8rem; font-size: 1.12rem; margin-bottom: .25rem; }
.items h3 a { color: inherit; }
.items p { margin: 0; }
.items p + p { margin-top: .4rem; }
.role { color: var(--ink-2); font-weight: 500; }
.dates { color: var(--muted); font-weight: 400; font-size: .9rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.meta { color: var(--muted); font-size: .92rem; }
.bullets { margin: .5rem 0 0; padding-inline-start: 1.1rem; color: var(--ink-2); }
.bullets li { margin: .2rem 0; }
.bullets li::marker { color: var(--accent); }

/* experience: timeline */
.timeline > li { display: grid; grid-template-columns: 9.5rem 4.25rem minmax(0, 1fr); gap: 1.25rem; position: relative; }
.logo { display: block; width: 4.25rem; height: 2.1rem; object-fit: contain; object-position: left center; margin-top: .3rem; }
html[dir="rtl"] .logo { object-position: right center; }
:root[data-theme="dark"] img.logo { background: #f3f2ee; border-radius: 6px; padding: .2rem .3rem; box-sizing: border-box; }
.timeline .when { color: var(--muted); font-size: .9rem; line-height: 1.5; padding-top: .3rem; font-variant-numeric: tabular-nums; }
.timeline .when b { display: block; color: var(--ink); font-weight: 500; }

/* projects: cards */
.projects { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.project { display: flex; flex-direction: column; gap: .6rem; background: var(--paper-2); border: 1px solid var(--line); border-radius: 14px; padding: 1.25rem 1.3rem; transition: border-color .15s, transform .15s; }
.project:hover { border-color: var(--line-strong); }
.project .head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.project h3 { font-size: 1.12rem; margin: 0; line-height: 1.3; }
.project .kind { color: var(--muted); font-size: .9rem; margin: 0; }
.project p { margin: 0; color: var(--ink-2); font-size: .97rem; }
.project .links { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: auto; padding-top: .4rem; }
.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .32rem .75rem; border: 1px solid var(--line-strong); border-radius: 999px; text-decoration: none; color: var(--ink); font-size: .85rem; font-weight: 500; }
.chip:hover { border-color: var(--accent); color: var(--accent-ink); }
.chip .ico { width: .95rem; height: .95rem; }
.chip-live { background: transparent; border-color: var(--accent); color: var(--accent-ink); }
.chip-live:hover { border-color: var(--accent); }
.tag-nolink { color: var(--muted); font-size: .85rem; font-style: italic; }
/* subtle emphasis inside project copy: italic in Latin, semibold in Arabic (Arabic fonts have no true italics) */
.hl { font-style: italic; font-weight: 500; color: var(--ink); }
html[dir="rtl"] .hl { font-style: normal; font-weight: 600; color: var(--ink); }

/* publications */
.papers > li { display: grid; grid-template-columns: 3.4rem minmax(0, 1fr); gap: 1rem; }
.year { color: var(--muted); font-variant-numeric: tabular-nums; }
.paper-title { font-weight: 500; }
.paper-title a { color: inherit; text-decoration-color: var(--line-strong); }
.paper-title a:hover { color: var(--accent-ink); text-decoration-color: var(--accent); }
.paper-title[lang="en"], .papers .meta[lang="en"] { direction: ltr; text-align: start; unicode-bidi: isolate; }
.papers .meta { font-size: .88rem; margin-top: .15rem !important; }

/* education + training */
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem; }
.sub h3 { font-size: 1.05rem; margin: 0 0 .8rem; padding-bottom: .5rem; border-bottom: 1px solid var(--line-strong); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .2rem 1rem; align-items: baseline; padding: .55rem 0; border-top: 1px solid var(--line); font-size: .97rem; }
.list li:first-child { border-top: 0; padding-top: 0; }
.list .who { color: var(--muted); font-size: .88rem; grid-column: 1 / -1; margin-top: -.15rem; }
.list.with-logos li { grid-template-columns: 3rem minmax(0, 1fr) auto; }
.list.with-logos .who { grid-column: 2 / -1; }
.mini { display: block; width: 3rem; height: 1.35rem; object-fit: contain; object-position: left center; align-self: start; margin-top: .3rem; }
html[dir="rtl"] .mini { object-position: right center; }
:root[data-theme="dark"] img.mini { background: #f3f2ee; border-radius: 4px; padding: .1rem .2rem; box-sizing: border-box; }
.list .dates { font-size: .85rem; }
.conferences { margin-top: 2.25rem; }
.edu { list-style: none; margin: 0 0 2rem; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.edu li { border: 1px solid var(--line); border-radius: 14px; padding: 1.1rem 1.25rem; background: var(--paper-2); }
.edu h3 { font-size: 1.08rem; margin: 0 0 .2rem; }
.edu p { margin: 0; color: var(--ink-2); }
.badge { display: inline-block; margin-top: .6rem; padding: .22rem .65rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: .82rem; font-weight: 600; }

/* awards */
.awards li { font-size: 1.02rem; }

/* contact */
.contact { list-style: none; margin: 0; padding: 0; }
.contact a { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.contact li:first-child a { border-top: 0; }
.contact a:hover span:first-child { text-decoration: underline; text-underline-offset: .18em; text-decoration-color: var(--accent); }
.contact .url { color: var(--muted); font-size: .92rem; direction: ltr; unicode-bidi: isolate; text-align: end; }

/* footer */
.foot { max-width: 1120px; margin: 0 auto; padding: 0 1.25rem 3.5rem; color: var(--muted); font-size: .9rem; }
.foot-in { display: flex; flex-wrap: wrap; gap: .5rem 2rem; align-items: center; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.foot p { margin: 0; }
.foot .links { margin-inline-start: auto; display: flex; gap: 1.25rem; }

/* bidi: Latin names inside the Arabic page */
html[dir="rtl"] .list [lang="en"], html[dir="rtl"] .project h3[lang="en"] { direction: ltr; unicode-bidi: isolate; text-align: end; }
html[dir="rtl"] .chip-live .ico { transform: scaleX(-1); }

/* entrance */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.hero-text { animation: rise .55s ease-out both; }
.hero-side { animation: rise .55s ease-out .12s both; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 2.25rem; padding-top: 2.5rem; }
  .section { grid-template-columns: 1fr; gap: 1rem; padding: 2.25rem 0; }
  .section > header { position: static; }
  .projects, .two, .edu { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .top-in { flex-wrap: wrap; gap: .6rem 1.25rem; }
  .nav { order: 3; flex-basis: 100%; flex-wrap: wrap; overflow: visible; margin: 0; padding-top: .1rem; gap: .25rem .9rem; }
  .controls { margin-inline-start: auto; }
}
@media (max-width: 760px) {
  .timeline > li { grid-template-columns: 4.25rem minmax(0, 1fr); gap: .35rem 1rem; }
  .timeline .when { grid-column: 1 / -1; padding-top: 0; }
  .timeline .when b { display: inline; margin-inline-end: .5rem; }
  .logo { margin-top: .15rem; }
  .contact a { flex-direction: column; gap: .15rem; }
  .contact .url { text-align: start; }
  .hero-logo { width: 68px; height: 68px; }
}
a.tag-nolink { text-decoration: none; }
a.tag-nolink:hover { color: var(--accent-ink); text-decoration: underline; }

/* project thumbnails */
.thumb { margin: -.25rem 0 .35rem; aspect-ratio: 16 / 9; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; display: grid; place-items: center; }
.thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
:root[data-theme="dark"] .thumb img { filter: brightness(.9); }
.diagram-wrap { background: var(--paper); }
.diagram { width: 100%; height: 100%; display: block; font-family: inherit; direction: ltr; }
.diagram .bg { fill: var(--paper); }
.diagram .title { fill: var(--ink); font-family: "Newsreader", Georgia, serif; font-size: 30px; font-weight: 500; }
html[dir="rtl"] .diagram .title { font-family: "Noto Naskh Arabic", serif; font-weight: 600; }
.diagram .sub { fill: var(--muted); font-size: 17px; }
.diagram .agent rect { fill: var(--paper-2); stroke: var(--line-strong); stroke-width: 1; }
.diagram .agent.core rect { stroke: var(--accent); stroke-width: 1.5; }
.diagram .num { fill: var(--accent-ink); font-family: "Newsreader", Georgia, serif; font-style: italic; font-size: 16px; }
.diagram .t { fill: var(--ink); font-size: 16px; font-weight: 600; }
.diagram .s { fill: var(--muted); font-size: 13px; }
.diagram .io rect { fill: var(--ink); }
.diagram .io.out rect { fill: var(--accent); }
.diagram .io-t { fill: var(--paper); font-size: 14px; font-weight: 600; letter-spacing: .04em; }
.diagram .arr { fill: none; stroke: var(--line-strong); stroke-width: 1.6; marker-end: none; }
.diagram .band { fill: var(--accent-soft); stroke: var(--line); }
.diagram .band-t { fill: var(--ink); font-size: 16px; font-weight: 500; }
.diagram .foot { fill: var(--muted); font-size: 15px; }
.diagram .wave rect, .diagram .frames rect { fill: var(--accent); opacity: .75; }
.diagram .ar { direction: rtl; unicode-bidi: isolate; }
.diagram .lane { font-size: 13px; font-weight: 700; letter-spacing: .08em; }
.diagram .lane.ok { fill: #2f6b4f; }
.diagram .lane.bad { fill: var(--accent-ink); }
.diagram .io.dark rect { fill: var(--ink-2); }
