/* =========================================================
   1) Tokens / Base
   ========================================================= */
:root{
  --text: #595959;
  --heading: #13294B;
  --link: #39c;
  --link-hover: #069;

  --page-bg: #fff;
  --border: #e5e5e5;
  --code-bg: #f8f8f8;

  /* Used to offset fixed top navigation (topnav.css) */
  --nav-h: 64px;

  /* Layout */
  --wrap-w: 960px;
  --left-col: 210px;
  --right-col: 650px;
  --col-gap: 64px;

  /* Radius */
  --radius-sm: 5px;

  /* Fonts (system-first) */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas,
               "Liberation Mono", monospace;

  /* Type scale */
  --base-size: 15.5px;
  --line: 1.6;

  /* Spacing */
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 20px;
  --space-5: 28px;
}

*{ box-sizing: border-box; }

html{ scroll-behavior: smooth; }

body{
  background: var(--page-bg);
  margin: 0;
  padding: 0;
  padding-top: var(--nav-h);

  font-family: var(--font-sans);
  font-size: var(--base-size);
  line-height: var(--line);
  font-weight: 400;
  color: var(--text);

  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Make keyboard navigation visible without hurting mouse users */
:focus-visible{
  outline: 2px solid rgba(0,0,0,0.25);
  outline-offset: 2px;
}

/* =========================================================
   2) Typography
   ========================================================= */
h1, h2, h3, h4, h5, h6{
  color: var(--heading);
  margin: 0 0 var(--space-4);
  font-family: var(--font-sans);
  letter-spacing: 0.2px;
}

h1{
  font-size: 28px;
  font-weight: 650;
  line-height: 1.15;
}

h2{
  font-size: 20px;
  font-weight: 650;
  line-height: 1.2;
  /* margin-top: var(--space-5); */
}

h3{
  font-size: 17px;
  font-weight: 650;
  line-height: 1.25;
}

p, ul, ol, table, pre, dl{
  margin: 0 0 var(--space-4);
}

small{ font-size: 11px; }

strong{
  color: #222;
  font-weight: 600;
}

/* Links */
a{
  color: var(--link);
  text-decoration: none;
}
a:hover{ color: var(--link-hover); }

/* Prevent anchor headings from hiding behind fixed top nav */
section h2, section h3, section h4{
  scroll-margin-top: calc(var(--nav-h) + 10px);
}

/* =========================================================
   3) Common elements
   ========================================================= */
blockquote{
  border-left: 1px solid var(--border);
  margin: 0;
  padding-left: 20px;
  font-style: italic;
}

code, pre{
  font-family: var(--font-mono);
  color: #333;
}

pre{
  max-width: 100%;
  padding: 10px 14px;
  background: var(--code-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow-x: auto;
}

table{
  width: 100%;
  border-collapse: collapse;
}
th, td{
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}
th, dt{
  color: #444;
  font-weight: 600;
}

img{ max-width: 100%; }

hr{
  border: 0;
  background: var(--border);
  height: 1px;
  margin: 0 0 var(--space-4);
}

#back-to-top{
  border: 1px solid #ccc;
  border-radius: 0;
  font-size: 15px;
  width: 100px;
  text-align: center;
  line-height: 30px;
  height: 30px;
}

email{
  font-size: 14px;
  font-family: var(--font-mono);
}

/* Template custom tags */
autocolor{ color: var(--text); }
lightonly{ visibility: visible; }
darkonly{ visibility: hidden; }
education{ font-weight: 600; font-size: 115%; }
papertitle{ font-weight: 650; font-size: 100%; }

/* =========================================================
   4) Avatar / Social
   ========================================================= */
.image{
  border-radius: 0.35em;
  border: 0;
  display: inline-block;
  position: relative;
}

.image:before{
  transition: opacity 0.2s ease-in-out;
  border-radius: 0.35em;
  content: "";
  display: block;
  height: 100%;
  left: 0;
  opacity: 0.5;
  position: absolute;
  top: 0;
  width: 100%;
}

.image.avatar{ border-radius: 100%; }
.image.avatar:before{ display: none; }

.image.avatar img{
  border-radius: 100%;
  width: 60%;
  padding: 12px;
}

.social-icons{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.social-icons a{
  display: inline-flex;
  align-items: center;
  justify-content: center;

  height: 2.4rem;
  width: 2.4rem;
  background: transparent;

  color: var(--heading) !important;
  border-radius: 100%;

  font-size: 1rem;
  line-height: 1;

  transition: transform 0.15s ease, background-color 0.15s ease;
}

.social-icons a:hover{
  background: #fff;
  transform: scale(1.12);
}

/* =========================================================
   5) Layout (Grid)
   ========================================================= */
.wrapper{
  width: min(var(--wrap-w), calc(100% - 40px));
  margin: 0 auto;

  display: grid;
  grid-template-columns: var(--left-col) var(--right-col);
  column-gap: var(--col-gap);
  align-items: start;
}

/*
  Fixed sidebar aligned to the wrapper.
  The left offset mirrors the wrapper's centered position.
*/
header{
  width: var(--left-col);
  position: fixed;
  top: var(--nav-h);

  left: clamp(20px, calc((100% - var(--wrap-w)) / 2), 9999px);

  text-align: center;
  padding-top: 1.5em;
  font-size: 0.95rem;
}

header h1{
  font-size: 24px;
}

main{ grid-column: 2; }

section{
  width: 100%;
  padding-top: 1.2em;
  padding-bottom: 50px;

  /* Improve readability for long paragraphs */
  max-width: 70ch;
}

/* Optional footer placeholder */
footer{ display: none; }

/* =========================================================
   6) Publications / Misc
   ========================================================= */
.pub-row{
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.biblink{
  text-decoration: none;
  display: inline;
  margin-right: 0;
}

.fakelink{
  text-decoration: none;
  cursor: pointer;
}

.bibref{
  font-size: 70%;
  margin-top: 10px;
  margin-left: 0;
  display: none;
  font-family: var(--font-mono);
}

/* =========================================================
   7) Responsive
   ========================================================= */
@media (max-width: 960px){
  .wrapper{
    grid-template-columns: 1fr;
    column-gap: 0;
  }

  header{
    position: static;
    width: auto;
    left: auto;
    top: auto;
    padding-top: 20px;
  }

  main{ grid-column: 1; }

  section{
    max-width: none;
    border: 1px solid var(--border);
    border-width: 1px 0;
    padding: 20px 0;
    margin: 0 0 20px;
  }

  .image.avatar img{
    width: 117px;
    padding: 20px;
  }
}

@media (max-width: 480px){
  :root{ --nav-h: 56px; }

  .pub-row{ display: block; }

  .image.avatar img{
    width: 95px;
    padding: 20px;
  }
}

@media print{
  body{
    padding: 0.4in;
    font-size: 12pt;
    color: #444;
  }
}

/* CV-style item (used for Education / Research Positions / etc.) */
.cv-item{
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 22px;
}

.cv-icon{
  font-size: 26px;
  line-height: 1.2;
  margin-top: 5px;
  color: #333;
  width: 32px;          /* keeps icons aligned */
  display: inline-flex;
  justify-content: center;
}

.cv-text{
  display: flex;
  flex-direction: column;
}

.cv-title{
  font-size: var(--base-size);
  font-weight: 500;
  color: var(--heading);
}

.cv-subtitle{
  font-size: var(--base-size);
  color: #666;
  margin-top: 4px;
}

