@page {
  size: letter portrait;
  margin: 0;
}

* {
  box-sizing: border-box;
}

:root {
  --decorator-horizontal-margin: 0.18in;

  --sidebar-color: #f4f4f5;
  --sidebar-horizontal-padding: 0.2in;

  /* XXX: using px for very good precision control */
  --decorator-outer-offset-top: 10px;
  --decorator-outer-offset-left: -5.1px;
  --decorator-border-width: 1px;
  --decorator-outer-dim: 9px;
  --decorator-border: 1px solid #ccc;

  --row-blocks-padding-top: 5pt;
  --date-block-width: 0.6in;

  --main-blocks-title-icon-offset-left: -19pt;
}

/* small device mode */
@media not print {
  @media (max-width: 700px) {
    :root {
      --page-width: 100%;
      --page-height: 100%;
      --main-width: 100%;
      --sidebar-width: 0%;
      --date-block-width: 0in;
    }
    #sidebar {
      display: none;
    }
    #wrapper {
      padding-bottom: 2em;
      min-width: 500px;
    }
    #main {
      width: 100% !important;
    }
    .details {
      padding-left: 0.7em !important;
    }
    .details .location,
    .details .place {
      font-size: 12pt !important;
    }
    .date {
      display: none;
    }
    .date-sm {
      padding-right: 1em;
    }
    #title {
      position: inherit !important;
    }
    .details .title {
      display: block;
    }
    .details .place {
      float: left !important;
    }
    .details .location {
      float: none !important;
    }
    #contact-alt li::before {
      content: none !important;
    }
    #contact-alt {
      padding-left: 0 !important;
      line-height: -1em;
    }
    * {
      font-family: 'Roboto', 'Helvetica', 'Arial', sans-serif;
      font-size: 12pt;
    }
  }
}

/* large device and print mode */
@media (min-width: 701px), print {
  :root {
    --page-width: 8.5in !important;
    --page-height: 11in;
    --main-width: 6.7in;
    --sidebar-width: calc(var(--page-width) - var(--main-width));
  }
  .date-sm {
    display: none;
  }
  * {
    font-family: 'Roboto', 'Helvetica', 'Arial', sans-serif;
    font-size: 9pt;
  }
  #contact-alt {
    display: none;
  }
}

#wrapper {
  width: var(--page-width);
  height: var(--page-height);
  overflow: hidden;
  margin: 0;
  font-weight: 300;
  line-height: 1.3;
  color: #444;
  hyphens: auto;
  display: block;
  margin: auto;
  /* outline: 1px solid var(--sidebar-color); */
}

h1,
h2,
h3 {
  margin: 0;
  color: #000;
}

li {
  list-style-type: none;
}

#main {
  float: left;
  width: var(--main-width);
  padding: 0.25in 0.25in 0 0.25in;
  font-size: 7pt;
}

#sidebar {
  float: right;
  position: relative; /* for disclaimer */
  width: var(--sidebar-width);
  height: 100%;
  padding: 0.6in var(--sidebar-horizontal-padding);
  background-color: var(--sidebar-color);
  font-size: 8.5pt;
  -webkit-print-color-adjust: exact;
  color-adjust: exact;
}

/* main */

/** big title **/
h1,
h2 {
  text-transform: uppercase;
}

#title {
  position: relative;
  left: 0.55in;
  line-height: 1.2;
}

#title .pronouns {
  font-weight: 100;
}

#title h1 {
  font-weight: 300;
  font-size: 18pt;
  line-height: 1.5;
}

#title h1 strong {
  margin: auto 2pt auto 4pt;
  font-weight: 600;
}

.subtitle {
  font-size: 8pt;
}

/*** categorial blocks ***/

#main h2 {
  position: relative;
  top: var(--row-blocks-padding-top);
  /* XXX: 0.5px for aligning fx printing */
  left: calc((var(--date-block-width) + var(--decorator-horizontal-margin)));
  font-weight: 400;
  font-size: 11pt;
  color: #555;
}

#main h2 > i {
  /* use absolute position to prevent icon's width from misaligning title */
  /* assigning a fixed width here is no better due to needing to align decorator
     line too */
  position: absolute;
  left: var(--main-blocks-title-icon-offset-left);
  z-index: 1; /* over decorator line */
  color: #444;
}

#main h2::after {
  /* extends the decorator line */
  height: calc(var(--row-blocks-padding-top) * 2);
  position: relative;
  top: calc(-1 * var(--row-blocks-padding-top));
  /* XXX: 0.5px for aligning fx printing */
  left: calc(-1 * var(--decorator-horizontal-margin));
  display: block;
  border-left: var(--decorator-border);
  z-index: 0;
  line-height: 0;
  font-size: 0;
  content: ' ';
}

/**** minor tweaks on the icon fonts ****/
.detail-title > .material-icons,
.contact-item > .material-icons {
  display: inline;
}
.contact-item {
  display: flex;
  margin-bottom: 5px;
}
.contact-item > .contact-icon {
  margin-right: 4px;
  font-size: 12pt;
}
.contact-item > .contact-icon,
.contact-item > .contact-data {
  display: block;
}
.contact-item > .contact-data {
  vertical-align: top;
  line-height: 11pt;
}

#experience-title > .material-icons {
  left: calc(var(--main-blocks-title-icon-offset-left) - 2pt);
  top: -1pt;
}

#education-title > .material-icons {
  left: calc(var(--main-blocks-title-icon-offset-left) - 3pt);
  top: -3pt;
}

#project-title > .material-icons {
  left: calc(var(--main-blocks-title-icon-offset-left) - 2pt);
  top: -3pt;
}

/**** individual row blocks (date - decorator - details) ****/

.blocks {
  display: flex;
  flex-flow: row nowrap;
}

.blocks > div {
  padding-top: var(--row-blocks-padding-top);
}

.date {
  flex: 0 0 var(--date-block-width);
  padding-top: calc(var(--row-blocks-padding-top) + 2.5pt) !important;
  padding-right: var(--decorator-horizontal-margin);
  font-size: 7pt;
  text-align: right;
  line-height: 1;
}

.date span {
  display: block;
}

.date span:nth-child(2)::before {
  position: relative;
  top: 1pt;
  right: 9pt;
  display: block;
  height: 10pt;
  content: '|';
}

.decorator {
  flex: 0 0 0;
  position: relative;
  width: 2pt;
  min-height: 100%;
  border-left: var(--decorator-border);
}

/*
 * XXX: Use two filled circles to achieve the circle-with-white-border effect.
 * The normal technique of only using one pseudo element and
 * border: 1px solid white; style makes firefox erroneously either:
 * 1) overflows the grayshade background (if no background-clip is set), or
 * 2) shows decorator line which should've been masked by the white border
 *
 */

.decorator::before {
  position: absolute;
  top: var(--decorator-outer-offset-top);
  left: var(--decorator-outer-offset-left);
  content: ' ';
  display: block;
  width: var(--decorator-outer-dim);
  height: var(--decorator-outer-dim);
  border-radius: calc(var(--decorator-outer-dim) / 2);
  background-color: #fff;
  -webkit-print-color-adjust: exact;
  color-adjust: exact;
}

.decorator::after {
  position: absolute;
  top: calc(var(--decorator-outer-offset-top) + var(--decorator-border-width));
  left: calc(
    var(--decorator-outer-offset-left) + var(--decorator-border-width)
  );
  content: ' ';
  display: block;
  width: calc(var(--decorator-outer-dim) - (var(--decorator-border-width) * 2));
  height: calc(
    var(--decorator-outer-dim) - (var(--decorator-border-width) * 2)
  );
  border-radius: calc(
    (var(--decorator-outer-dim) - (var(--decorator-border-width) * 2)) / 2
  );
  background-color: #555;
  -webkit-print-color-adjust: exact;
  color-adjust: exact;
}

.blocks:last-child .decorator {
  /* slightly shortens it */
  margin-bottom: 0.25in;
}

/***** fine-tunes on the details block where the real juice is *****/

.details {
  flex: 1 0 0;
  padding-left: var(--decorator-horizontal-margin);
  padding-top: calc(
    var(--row-blocks-padding-top) - 0.5pt
  ) !important; /* not sure why but this is needed for better alignment */
}

.details header {
  color: #000;
}

.details h3 {
  font-size: 9pt;
}

.main-block:not(.concise) .blocks:last-child .details div {
  margin-bottom: 0;
}

.main-block.concise .details div:not(.concise) {
  /* use padding to work around the fact that margin doesn't affect floated
     neighboring elements */
  padding: 0 0 0 0;
}

.details .place {
  font-size: 8pt;
  font-weight: lighter;
  float: right;
  margin-right: 10px;
}

.details .place.same {
  font-weight: 100;
}

.details .location {
  font-weight: lighter;
  font-size: 8pt;
  float: right;
}

.details div {
  clear: both;
}

.details .location > .material-icons {
  display: inline-block;
  position: relative;
  right: 3pt;
  top: 0.25pt;
  font-weight: normal;
  font-style: normal;
  text-decoration: inherit;
  font-size: 8pt;
}

/***** fine-tunes on the lists... *****/

#main ul {
  padding-left: 0.07in;
  margin: 0.01in 0;
}

#main li {
  margin: 0 0 0 0;
}

/****** customize list symbol style ******/
#main li::before {
  position: relative;
  margin-left: -4.25pt;
  content: '• ';
}

.details .details-subsection {
  margin: 4px 0 4px 0;
}

.details .concise ul {
  margin: 0 !important;
  -webkit-columns: 2;
  -moz-columns: 2;
  columns: 2;
}

.details .concise li {
  margin: 0 !important;
}

.details .concise li {
  margin-left: 0 !important;
}

.details .details-subsection b {
  font-weight: bold;
}

/* sidebar */

#sidebar h1 {
  font-weight: 400;
  font-size: 11pt;
}

.side-block {
  margin-top: 0.5in;
}

.side-block i.material-icons {
  vertical-align: bottom;
}

#contact ul {
  margin-top: 0.05in;
  padding-left: 0;
  font-weight: 400;
  line-height: 1.75;
}

#skills,
#languages {
  margin-top: 1em;
  line-height: 1.5;
}

#skills ul,
#languages ul {
  margin: 0.05in 0 0.15in;
  padding: 0;
}

#languages .material-icons,
#skills .material-icons {
  font-size: 15pt;
}

#disclaimer {
  position: absolute;
  bottom: var(--sidebar-horizontal-padding);
  right: var(--sidebar-horizontal-padding);
  font-size: 7.5pt;
  font-style: italic;
  line-height: 1.1;
  text-align: right;
  color: #777;
}

#disclaimer code {
  color: #666;
  font-weight: 400;
  font-style: normal;
}

ul.inline-list {
  li {
    float: left;
    margin-right: 20px !important;
  }
}