/* ================================================
   Site-wide mobile fixes
   ================================================ */

/* Make the hamburger menu button clearly visible on mobile */
.navbar-toggler {
  border: 2px solid rgba(0, 0, 0, 0.6) !important;
  border-radius: 4px !important;
  padding: 5px 8px !important;
  opacity: 1 !important;
}

/* Make the fa-bars icon dark so it's visible */
.navbar-toggler span i.fas.fa-bars {
  color: rgba(0, 0, 0, 0.75) !important;
  font-size: 1.2rem !important;
}

/* ================
   Vitae Timeline
   Adapted from msaveski/www_personal (timeline.css)
   ================ */

/* ---- Timeline container ---- */
ul.timeline {
  position: relative;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  margin-top: 20px;
  padding: 1em 0;
  list-style-type: none;
}

/* Centered vertical line */
ul.timeline:before {
  position: absolute;
  left: 50%;
  top: 0;
  content: ' ';
  display: block;
  width: 6px;
  height: 100%;
  margin-left: -3px;
  background: rgb(80,80,80);
  background: -moz-linear-gradient(top, rgba(80,80,80,0) 0%, rgb(80,80,80) 8%, rgb(80,80,80) 92%, rgba(80,80,80,0) 100%);
  background: -webkit-linear-gradient(top, rgba(80,80,80,0) 0%, rgb(80,80,80) 8%, rgb(80,80,80) 92%, rgba(80,80,80,0) 100%);
  background: linear-gradient(to bottom, rgba(80,80,80,0) 0%, rgb(80,80,80) 8%, rgb(80,80,80) 92%, rgba(80,80,80,0) 100%);
  z-index: 5;
}

ul.timeline li {
  padding: 1em 0;
  position: relative;
}

/* Clearfix */
ul.timeline li:after {
  content: "";
  display: block;
  height: 0;
  clear: both;
  visibility: hidden;
}

/* ---- Circular node: perfectly centered on the line ---- */
ul.timeline li:before {
  content: ' ';
  position: absolute;
  left: 50%;
  top: 1.75em;
  transform: translateX(-50%);
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  border: 2px solid #0066cc;
  z-index: 10;
}

/* ---- Left entries (industry/professional) ---- */
.direction-l {
  position: relative;
  width: calc(50% - 40px);
  float: left;
  text-align: right;
}

/* ---- Right entries (academic/education) ---- */
.direction-r {
  position: relative;
  width: calc(50% - 40px);
  float: right;
}

/* ---- Flag row: flexbox so date and institution are always on one line ---- */
/* direction-r (academic, right side): [flag] [date]                         */
/* direction-l (industry, left side):  [date] [flag]  via row-reverse        */
.flag-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.direction-r .flag-wrapper {
  flex-direction: row;
  justify-content: flex-start;
}

.direction-l .flag-wrapper {
  flex-direction: row-reverse;
  justify-content: flex-start;
}

.flag {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  background: rgb(248,248,248);
  padding: 6px 10px;
  border-radius: 5px;
  font-weight: 600;
}

.direction-l .flag {
  -webkit-box-shadow: -1px 1px 1px rgba(0,0,0,0.15), 0 0 1px rgba(0,0,0,0.15);
  -moz-box-shadow:    -1px 1px 1px rgba(0,0,0,0.15), 0 0 1px rgba(0,0,0,0.15);
  box-shadow:         -1px 1px 1px rgba(0,0,0,0.15), 0 0 1px rgba(0,0,0,0.15);
}

.direction-r .flag {
  -webkit-box-shadow: 1px 1px 1px rgba(0,0,0,0.15), 0 0 1px rgba(0,0,0,0.15);
  -moz-box-shadow:    1px 1px 1px rgba(0,0,0,0.15), 0 0 1px rgba(0,0,0,0.15);
  box-shadow:         1px 1px 1px rgba(0,0,0,0.15), 0 0 1px rgba(0,0,0,0.15);
}

/* No node on flag (moved to li::before) */
.direction-l .flag:before,
.direction-r .flag:before {
  display: none;
}

/* ---- Arrow pointer toward center line ---- */
.direction-l .flag:after {
  content: "";
  position: absolute;
  left: 100%;
  top: 50%;
  height: 0;
  width: 0;
  margin-top: -8px;
  border: solid transparent;
  border-left-color: rgb(248,248,248);
  border-width: 8px;
  pointer-events: none;
}

.direction-r .flag:after {
  content: "";
  position: absolute;
  right: 100%;
  top: 50%;
  height: 0;
  width: 0;
  margin-top: -8px;
  border: solid transparent;
  border-right-color: rgb(248,248,248);
  border-width: 8px;
  pointer-events: none;
}

/* ---- Time / date label ---- */
.time-wrapper {
  display: inline-block;
  flex-shrink: 0;
  line-height: 1em;
  font-size: 0.66666em;
  color: #0066cc;
  white-space: nowrap;
}

.time {
  display: inline-block;
  padding: 4px 6px;
  background: rgb(248,248,248);
}

/* ---- Description block ---- */
.desc {
  margin: 1em 0.75em 0 0;
  font-size: 0.77777em;
  line-height: 1.5em;
}

.direction-r .desc {
  margin: 1em 0 0 0.75em;
}

/* ================================================
   Mobile: single column, line on the left
   ================================================ */

@media screen and (max-width: 660px) {

  ul.timeline {
    width: 100%;
    padding: 0.5em 0;
  }

  /* Shift line to left edge */
  ul.timeline:before {
    left: 12px !important;
    margin-left: 0 !important;
  }

  /* Indent all li content to the right of the line */
  ul.timeline li {
    padding: 0.75em 0 0.75em 38px !important;
  }

  /* Node aligned with left line */
  ul.timeline li:before {
    left: 6px !important;
    top: 1em !important;
    transform: none !important;
  }

  /* Both sides: full width, left-aligned */
  .direction-l,
  .direction-r {
    float: none !important;
    width: 100% !important;
    text-align: left !important;
  }

  /* Flag + date always on the same row, left to right */
  .flag-wrapper,
  .direction-l .flag-wrapper,
  .direction-r .flag-wrapper {
    flex-direction: row !important;
    justify-content: flex-start !important;
    align-items: center !important;
    flex-wrap: wrap;
    gap: 6px;
  }

  /* Hide arrows — don't make sense in single column */
  .direction-l .flag:after,
  .direction-r .flag:after {
    display: none !important;
  }

  /* Clean description — no grey box */
  .desc,
  .direction-l .desc,
  .direction-r .desc {
    margin: 0.35em 0 0 0 !important;
    padding: 0 !important;
    background: none !important;
    box-shadow: none !important;
  }
}
