:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --panel: #fffdf8;
  --ink: #1d2329;
  --muted: #58616d;
  --line: #d9d3c6;
  --link: #075f73;
  --link-hover: #8a3b12;
  --accent: #b35323;
  --soft: #e8f1ee;
  --max: 980px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  font-size: 17px;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.58;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover,
a:focus {
  color: var(--link-hover);
}

#navigation {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.65rem 1rem;
  background: rgba(255, 253, 248, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

#navigation p {
  margin: 0;
}

#navigation a {
  display: inline-block;
  padding: 0.38rem 0.72rem;
  border-radius: 999px;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.88rem;
  font-weight: 650;
  text-decoration: none;
}

#navigation a:hover,
#navigation a:focus {
  background: var(--soft);
  color: var(--link);
}

#heading {
  max-width: var(--max);
  margin: 0 auto;
  padding: 3.2rem 1.4rem 2.2rem;
  border-bottom: 1px solid var(--line);
}

#heading h1 {
  margin: 0 0 0.55rem;
  font-size: clamp(2.35rem, 7vw, 4.6rem);
  line-height: 0.95;
  letter-spacing: 0;
  font-weight: 700;
}

#heading h4,
#heading h5 {
  max-width: 760px;
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(0.96rem, 2.4vw, 1.12rem);
  font-weight: 500;
  line-height: 1.45;
}

#heading h5 {
  color: var(--accent);
}

#main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2rem 1.4rem 4rem;
}

#main > div {
  padding: 1.35rem 0;
  border-bottom: 1px solid var(--line);
}

#main > div:last-child {
  border-bottom: 0;
}

h2,
h5 {
  margin: 0 0 0.85rem;
  color: #14191f;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.15;
  letter-spacing: 0;
}

h2 {
  font-size: 1.5rem;
}

h5 {
  font-size: 1.08rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

p {
  max-width: 78ch;
  margin: 0 0 1rem;
}

#aboutme p,
#students p,
#courses p,
#publications > p:first-of-type {
  max-width: none;
  text-align: justify;
  text-justify: inter-word;
  -webkit-hyphens: auto;
  hyphens: auto;
}

ul {
  margin: 0.35rem 0 1rem;
  padding-left: 1.2rem;
}

li {
  margin: 0.35rem 0;
}

img {
  max-width: 100%;
  height: auto;
}

#aboutme img {
  width: min(260px, 42vw);
  margin: 0.25rem 1.25rem 0.65rem 0;
  border-radius: 6px;
  border: 1px solid var(--line);
}

#publications > p:not(:first-of-type),
#classes li {
  max-width: none;
  padding: 0.62rem 0;
  border-top: 1px solid rgba(217, 211, 198, 0.72);
}

#publications > p:first-of-type {
  margin-bottom: 1.35rem;
}

#publications a {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.9rem;
  font-weight: 650;
}

#publications span[style] {
  color: var(--accent) !important;
}

#classes ul {
  padding-left: 0;
  list-style: none;
}

#classes li {
  margin: 0;
}

#contact ul {
  padding-left: 0;
  list-style: none;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
}

@media (max-width: 620px) {
  html {
    font-size: 16px;
  }

  #navigation {
    justify-content: flex-start;
    overflow-x: auto;
  }

  #heading {
    padding-top: 2.25rem;
  }

  #main {
    padding-top: 1.2rem;
  }

  #aboutme img {
    float: none !important;
    display: block;
    width: min(100%, 340px);
    margin: 0 0 1rem;
  }

  #aboutme p,
  #students p,
  #courses p,
  #publications > p:first-of-type {
    text-align: left;
  }
}
