/* Stylesheet for nathanieltarshish.com, shared by every page.
   Colors, fonts and widths are set once in :root below. */

:root {
  --paper: #ffffff;
  --ink: #1d1d1f;
  --graphite: #5f6368;   /* dates, captions, menu */
  --ocean: #1d4e89;      /* links, headings, top band */
  --mist: #d5dfeb;       /* timeline line */
  --measure: 740px;      /* widest the text column gets; it shrinks on smaller windows */
  --gutter: 104px;       /* width of the date / year column */
  --line: calc(18px * 1.55);

  /* The three blue lines step by the golden ratio around the menu rule. */
  --phi: 1.618;
  --rule: 2px;                              /* line under the menu */
  --band: calc(var(--rule) * var(--phi) * var(--phi) * var(--phi));   /* top band: three steps thicker */
  --tab: calc(var(--rule) / var(--phi));    /* current-tab underline: one step thinner */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 20px 80px;
  background: var(--paper);
  color: var(--ink);
  border-top: var(--band) solid var(--ocean);
  font-family: "STIX Two Text", "STIX Two", Georgia, serif;
  font-size: 18px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

.page {
  max-width: var(--measure);
  margin: 0 auto;
}

p { margin: 0 0 1em; }
p, li, figcaption { text-wrap: pretty; }
b { font-weight: 600; }
sub { line-height: 0; }
.nowrap { white-space: nowrap; }   /* keeps a short formula on one line */

a {
  color: var(--ocean);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--ocean) 40%, transparent);
}
a:hover { text-decoration-color: currentColor; }
a:focus-visible {
  outline: 2px solid var(--ocean);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- header ---------- */

.site-header {
  padding: 34px 0 16px;
  border-bottom: var(--rule) solid var(--ocean);
  margin-bottom: 44px;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 36px;
  font-size: 20px;
}
nav a {
  color: var(--graphite);
  text-decoration: none;
}
nav a:hover { color: var(--ink); }
nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--ocean);
  text-decoration-thickness: var(--tab);
  text-underline-offset: 7px;
}

/* ---------- headings ---------- */

h2 {
  clear: both;
  margin: 56px 0 18px;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ocean);
  text-wrap: balance;
}
main > h2:first-child,
main > .visually-hidden + h2 { margin-top: 0; }

/* page titles that screen readers announce but are not shown */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- home ---------- */

/* left column: photo, name, contact details; right column: text */
.intro {
  display: grid;
  grid-template-columns: 250px 1fr;
  column-gap: 40px;
  align-items: start;
}

.profile img {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 14px;
}
.profile h1 {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 600;
  line-height: 1.15;
}
.profile address,
.profile p {
  margin: 0 0 10px;
  font-size: 16px;
  font-style: normal;
  line-height: 1.5;
  color: var(--graphite);
}

.bio > :first-child { margin-top: -6px; }   /* line up the first line with the photo */

.lede {                    /* the larger opening line */
  margin-bottom: 18px;
  font-size: 27px;
  font-style: italic;
  line-height: 1.3;
}

/* ---------- dated lists: news and talks ---------- */

ul.dated {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
}
ul.dated li {
  position: relative;
  padding-left: var(--gutter);
  margin-bottom: 14px;
}
ul.dated li::before {          /* a dot on the timeline for each entry */
  content: "";
  position: absolute;
  left: calc(var(--gutter) - 20px);
  top: calc(var(--line) / 2 - 3px);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ocean);
  z-index: 1;
}
ul.dated li::after {           /* timeline segment down to the next dot */
  content: "";
  position: absolute;
  left: calc(var(--gutter) - 17px);
  top: calc(var(--line) / 2);
  bottom: calc(-14px - var(--line) / 2);
  width: 1px;
  background: var(--mist);
}
ul.dated li:last-child::after { display: none; }
ul.dated time {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 15px;
  line-height: var(--line);
  color: var(--graphite);
  font-variant-numeric: tabular-nums;
}

/* ---------- publications ---------- */

section.year {
  position: relative;
  padding-left: var(--gutter);
  margin-bottom: 28px;
}
section.year h3 {
  position: absolute;
  left: 0;
  top: 0;
  margin: 0;
  font-size: 15px;
  font-weight: 400;
  line-height: var(--line);
  color: var(--graphite);
}

ul.pubs {
  list-style: none;
  margin: 0;
  padding: 0;
}
ul.pubs li {                 /* authors and journal: smaller and grey */
  margin-bottom: 18px;
  font-size: 16px;
  color: var(--graphite);
}
ul.pubs b { color: var(--ink); }   /* your name stands out within the author list */

/* links at the end of a news item, talk or paper show as [paper] [video] ...
   The brackets are added here, so the HTML is just <a href="...">video</a>. */
ul.dated a,
ul.pubs a {
  margin-right: 0.3em;
  white-space: nowrap;
  text-decoration: none;
}
ul.dated a:hover,
ul.pubs a:hover { text-decoration: underline; }
ul.dated a::before,
ul.pubs a::before { content: "["; }
ul.dated a::after,
ul.pubs a::after { content: "]"; }
ul.dated a::before,
ul.dated a::after,
ul.pubs a::before,
ul.pubs a::after {
  display: inline-block;   /* keeps the brackets out of the hover underline */
  color: var(--graphite);
}
ul.pubs cite {               /* paper title: full size, bold, black */
  display: block;
  margin-bottom: 2px;
  font-size: 18px;
  font-style: normal;
  font-weight: 600;
  color: var(--ink);
}

/* ---------- research ---------- */

section.topic {
  display: flow-root;   /* contains floated figures */
  margin-bottom: 56px;
}
section.topic h2 { margin-top: 0; }
section.topic > :last-child { margin-bottom: 0; }

figure { margin: 24px 0; }
figure img {
  display: block;
  width: 100%;
  height: auto;
}
figure.right {
  float: right;
  width: 46%;
  margin: 4px 0 14px 28px;
}
figure.video iframe {        /* embedded video at 16:9 */
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
}
ul.dated figure.video { margin: 10px 0 6px; }   /* a video inside a talks-list entry */
figure.right.small { width: 34%; }               /* a smaller inset */
figure.framed img { border: 1px solid var(--ink); }   /* thin black frame */
figcaption {
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--graphite);
}

/* ---------- phones ---------- */

@media (max-width: 600px) {
  body { font-size: 17px; }
  .site-header {
    padding: 24px 0 12px;
    margin-bottom: 28px;
  }
  nav { gap: 4px 18px; font-size: 17px; }
  .lede { font-size: 20px; }
  ul.dated li::before,
  ul.dated li::after { display: none; }
  ul.dated li,
  section.year { padding-left: 0; }
  ul.dated time,
  section.year h3 {
    position: static;
    display: block;
    line-height: 1.4;
  }
  section.year h3 { margin-bottom: 6px; }
  figure.right {
    float: none;
    width: 100%;
    margin: 20px 0;
  }
  figure.right.small { width: 60%; }
}

/* the home-page intro stacks earlier, so the text column never gets too narrow */
@media (max-width: 720px) {
  .intro { grid-template-columns: 1fr; }
  .profile {               /* small photo with name and contact details beside it */
    display: grid;
    grid-template-columns: 120px 1fr;
    column-gap: 16px;
    margin-bottom: 20px;
  }
  .profile img {
    grid-row: span 3;
    margin: 0;
  }
  .profile h1 { font-size: 22px; }
  .bio > :first-child { margin-top: 0; }
}
