/* ===== Fonts ===== */
@font-face {
  font-family: "Piazzolla";
  font-style: normal;
  font-weight: 100 900;
  font-display: optional;
  src: url('../fonts/Piazzolla-VariableFont.ttf') format('truetype');
}
@font-face {
  font-family: "Piazzolla";
  font-style: italic;
  font-weight: 100 900;
  font-display: optional;
  src: url('../fonts/Piazzolla-Italic-VariableFont.ttf') format('truetype');
}

/* ===== CSS Variables (from Hey theme) ===== */
:root {
  --color-primary:    #1f1f1d;
  --color-secondary:  #787670;
  --color-foreground: #555451;
  --color-background: #ffffff;
  --color-tertiary:   #d9d9d6;
  --color-social-bg:  #f0f0f0;
  --color-toggle-bg:  #e8e6e3;
  --color-toggle-icon: #555451;
  --color-education-doctorate: #d97706;
  --color-education-masters: #1d4ed8;
  --color-education-bachelors: #15803d;
  --color-link: #1d4ed8;
  --color-role-tutor: #7c3aed;
  --color-role-demonstrator: #db2777;

  --font-system: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  --font-serif:  Piazzolla, Georgia, serif;

  --fs-small:     0.833rem;
  --fs-medium:    clamp(0.833rem, 0.833rem + ((1vw - 0.2rem) * 0.393), 1rem);
  --fs-large:     clamp(1rem, 1rem + ((1vw - 0.2rem) * 0.471), 1.2rem);
  --fs-x-large:   clamp(1.2rem, 1.2rem + ((1vw - 0.2rem) * 1.242), 1.728rem);
  --fs-xx-large:  clamp(1.728rem, 1.728rem + ((1vw - 0.2rem) * 0.814), 2.074rem);
  --fs-xxx-large: clamp(2.074rem, 2.074rem + ((1vw - 0.2rem) * 2.146), 2.986rem);

  --sp-20: 0.44rem;
  --sp-30: 0.5rem;
  --sp-40: 0.875rem;
  --sp-50: 1.75rem;
  --sp-60: 2.625rem;
  --sp-70: 3.5rem;
  --sp-80: 5.25rem;

  --content-width: 760px;
}

[data-theme="dark"] {
  --color-primary:    #f4f1eb;
  --color-secondary:  #c3bdb4;
  --color-foreground: #ddd8d0;
  --color-background: #1a1917;
  --color-tertiary:   #38362f;
  --color-social-bg:  #2c2a27;
  --color-toggle-bg:  #2c2a27;
  --color-toggle-icon: #c8c4bc;
  --color-education-doctorate: #ffbf69;
  --color-education-masters: #5b8def;
  --color-education-bachelors: #7ee081;
  --color-link: #8ab4f8;
  --color-role-tutor: #b794f6;
  --color-role-demonstrator: #f472b6;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ===== Base ===== */
body {
  background-color: var(--color-background);
  color: var(--color-foreground);
  font-family: var(--font-system);
  font-size: var(--fs-medium);
  font-weight: 400;
  line-height: 1.75;
  padding: var(--sp-50);
}

a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-color: var(--color-primary);
  text-decoration-thickness: 0.5px;
  text-underline-offset: 0.1em;
}
a:hover {
  color: var(--color-secondary);
  text-decoration: none;
}

p { line-height: calc(1em + 0.75rem); }

h1, h2, h3, h4, h5, h6 {
  color: var(--color-primary);
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: calc(1em + 0.75rem);
}
h1 { font-size: var(--fs-xxx-large); line-height: calc(1em + 0.4375rem); }
h2 { font-size: var(--fs-xx-large);  line-height: calc(1em + 0.5rem); }
h3 { font-size: var(--fs-x-large); }
h4 { font-size: var(--fs-large); }
h5 { font-size: var(--fs-medium); }
h6 { font-size: var(--fs-small); }

ul, ol { box-sizing: border-box; }

/* ===== Page wrapper ===== */
.site-content {
  max-width: var(--content-width);
  margin: var(--sp-40) auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-50);
}

/* ===== Avatar ===== */
.avatar-wrap img {
  width: 96px;
  height: 96px;
  border-radius: 999px;
  display: block;
}

/* ===== Separator ===== */
hr {
  border: none;
  border-top: 1px solid var(--color-tertiary);
  width: 100%;
}

/* ===== Lists ===== */
.site-content ul,
.site-content ol {
  padding-left: var(--sp-50);
}

/* ===== Education ===== */
.education-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-20);
}

.education-item {
  border-left: 3px solid var(--color-tertiary);
  padding-left: var(--sp-30);
}

.education-doctorate {
  border-left-color: var(--color-education-doctorate);
}

.education-masters {
  border-left-color: var(--color-education-masters);
}

.education-bachelors {
  border-left-color: var(--color-education-bachelors);
}


.education-line,
.education-degree,
.education-detail {
  margin: 0;
}

.education-line {
  line-height: 1.45;
}

.education-degree {
  color: var(--color-primary);
  font-family: var(--font-serif);
  font-size: var(--fs-medium);
  font-weight: 700;
}

.education-detail {
  color: var(--color-secondary);
  margin-left: 0.35rem;
}

.section-label,
.experience-label,
.column-label,
.teaching-label,
.connect-label {
  color: var(--color-primary);
  font-family: var(--font-serif);
  font-size: var(--fs-medium);
  font-weight: 700;
}

.experience-label {
  margin-bottom: 0.2rem;
}

/* ===== Publications ===== */
.publications {
  display: flex;
  flex-direction: column;
  gap: var(--sp-20);
}

.publications-note {
  color: var(--color-foreground);
  font-size: var(--fs-small);
  font-style: italic;
  margin-top: var(--sp-20);
}

.publications-list {
  list-style: none;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-30);
  color: var(--color-secondary);
  font-size: var(--fs-small);
  line-height: 1.6;
}

.publications-list li {
  border-left: 2px solid var(--color-tertiary);
  padding-left: var(--sp-30);
}

.publications-list a {
  color: var(--color-link);
  text-decoration-color: currentColor;
}

.publications-list a:hover {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-color: var(--color-primary);
  text-decoration-thickness: 2px;
}

/* ===== Two-column layout ===== */
.columns {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--sp-50);
  align-items: flex-start;
}
.col-wide  { flex: 0 0 66%; }
.col-narrow { flex: 1 1 0; }

.column-label {
  text-align: center;
}

/* ===== Teaching ===== */
.teaching {
  display: flex;
  flex-direction: column;
  gap: var(--sp-30);
}

#experience {
  margin-top: 0;
}

.teaching-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  column-gap: var(--sp-40);
  row-gap: var(--sp-20);
}

/* Rows share the list's columns so icons and years line up across rows */
.teaching-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  grid-template-areas: "subject years icon";
  align-items: baseline;
  padding: 0;
}

.teaching-subject,
.teaching-years {
  margin: 0;
}

.teaching-subject {
  grid-area: subject;
  min-width: 0;
  padding-right: var(--sp-20);
}

.teaching-years {
  grid-area: years;
  color: var(--color-primary);
  font-family: var(--font-serif);
  font-weight: 700;
  white-space: nowrap;
  text-align: left;
  justify-self: end;
}

/* ===== Social / connect row ===== */
.connect-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: var(--sp-50);
}

.connect-email { text-align: left; }

/* ===== Social links ===== */
.social-links {
  list-style: none;
  padding: 0;
  display: flex;
  align-items: center;
  gap: var(--sp-40);
}
.social-links li {
  display: inline-block;
}
.social-links a {
  display: flex;
  align-items: center;
  line-height: 0;
  color: var(--color-primary);
  text-decoration: none;
  background-color: var(--color-social-bg);
  border-radius: 9999px;
  padding: 8px;
  transition: transform 0.1s ease, background-color 0.2s;
}
.social-links a:hover {
  transform: scale(1.1);
}
.social-linkedin a { background-color: #0077b5; color: #fff; }
.social-github   a { background-color: #24292d; color: #fff; }
.social-linkedin a:hover,
.social-github   a:hover { color: #fff; }
[data-theme="dark"] .social-github a { background-color: #6e7681; color: #fff; }
[data-theme="dark"] .social-github a:hover { color: #fff; }
.social-links svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* ===== Text align ===== */
.text-center { text-align: center; }

/* ===== Dark mode toggle ===== */
.theme-toggle {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 200;
  background: var(--color-toggle-bg);
  border: none;
  border-radius: 9999px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.15s;
  color: var(--color-toggle-icon);
}
.theme-toggle:hover { transform: scale(1.1); }

.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity 0.15s;
}

/* Show sun in dark mode, moon in light mode */
.icon-sun  { display: none; }
.icon-moon { display: block; }
[data-theme="dark"] .icon-sun  { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* Smooth colour transitions across the page */
body,
a,
h1, h2, h3, h4, h5, h6,
hr,
.social-links a {
  transition: background-color 0.25s, color 0.25s, border-color 0.25s;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  body { padding: var(--sp-50) var(--sp-40); }

  .columns {
    flex-wrap: wrap;
  }
  .col-wide,
  .col-narrow {
    flex: 1 1 100%;
  }

  .teaching-list {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: var(--sp-40);
  }

  .teaching-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "subject icon"
      "years   years";
    row-gap: 0;
  }

  .teaching-years {
    justify-self: start;
  }

  .teaching-years {
    white-space: normal;
  }

  .connect-row {
    flex-wrap: wrap;
    gap: var(--sp-40);
  }
}

/* ===== Teaching role icons + legend ===== */
.subject-icon {
  width: 1.15em;
  height: 1.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.teaching-row .subject-icon {
  grid-area: icon;
  align-self: center;
}

.role-tutor        { color: var(--color-role-tutor); }
.role-demonstrator { color: var(--color-role-demonstrator); }

.teaching-years a {
  color: var(--color-link);
  text-decoration-color: currentColor;
}

.teaching-years a:hover {
  color: var(--color-primary);
}

.teaching-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-20) var(--sp-40);
  color: var(--color-secondary);
  font-size: var(--fs-small);
}

.teaching-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
}

/* Bullet separator between legend items */
.teaching-legend span + span::before {
  content: "\2022";
  margin-right: calc(var(--sp-40) - 0.35em);
  color: var(--color-secondary);
}
