:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #444444;
  --accent: #111111;
  --hr: #e6e6e6;
  --container-w: 780px;
  --gutter: 24px;
  --main-font: "EB Garamond", Garamond, "Times New Roman", serif;
}

body {
  background: var(--bg);
  color: var(--text);
  margin: 0;
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* { box-sizing: border-box; }

.container {
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 28px;
}

.topbar {
  border-bottom: 1px solid var(--hr);
  background: transparent;
  padding: 16px 0;
}

.topbar-content {
  display: flex;
  align-items: baseline; /* Align title and links on the same line */
  justify-content: space-between;
  flex-wrap: wrap; /* ensures it wraps neatly on narrow screens */
}

.name {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--accent);
  line-height: 1; /* keep tight alignment */
}
/* Navigation links (upper right, same level as title) */
.nav-links {
  display: flex;
  align-items: baseline;
  gap: 24px;
}

.nav-link {
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  font-size: 11pt;
  border-bottom: 1.5px solid transparent;
  padding-bottom: 2px;
  transition: border-color 0.2s ease;
}

.nav-link:hover {
  border-color: var(--accent);
}

/* CV styles */
.cv-header { 
    padding-top:36px; 
    padding-bottom:12px; /* Increased vertical space after name/contact */
    border-bottom:none; /* Remove header border */
    display:flex; 
    flex-direction: column; /* Stack name and contact */
    align-items:flex-start; 
    gap: 0;
}
/* Name styling (Large and Bold) */
.cv-name { 
    margin:0; 
    font-size:28pt; 
    letter-spacing:0.2px; 
    font-weight: 700; /* Original: \LARGE\bfseries */
    line-height: 1.2;
}
/* Contact section is not a formal section, but styled for separation */
.cv-contact { 
    margin-top: 2.5em; /* approximate \bigskip\bigskip\medskip */
    text-align:left; 
    font-size: inherit; 
    color:var(--text); 
    line-height: 1.5;
}
.cv-contact div:not(:last-child) { 
    margin-bottom: 0.5em; /* approximate \medskip between lines */
}
.cv-contact a { 
    color: MidnightBlue; /* Set urlcolor as in LaTeX source  */
    text-decoration: underline; 
    text-underline-offset: 2px; 
}
.cv-contact strong { font-weight: 700; } /* For 'Address:', 'Mobile:', 'Email:' */


.cv-content { padding-top:20px; padding-bottom:60px; }

/* Section Title Styling: \section* and \sectionfont{...}  */
.section-title { 
    font-size: 13.5pt; /* \fontsize{13.5pt}{18pt} */
    line-height: 18pt;
    margin: 1.5em 0 0.5em 0; /* Vertical space before and after */
    font-weight: 600; /* \selectfont has no weight change, but making it visible */
    letter-spacing: 0.2px; 
    text-transform: uppercase;
    border-bottom: 0.5px solid var(--hr); /* Visual separator for sections */
    padding-bottom: 2px;
}

/* Hanging indentation/year style for CV items */
.cv-item-wrapper {
    position: relative;
    margin: 0 0 0.5em 0; /* Spacing between items (approx \vspace{0.5em}) */
    padding-left: 20px; /* Space for the hanging indent */
    text-indent: -20px;
    line-height: 1.4;
}

/* Styling for the year/margin content */
.cv-item-year {
    position: absolute;
    left: -80px; /* Move year to the left margin */
    top: 0;
    width: 70px; /* Allocate width for the year */
    text-align: left; /* \renewcommand*{\raggedleftmarginnote}{} is left-align for reversemarginpar */
    font-size: 0.8em; /* \scriptsize */
    color: var(--muted);
}

.cv-item-detail {
    display: inline-block;
    padding-left: 0;
    text-indent: 0;
    color: var(--text); /* Main text should be 'text' color, not 'muted' */
}
.cv-item-detail strong { 
    font-weight: 700; 
}
.cv-item-detail em { /* Italic text from LaTeX */
    font-style: italic;
}
.cv-item-detail span.smallcaps {
    font-variant: small-caps; /* \textsc{} */
}

/* Styling for non-hanging sections (like Skills) */
.non-hanging-item {
    margin: 10px 0; 
    color: var(--text); 
    font-size: inherit; 
    line-height: 1.45; 
}
.non-hanging-item strong { 
    font-weight: 700; 
    margin-right: 0.5em;
}


/* Adjustments for link colours */
a {
    color: black; /* linkcolor/citecolor */
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* Publications note */
.pub-note {
    font-size: 0.95em;
    font-weight: 700;
    margin-bottom: 0.5em;
}
/* Collaborator note */
.collab-note {
    font-size: 0.95em;
    font-weight: 700;
    margin-top: 1em;
    margin-bottom: 0.5em;
}

/* Narrow measure on small screens */
@media (max-width:820px){
    /* Adjusted container width for smaller screens */
    :root{ --container-w: 90vw; } 
    .cv-item-year {
        position: static; /* Stack year above/before the text */
        display: block;
        margin-bottom: 0.2em;
        width: auto;
        font-size: 1em;
        font-weight: 700;
        color: var(--text);
    }
    .cv-item-wrapper {
        padding-left: 0;
        text-indent: 0;
    }
}
/* Download CV section */
.download-section {
  text-align: center;
  margin-top: 40px;
}

.download-link {
  display: inline-block;
  text-decoration: none;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--hr);
  padding: 8px 14px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.download-link:hover {
  background: var(--accent);
  color: black;
  border-color: var(--accent);
}

/* Mobile adjustments (to be more readable on very small screens) */
@media (max-width:520px){
    .container { padding:16px; }
    .cv-name { font-size:22pt; }
}

/* Responsive adjustments for header */
@media (max-width:600px){
  .topbar-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .nav-links {
    gap: 16px;
  }
  
}
