/* ayoubnainia.com - document-style page: quiet sidebar, one reading column, typography first. */
:root {
  --bg: #ffffff; --sb: #f7f7f5; --ink: #37352f; --ink-2: #5f5e5a; --muted: #91918e; --line: rgba(55, 53, 47, .09); --line-2: rgba(55, 53, 47, .16);
  --hover: rgba(55, 53, 47, .06); --chip: rgba(55, 53, 47, .07); --link: #37352f; --ul: rgba(55, 53, 47, .35);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #191919; --sb: #202020; --ink: #d4d4d4; --ink-2: #b4b4b4; --muted: #8f8f8f; --line: rgba(255,255,255,.08); --line-2: rgba(255,255,255,.14);
  --hover: rgba(255,255,255,.06); --chip: rgba(255,255,255,.08); --link: #d4d4d4; --ul: rgba(255,255,255,.35); } }
:root[data-theme="dark"] {
  --bg: #191919; --sb: #202020; --ink: #d4d4d4; --ink-2: #b4b4b4; --muted: #8f8f8f; --line: rgba(255,255,255,.08); --line-2: rgba(255,255,255,.14);
  --hover: rgba(255,255,255,.06); --chip: rgba(255,255,255,.08); --link: #d4d4d4; --ul: rgba(255,255,255,.35); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
img { display: block; max-width: 100%; }
h1, h2 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
.mono { font-family: var(--mono); font-size: .88em; }
.muted { color: var(--muted); }
.sep { color: var(--muted); margin: 0 6px; }
svg { width: 1em; height: 1em; fill: currentColor; flex: 0 0 auto; }
.ic { display: none; }

/* shell */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }

/* sidebar */
.sb { background: var(--sb); border-right: 1px solid var(--line); padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow: auto; display: flex; flex-direction: column; font-size: 14px; }
.sb-me { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; font-weight: 600; color: var(--ink); }
.sb-me img { width: 22px; height: 22px; border-radius: 4px; object-fit: cover; }
.sb-me:hover { background: var(--hover); }
.sb-nav { display: flex; flex-direction: column; margin-top: 14px; }
.sb-nav a, .sb-links a { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; color: var(--ink-2); }
.sb-nav a:hover, .sb-links a:hover { background: var(--hover); color: var(--ink); }
.sb-row { display: flex; align-items: center; }
.sb-row > a { flex: 1 1 auto; }
.tw { flex: none; width: 22px; height: 22px; margin-left: 2px; border: 0; background: none; color: var(--muted); border-radius: 4px; cursor: pointer; display: grid; place-items: center; padding: 0; }
.tw svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.tw:hover { background: var(--hover); color: var(--ink); }
.sb-grp.open .tw svg { transform: rotate(90deg); }
.sb-sub { display: none; margin: 1px 0 2px; }
.sb-grp.open .sb-sub { display: block; }
.sb-nav a.sub { padding: 2px 8px 2px 24px; font-size: 13px; color: var(--muted); position: relative; gap: 7px; }
.sb-nav a.sub svg.ic { display: block; width: 13px; height: 13px; opacity: .8; }
.sb-nav a.sub::before { content: ""; position: absolute; left: 13px; top: 0; bottom: 0; width: 1px; background: var(--line-2); }
.sb-nav a.sub:hover, .sb-nav a.sub.active { color: var(--ink); }
.sb-nav a.active { background: var(--hover); color: var(--ink); font-weight: 600; }
.sb-h { margin: 22px 8px 4px; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; color: var(--muted); }
.sb-links a svg { width: 14px; height: 14px; color: var(--muted); transition: color .15s; }
.sb-links .hf-mark { width: 15px; height: 15px; filter: grayscale(1) opacity(.6); transition: filter .15s; }
.sb-links a:hover .hf-mark { filter: none; }
.sb-links a[data-k="linkedin"]:hover svg { color: #0a66c2; }
.sb-links a[data-k="orcid"]:hover svg { color: #a6ce39; }
.sb-links a[data-k="scholar"]:hover svg { color: #4285f4; }
.sb-links a[data-k="x"]:hover svg, .sb-links a[data-k="github"]:hover svg, .sb-links a[data-k="medium"]:hover svg, .sb-links a[data-k="mail"]:hover svg { color: var(--ink); }
.sb-foot { margin-top: auto; padding: 8px; }
.theme-btn { border: 0; background: none; color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; padding: 4px 0; }
.theme-btn:hover { color: var(--ink); }
.menu-btn { display: none; }

/* document */
.col { min-width: 0; }
.cover { height: 220px; overflow: hidden; background: #0b1a33; }
.cover img { width: 100%; height: 100%; object-fit: cover; object-position: 70% 50%; }
.doc { max-width: 708px; width: 100%; margin: 0 auto; padding: 0 32px 96px; }
.doc-head { margin-bottom: 56px; }
.doc-photo { width: 104px; height: 104px; border-radius: 50%; object-fit: cover; margin: -52px 0 18px; border: 4px solid var(--bg); background: var(--bg); position: relative; }
.doc h1 { font-size: 2.4rem; font-weight: 700; letter-spacing: -.02em; }
.sub { margin: 8px 0 0; color: var(--muted); font-size: 1rem; }
.lead + .lead { margin-top: 10px; }
.lead { margin: 20px 0 0; color: var(--ink); font-size: 1.02rem; line-height: 1.65; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.tags span { font-size: 12.5px; padding: 2px 8px; border-radius: 4px; background: var(--chip); color: var(--ink-2); }
.orgs { margin: 26px 0 0; padding-top: 18px; border-top: 1px solid var(--line); overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.orgs-track { display: flex; align-items: center; gap: 44px; width: max-content; animation: glide 40s linear infinite; }
.orgs:hover .orgs-track { animation-play-state: paused; }
.orgs a { display: inline-flex; align-items: center; justify-content: center; padding: 6px 4px; border-radius: 6px; flex: 0 0 auto; }
.orgs img { height: 30px; width: auto; object-fit: contain; }
.orgs a.tall img { height: 44px; }
@keyframes glide { from { transform: translateX(-50%); } to { transform: translateX(0); } }
.orgs a:hover { background: var(--hover); }
:root[data-theme="dark"] .orgs a { background: #f3f3f1; }
:root[data-theme="dark"] .orgs a:hover { background: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .orgs a { background: #f3f3f1; } }

section { margin-top: 48px; }
h2 { font-size: 1.35rem; font-weight: 600; padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.note { margin: 0 0 16px; color: var(--muted); font-size: .95rem; }
.note a, .plain a, .pub-t a, .list a, .posts a { border-bottom: 1px solid var(--ul); }
.note a:hover, .plain a:hover, .pub-t a:hover, .list a:hover, .posts a:hover { background: var(--hover); }

/* research items: numbered rail */
.items { display: flex; flex-direction: column; position: relative; padding-left: 44px; }
.items::before { content: ""; position: absolute; left: 11px; top: 30px; bottom: 30px; width: 1px; background: var(--line-2); transform: scaleY(0); transform-origin: top; transition: transform 1.1s cubic-bezier(.2,.7,.2,1); }
#work.on .items::before { transform: scaleY(1); }
.item::before { opacity: 0; transform: scale(.6); transition: opacity .4s ease, transform .4s ease, border-color .15s, color .15s; }
#work.on .item:nth-child(1)::before { opacity: 1; transform: none; transition-delay: .15s; }
#work.on .item:nth-child(2)::before { opacity: 1; transform: none; transition-delay: .55s; }
#work.on .item:nth-child(3)::before { opacity: 1; transform: none; transition-delay: .95s; }
.item { position: relative; }
.item::before { content: attr(data-step); position: absolute; left: -36.5px; top: 15px; width: 24px; height: 24px; border-radius: 50%; background: var(--bg); border: 1px solid var(--line-2); color: var(--muted); font-family: var(--mono); font-size: 10.5px; line-height: 1; letter-spacing: .02em; display: flex; align-items: center; justify-content: center; box-sizing: border-box; }
.item:hover::before { border-color: var(--ink-2); color: var(--ink); }
.thumb { transition: transform .2s ease, box-shadow .2s ease; }
.item:hover .thumb { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.item { display: grid; grid-template-columns: 236px 1fr; gap: 20px; padding: 14px 8px; margin: 0 -8px; border-radius: 6px; align-items: start; }
.item:hover { background: var(--hover); }
.thumb { display: block; width: 100%; aspect-ratio: 960 / 560; object-fit: cover; object-position: top; border-radius: 6px; border: 1px solid var(--line); background: var(--sb); }
.item-t { font-weight: 600; font-size: 1rem; }
.item-d { color: var(--ink-2); font-size: .93rem; margin-top: 2px; }
.item-m { color: var(--muted); font-size: .85rem; margin-top: 6px; }
.item-m .u { color: var(--ink-2); border-bottom: 1px solid var(--ul); }
.item-m .u:hover { color: var(--ink); }

/* plain blocks */
.plain { padding: 10px 0 14px; }
.plain + .plain { border-top: 1px solid var(--line); }
.plain-t { font-weight: 600; font-size: 1rem; }
.plain-t .muted { font-weight: 400; }
.plain p { margin: 6px 0 0; color: var(--ink-2); font-size: .93rem; }
.posts { list-style: none; margin: 6px 0 0; padding: 0; }
.posts li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: .93rem; }
.posts li .muted { font-size: .8rem; white-space: nowrap; padding-top: 3px; }

/* publications */
.year { display: grid; grid-template-columns: 56px 1fr; gap: 12px; padding: 6px 0; }
.year .y { color: var(--muted); font-size: .85rem; padding-top: 9px; font-family: var(--mono); }
.pub { padding: 8px 0 12px; }
.pub + .pub { border-top: 1px solid var(--line); }
.pub-t { font-weight: 500; font-size: .98rem; line-height: 1.4; }
.pub-m { color: var(--muted); font-size: .85rem; margin-top: 3px; }
.pub-l { margin-top: 4px; font-size: .82rem; display: flex; flex-wrap: wrap; gap: 0 14px; }
.pub-l a { color: var(--ink-2); border-bottom: 1px solid var(--ul); }
.pub-l a:hover { color: var(--ink); }
.bib { font: inherit; font-size: inherit; background: none; border: 0; padding: 0; color: var(--ink-2); border-bottom: 1px solid var(--ul); cursor: pointer; line-height: inherit; }
.bib:hover { color: var(--ink); }
.bib.ok { color: var(--ink); border-bottom-color: transparent; }

/* resources */
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }
/* open resources */
.res-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 4px 0 18px; }
.res-sum-i { display: flex; flex-direction: column; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--sb); color: var(--ink); transition: border-color .15s, transform .15s; }
.res-sum-i:hover { border-color: var(--line-2); transform: translateY(-1px); }
.res-sum-i b { font-size: 1.45rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; font-family: var(--mono); }
.res-sum-i span { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.res { margin-top: 22px; scroll-margin-top: 24px; }
.res-h { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.res-ic { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: var(--chip); color: var(--ink-2); }
.res-ic svg.ic { display: block; width: 14px; height: 14px; }
.res-t { font-weight: 600; font-size: .95rem; }
.res-n { font-family: var(--mono); font-size: .75rem; color: var(--muted); padding: 1px 7px; border-radius: 999px; background: var(--chip); }
.res-all { margin-left: auto; font-size: .8rem; color: var(--muted); border-bottom: 1px solid transparent; }
.res-all:hover { color: var(--ink); border-bottom-color: var(--ul); }
.res-list { list-style: none; margin: 0; padding: 0; }
.res-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 8px; margin: 0 -8px; border-radius: 6px; border-top: 1px solid var(--line); font-size: .92rem; }
.res-list li:first-child { border-top: 0; }
.res-list li:hover { background: var(--hover); }
.res-list li > a { display: flex; flex-direction: column; min-width: 0; border-bottom: 0; }
.res-list li > a:hover { background: none; }
.res-list li > a > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-sub { font-size: .8rem; color: var(--muted); }
.res-meta { display: flex; align-items: center; gap: 10px; font-size: .78rem; white-space: nowrap; }
.res-alt { color: var(--ink-2); border-bottom: 1px solid var(--ul); }
.res-alt:hover { color: var(--ink); }
.res-chip { padding: 2px 8px; border-radius: 4px; background: var(--chip); color: var(--ink-2); font-size: .74rem; }
.h3 { font-size: .8rem; font-weight: 600; color: var(--muted); letter-spacing: .02em; text-transform: uppercase; margin: 6px 0 4px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; flex-direction: column; padding: 6px 0; border-top: 1px solid var(--line); font-size: .92rem; }
.list li:first-child { border-top: 0; }
.list li .muted { font-size: .8rem; }

.doc-foot { margin-top: 72px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
.doc-foot a { color: var(--ink-2); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sb { position: fixed; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform .2s ease; z-index: 20; box-shadow: none; }
  body.nav-open .sb { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.25); }
  .menu-btn { display: flex; flex-direction: column; justify-content: center; gap: 4px; position: fixed; top: 12px; left: 12px; width: 36px; height: 36px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); z-index: 30; cursor: pointer; padding: 0 9px; }
  .menu-btn span { height: 1.5px; background: var(--ink-2); display: block; }
  .cover { height: 140px; }
  .doc { padding: 0 20px 64px; }
  .doc-photo { width: 84px; height: 84px; margin-top: -42px; }
  .doc h1 { font-size: 1.9rem; }
  .item { grid-template-columns: 1fr; gap: 10px; }
  .year { grid-template-columns: 1fr; gap: 0; }
  .year .y { padding-top: 10px; }
  .cols { grid-template-columns: 1fr; }
  .res-sum { gap: 8px; }
  .res-sum-i { padding: 10px 12px; }
  .res-list li { grid-template-columns: 1fr; gap: 4px; }
  .res-meta { white-space: normal; }
  .orgs-track { gap: 28px; }
  .orgs img { height: 24px; }
  .orgs a.tall img { height: 36px; }
  .items { padding-left: 0; }
  .items::before, .item::before { display: none; }
  .orgs a { flex: 0 0 auto; }
}


/* get in touch */
.lead-sm { margin: 0 0 16px; color: var(--ink-2); font-size: .98rem; }
.contact { display: flex; flex-wrap: wrap; gap: 8px; }
.cta span { overflow-wrap: anywhere; }
.cta.icon-only { padding: 8px 10px; }
.cta { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 8px; background: var(--ink); color: var(--bg); font-weight: 500; font-size: .92rem; }
.cta:hover { opacity: .88; }
.cta.ghost { background: none; color: var(--ink-2); border: 1px solid var(--line-2); }
.cta.ghost:hover { background: var(--hover); color: var(--ink); opacity: 1; }
.cta svg { width: 15px; height: 15px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--ink-2); outline-offset: 2px; border-radius: 4px; }

/* entrance */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.reveal { animation: rise .5s ease both; }
.reveal:nth-child(2) { animation-delay: .08s; } .reveal:nth-child(3) { animation-delay: .16s; } .reveal:nth-child(4) { animation-delay: .24s; } .reveal:nth-child(5) { animation-delay: .32s; }
@media (prefers-reduced-motion: reduce) { .reveal { animation: none; } .items::before, .item::before { transition: none !important; transform: none !important; opacity: 1 !important; } .orgs-track { animation: none; flex-wrap: wrap; width: auto; } .orgs-track a:nth-child(n+11) { display: none; } .orgs { mask-image: none; -webkit-mask-image: none; } .thumb, .item::before { transition: none; } }
