/*
  Faheem H. Gilani — academic website
  Typeface: Pagella (TeX Gyre Pagella, a Palatino design), the same face the
  papers and research statement are set in. Subset web files in assets/fonts.
*/

@font-face {
  font-family: "Pagella";
  src: url("assets/fonts/pagella-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  ascent-override: 72.6%;
  descent-override: 28.1%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Pagella";
  src: url("assets/fonts/pagella-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  ascent-override: 72.6%;
  descent-override: 28.1%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Pagella";
  src: url("assets/fonts/pagella-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  ascent-override: 72.6%;
  descent-override: 28.1%;
  line-gap-override: 0%;
}

:root {
  --paper: #fcfbfd;
  --mist: #f3f0f7;
  --ink: #1f1c2c;
  --muted: #625d73;
  --plum: #624477;
  --plum-deep: #4c3360;
  --periwinkle: #4d5e9b;
  --rule: #e6e2eb;
  --rule-strong: #d4cedc;
  --serif: "Pagella", "Palatino", "Palatino Linotype", "Book Antiqua", "URW Palladio L", P052, Georgia, serif;

  --wrap: 70rem;
  --pad: 3rem;
  --margin: 16.5rem;
  --gutter: 4rem;
  --header-h: 4.25rem;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1.25rem);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.6;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, p, figure, ul { margin: 0; }
ul { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }

a {
  color: var(--periwinkle);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
  text-decoration-color: color-mix(in srgb, currentColor 38%, transparent);
  transition: color .15s ease, text-decoration-color .15s ease, background-color .15s ease, border-color .15s ease;
}
a:hover { color: var(--plum); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--plum); outline-offset: 3px; border-radius: 2px; }
::selection { background: #e7dff0; color: var(--ink); }

.wrap { width: min(var(--wrap), 100% - 2 * var(--pad)); margin-inline: auto; }

.grid {
  display: grid;
  grid-template-columns: var(--margin) minmax(0, 1fr);
  column-gap: var(--gutter);
}

.skip-link {
  position: fixed;
  z-index: 30;
  top: .75rem;
  left: .75rem;
  padding: .6rem 1.1rem;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* Hanging labels: section headings sit in the left margin column. */
.margin-label {
  color: var(--plum);
  font-size: 1.375rem;
  font-style: italic;
  font-weight: 400;
  line-height: 1.3;
}

.arrow {
  display: inline-block;
  position: relative;
  top: -.06em;
  margin-left: .25em;
  font-size: .8em;
  font-style: normal;
  line-height: 1;
  color: var(--periwinkle);
  transition: transform .15s ease;
}

/* Header */
.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.js .site-header { border-bottom-color: transparent; transition: border-color .2s ease; }
.js .site-header.is-stuck { border-bottom-color: var(--rule); }
.header-inner {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}
.wordmark {
  color: var(--plum);
  font-size: 1.3rem;
  letter-spacing: -.005em;
  text-decoration: none;
  white-space: nowrap;
}
.wordmark:hover { color: var(--plum-deep); }
.js .wordmark { transition: opacity .25s ease, visibility .25s ease; }
.js .site-header:not(.is-stuck) .wordmark { opacity: 0; visibility: hidden; }
.site-nav { display: flex; align-items: center; gap: 2.25rem; margin-left: auto; }
.site-nav a {
  color: var(--ink);
  font-size: 1.0625rem;
  text-decoration-color: transparent;
  white-space: nowrap;
  padding-block: .5rem;
}
.site-nav a:hover { color: var(--plum); text-decoration-color: currentColor; }

/* Profile */
.profile { padding-top: 4.25rem; padding-bottom: 3.25rem; align-items: start; }
.portrait img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 2px;
  background: var(--mist);
}
.name {
  margin-top: -.08em;
  color: var(--plum);
  font-size: clamp(2.75rem, 1.4rem + 3.5vw, 4.25rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -.018em;
}
.profile-intro {
  max-width: 29em;
  margin-top: 1.5rem;
  font-size: 1.625rem;
  line-height: 1.42;
  text-wrap: pretty;
}
.profile-intro strong, .market-note strong { font-weight: 700; }
.market-note { margin-top: 1rem; font-size: 1.125rem; font-variant-numeric: oldstyle-nums; }
.profile-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 1.75rem;
  margin-top: 1.75rem;
}
.profile-links li:nth-child(2) { margin-right: .5rem; }

.button {
  display: inline-flex;
  align-items: baseline;
  padding: .5em 1.05em .55em;
  border: 1px solid color-mix(in srgb, var(--plum) 50%, transparent);
  border-radius: 3px;
  color: var(--plum);
  font-size: 1.0625rem;
  line-height: 1.25;
  text-decoration: none;
  white-space: nowrap;
}
.button .arrow { color: inherit; }
.button:hover { background: var(--plum); border-color: var(--plum); color: #fff; }
.button-primary { background: var(--plum); border-color: var(--plum); color: #fff; }
.button-primary:hover { background: var(--plum-deep); border-color: var(--plum-deep); }

.icon-link {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  font-size: 1.0625rem;
}
.icon-link svg { flex: none; color: var(--plum); }

/* Committee */
.committee { align-items: baseline; padding-bottom: 4rem; }
.committee-list { display: flex; flex-wrap: wrap; gap: .35rem 1.6rem; }
.committee-list a { color: var(--ink); text-decoration-color: var(--rule-strong); }
.committee-list a:hover { color: var(--plum); text-decoration-color: currentColor; }

/* Job market paper */
.jmp {
  padding-block: 4.25rem 4.5rem;
  background: var(--mist);
  border-block: 1px solid color-mix(in srgb, var(--plum) 12%, transparent);
}
.jmp .margin-label { padding-top: .45rem; }
.jmp-heading {
  font-size: 2.125rem;
  font-weight: 400;
  line-height: 1.18;
  letter-spacing: -.01em;
  text-wrap: balance;
}
.jmp-heading a { color: var(--ink); text-decoration-color: transparent; }
.jmp-heading a:hover { color: var(--plum); text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
.jmp-abstract {
  max-width: 39em;
  margin-top: 1.75rem;
  line-height: 1.7;
  text-wrap: pretty;
}
.jmp-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.4rem; }

/* Working papers */
.papers { padding-block: 4.5rem 4rem; }
.paper + .paper { margin-top: 2.25rem; }
.paper-title {
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1.28;
  letter-spacing: -.005em;
  text-wrap: balance;
}
.paper-title a { color: var(--ink); text-decoration-color: transparent; }
.paper-title a:hover { color: var(--plum); text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
.paper-title a:hover .arrow, .button:hover .arrow, .site-nav a:hover .arrow { transform: translate(.08em, -.08em); }
.coauthors { margin-top: .2rem; color: var(--muted); font-style: italic; }

.abstract { margin-top: .4rem; }
.abstract summary {
  display: inline-flex;
  align-items: center;
  gap: .3em;
  padding-block: .2rem;
  color: var(--periwinkle);
  font-size: 1.0625rem;
  font-style: italic;
  cursor: pointer;
  list-style: none;
}
.abstract summary::-webkit-details-marker { display: none; }
.abstract summary > span {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
  text-decoration-color: color-mix(in srgb, currentColor 38%, transparent);
}
.abstract summary:hover { color: var(--plum); }
.abstract summary:hover > span { text-decoration-color: currentColor; }
.chevron {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  transform: rotate(-90deg);
  transition: transform .2s ease;
}
.abstract[open] .chevron { transform: none; }
.abstract-text {
  max-width: 39em;
  margin-top: .6rem;
  margin-bottom: .4rem;
  padding-left: 1.25rem;
  border-left: 2px solid var(--rule-strong);
  line-height: 1.7;
  text-wrap: pretty;
}
.abstract[open] .abstract-text { animation: reveal .3s ease-out; }
@keyframes reveal {
  from { opacity: 0; transform: translateY(-.35rem); }
  to { opacity: 1; transform: none; }
}

/* Teaching */
.teaching { padding-top: 4rem; padding-bottom: 5rem; border-top: 1px solid var(--rule); }
.course-group + .course-group { margin-top: 2.75rem; }
.course-group-title {
  padding-bottom: .55rem;
  border-bottom: 1px solid var(--rule-strong);
  color: var(--muted);
  font-size: 1.0625rem;
  font-style: italic;
  font-weight: 400;
}
.course {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 2.5rem;
  padding-block: .95rem 1rem;
  border-bottom: 1px solid var(--rule);
}
.course-title { font-size: 1.125rem; font-weight: 400; line-height: 1.45; text-wrap: balance; }
.course-meta { grid-column: 1; margin-top: .1rem; color: var(--muted); font-size: 1rem; }
.course-term {
  grid-column: 2;
  grid-row: 1;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
  padding-top: .1em;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: oldstyle-nums;
}
.role { color: var(--plum); }
.notes { font-size: .9375rem; font-style: italic; white-space: nowrap; }

/* Footer */
.site-footer { padding-block: 2rem 3rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: 1rem; }
.footer-name { font-style: italic; }

/* Medium screens */
@media (max-width: 1080px) {
  :root { --pad: 2.5rem; --margin: 12rem; --gutter: 3rem; }
  .profile-intro { font-size: 1.5rem; }
  .jmp-heading { font-size: 1.95rem; }
}

/* Small screens: one column, labels above their content */
@media (max-width: 820px) {
  :root { --pad: 1.5rem; --header-h: 3.5rem; }
  body { font-size: 1.0625rem; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .margin-label { margin-bottom: 1.1rem; font-size: 1.5rem; }

  .site-nav { gap: 1.6rem; }
  .site-nav a { font-size: 1rem; }
  .wordmark { font-size: 1.15rem; }

  .profile {
    grid-template-columns: clamp(6.75rem, 19vw, 10rem) minmax(0, 1fr);
    column-gap: 1.25rem;
    align-items: end;
    padding-top: 1.75rem;
    padding-bottom: 2.5rem;
  }
  .profile-copy { display: contents; }
  .portrait { grid-column: 1; grid-row: 1; }
  .name { grid-column: 2; grid-row: 1; align-self: end; margin: 0 0 -.12em; font-size: clamp(2.1rem, 1.2rem + 3.6vw, 2.75rem); line-height: 1.02; }
  .profile-intro, .market-note, .profile-links { grid-column: 1 / -1; }
  .profile-intro { margin-top: 1.5rem; font-size: 1.3rem; line-height: 1.45; }
  .profile-links { gap: .65rem 1.25rem; margin-top: 1.4rem; }
  .profile-links li:nth-child(2) { margin-right: 0; }

  .committee { padding-bottom: 3rem; }
  .committee .margin-label { margin-bottom: .6rem; font-size: 1.25rem; }
  .committee-list { column-gap: 1.25rem; }

  .jmp { padding-block: 2.75rem 3rem; }
  .jmp .margin-label { padding-top: 0; margin-bottom: .75rem; font-size: 1.25rem; }
  .jmp-heading { font-size: 1.65rem; line-height: 1.22; }
  .jmp-abstract { margin-top: 1.4rem; line-height: 1.65; }
  .jmp-actions { margin-top: 1.1rem; }

  .papers { padding-block: 3rem 2.75rem; }
  .paper + .paper { margin-top: 1.9rem; }
  .paper-title { font-size: 1.3rem; }
  .abstract-text { padding-left: 1rem; line-height: 1.65; }

  .teaching { padding-top: 3rem; padding-bottom: 3.5rem; }
  .course { grid-template-columns: minmax(0, 1fr); }
  .course-term { grid-column: 1; grid-row: auto; text-align: left; padding-top: 0; white-space: normal; }

  .site-footer .grid { row-gap: .25rem; }
}

@media (max-width: 560px) {
  .wordmark { display: none; }
  .site-nav { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  html { font-size: 11.5px; }
  .site-header, .skip-link, .site-footer, .jmp-actions { display: none; }
  body { background: #fff; color: #000; }
  .wrap { width: 100%; }
  .margin-label { break-after: avoid; }
  .profile { padding-top: 0; }
  .jmp { background: none; border: 0; padding-block: 1.5rem; }
  .papers, .teaching { padding-block: 1.5rem; }
  a { color: inherit; text-decoration: none; }
  .paper, .course { break-inside: avoid; }
}
