/* modar.me */
:root {
  --paper: #f6f6f2;
  --ink: #182430;
  --muted: #5b6874;
  --line: rgba(24, 36, 48, .16);
  --accent: #1f3fbf;
  --accent-ink: #1a34a0;
  --code: #e9ece5;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #0e1418;
  --ink: #e6ebef;
  --muted: #9aa7b2;
  --line: rgba(230, 235, 239, .16);
  --accent: #8ea4ff;
  --accent-ink: #a9b8ff;
  --code: #182027;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { font-size: 17px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html[dir="rtl"] { font-size: 18px; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: "IBM Plex Sans", "IBM Plex Sans Arabic", system-ui, sans-serif;
  line-height: 1.6;
}
html[dir="rtl"] body { font-family: "IBM Plex Sans Arabic", "IBM Plex Sans", system-ui, sans-serif; line-height: 1.85; }
[lang="en"] { font-family: "IBM Plex Sans", system-ui, sans-serif; }
[lang="ar"] { font-family: "IBM Plex Sans Arabic", system-ui, sans-serif; }
code { font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .95em; background: var(--code); padding: .08em .38em; border-radius: 4px; }
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; }
h1, h2, h3, p, dl, dd { margin-top: 0; }
img { max-width: 100%; }

/* 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 { display: flex; align-items: center; gap: 1.5rem; max-width: 1080px; margin: 0 auto; padding: 1.1rem 1.25rem; }
.mark { display: inline-flex; align-items: baseline; gap: .4rem; font-weight: 600; text-decoration: none; color: var(--ink); }
.mark .slash { color: var(--accent); font-weight: 400; }
.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; }
.nav a:hover { color: var(--ink); }
.controls { display: flex; align-items: center; gap: .5rem; }
.lang, .theme { display: inline-flex; align-items: center; justify-content: center; height: 2.1rem; padding: 0 .75rem; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--ink); text-decoration: none; cursor: pointer; font: inherit; font-size: .92rem; }
.lang:hover, .theme:hover { border-color: var(--ink); }
.theme { width: 2.1rem; padding: 0; }
.theme .sun { display: none; }
:root[data-theme="dark"] .theme .sun { display: inline; }
:root[data-theme="dark"] .theme .moon { display: none; }

/* layout */
main { max-width: 1080px; margin: 0 auto; padding: 0 1.25rem 3rem; }
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); gap: 3rem; align-items: center; padding: 3.25rem 0 3rem; }
.portrait { display: block; width: 88px; height: 110px; object-fit: cover; object-position: 50% 12%; border-radius: 10px; margin-bottom: 1.25rem; }
h1 { font-size: clamp(2.1rem, 4.5vw, 3.4rem); line-height: 1.05; letter-spacing: -.02em; font-weight: 600; margin-bottom: .5rem; }
html[dir="rtl"] h1 { letter-spacing: 0; line-height: 1.35; }
.lede { font-size: clamp(1.15rem, 2vw, 1.4rem); color: var(--muted); margin-bottom: 1.25rem; }
.statement { font-size: 1.06rem; max-width: 58ch; margin-bottom: 1.5rem; }
.facts { display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; margin: 0 0 1.5rem; }
.facts div { display: grid; gap: .1rem; }
.facts dt { color: var(--muted); font-size: .85rem; }
.facts dd { margin: 0; font-weight: 500; }
.ctas { display: flex; flex-wrap: wrap; gap: .6rem; margin: 0; }
.btn { display: inline-flex; align-items: center; padding: .55rem 1rem; border: 1px solid var(--line); border-radius: 8px; font-weight: 500; color: var(--ink); text-decoration: none; }
.btn:hover { border-color: var(--ink); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* the one illustration: the CVPR 2018 pull figure */
.pullfig { margin: 0; }
.pullfig img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.pullfig figcaption { color: var(--muted); font-size: .85rem; line-height: 1.5; max-width: 48ch; margin-top: .6rem; }

/* sections */
.section { display: grid; grid-template-columns: 10rem minmax(0, 1fr); gap: 2rem; padding: 2.75rem 0; border-top: 1px solid var(--line); }
.section h2 { font-size: 1.05rem; font-weight: 600; margin: 0; position: sticky; top: 1.5rem; align-self: start; }
.body { max-width: 68ch; }
.org { font-weight: 500; margin-bottom: .35rem; }
.intro { color: var(--muted); margin-bottom: 1.5rem; }
.items { list-style: none; margin: 0; padding: 0; }
.items > li { padding: 1.1rem 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: .3rem .9rem; font-size: 1rem; font-weight: 600; margin-bottom: .35rem; }
.items h3 a { color: inherit; }
.items p { margin: 0; }
.items p + p { margin-top: .4rem; }
.dates { color: var(--muted); font-weight: 400; font-size: .9rem; }
.meta { color: var(--muted); font-size: .92rem; }
.meta .dates { margin-inline-start: .75rem; }
.items.work > li { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr); gap: 1.25rem; }
.logo { display: block; width: 3.5rem; height: 2rem; object-fit: contain; object-position: left center; margin-top: .25rem; }
html[dir="rtl"] .logo { object-position: right center; }
:root[data-theme="dark"] .logo { filter: brightness(0) invert(1) opacity(.85); }
.papers > li { display: grid; grid-template-columns: 3.2rem minmax(0, 1fr); gap: 1rem; }
.year { color: var(--muted); font-variant-numeric: tabular-nums; }
.paper-title { font-weight: 500; }
.note { color: var(--muted); }
.links a { margin-inline-end: 1rem; }
.contact { list-style: none; margin: 0; padding: 0; }
.contact a { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem 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; }
.contact .url { color: var(--muted); font-size: .92rem; direction: ltr; unicode-bidi: isolate; text-align: end; }

/* footer */
.foot { max-width: 1080px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; display: flex; flex-wrap: wrap; gap: .5rem 2rem; }
.foot p { margin: 0; }
.foot a { margin-inline-end: 1rem; }
.foot .agents { flex-basis: 100%; }

/* 404 */
.notfound { padding-top: 4rem; }

/* one entrance, on the hero only */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.hero-text, .pullfig { animation: rise .5s ease-out both; }
.pullfig { animation-delay: .1s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

@media (max-width: 760px) {
  .top { flex-wrap: wrap; gap: .75rem 1.5rem; }
  .nav { order: 3; flex-basis: 100%; flex-wrap: wrap; overflow: visible; margin: 0; padding-top: .25rem; }
  .hero { grid-template-columns: 1fr; gap: 2.25rem; padding-top: 2rem; }
  .section { grid-template-columns: 1fr; gap: .75rem; padding: 2rem 0; }
  .section h2 { position: static; }
  .items.work > li { grid-template-columns: 1fr; gap: .5rem; }
  .logo { height: 1.7rem; }
  .contact a { flex-direction: column; gap: .15rem; }
  .contact .url { text-align: start; }
}
