/* nimasaeidi.dev
   One typeface (Archivo), two weights (400, 650), three sizes:
     --big   the name
     --text  everything you read (titles are the same size, bold)
     --small dates, captions, navigation
   Colour: ink, a grey for secondary text, hairline rules, and one accent (blue) for the tracked path
   and the current page. The serif (Latin Modern) is used only inside the drawing's caption. */
:root {
  --paper: #f5f4f0; --ink: #161616; --mid: #6c6a64; --soft: #a8a6a0; --rule: #dddbd4; --accent: #2b5ea7;
  --font: Archivo, "Helvetica Neue", Arial, sans-serif;
  --serif: "Latin Modern", "Latin Modern Roman", Georgia, serif;
  --big: clamp(38px, 4.4vw, 56px); --text: 17px; --small: var(--text);   /* one text size: titles are bold, secondary text grey */
  --w: 1280px; --gap: 32px;
  color-scheme: only light;   /* always the light paper look, whatever the device setting (user) */
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 var(--text)/1.6 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, dl, dd, figure { margin: 0; }
h1, h2, h3 { font-weight: 650; }
a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; text-decoration-color: var(--soft); }
a:hover { text-decoration-color: var(--ink); }
::selection { background: var(--accent); color: var(--paper); }

.top, main, .foot { max-width: var(--w); margin: 0 auto; padding-left: var(--gap); padding-right: var(--gap); }

/* header */
.top { display: flex; align-items: baseline; justify-content: space-between; padding-top: 28px; padding-bottom: 28px; }
.top .name { font-weight: 650; text-decoration: none; }
.top nav { display: flex; gap: 28px; font-size: var(--small); }
.top nav a { color: var(--mid); text-decoration: none; padding-bottom: 4px; }
.top nav a:hover { color: var(--ink); }
.top nav a[aria-current] { color: var(--ink); box-shadow: inset 0 -1.5px 0 var(--accent); }

/* hero */
.hero { display: grid; grid-template-columns: 5fr 7fr; gap: 48px; align-items: center; padding: 24px 0 48px; border-top: 1px solid var(--rule); }
.meta { font-size: var(--small); color: var(--mid); margin-bottom: 14px; }
h1 { font-size: var(--big); line-height: 1.04; letter-spacing: -.03em; margin-bottom: 24px; }
.intro p { max-width: 30em; }
.links { display: flex; gap: 24px; margin-top: 28px; }
.stage { position: relative; }
.stage canvas { display: block; width: 100%; height: min(56vh, 480px); cursor: crosshair; }
.stage figcaption { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 22px; margin-top: 8px; font: 14px/1.4 var(--serif); color: var(--mid); }
.stage figcaption span:last-child { flex-basis: 100%; text-align: right; color: var(--soft); }
.stage figcaption i { display: inline-block; width: 22px; height: 0; margin: 0 8px 4px 0; vertical-align: middle; }
.stage figcaption i.ref { border-top: 1px dashed var(--mid); }
.stage figcaption i.act { border-top: 1.5px solid var(--accent); }
.stage.nogl::after { content: "This drawing needs WebGL."; position: absolute; inset: 0; display: grid; place-items: center; color: var(--soft); font-size: var(--small); }

/* sections: name on the left, content on the right */
.block { display: grid; grid-template-columns: 3fr 9fr; gap: 48px; padding: 48px 0 56px; border-top: 1px solid var(--rule); }
.block h2 { font-size: var(--text); }
.topics { display: grid; grid-template-columns: 1fr 1fr; gap: 32px 48px; }
.topics h3 { font-size: var(--text); margin-bottom: 4px; }
.topics p { color: var(--mid); }
.background { display: grid; grid-template-columns: 200px 1fr; gap: 48px; align-items: start; }
.background img { width: 100%; height: auto; display: block; filter: grayscale(1) contrast(1.04); mix-blend-mode: multiply; }   /* the white backdrop takes the paper colour */
.background dl { display: grid; grid-template-columns: 110px 1fr; gap: 20px 24px; }
.background dt { font-size: var(--small); color: var(--mid); padding-top: 3px; font-variant-numeric: tabular-nums; }
.background dd span { display: block; color: var(--mid); }

.foot { display: flex; justify-content: space-between; width: min(100% - 2 * var(--gap), var(--w) - 2 * var(--gap)); padding: 24px 0 32px; border-top: 1px solid var(--rule); font-size: var(--small); color: var(--soft); }

/* the home page fits one screen: header, hero (text + drawing), background strip, footer */
body.onepage { min-height: 100dvh; display: flex; flex-direction: column; }
body.onepage .top { width: 100%; }
body.onepage main.home { flex: 1; min-height: 0; display: flex; flex-direction: column; width: 100%; }
body.onepage .hero { flex: 1; min-height: 0; padding: 4px 0 16px; align-items: stretch; grid-template-columns: 5fr 7fr; gap: 40px; }
body.onepage .intro { align-self: center; }
body.onepage .stage { display: flex; flex-direction: column; justify-content: center; min-height: 0; }
body.onepage .stage canvas { flex: 1 1 auto; min-height: 0; height: auto; max-height: 580px; }
body.onepage .links { flex-wrap: wrap; gap: 10px 22px; }
.homebg { padding: 20px 0 20px; align-items: center; }
.homebg .background { grid-template-columns: 1fr; }
.who { display: flex; align-items: center; gap: 24px; margin-bottom: 24px; }
.who img { width: 108px; height: auto; flex: none; display: block; filter: grayscale(1) contrast(1.04); mix-blend-mode: multiply; }   /* white backdrop takes the paper colour */
.who .meta { max-width: none; margin-bottom: 10px; }
.homebg .background dt { padding-top: 0; }
@media (max-height: 780px) { body.onepage .who { margin-bottom: 16px; } body.onepage .links { margin-top: 18px; } body.onepage .who img { width: 96px; } }
.who h1 { margin-bottom: 0; }
.homebg .background dl { grid-template-columns: 110px 1fr; gap: 8px 24px; }
.homebg .background dd { white-space: nowrap; }
.homebg .background dd span { white-space: normal; }
@media (min-width: 1000px) and (min-height: 700px) { body.onepage { height: 100dvh; overflow: hidden; } }
@media (max-width: 999px) { body.onepage .stage canvas { flex: none; height: 56vw; min-height: 280px; max-height: none; } .homebg .background dd { white-space: normal; } }
@media (max-width: 600px) { .who { gap: 16px; } .who img { width: 84px; } .homebg .background dl { grid-template-columns: 1fr; } .homebg .background dd { margin-bottom: 10px; } }

/* inner pages */
.note { color: var(--mid); margin-top: 6px; }

.pagehead.sub { padding-top: 48px; }
.pagehead.sub h2 { font-size: var(--big); line-height: 1.04; letter-spacing: -.03em; margin: 0; }
.pagehead { padding: 24px 0 48px; border-top: 1px solid var(--rule); display: grid; grid-template-columns: 3fr 9fr; gap: 48px; align-items: baseline; }
.pagehead h1 { margin: 0; }
.pagehead p { max-width: 38em; }
.item p { max-width: 38em; }
.fig { margin-top: 24px; position: relative; }
.fig canvas { display: block; width: 100%; height: 340px; position: relative; }
.fig canvas.gl { position: absolute; left: 0; top: 0; }
.fig figcaption { margin-top: 6px; font: 14px/1.4 var(--serif); color: var(--mid); }

/* publications */
.pubitem h3 { font-size: var(--text); line-height: 1.45; margin-bottom: 6px; max-width: 40em; }
.pubitem .authors, .pubitem .venue { color: var(--mid); }
.pubitem .authors b { color: var(--ink); font-weight: 650; }
.pubitem .plinks { display: flex; gap: 20px; margin-top: 8px; }
.pubitem .item > p + p { margin-top: 10px; }
.fig.pub canvas { height: 240px; }

/* CV */
.cv { display: grid; grid-template-columns: 120px 1fr; gap: 18px 24px; margin: 0; }
.cv dt { font-size: var(--small); color: var(--mid); padding-top: 3px; font-variant-numeric: tabular-nums; }
.cv dd { margin: 0; max-width: 40em; }
.cv dd span { display: block; color: var(--mid); }

/* CV: dated entries on a thin timeline, keyword lists on hairlines */
.cv.timeline { position: relative; }
.cv.timeline dd { position: relative; padding-left: 26px; }
.cv.timeline dd::before { content: ""; position: absolute; left: 0; top: .62em; width: 7px; height: 7px; border-radius: 50%; border: 1.3px solid var(--ink); background: var(--paper); box-sizing: border-box; }
.cv.timeline dd::after { content: ""; position: absolute; left: 3px; top: calc(.62em + 9px); bottom: -16px; width: 1px; background: var(--rule); }
.cv.timeline dd:last-of-type::after { display: none; }
.cv.timeline dd.now::before { background: var(--accent); border-color: var(--accent); }
.cv dd .where { display: block; color: var(--ink); }
.cv.keys { gap: 0 24px; }
.cv.keys dt, .cv.keys dd { padding: 10px 0; border-top: 1px solid var(--rule); }
.cv.keys dt:first-of-type, .cv.keys dd:first-of-type { border-top: 0; padding-top: 0; }

/* tablet and phone */
@media (max-width: 900px) {
  .hero, body.onepage .hero { grid-template-columns: 1fr; gap: 24px; padding-top: 16px; }
  .stage { order: -1; }
  .stage canvas { height: 60vw; min-height: 280px; }
  .block, .pagehead { grid-template-columns: 1fr; gap: 20px; }
  .fig canvas { height: 230px; }
  .fig.pub canvas { height: 220px; }
}
@media (max-width: 600px) {
  :root { --gap: 18px; --text: 16px; }
  .top { flex-direction: column; gap: 10px; padding-top: 20px; padding-bottom: 16px; }
  .top nav { gap: 18px; flex-wrap: wrap; }
  .topics { grid-template-columns: 1fr; gap: 22px; }
  .background { grid-template-columns: 1fr; gap: 24px; }
  .background img { max-width: 180px; }
  .background dl, .cv { grid-template-columns: 1fr; gap: 2px; }
  .cv dd { margin-bottom: 14px; }
  .background dd { margin-bottom: 14px; }
  .stage figcaption span:last-child { text-align: left; }
  .stage figcaption { justify-content: flex-start; }
  .foot { flex-direction: column; gap: 4px; }
}

/* CV, Contact, Research: the page title hangs from the rule above it on two small springs (js/hang.js); the
   title only moves by a transform, the springs are drawn on this canvas */
.pagehead { position: relative; }
.pagehead canvas.hang { position: absolute; top: 0; left: 0; pointer-events: none; }
